Plugin Directory

Changeset 2019905


Ignore:
Timestamp:
01/27/2019 01:55:35 PM (7 years ago)
Author:
antsanchez
Message:

Updated to version 2.3 fixed JS bugs

Location:
easy-cookie-law/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • easy-cookie-law/trunk/class/easy-cookie-law.php

    r2019898 r2019905  
    8686     */
    8787    public function printNotice()
    88     {
    89         echo "<div id='ecl-notice'></div>";
    90        
    91         $ecl_style_otuput = "";
    92         if( $this->options['custom'] == 0 ) {
    93             $position = $this->options['position'] == "top" ? "top: 0" : "bottom: 0";
    94             $ecl_style_otuput = "<style type='text/css'>#ecl-notice{position: fixed; z-index: 1000000; $position; left: 0; width: 100%; font-size: 14px; padding: 0.5em; background-color: ".$this->options['noticecolor']."; color: ".$this->options['textcolor'].";}#ecl-notice a{color:".$this->options['linkscolor'].";}</style>";
    95         }
    96 
    97         $ecl_notice_output = $ecl_style_otuput . $this->options['text'] ." <a href='". $this->options['link'] ."' target='". $this->options['link_target'] ."'>". $this->options['link_text'] ."</a> | <a href onclick='ecl_close_and_send();' >". $this->options['close'] ."</a>";
    98 
    99         /**
    100          * Not minimized JS
    101          *
    102          var ecln = document.getElementById('ecl-notice')
     88    {       
     89        ?>
     90        <script type="text/javascript">
    10391            function ecl_set_cookie() {
    10492                var d = new Date();
     
    10694                var expires = "expires="+ d.toUTCString();
    10795                document.cookie = "<?php echo self::ECL_COOKIE_NAME; ?>" + "=" + "visited" + ";" + expires + ";path=/";
    108             }
    109             function ecl_close_notice(){
    110                 if(ecln) ecln.style.display = "none";
    11196            }
    11297            function ecl_is_cookie_accepted(){
     
    121106                }
    122107            }
     108            if(ecl_is_cookie_accepted()) {
     109                <?php echo $this->printGtmHeader(); ?>
     110           
     111            }
     112        </script>
     113        <?php
     114    }
     115
     116    public function printFooterNotice()
     117    {
     118        $ecl_style_otuput = "";
     119        if( $this->options['custom'] == 0 ) {
     120            $position = $this->options['position'] == "top" ? "top: 0" : "bottom: 0";
     121            $ecl_style_otuput = "<style type='text/css'>#ecl-notice{position: fixed; z-index: 1000000; $position; left: 0; width: 100%; font-size: 14px; padding: 0.5em; background-color: ".$this->options['noticecolor']."; color: ".$this->options['textcolor'].";}#ecl-notice a{color:".$this->options['linkscolor'].";}</style>";
     122        }
     123
     124        $ecl_notice_output = $ecl_style_otuput . "<div id='ecl-notice'>" . $this->options['text'] ." <a href='". $this->options['link'] ."' target='". $this->options['link_target'] ."'>". $this->options['link_text'] ."</a> | <a href onclick='ecl_close_and_send();' >". $this->options['close'] ."</a></div>";
     125       
     126        ?>
     127        <div id='ecl-notice'></div>
     128        <script type="text/javascript">
     129            var ecln = document.getElementById('ecl-notice');
    123130            function ecl_close_and_send(){
    124131                ecl_close_notice();
    125132                ecl_set_cookie();
    126133            }
     134            function ecl_close_notice(){
     135                if(ecln) ecln.style.display = "none";
     136            }
    127137            if(ecl_is_cookie_accepted()) {
    128138                ecl_close_notice();
    129                 <?php echo $this->printGtmHeader(); ?>
    130            
    131139            }else{
    132140                ecln.innerHTML = "<?php echo $ecl_notice_output; ?>";
    133141            }
    134         */
    135        
    136         ?>
    137         <script type="text/javascript">
    138             var ecln=document.getElementById("ecl-notice");function ecl_set_cookie(){var e=new Date;e.setTime(e.getTime()+2592e6);var c="expires="+e.toUTCString();document.cookie="<?php echo self::ECL_COOKIE_NAME; ?>=visited;"+c+";path=/"}function ecl_close_notice(){ecln&&(ecln.style.display="none")}function ecl_is_cookie_accepted(){for(var e=decodeURIComponent(document.cookie).split(";"),c=0;c<e.length;c++){for(var o=e[c];" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf("<?php echo self::ECL_COOKIE_NAME; ?>="))return!0}}function ecl_close_and_send(){ecl_close_notice(),ecl_set_cookie()}
    139             if(ecl_is_cookie_accepted()) {
    140                 ecl_close_notice();
    141                 <?php echo $this->printGtmHeader(); ?>
    142            
    143             }else{
    144                 ecln.innerHTML = "<?php echo $ecl_notice_output; ?>";
    145             }
    146142        </script>
    147         <?php
     143        <?php 
    148144    }
    149145
  • easy-cookie-law/trunk/easy-cookie-law.php

    r2019902 r2019905  
    44 * Description: Minimal code to help your website respect the cookie law
    55 * Plugin URI: https://antsanchez.com
    6  * Version: 2.2
     6 * Version: 2.3
    77 * Author: antsanchez
    88 * Author URI: https://antsanchez.com
     
    118118}
    119119
     120function ecl_print_div()
     121{
     122    global $ecl_plugin;
     123    $ecl_plugin->printFooterNotice();
     124}
     125add_action('wp_footer', 'ecl_print_div', 1);
     126
    120127?>
  • easy-cookie-law/trunk/readme.txt

    r2019898 r2019905  
    55Requires PHP: 5.2
    66Tested up to: 5.0.3
    7 Stable tag: 2.2
     7Stable tag: 2.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7070== Changelog ==
    7171
     72= 2.3 =
     73* Fixed some small JavaScript bugs
     74
    7275= 2.2 =
    7376* Added support for Google Tag Manager
Note: See TracChangeset for help on using the changeset viewer.