Plugin Directory

Changeset 3436765


Ignore:
Timestamp:
01/10/2026 05:58:03 PM (3 months ago)
Author:
lovecoding
Message:

updated plugin to v2.1

Location:
simple-cookie-notice
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • simple-cookie-notice/tags/2.1/public/js/jlplg_lovecoding_script.js

    r3144342 r3436765  
    6464        const jlplgCookie = jlplgGetCookie("jlplg-cookies-accepted");
    6565
    66         if (jlplgCookie != 'yes') {
     66        if (jlplgCookie !== 'yes') {
    6767            document.querySelector('.jlplg-lovecoding-cookie-info-container').classList.remove('jlplg-hidden');
    6868        }
  • simple-cookie-notice/tags/2.1/readme.txt

    r3144342 r3436765  
    11=== Simple Cookie Notice ===
    22Contributors: lovecoding
    3 Tags: cookie, cookie notice, cookie consent, cookie law, privacy policy, cookies,
     3Tags: cookie, cookie notice, cookie consent, cookie law, privacy policy, cookies, simple cookies
    44Requires at least: 5.0
    5 Tested up to: 6.6
     5Tested up to: 6.9
    66Requires PHP: 7.0
    7 Stable tag: 2.0
     7Stable tag: 2.1
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    4242
    4343== Upgrade Notice ==
     44
     45= 2.1 =
     46* Fixed critical bug with cookie name inconsistency
     47* Improved uninstall process
     48* Changed Privacy Policy button to link for better performance and SEO
     49* Added validation for cookie expiration time
     50* Fixed typos in variable names
     51* Code refactoring and improvements
    4452
    4553= 2.0 =
  • simple-cookie-notice/tags/2.1/simple-cookie-notice.php

    r3144342 r3436765  
    33 * Plugin Name: Simple Cookie Notice
    44 * Description: In simple way add personalized cookie info and link to wordpress privacy policy page.
    5  * Version: 2.0
     5 * Version: 2.1
    66 * Requires at least: 5.0
    77 * Requires PHP: 7.0
     
    2828defined( 'ABSPATH' ) or die( 'hey, you don\'t have an access to read this site' );
    2929
    30 
    3130// adding 'Settings' link to plugin links
    3231function jlplg_lovecoding_add_plugin_settings_link( $links ) {
     
    4140// adding styles and scripts
    4241function jlplg_lovecoding_enqueue_scripts() {
    43     // load styles and script for plugin only if cookies are not accepted
    44     if ( !isset( $_COOKIE['cookie-accepted'] ) ) {
    45         wp_enqueue_style( 'styles', plugins_url( 'styles.css', __FILE__ ) );
    46         wp_enqueue_script( 'jlplg_lovecoding_script', plugins_url( 'public/js/jlplg_lovecoding_script.js', __FILE__ ), array(), time(), true );
    47     }
     42    $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/simple-cookie-notice/simple-cookie-notice.php' );
     43    $plugin_version = isset( $plugin_data['Version'] ) ? $plugin_data['Version'] : '2.0';
     44
     45    wp_enqueue_style( 'jlplg_lovecoding_styles', plugins_url( 'styles.css', __FILE__ ), [], $plugin_version );
     46    wp_enqueue_script( 'jlplg_lovecoding_script', plugins_url( 'public/js/jlplg_lovecoding_script.js', __FILE__ ), array(), $plugin_version, true );
    4847}
    4948add_action( 'wp_enqueue_scripts', 'jlplg_lovecoding_enqueue_scripts' );
     
    8887                <span class="button-text" style="<?php echo 'color: '.esc_attr( $button_text_color ) ?>"><?php echo esc_html( $cookie_info_button ); ?></span>
    8988            </button>
    90             <?php if ( $show_policy_privacy ) { ?>
    91             <button type="submit" name="jlplg-cookie-privacy-policy" class="jlplg-lovecoding-cookie-privacy-policy" id="cookie-privacy-policy" style="<?php echo 'background-color: '.esc_attr( $button_background_color ) ?>">
     89            <?php if ( $show_policy_privacy ) {
     90                $privacy_url = get_privacy_policy_url();
     91                if ( empty( $privacy_url ) ) {
     92                    $privacy_url = get_home_url() . '/privacy-policy';
     93                }
     94            ?>
     95            <a href="<?php echo esc_url( $privacy_url ); ?>" class="jlplg-lovecoding-cookie-privacy-policy" id="cookie-privacy-policy" style="<?php echo 'background-color: '.esc_attr( $button_background_color ) ?>">
    9296                <span class="button-text" style="<?php echo 'color: '.esc_attr( $button_text_color ) ?>"><?php esc_html_e( 'Privacy Policy', 'jlplg_lovecoding' ) ?></span>
    93             </button>
     97            </a>
    9498            <?php } ?>
    9599            </div>
     
    101105// display cookie notice if cookie info is not set
    102106function jlplg_lovecoding_display_cookie_notice() {
    103     // always display cookies info
    104107    add_action('wp_footer', 'jlplg_lovecoding_display_cookie_info');
    105 
    106     // make action when privacy policy button was clicked
    107     if ( isset( $_POST['jlplg-cookie-privacy-policy'] ) ) {
    108         $privacy_policy = get_privacy_policy_url();
    109         if ( empty($privacy_policy) ) {
    110             $privacy_policy = get_home_url().'/privacy-policy';
    111         }
    112         wp_safe_redirect( $privacy_policy );
    113         exit;
    114     }
    115108}
    116109add_action( 'init', 'jlplg_lovecoding_display_cookie_notice');
     
    133126function jlplg_lovecoding_add_new_settings() {
    134127    // register settings
    135     $configuration_settins_field1_arg = array(
     128    $configuration_settings_field1_arg = array(
    136129        'type' => 'string',
    137130        'sanitize_callback' => 'jlplg_lovecoding_sanitize_textarea_field',
    138131        'default' => 'We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies'
    139132    );
    140     $configuration_settins_field2_arg = array(
     133    $configuration_settings_field2_arg = array(
    141134        'type' => 'boolean',
    142135        'sanitize_callback' => 'jlplg_lovecoding_sanitize_checkbox',
    143136        'default' => false
    144137    );
    145     $configuration_settins_field3_arg = array(
     138    $configuration_settings_field3_arg = array(
    146139        'type' => 'string',
    147140        'sanitize_callback' => 'jlplg_lovecoding_sanitize_input_field',
    148141        'default' => 'Accept Cookies'
    149142    );
    150     $configuration_settins_field4_arg = array(
     143    $configuration_settings_field4_arg = array(
    151144        'type' => 'string',
    152145        'sanitize_callback' => 'jlplg_lovecoding_sanitize_input_field',
    153146        'default' => 'bottom'
    154147    );
    155     $configuration_settins_field5_arg = array(
    156         'type' => 'string',
    157         'sanitize_callback' => 'jlplg_lovecoding_sanitize_input_field',
    158         'default' => 'bottom'
    159     );
    160     $layout_settins_field1_arg = array(
     148    $configuration_settings_field5_arg = array(
     149        'type' => 'integer',
     150        'sanitize_callback' => 'jlplg_lovecoding_sanitize_integer',
     151        'default' => 30
     152    );
     153    $layout_settings_field1_arg = array(
    161154        'type' => 'string',
    162155        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    163156        'default' => '#444546'
    164157    );
    165     $layout_settins_field2_arg = array(
     158    $layout_settings_field2_arg = array(
    166159        'type' => 'string',
    167160        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    168161        'default' => '#ffffff'
    169162    );
    170     $layout_settins_field3_arg = array(
     163    $layout_settings_field3_arg = array(
    171164        'type' => 'string',
    172165        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    173166        'default' => '#dcf1ff'
    174167    );
    175     $layout_settins_field4_arg = array(
     168    $layout_settings_field4_arg = array(
    176169        'type' => 'string',
    177170        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    178171        'default' => '#000000'
    179172    );
    180     register_setting( 'jl_options', 'jlplg_lovecoding-field1-cookie-message', $configuration_settins_field1_arg);     // option group, option name, args
    181     register_setting( 'jl_options', 'jlplg_lovecoding-field2-checkbox-privacy-policy', $configuration_settins_field2_arg);
    182     register_setting( 'jl_options', 'jlplg_lovecoding-field3-cookie-button-text', $configuration_settins_field3_arg);
    183     register_setting( 'jl_options', 'jlplg_lovecoding-field4-cookie-plugin-placement', $configuration_settins_field4_arg);
    184     register_setting( 'jl_options', 'jlplg_lovecoding-field5-background-color', $layout_settins_field1_arg);
    185     register_setting( 'jl_options', 'jlplg_lovecoding-field6-text-color', $layout_settins_field2_arg);
    186     register_setting( 'jl_options', 'jlplg_lovecoding-field7-button-background-color', $layout_settins_field3_arg);
    187     register_setting( 'jl_options', 'jlplg_lovecoding-field8-button-text-color', $layout_settins_field4_arg);
    188     register_setting( 'jl_options', 'jlplg_lovecoding-field9-cookie-expire-time', $configuration_settins_field5_arg);
     173    register_setting( 'jl_options', 'jlplg_lovecoding-field1-cookie-message', $configuration_settings_field1_arg);     // option group, option name, args
     174    register_setting( 'jl_options', 'jlplg_lovecoding-field2-checkbox-privacy-policy', $configuration_settings_field2_arg);
     175    register_setting( 'jl_options', 'jlplg_lovecoding-field3-cookie-button-text', $configuration_settings_field3_arg);
     176    register_setting( 'jl_options', 'jlplg_lovecoding-field4-cookie-plugin-placement', $configuration_settings_field4_arg);
     177    register_setting( 'jl_options', 'jlplg_lovecoding-field5-background-color', $layout_settings_field1_arg);
     178    register_setting( 'jl_options', 'jlplg_lovecoding-field6-text-color', $layout_settings_field2_arg);
     179    register_setting( 'jl_options', 'jlplg_lovecoding-field7-button-background-color', $layout_settings_field3_arg);
     180    register_setting( 'jl_options', 'jlplg_lovecoding-field8-button-text-color', $layout_settings_field4_arg);
     181    register_setting( 'jl_options', 'jlplg_lovecoding-field9-cookie-expire-time', $configuration_settings_field5_arg);
    189182
    190183    // adding sections
     
    256249}
    257250
    258 // field 8 - cookie expire time
     251// field 9 - cookie expire time
    259252function jlplg_lovecoding_field_9_callback() {
    260253    echo '<input type="text" name="jlplg_lovecoding-field9-cookie-expire-time" value="'.esc_html( get_option( "jlplg_lovecoding-field9-cookie-expire-time", '30' ) ).'" />';
     
    268261    }
    269262    return $input;
     263}
     264
     265// sanitize integer
     266function jlplg_lovecoding_sanitize_integer( $input ) {
     267    return ( isset( $input ) ) ? absint( $input ) : 30;
    270268}
    271269
  • simple-cookie-notice/tags/2.1/styles.css

    r3144342 r3436765  
    11.jlplg-lovecoding-cookie-info-container {
    22    position: fixed;
    3     z-index: 50;
     3    z-index: 9999;
    44    width: 100%;
    55    text-align: center;
     
    2323
    2424.jlplg-lovecoding-buttons {
    25     display: inline-block;
    26     margin-bottom: 10px;
     25    display: flex;
     26    flex-wrap: wrap;
     27    justify-content: center;
     28    align-items: center;
     29    gap: 10px;
     30    margin-bottom: 16px;
    2731}
    2832
    29 button.jlplg-lovecoding-cookie-accept-button, button.jlplg-lovecoding-cookie-privacy-policy {
    30     padding: 5px 15px;
     33.jlplg-lovecoding-cookie-accept-button, .jlplg-lovecoding-cookie-privacy-policy {
     34    display: inline-block;
     35    padding: 7px 15px;
    3136    border-radius: 4px;
    3237    border: 2px solid transparent;
    33     margin: 5px 0;
     38    margin: 0;
     39    text-decoration: none;
     40    line-height: 1;
     41    font-family: inherit;
     42    font-size: 16px;
    3443}
    3544
    36 button.jlplg-lovecoding-cookie-accept-button:hover, button.jlplg-lovecoding-cookie-privacy-policy:hover,
    37 button.jlplg-lovecoding-cookie-accept-button:focus, button.jlplg-lovecoding-cookie-privacy-policy:focus {
     45.jlplg-lovecoding-cookie-accept-button:hover, .jlplg-lovecoding-cookie-privacy-policy:hover,
     46.jlplg-lovecoding-cookie-accept-button:focus, .jlplg-lovecoding-cookie-privacy-policy:focus {
    3847    cursor: pointer;
    3948    border: 2px solid transparent;
    4049}
    4150
    42 button.jlplg-lovecoding-cookie-accept-button:focus-visible, button.jlplg-lovecoding-cookie-privacy-policy:focus-visible {
     51.jlplg-lovecoding-cookie-accept-button:focus-visible, .jlplg-lovecoding-cookie-privacy-policy:focus-visible {
    4352    border: 2px solid transparent;
    4453    outline: 2px solid var(--jlplg-buton-bg-color);
  • simple-cookie-notice/tags/2.1/uninstall.php

    r2856380 r3436765  
    1313
    1414function jlplg_lovecoding_delete_settings() {
    15     delete_option( 'jlplg_prvpol-field1-cookie-message' );
    16     delete_option( 'jlplg_prvpol-field2-checkbox-privacy-policy' );
    17     delete_option( 'jlplg_prvpol-field3-cookie-button-text' );
    18     delete_option( 'jlplg_prvpol-field4-background-color' );
    19     delete_option( 'jlplg_prvpol-field5-text-color' );
    20     delete_option( 'jlplg_prvpol-field6-button-background-color' );
    21     delete_option( 'jlplg_prvpol-field7-button-text-color' );
     15    delete_option( 'jlplg_lovecoding-field1-cookie-message' );
     16    delete_option( 'jlplg_lovecoding-field2-checkbox-privacy-policy' );
     17    delete_option( 'jlplg_lovecoding-field3-cookie-button-text' );
     18    delete_option( 'jlplg_lovecoding-field4-cookie-plugin-placement' );
     19    delete_option( 'jlplg_lovecoding-field5-background-color' );
     20    delete_option( 'jlplg_lovecoding-field6-text-color' );
     21    delete_option( 'jlplg_lovecoding-field7-button-background-color' );
     22    delete_option( 'jlplg_lovecoding-field8-button-text-color' );
     23    delete_option( 'jlplg_lovecoding-field9-cookie-expire-time' );
    2224}
    2325
     
    2527
    2628function jlplg_lovecoding_delete_cookies() {
    27     unset( $_COOKIE['cookie-accepted'] );
    28     setcookie( sanitize_key( 'cookie-accepted' ), '', 1);
     29    unset( $_COOKIE['jlplg-cookies-accepted'] );
     30    setcookie( sanitize_key( 'jlplg-cookies-accepted' ), '', 1);
    2931}
    3032
  • simple-cookie-notice/trunk/public/js/jlplg_lovecoding_script.js

    r3144342 r3436765  
    6464        const jlplgCookie = jlplgGetCookie("jlplg-cookies-accepted");
    6565
    66         if (jlplgCookie != 'yes') {
     66        if (jlplgCookie !== 'yes') {
    6767            document.querySelector('.jlplg-lovecoding-cookie-info-container').classList.remove('jlplg-hidden');
    6868        }
  • simple-cookie-notice/trunk/readme.txt

    r3144342 r3436765  
    11=== Simple Cookie Notice ===
    22Contributors: lovecoding
    3 Tags: cookie, cookie notice, cookie consent, cookie law, privacy policy, cookies,
     3Tags: cookie, cookie notice, cookie consent, cookie law, privacy policy, cookies, simple cookies
    44Requires at least: 5.0
    5 Tested up to: 6.6
     5Tested up to: 6.9
    66Requires PHP: 7.0
    7 Stable tag: 2.0
     7Stable tag: 2.1
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    4242
    4343== Upgrade Notice ==
     44
     45= 2.1 =
     46* Fixed critical bug with cookie name inconsistency
     47* Improved uninstall process
     48* Changed Privacy Policy button to link for better performance and SEO
     49* Added validation for cookie expiration time
     50* Fixed typos in variable names
     51* Code refactoring and improvements
    4452
    4553= 2.0 =
  • simple-cookie-notice/trunk/simple-cookie-notice.php

    r3144342 r3436765  
    33 * Plugin Name: Simple Cookie Notice
    44 * Description: In simple way add personalized cookie info and link to wordpress privacy policy page.
    5  * Version: 2.0
     5 * Version: 2.1
    66 * Requires at least: 5.0
    77 * Requires PHP: 7.0
     
    2828defined( 'ABSPATH' ) or die( 'hey, you don\'t have an access to read this site' );
    2929
    30 
    3130// adding 'Settings' link to plugin links
    3231function jlplg_lovecoding_add_plugin_settings_link( $links ) {
     
    4140// adding styles and scripts
    4241function jlplg_lovecoding_enqueue_scripts() {
    43     // load styles and script for plugin only if cookies are not accepted
    44     if ( !isset( $_COOKIE['cookie-accepted'] ) ) {
    45         wp_enqueue_style( 'styles', plugins_url( 'styles.css', __FILE__ ) );
    46         wp_enqueue_script( 'jlplg_lovecoding_script', plugins_url( 'public/js/jlplg_lovecoding_script.js', __FILE__ ), array(), time(), true );
    47     }
     42    $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/simple-cookie-notice/simple-cookie-notice.php' );
     43    $plugin_version = isset( $plugin_data['Version'] ) ? $plugin_data['Version'] : '2.0';
     44
     45    wp_enqueue_style( 'jlplg_lovecoding_styles', plugins_url( 'styles.css', __FILE__ ), [], $plugin_version );
     46    wp_enqueue_script( 'jlplg_lovecoding_script', plugins_url( 'public/js/jlplg_lovecoding_script.js', __FILE__ ), array(), $plugin_version, true );
    4847}
    4948add_action( 'wp_enqueue_scripts', 'jlplg_lovecoding_enqueue_scripts' );
     
    8887                <span class="button-text" style="<?php echo 'color: '.esc_attr( $button_text_color ) ?>"><?php echo esc_html( $cookie_info_button ); ?></span>
    8988            </button>
    90             <?php if ( $show_policy_privacy ) { ?>
    91             <button type="submit" name="jlplg-cookie-privacy-policy" class="jlplg-lovecoding-cookie-privacy-policy" id="cookie-privacy-policy" style="<?php echo 'background-color: '.esc_attr( $button_background_color ) ?>">
     89            <?php if ( $show_policy_privacy ) {
     90                $privacy_url = get_privacy_policy_url();
     91                if ( empty( $privacy_url ) ) {
     92                    $privacy_url = get_home_url() . '/privacy-policy';
     93                }
     94            ?>
     95            <a href="<?php echo esc_url( $privacy_url ); ?>" class="jlplg-lovecoding-cookie-privacy-policy" id="cookie-privacy-policy" style="<?php echo 'background-color: '.esc_attr( $button_background_color ) ?>">
    9296                <span class="button-text" style="<?php echo 'color: '.esc_attr( $button_text_color ) ?>"><?php esc_html_e( 'Privacy Policy', 'jlplg_lovecoding' ) ?></span>
    93             </button>
     97            </a>
    9498            <?php } ?>
    9599            </div>
     
    101105// display cookie notice if cookie info is not set
    102106function jlplg_lovecoding_display_cookie_notice() {
    103     // always display cookies info
    104107    add_action('wp_footer', 'jlplg_lovecoding_display_cookie_info');
    105 
    106     // make action when privacy policy button was clicked
    107     if ( isset( $_POST['jlplg-cookie-privacy-policy'] ) ) {
    108         $privacy_policy = get_privacy_policy_url();
    109         if ( empty($privacy_policy) ) {
    110             $privacy_policy = get_home_url().'/privacy-policy';
    111         }
    112         wp_safe_redirect( $privacy_policy );
    113         exit;
    114     }
    115108}
    116109add_action( 'init', 'jlplg_lovecoding_display_cookie_notice');
     
    133126function jlplg_lovecoding_add_new_settings() {
    134127    // register settings
    135     $configuration_settins_field1_arg = array(
     128    $configuration_settings_field1_arg = array(
    136129        'type' => 'string',
    137130        'sanitize_callback' => 'jlplg_lovecoding_sanitize_textarea_field',
    138131        'default' => 'We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies'
    139132    );
    140     $configuration_settins_field2_arg = array(
     133    $configuration_settings_field2_arg = array(
    141134        'type' => 'boolean',
    142135        'sanitize_callback' => 'jlplg_lovecoding_sanitize_checkbox',
    143136        'default' => false
    144137    );
    145     $configuration_settins_field3_arg = array(
     138    $configuration_settings_field3_arg = array(
    146139        'type' => 'string',
    147140        'sanitize_callback' => 'jlplg_lovecoding_sanitize_input_field',
    148141        'default' => 'Accept Cookies'
    149142    );
    150     $configuration_settins_field4_arg = array(
     143    $configuration_settings_field4_arg = array(
    151144        'type' => 'string',
    152145        'sanitize_callback' => 'jlplg_lovecoding_sanitize_input_field',
    153146        'default' => 'bottom'
    154147    );
    155     $configuration_settins_field5_arg = array(
    156         'type' => 'string',
    157         'sanitize_callback' => 'jlplg_lovecoding_sanitize_input_field',
    158         'default' => 'bottom'
    159     );
    160     $layout_settins_field1_arg = array(
     148    $configuration_settings_field5_arg = array(
     149        'type' => 'integer',
     150        'sanitize_callback' => 'jlplg_lovecoding_sanitize_integer',
     151        'default' => 30
     152    );
     153    $layout_settings_field1_arg = array(
    161154        'type' => 'string',
    162155        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    163156        'default' => '#444546'
    164157    );
    165     $layout_settins_field2_arg = array(
     158    $layout_settings_field2_arg = array(
    166159        'type' => 'string',
    167160        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    168161        'default' => '#ffffff'
    169162    );
    170     $layout_settins_field3_arg = array(
     163    $layout_settings_field3_arg = array(
    171164        'type' => 'string',
    172165        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    173166        'default' => '#dcf1ff'
    174167    );
    175     $layout_settins_field4_arg = array(
     168    $layout_settings_field4_arg = array(
    176169        'type' => 'string',
    177170        'sanitize_callback' => 'jlplg_lovecoding_sanitize_color_input',
    178171        'default' => '#000000'
    179172    );
    180     register_setting( 'jl_options', 'jlplg_lovecoding-field1-cookie-message', $configuration_settins_field1_arg);     // option group, option name, args
    181     register_setting( 'jl_options', 'jlplg_lovecoding-field2-checkbox-privacy-policy', $configuration_settins_field2_arg);
    182     register_setting( 'jl_options', 'jlplg_lovecoding-field3-cookie-button-text', $configuration_settins_field3_arg);
    183     register_setting( 'jl_options', 'jlplg_lovecoding-field4-cookie-plugin-placement', $configuration_settins_field4_arg);
    184     register_setting( 'jl_options', 'jlplg_lovecoding-field5-background-color', $layout_settins_field1_arg);
    185     register_setting( 'jl_options', 'jlplg_lovecoding-field6-text-color', $layout_settins_field2_arg);
    186     register_setting( 'jl_options', 'jlplg_lovecoding-field7-button-background-color', $layout_settins_field3_arg);
    187     register_setting( 'jl_options', 'jlplg_lovecoding-field8-button-text-color', $layout_settins_field4_arg);
    188     register_setting( 'jl_options', 'jlplg_lovecoding-field9-cookie-expire-time', $configuration_settins_field5_arg);
     173    register_setting( 'jl_options', 'jlplg_lovecoding-field1-cookie-message', $configuration_settings_field1_arg);     // option group, option name, args
     174    register_setting( 'jl_options', 'jlplg_lovecoding-field2-checkbox-privacy-policy', $configuration_settings_field2_arg);
     175    register_setting( 'jl_options', 'jlplg_lovecoding-field3-cookie-button-text', $configuration_settings_field3_arg);
     176    register_setting( 'jl_options', 'jlplg_lovecoding-field4-cookie-plugin-placement', $configuration_settings_field4_arg);
     177    register_setting( 'jl_options', 'jlplg_lovecoding-field5-background-color', $layout_settings_field1_arg);
     178    register_setting( 'jl_options', 'jlplg_lovecoding-field6-text-color', $layout_settings_field2_arg);
     179    register_setting( 'jl_options', 'jlplg_lovecoding-field7-button-background-color', $layout_settings_field3_arg);
     180    register_setting( 'jl_options', 'jlplg_lovecoding-field8-button-text-color', $layout_settings_field4_arg);
     181    register_setting( 'jl_options', 'jlplg_lovecoding-field9-cookie-expire-time', $configuration_settings_field5_arg);
    189182
    190183    // adding sections
     
    256249}
    257250
    258 // field 8 - cookie expire time
     251// field 9 - cookie expire time
    259252function jlplg_lovecoding_field_9_callback() {
    260253    echo '<input type="text" name="jlplg_lovecoding-field9-cookie-expire-time" value="'.esc_html( get_option( "jlplg_lovecoding-field9-cookie-expire-time", '30' ) ).'" />';
     
    268261    }
    269262    return $input;
     263}
     264
     265// sanitize integer
     266function jlplg_lovecoding_sanitize_integer( $input ) {
     267    return ( isset( $input ) ) ? absint( $input ) : 30;
    270268}
    271269
  • simple-cookie-notice/trunk/styles.css

    r3144342 r3436765  
    11.jlplg-lovecoding-cookie-info-container {
    22    position: fixed;
    3     z-index: 50;
     3    z-index: 9999;
    44    width: 100%;
    55    text-align: center;
     
    2323
    2424.jlplg-lovecoding-buttons {
    25     display: inline-block;
    26     margin-bottom: 10px;
     25    display: flex;
     26    flex-wrap: wrap;
     27    justify-content: center;
     28    align-items: center;
     29    gap: 10px;
     30    margin-bottom: 16px;
    2731}
    2832
    29 button.jlplg-lovecoding-cookie-accept-button, button.jlplg-lovecoding-cookie-privacy-policy {
    30     padding: 5px 15px;
     33.jlplg-lovecoding-cookie-accept-button, .jlplg-lovecoding-cookie-privacy-policy {
     34    display: inline-block;
     35    padding: 7px 15px;
    3136    border-radius: 4px;
    3237    border: 2px solid transparent;
    33     margin: 5px 0;
     38    margin: 0;
     39    text-decoration: none;
     40    line-height: 1;
     41    font-family: inherit;
     42    font-size: 16px;
    3443}
    3544
    36 button.jlplg-lovecoding-cookie-accept-button:hover, button.jlplg-lovecoding-cookie-privacy-policy:hover,
    37 button.jlplg-lovecoding-cookie-accept-button:focus, button.jlplg-lovecoding-cookie-privacy-policy:focus {
     45.jlplg-lovecoding-cookie-accept-button:hover, .jlplg-lovecoding-cookie-privacy-policy:hover,
     46.jlplg-lovecoding-cookie-accept-button:focus, .jlplg-lovecoding-cookie-privacy-policy:focus {
    3847    cursor: pointer;
    3948    border: 2px solid transparent;
    4049}
    4150
    42 button.jlplg-lovecoding-cookie-accept-button:focus-visible, button.jlplg-lovecoding-cookie-privacy-policy:focus-visible {
     51.jlplg-lovecoding-cookie-accept-button:focus-visible, .jlplg-lovecoding-cookie-privacy-policy:focus-visible {
    4352    border: 2px solid transparent;
    4453    outline: 2px solid var(--jlplg-buton-bg-color);
  • simple-cookie-notice/trunk/uninstall.php

    r2856380 r3436765  
    1313
    1414function jlplg_lovecoding_delete_settings() {
    15     delete_option( 'jlplg_prvpol-field1-cookie-message' );
    16     delete_option( 'jlplg_prvpol-field2-checkbox-privacy-policy' );
    17     delete_option( 'jlplg_prvpol-field3-cookie-button-text' );
    18     delete_option( 'jlplg_prvpol-field4-background-color' );
    19     delete_option( 'jlplg_prvpol-field5-text-color' );
    20     delete_option( 'jlplg_prvpol-field6-button-background-color' );
    21     delete_option( 'jlplg_prvpol-field7-button-text-color' );
     15    delete_option( 'jlplg_lovecoding-field1-cookie-message' );
     16    delete_option( 'jlplg_lovecoding-field2-checkbox-privacy-policy' );
     17    delete_option( 'jlplg_lovecoding-field3-cookie-button-text' );
     18    delete_option( 'jlplg_lovecoding-field4-cookie-plugin-placement' );
     19    delete_option( 'jlplg_lovecoding-field5-background-color' );
     20    delete_option( 'jlplg_lovecoding-field6-text-color' );
     21    delete_option( 'jlplg_lovecoding-field7-button-background-color' );
     22    delete_option( 'jlplg_lovecoding-field8-button-text-color' );
     23    delete_option( 'jlplg_lovecoding-field9-cookie-expire-time' );
    2224}
    2325
     
    2527
    2628function jlplg_lovecoding_delete_cookies() {
    27     unset( $_COOKIE['cookie-accepted'] );
    28     setcookie( sanitize_key( 'cookie-accepted' ), '', 1);
     29    unset( $_COOKIE['jlplg-cookies-accepted'] );
     30    setcookie( sanitize_key( 'jlplg-cookies-accepted' ), '', 1);
    2931}
    3032
Note: See TracChangeset for help on using the changeset viewer.