PHP code example of undefinedfr / cookie-notice

1. Go to this page and download the library: Download undefinedfr/cookie-notice library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

undefinedfr / cookie-notice example snippets


function add_cookies_names( $cookies_names ) {
    $new_cookies_names = [
        'cookie_name' => '_nom_du_cookie'
    ];
    
    return array_merge($new_cookies_names, $cookies_names);
}
add_filter( 'undfnd_cookie_default_cookies_names', 'add_cookies_names', 10, 1 );

function add_cookies_banned_scripts( $banned_scripts ) {
    $new_banned_scripts = [
        'handle' => 'handle_du_script'
    ];
    
    return array_merge($new_banned_scripts, $banned_scripts);
}
add_filter( 'undfnd_cookie_banned_scripts', 'add_cookies_banned_scripts', 10, 1 );

function label_cookie_function() {
    return __('Fonction');
}
add_filter( 'undfnd_label_cookie_function', 'label_cookie_function', 10, 1 );

function label_cookie_authorize() {
    return __('Autoriser ?');
}
add_filter( 'undfnd_label_cookie_authorize', 'label_cookie_authorize', 10, 1 );