Ginger – EU Cookie Law - Version 2.3

Version Description

  • Logger addon
Download this release

Release Info

Developer manafactory
Plugin Icon 128x128 Ginger – EU Cookie Law
Version 2.3
Comparing to
See all releases

Code changes from version 2.2 to 2.3

addon/ginger.addon.utils.php CHANGED
@@ -95,6 +95,8 @@ if ( $request == 'activation' && $activationcode != '' && $activationemail != ''
95
  );
96
  $array_activate = update_option($product_id, $args);
97
  $notice = $data->message;
 
 
98
  }else{
99
  $notice = $data->error;
100
  }
@@ -103,6 +105,7 @@ if ( $request == 'activation' && $activationcode != '' && $activationemail != ''
103
  $notice = __("Fill all required fields!", "ginger");
104
  }
105
 
 
106
  // Valid check request
107
  if ( $request == 'check' ) {
108
  $args = array(
95
  );
96
  $array_activate = update_option($product_id, $args);
97
  $notice = $data->message;
98
+ do_action("ginger_activated_addon", $product_id);
99
+
100
  }else{
101
  $notice = $data->error;
102
  }
105
  $notice = __("Fill all required fields!", "ginger");
106
  }
107
 
108
+
109
  // Valid check request
110
  if ( $request == 'check' ) {
111
  $args = array(
addon/logger/ginger.logger.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_action('ginger_add_menu', 'add_ginger_logger');
4
+ function add_ginger_logger(){
5
+ add_submenu_page( 'ginger-setup', "Ginger Logger", __("Activity Logger", "ginger"), 'manage_options', 'ginger-logger', 'ginger_logger');
6
+ }
7
+
8
+ function ginger_logger(){
9
+ global $wpdb;
10
+ $wp_root = dirname(dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ));
11
+ if ( file_exists( $wp_root . '/wp-load.php' ) ) {
12
+ require_once( $wp_root . "/wp-load.php" );
13
+ } else {
14
+ exit;
15
+ }
16
+
17
+ if ( ! current_user_can( 'manage_options' ) ) die();
18
+
19
+ if(isset($_POST["submit"]) && !wp_verify_nonce($_POST['ginger_options'], 'save_ginger_logger')){
20
+ return;
21
+ }
22
+
23
+ if(isset($_POST["action"]) && $_POST["action"] == "deleteall"){
24
+ $wpdb->query( "DELETE FROM {$wpdb->prefix}logger_ginger WHERE 1" );
25
+ }
26
+
27
+ $option_logger = get_option('gingerlogger');
28
+ $activationemail = $option_logger['email'];
29
+ $activationcode = $option_logger['licence_key'];
30
+ $product_id = $option_logger['product_id'];
31
+ $instance = $option_logger['instance'];
32
+
33
+
34
+ $args = array(
35
+ 'wc-api' => 'software-api',
36
+ 'request' => 'check',
37
+ 'email' => $activationemail,
38
+ 'licence_key' => $activationcode,
39
+ 'product_id' => $product_id,
40
+ 'instance' => $instance
41
+ );
42
+
43
+ $data = execute_request( $args );
44
+ if($data->success == 1): ?>
45
+ <div class="wrap">
46
+ <h2>Ginger - Logger Add On</h2>
47
+ <?php
48
+
49
+
50
+
51
+ $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
52
+ $limit = 20;
53
+ $offset = ( $pagenum - 1 ) * $limit;
54
+ $entries = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}logger_ginger WHERE 1 ORDER BY id DESC LIMIT $offset, $limit" );
55
+
56
+ echo '<div class="wrap">';
57
+
58
+ ?>
59
+ <table class="widefat">
60
+ <thead>
61
+ <tr>
62
+ <th scope="col" class="manage-column column-name" style="">Time</th>
63
+ <th scope="col" class="manage-column column-name" style="">IP</th>
64
+ <th scope="col" class="manage-column column-name" style="">url</th>
65
+ <th scope="col" class="manage-column column-name" style="">Cookie</th>
66
+ </tr>
67
+ </thead>
68
+
69
+ <tfoot>
70
+ <tr>
71
+ <th scope="col" class="manage-column column-name" style="">Time</th>
72
+ <th scope="col" class="manage-column column-name" style="">IP</th>
73
+ <th scope="col" class="manage-column column-name" style="">url</th>
74
+ <th scope="col" class="manage-column column-name" style="">Cookie</th>
75
+ </tr>
76
+ </tfoot>
77
+
78
+ <tbody>
79
+ <?php if( $entries ) { ?>
80
+
81
+ <?php
82
+ $count = 1;
83
+ $class = '';
84
+ foreach( $entries as $entry ) {
85
+ $class = ( $count % 2 == 0 ) ? ' class="alternate"' : '';
86
+ ?>
87
+
88
+ <tr<?php echo $class; ?>>
89
+ <td><?php echo $entry->time; ?></td>
90
+ <td><?php echo $entry->ipaddress; ?></td>
91
+ <td><?php echo $entry->url; ?></td>
92
+ <td><?php echo $entry->status; ?></td>
93
+ </tr>
94
+
95
+ <?php
96
+ $count++;
97
+ }
98
+ ?>
99
+
100
+ <?php } else { ?>
101
+ <tr>
102
+ <td colspan="2">No Logs yet</td>
103
+ </tr>
104
+ <?php } ?>
105
+ </tbody>
106
+ </table>
107
+
108
+ <?php
109
+ $total = $wpdb->get_var( "SELECT COUNT('id') FROM {$wpdb->prefix}logger_ginger" );
110
+ $num_of_pages = ceil( $total / $limit );
111
+ $page_links = paginate_links( array(
112
+ 'base' => add_query_arg( 'pagenum', '%#%' ),
113
+ 'format' => '',
114
+ 'prev_text' => __( '&laquo;', 'aag' ),
115
+ 'next_text' => __( '&raquo;', 'aag' ),
116
+ 'total' => $num_of_pages,
117
+ 'current' => $pagenum
118
+ ) );
119
+
120
+ if ( $page_links ) {
121
+ echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
122
+ }
123
+
124
+ echo '</div>';
125
+ ?>
126
+ <form method="post" action="admin.php?page=<?php echo $_GET["page"]; ?>" >
127
+ <?php wp_nonce_field('save_ginger_logger', 'ginger_options'); ?>
128
+ <p><input type="submit" name="submit" value="<?php _e("Delete all logs", "ginger"); ?>" class="button button-primary delete-cookies"></p>
129
+ <input type="hidden" name="action" value="deleteall">
130
+ </form>
131
+ <script type="text/javascript">
132
+ jQuery(document).ready(function(){
133
+ jQuery(".delete-cookies").click(function() {
134
+ if (!confirm("<?php _e("Are you sure? This process cannot be undone.", "ginger"); ?>")){
135
+ return false;
136
+ }
137
+ });
138
+ });
139
+ </script>
140
+ </div>
141
+ <?php else: //La licenza sembra non essere valida; ?>
142
+ <?php $option = get_option('gingerlogger');
143
+ $option['activated'] = 0; update_option('gingerlogger', $option); ?>
144
+ <div class="wrap">
145
+ <h2>Ginger - Logger Add On</h2>
146
+ <p><?php _e("Licence key look inactive. Addon disabled", "ginger"); ?></p>
147
+ <p><?php _e("If you think is an error contact us here:", "ginger"); ?> <a href="http://www.ginger-cookielaw.com/">www.ginger-cookielaw.com/</a></p>
148
+ </div>
149
+ <?php endif; ?>
150
+
151
+
152
+ <?php }
153
+
154
+ add_action("wp_head", "ginger_add_log_variable");
155
+ function ginger_add_log_variable(){
156
+ ?>
157
+ <script type="text/javascript">
158
+ var ginger_logger = "Y";
159
+ var ginger_logger_url = "<?php bloginfo("url"); ?>";
160
+ var current_url = "<?php echo (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>";
161
+
162
+ function gingerAjaxLogTime(status) {
163
+ var xmlHttp = new XMLHttpRequest();
164
+ var parameters = "ginger_action=time";
165
+ var url= ginger_logger_url + "?" + parameters;
166
+ xmlHttp.open("GET", url, true);
167
+
168
+ //Black magic paragraph
169
+ xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
170
+
171
+ xmlHttp.onreadystatechange = function() {
172
+ if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
173
+ var time = xmlHttp.responseText;
174
+ gingerAjaxLogger(time, status);
175
+ }
176
+ }
177
+
178
+ xmlHttp.send(parameters);
179
+ }
180
+
181
+ function gingerAjaxLogger(ginger_logtime, status) {
182
+ console.log(ginger_logtime);
183
+ var xmlHttp = new XMLHttpRequest();
184
+ var parameters = "ginger_action=log&time=" + ginger_logtime + "&url=" + current_url + "&status=" + status;
185
+ var url= ginger_logger_url + "?" + parameters;
186
+ console.log(url);
187
+ xmlHttp.open("GET", url, true);
188
+
189
+ //Black magic paragraph
190
+ xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
191
+
192
+ xmlHttp.send(parameters);
193
+ }
194
+
195
+ </script>
196
+ <?php
197
+ }
addon/logger/index.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Logger
3
+ $option_logger = get_option('gingerlogger');
4
+ if($option_logger && $option_logger['activated'] == 1):
5
+ require_once('ginger.logger.php');
6
+ endif;
7
+
8
+ add_action("ginger_addon_activation_page", "ginger_logger_activation_page");
9
+
10
+ function ginger_logger_activation_page()
11
+ {
12
+ $appname = "logger";
13
+ $app_data = ginger_app_data($appname);
14
+ $option_ginger_analitics = get_option('gingerlogger');
15
+ ?>
16
+
17
+ <div class="ginger-addon">
18
+ <table class="form-table striped">
19
+ <thead>
20
+ <tr>
21
+ <td colspan="2">
22
+ <img class="ginger-thumb" src="<?php echo $app_data["thumb"]; ?>" />
23
+ <h3><?php _e("Acceptance Logger", "ginger"); ?>
24
+ <?php
25
+ ginger_app_price($appname, $app_data);
26
+ ?></h3>
27
+ <small><?php _e("This add-on log user's acceptance and show reports on admin page. Very useful in case of disputes", "ginger"); ?></small>
28
+ <br style="clear: both" />
29
+ <p>
30
+ <a href="http://www.ginger-cookielaw.com/prodotto/<?php echo $appname; ?>/" target="_BLANK" class="button button-primary" <?php if($option_ginger_analitics && $option_ginger_analitics['activated'] == 1){ echo "disabled='disabled' "; } ?>><?php _e("Get Activation Code", "ginger"); ?></a>
31
+ </p>
32
+ </td>
33
+ </tr>
34
+ </thead>
35
+ <tbody>
36
+ <tr>
37
+
38
+ <td>
39
+ <fieldset>
40
+ <legend class="screen-reader-text"><span><?php _e("Acceptance Logger", "ginger"); ?></span></legend>
41
+ <p>
42
+ <label>
43
+ <?php _e("Active add-on", "ginger");?>:&nbsp;
44
+ </label>
45
+ <?php if ($option_ginger_analitics && $option_ginger_analitics['activated'] == 1): ?>
46
+ <img id="img_google_logger"
47
+ src="<?php echo plugins_url('/ginger/img/ok.png'); ?>"
48
+ style="max-width: 20px; max-height: 20px; vertical-align: middle">
49
+
50
+ <form method="get" action="<?php echo admin_url('admin.php?page=ginger-add-on'); ?>">
51
+ <input type="hidden" name="page" value="ginger-add-on">
52
+ <input id="activationcode" type="text" name="activationcode"
53
+ value="<?php echo $option_ginger_analitics['licence_key']; ?>" placeholder=""
54
+ size="30px">
55
+ <input id="activationmail" type="text" name="activationmail"
56
+ value="<?php echo $option_ginger_analitics['email']; ?>" placeholder="" size="30px">
57
+ <input type="hidden" name="product_id" value="gingerlogger">
58
+ <input type="hidden" name="request" value="deactivation">
59
+ <input type="submit" class="button" value="<?php _e('Deactivate', 'ginger') ?>">
60
+ </form>
61
+ <?php else: ?>
62
+ <img id="img_google_logger"
63
+ src="<?php echo plugins_url('/ginger/img/xx.png'); ?>"
64
+ style="max-width: 20px; max-height: 20px; vertical-align: middle">
65
+ <form method="get" action="<?php echo admin_url('admin.php?page=ginger-add-on'); ?>">
66
+ <input type="hidden" name="page" value="ginger-add-on">
67
+ <input id="activationcode" type="text" name="activationcode" value=""
68
+ placeholder="<?php _e('Insert here the add-on activation code.', 'ginger') ?>"
69
+ size="30px">
70
+ <input id="activationmail" type="text" name="activationmail" value=""
71
+ placeholder="<?php _e('Insert here your activation mail.', 'ginger') ?>" size="30px">
72
+ <input type="hidden" name="product_id" value="gingerlogger">
73
+ <input type="hidden" name="request" value="activation">
74
+ <input type="submit" class="button" value="<?php _e('Activate', 'ginger') ?>">
75
+ </form>
76
+ <?php endif; ?>
77
+ </p>
78
+ </fieldset>
79
+ </td>
80
+ </tr>
81
+
82
+ </tbody>
83
+ </table>
84
+ </div>
85
+ <?php
86
+
87
+ }
88
+
89
+
90
+ function ginger_do_log($url = "", $status = "Y"){
91
+ global $wpdb;
92
+ if($url == "")
93
+ $url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
94
+ $table_name = $wpdb->prefix . 'logger_ginger';
95
+ $ipuser = ginger_get_ip_address();
96
+ $now = current_time( 'mysql' );
97
+ $wpdb->insert(
98
+ $table_name,
99
+ array(
100
+ 'time' => $now,
101
+ 'ipaddress' => $ipuser,
102
+ 'url' => $url,
103
+ 'status' => $status
104
+ ),
105
+ array(
106
+ '%s',
107
+ '%s',
108
+ '%s',
109
+ '%s'
110
+ )
111
+ );
112
+ }
113
+
114
+
115
+ function ginger_get_ip_address() {
116
+ // check for shared internet/ISP IP
117
+ if (!empty($_SERVER['HTTP_CLIENT_IP']) && ginger_validate_ip($_SERVER['HTTP_CLIENT_IP'])) {
118
+ return $_SERVER['HTTP_CLIENT_IP'];
119
+ }
120
+
121
+ // check for IPs passing through proxies
122
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
123
+ // check if multiple ips exist in var
124
+ if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') !== false) {
125
+ $iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
126
+ foreach ($iplist as $ip) {
127
+ if (ginger_validate_ip($ip))
128
+ return $ip;
129
+ }
130
+ } else {
131
+ if (ginger_validate_ip($_SERVER['HTTP_X_FORWARDED_FOR']))
132
+ return $_SERVER['HTTP_X_FORWARDED_FOR'];
133
+ }
134
+ }
135
+ if (!empty($_SERVER['HTTP_X_FORWARDED']) && ginger_validate_ip($_SERVER['HTTP_X_FORWARDED']))
136
+ return $_SERVER['HTTP_X_FORWARDED'];
137
+ if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && ginger_validate_ip($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']))
138
+ return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
139
+ if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && ginger_validate_ip($_SERVER['HTTP_FORWARDED_FOR']))
140
+ return $_SERVER['HTTP_FORWARDED_FOR'];
141
+ if (!empty($_SERVER['HTTP_FORWARDED']) && ginger_validate_ip($_SERVER['HTTP_FORWARDED']))
142
+ return $_SERVER['HTTP_FORWARDED'];
143
+
144
+ // return unreliable ip since all else failed
145
+ return $_SERVER['REMOTE_ADDR'];
146
+ }
147
+
148
+ /**
149
+ * Ensures an ip address is both a valid IP and does not fall within
150
+ * a private network range.
151
+ */
152
+ function ginger_validate_ip($ip) {
153
+ if (strtolower($ip) === 'unknown')
154
+ return false;
155
+
156
+ // generate ipv4 network address
157
+ $ip = ip2long($ip);
158
+
159
+ // if the ip is set and not equivalent to 255.255.255.255
160
+ if ($ip !== false && $ip !== -1) {
161
+ // make sure to get unsigned long representation of ip
162
+ // due to discrepancies between 32 and 64 bit OSes and
163
+ // signed numbers (ints default to signed in PHP)
164
+ $ip = sprintf('%u', $ip);
165
+ // do private network range checking
166
+ if ($ip >= 0 && $ip <= 50331647) return false;
167
+ if ($ip >= 167772160 && $ip <= 184549375) return false;
168
+ if ($ip >= 2130706432 && $ip <= 2147483647) return false;
169
+ if ($ip >= 2851995648 && $ip <= 2852061183) return false;
170
+ if ($ip >= 2886729728 && $ip <= 2887778303) return false;
171
+ if ($ip >= 3221225984 && $ip <= 3221226239) return false;
172
+ if ($ip >= 3232235520 && $ip <= 3232301055) return false;
173
+ if ($ip >= 4294967040) return false;
174
+ }
175
+ return true;
176
+ }
177
+
178
+
179
+
180
+ function ginger_logger_create_table($product_id){
181
+ if($product_id == "gingerlogger"){
182
+ global $wpdb;
183
+ $table_name = $wpdb->prefix . 'logger_ginger';
184
+ $charset_collate = $wpdb->get_charset_collate();
185
+ $sql = "CREATE TABLE $table_name (
186
+ id int(10) NOT NULL AUTO_INCREMENT,
187
+ time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
188
+ ipaddress varchar(45),
189
+ url text NOT NULL,
190
+ status varchar(1) DEFAULT 'Y' NOT NULL,
191
+ UNIQUE KEY id (id)
192
+ ) $charset_collate;";
193
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
194
+ dbDelta( $sql );
195
+ }
196
+ }
197
+
198
+ add_action("ginger_activated_addon", "ginger_logger_create_table");
199
+
200
+ // init to check date and save log
201
+ add_action("init", "ginger_activity_log");
202
+ function ginger_activity_log(){
203
+ if(!((isset($_GET["ginger_action"]) && $_GET["ginger_action"] == "time") || (isset($_GET["ginger_action"]) && $_GET["ginger_action"] == "log"))) {
204
+ return;
205
+ }
206
+ if($_GET["ginger_action"] == "time"){
207
+
208
+ header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
209
+ header("Pragma: no-cache"); // HTTP 1.0.
210
+ header("Expires: 0"); // Proxies.
211
+ echo time();
212
+ exit;
213
+ }
214
+ if($_GET["ginger_action"] == "log"){
215
+ if(!isset($_GET["url"]) || $_GET["url"] == "") exit;
216
+ if(!isset($_GET["time"]) || $_GET["time"] == "") exit;
217
+ if(!isset($_GET["status"]) || $_GET["status"] == "") exit;
218
+
219
+ if(($_GET["time"] + 10) < time()) exit;
220
+ header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
221
+ header("Pragma: no-cache"); // HTTP 1.0.
222
+ header("Expires: 0"); // Proxies.
223
+ // echo time();
224
+ if(function_exists("ginger_do_log")){
225
+ ginger_do_log($_GET["url"], $_GET["status"]);
226
+ }
227
+ exit;
228
+ }
229
+
230
+ }
front/js/cookies-enabler.min.js CHANGED
@@ -1 +1 @@
1
- function strpos(e,n,t){var s=(e+"").indexOf(n,t||0);return-1===s?!1:s}window.COOKIES_ENABLER=window.COOKIES_ENABLER||function(){"use strict";function e(){var e,n;for(e=1;e<arguments.length;e++)for(n in arguments[e])arguments[e].hasOwnProperty(n)&&(arguments[0][n]=arguments[e][n]);return arguments[0]}function n(e,n,t){var s;return function(){var a=this,i=arguments,r=function(){s=null,t||e.apply(a,i)},o=t&&!s;clearTimeout(s),s=setTimeout(r,n),o&&e.apply(a,i)}}function t(e,n){do if(s(e,n))return e;while(e=e.parentNode);return null}function s(e,n){return(" "+e.className+" ").indexOf(" "+n+" ")>-1}var a,i,r,o={scriptClass:"ce-script",iframeClass:"ce-iframe",acceptClass:"ce-accept",disableClass:"ce-disable",dismissClass:"ce-dismiss",bannerClass:"ce-banner",bannerHTML:null!==document.getElementById("ce-banner-html")?document.getElementById("ce-banner-html").innerHTML:'<p>This website uses cookies. <a href="#" class="ce-accept">Enable Cookies</a></p>',eventScroll:!1,scrollOffset:200,clickOutside:!1,cookieName:"ce-cookie",cookieDuration:"365",forceBannerClass:"ginger-banner bottom dialog dark force",forceEnable:!1,forceEnableText:'<div class="ginger-button-wrapper"><div class="ginger-button"><a href="#" class="ginger-accept">Enable Cookie</a></div></div>',iframesPlaceholder:!0,iframesPlaceholderHTML:null!==document.getElementById("ce-iframePlaceholder-html")?document.getElementById("ce-iframePlaceholder-html").innerHTML:'<p>To view this content you need to<a href="#" class="ce-accept">Enable Cookies</a></p>',iframesPlaceholderClass:"ce-iframe-placeholder",onEnable:"",onDismiss:"",onDisable:"",forceReload:!1},c=function(){Math.abs(window.pageYOffset-r)>a.scrollOffset&&"N"!=p.get()&&u()},l=function(){i={accept:document.getElementsByClassName(a.acceptClass),disable:document.getElementsByClassName(a.disableClass),banner:document.getElementsByClassName(a.bannerClass),bannerForce:document.getElementsByClassName(a.forceBannerClass),dismiss:document.getElementsByClassName(a.dismissClass)};var e,n=i.accept,s=n.length,o=i.disable,l=o.length,d=i.dismiss,g=d.length;for(a.eventScroll&&window.addEventListener("load",function(){r=window.pageYOffset,window.addEventListener("scroll",c)}),a.clickOutside&&document.addEventListener("click",function(e){var n=e.target;return t(n,a.iframesPlaceholderClass)||t(n,a.disableClass)||t(n,a.bannerClass)||t(n,a.dismissClass)||t(n,a.disableClass)?!1:void("N"!=p.get()&&u())}),e=0;s>e;e++)n[e].addEventListener("click",function(e){e.preventDefault(),u(e)});for(e=0;l>e;e++)o[e].addEventListener("click",function(e){e.preventDefault(),f(e)});for(e=0;g>e;e++)d[e].addEventListener("click",function(e){e.preventDefault(),m.dismiss()})},d=function(n){if(a=e({},o,n),"Y"==p.get())"function"==typeof a.onEnable&&a.onEnable(),y.get_async(),b.get(),g.get();else if("N"==p.get()){var t=document.getElementById("disqus_thread");null!=t&&(t.style.display="none"),0!=a.forceEnable&&m.forceAccept(),"function"==typeof a.onDisable&&a.onDisable(),g.hide(),l()}else{var t=document.getElementById("disqus_thread");null!=t&&(t.style.display="none"),m.create(),g.hide(),l()}},u=n(function(e){if("undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"Y"!=p.get()){y.get_async(),p.set(),b.get(),g.get(),g.removePlaceholders(),m.dismiss();var n=document.getElementById("disqus_thread");null!=n&&(n.style.display="block"),window.removeEventListener("scroll",c),"function"==typeof a.onEnable&&a.onEnable(),1==a.forceReload&&location.reload()}},250,!1),f=function(e){"undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"N"!=p.get()&&(p.set("N"),m.dismiss(),window.removeEventListener("scroll",c),"function"==typeof a.onDisable&&a.onDisable())},m=function(){function e(){var e='<div class="'+a.bannerClass+'">'+a.bannerHTML+"</div>";document.body.insertAdjacentHTML("beforeend",e)}function n(){var e='<div class="'+a.forceBannerClass+'">'+a.forceEnableText+"</div>";document.body.insertAdjacentHTML("beforeend",e)}function t(){i.bannerForce[0]&&(i.bannerForce[0].style.display="none"),i.banner[0]&&(i.banner[0].style.display="none"),"function"==typeof a.onDismiss&&a.onDismiss()}return{create:e,dismiss:t,forceAccept:n}}(),p=function(){function e(e){var n,t,s="undefined"!=typeof e?e:"Y";a.cookieDuration?(n=new Date,n.setTime(n.getTime()+24*a.cookieDuration*60*60*1e3),t="; expires="+n.toGMTString()):t="",document.cookie=a.cookieName+"="+s+t+"; path=/"}function n(){var e,n,t,s=document.cookie.split(";"),i=s.length;for(e=0;i>e;e++)if(n=s[e].substr(0,s[e].indexOf("=")),t=s[e].substr(s[e].indexOf("=")+1),n=n.replace(/^\s+|\s+$/g,""),n==a.cookieName)return unescape(t)}return{set:e,get:n}}(),g=function(){function e(e){var n=document.createElement("div");n.className=a.iframesPlaceholderClass,n.innerHTML=a.iframesPlaceholderHTML,e.parentNode.insertBefore(n,e)}function n(){var e,n=document.getElementsByClassName(a.iframesPlaceholderClass),t=n.length;for(e=t-1;e>=0;e--)n[e].remove()}function t(){var n,t,s=document.getElementsByClassName(a.iframeClass),i=s.length;for(t=0;i>t;t++)n=s[t],n.style.display="none",a.iframesPlaceholder&&e(n)}function s(){var e,n,t,s=document.getElementsByClassName(a.iframeClass),i=s.length;for(t=0;i>t;t++)n=s[t],e=n.attributes["data-ce-src"].value,n.src=e,n.style.display="block"}return{hide:t,get:s,removePlaceholders:n}}(),b=function(){function e(){var e,n,t,s,i=document.getElementsByClassName(a.scriptClass),r=i.length,o=document.createDocumentFragment();for(e=0;r>e;e++)if(i[e].hasAttribute("data-ce-src"))"undefined"==typeof postscribe&&postscribe(i[e].parentNode,'<script src="'+i[e].getAttribute("data-ce-src")+'"></script>');else{for(t=document.createElement("script"),t.type="text/javascript",n=0;n<i[e].attributes.length;n++)s=i[e].attributes[n],s.specified&&"type"!=s.name&&"class"!=s.name&&t.setAttribute(s.name,s.value);t.innerHTML=i[e].innerHTML,o.appendChild(t)}document.body.appendChild(o)}function n(){"undefined"!=typeof async_ginger_script}return{get:e,get_async:n}}(),y=function(){function e(){if("undefined"!=typeof async_ginger_script){var e,n=async_ginger_script;for(e=0;e<n.length;++e){var t=document.createElement("script");t.type="text/javascript",t.src=n[e],document.getElementsByTagName("head")[0].appendChild(t)}}}return{get_async:e}}();return{init:d,enableCookies:u,dismissBanner:m.dismiss}}();
1
+ function strpos(e,n,t){var s=(e+"").indexOf(n,t||0);return-1===s?!1:s}window.COOKIES_ENABLER=window.COOKIES_ENABLER||function(){"use strict";function e(){var e,n;for(e=1;e<arguments.length;e++)for(n in arguments[e])arguments[e].hasOwnProperty(n)&&(arguments[0][n]=arguments[e][n]);return arguments[0]}function n(e,n,t){var s;return function(){var a=this,i=arguments,r=function(){s=null,t||e.apply(a,i)},o=t&&!s;clearTimeout(s),s=setTimeout(r,n),o&&e.apply(a,i)}}function t(e,n){do if(s(e,n))return e;while(e=e.parentNode);return null}function s(e,n){return(" "+e.className+" ").indexOf(" "+n+" ")>-1}var a,i,r,o={scriptClass:"ce-script",iframeClass:"ce-iframe",acceptClass:"ce-accept",disableClass:"ce-disable",dismissClass:"ce-dismiss",bannerClass:"ce-banner",bannerHTML:null!==document.getElementById("ce-banner-html")?document.getElementById("ce-banner-html").innerHTML:'<p>This website uses cookies. <a href="#" class="ce-accept">Enable Cookies</a></p>',eventScroll:!1,scrollOffset:200,clickOutside:!1,cookieName:"ce-cookie",cookieDuration:"365",forceBannerClass:"ginger-banner bottom dialog dark force",forceEnable:!1,forceEnableText:'<div class="ginger-button-wrapper"><div class="ginger-button"><a href="#" class="ginger-accept">Enable Cookie</a></div></div>',iframesPlaceholder:!0,iframesPlaceholderHTML:null!==document.getElementById("ce-iframePlaceholder-html")?document.getElementById("ce-iframePlaceholder-html").innerHTML:'<p>To view this content you need to<a href="#" class="ce-accept">Enable Cookies</a></p>',iframesPlaceholderClass:"ce-iframe-placeholder",onEnable:"",onDismiss:"",onDisable:"",forceReload:!1},c=function(){Math.abs(window.pageYOffset-r)>a.scrollOffset&&"N"!=g.get()&&u()},l=function(){i={accept:document.getElementsByClassName(a.acceptClass),disable:document.getElementsByClassName(a.disableClass),banner:document.getElementsByClassName(a.bannerClass),bannerForce:document.getElementsByClassName(a.forceBannerClass),dismiss:document.getElementsByClassName(a.dismissClass)};var e,n=i.accept,s=n.length,o=i.disable,l=o.length,d=i.dismiss,p=d.length;for(a.eventScroll&&window.addEventListener("load",function(){r=window.pageYOffset,window.addEventListener("scroll",c)}),a.clickOutside&&document.addEventListener("click",function(e){var n=e.target;return t(n,a.iframesPlaceholderClass)||t(n,a.disableClass)||t(n,a.bannerClass)||t(n,a.dismissClass)||t(n,a.disableClass)?!1:void("N"!=g.get()&&u())}),e=0;s>e;e++)n[e].addEventListener("click",function(e){e.preventDefault(),u(e)});for(e=0;l>e;e++)o[e].addEventListener("click",function(e){e.preventDefault(),f(e)});for(e=0;p>e;e++)d[e].addEventListener("click",function(e){e.preventDefault(),m.dismiss()})},d=function(n){if(a=e({},o,n),"Y"==g.get())"function"==typeof a.onEnable&&a.onEnable(),y.get_async(),b.get(),p.get();else if("N"==g.get()){var t=document.getElementById("disqus_thread");null!=t&&(t.style.display="none"),0!=a.forceEnable&&m.forceAccept(),"function"==typeof a.onDisable&&a.onDisable(),p.hide(),l()}else{var t=document.getElementById("disqus_thread");null!=t&&(t.style.display="none"),m.create(),p.hide(),l()}},u=n(function(e){if("undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"Y"!=g.get()){y.get_async(),g.set(),b.get(),p.get(),p.removePlaceholders(),m.dismiss();var n=document.getElementById("disqus_thread");null!=n&&(n.style.display="block"),window.removeEventListener("scroll",c),"function"==typeof a.onEnable&&a.onEnable(),1==a.forceReload&&location.reload()}},250,!1),f=function(e){"undefined"!=typeof e&&"click"===e.type&&e.preventDefault(),"N"!=g.get()&&(g.set("N"),m.dismiss(),window.removeEventListener("scroll",c),"function"==typeof a.onDisable&&a.onDisable())},m=function(){function e(){var e='<div class="'+a.bannerClass+'">'+a.bannerHTML+"</div>";document.body.insertAdjacentHTML("beforeend",e)}function n(){var e='<div class="'+a.forceBannerClass+'">'+a.forceEnableText+"</div>";document.body.insertAdjacentHTML("beforeend",e)}function t(){i.bannerForce[0]&&(i.bannerForce[0].style.display="none"),i.banner[0]&&(i.banner[0].style.display="none"),"function"==typeof a.onDismiss&&a.onDismiss()}return{create:e,dismiss:t,forceAccept:n}}(),g=function(){function e(e){var n,t,s="undefined"!=typeof e?e:"Y";a.cookieDuration?(n=new Date,n.setTime(n.getTime()+24*a.cookieDuration*60*60*1e3),t="; expires="+n.toGMTString()):t="",document.cookie=a.cookieName+"="+s+t+"; path=/";var i="undefined"!=typeof ginger_logger?ginger_logger:"N";"Y"==i&&gingerAjaxLogTime(s)}function n(){var e,n,t,s=document.cookie.split(";"),i=s.length;for(e=0;i>e;e++)if(n=s[e].substr(0,s[e].indexOf("=")),t=s[e].substr(s[e].indexOf("=")+1),n=n.replace(/^\s+|\s+$/g,""),n==a.cookieName)return unescape(t)}return{set:e,get:n}}(),p=function(){function e(e){var n=document.createElement("div");n.className=a.iframesPlaceholderClass,n.innerHTML=a.iframesPlaceholderHTML,e.parentNode.insertBefore(n,e)}function n(){var e,n=document.getElementsByClassName(a.iframesPlaceholderClass),t=n.length;for(e=t-1;e>=0;e--)n[e].remove()}function t(){var n,t,s=document.getElementsByClassName(a.iframeClass),i=s.length;for(t=0;i>t;t++)n=s[t],n.style.display="none",a.iframesPlaceholder&&e(n)}function s(){var e,n,t,s=document.getElementsByClassName(a.iframeClass),i=s.length;for(t=0;i>t;t++)n=s[t],e=n.attributes["data-ce-src"].value,n.src=e,n.style.display="block"}return{hide:t,get:s,removePlaceholders:n}}(),b=function(){function e(){var e,n,t,s,i=document.getElementsByClassName(a.scriptClass),r=i.length,o=document.createDocumentFragment();for(e=0;r>e;e++)if(i[e].hasAttribute("data-ce-src"))"undefined"==typeof postscribe&&postscribe(i[e].parentNode,'<script src="'+i[e].getAttribute("data-ce-src")+'"></script>');else{for(t=document.createElement("script"),t.type="text/javascript",n=0;n<i[e].attributes.length;n++)s=i[e].attributes[n],s.specified&&"type"!=s.name&&"class"!=s.name&&t.setAttribute(s.name,s.value);t.innerHTML=i[e].innerHTML,o.appendChild(t)}document.body.appendChild(o)}function n(){"undefined"!=typeof async_ginger_script}return{get:e,get_async:n}}(),y=function(){function e(){if("undefined"!=typeof async_ginger_script){var e,n=async_ginger_script;for(e=0;e<n.length;++e){var t=document.createElement("script");t.type="text/javascript",t.src=n[e],document.getElementsByTagName("head")[0].appendChild(t)}}}return{get_async:e}}();return{init:d,enableCookies:u,dismissBanner:m.dismiss}}();
ginger-eu-cookie-law.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ginger - EU Cookie Law
4
  Plugin URI: http://manafactory.it/
5
  Description: Make your website compliant with EU Cookie Policy.
6
- Version: 2.2
7
  Author: Manafactory
8
  Author URI: http://manafactory.it/
9
  License: GPLv2 or later
3
  Plugin Name: Ginger - EU Cookie Law
4
  Plugin URI: http://manafactory.it/
5
  Description: Make your website compliant with EU Cookie Policy.
6
+ Version: 2.3
7
  Author: Manafactory
8
  Author URI: http://manafactory.it/
9
  License: GPLv2 or later
readme.txt CHANGED
@@ -4,24 +4,24 @@ Donate link: http://www.ginger-cookielaw.com/
4
  Tags: EU Cookie Law, cookie law, block cookie, cookie consent, cookie law, cookie policy, privacy policy, cookie banner, italian cookie law, cookie italia
5
  Requires at least: 3.0.1
6
  Tested up to: 4.2.3
7
- Stable tag: 2.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Ginger allows to show a configurable banner and blocks the most common third party cookies complying with European Cookie Laws.
12
  == Description ==
13
 
14
- The aim of Ginger is to be a **complete plug'n play solution** that make your website compliant with EU Cookie law.
15
 
16
  = Features: =
17
  * really **plug'n play**: simply activate, and enjoy
18
  * complete **banner** configuration: style, position and colors
19
  * **Opt-in** mode enabler: block cookies BEFORE user acceptance (fit for **Italy** regulation)
20
  * Exclude Google Analytics cookie if not **anonymized**
21
- * Complatible with server **caching**
22
 
23
 
24
- = Actually Support: =
25
  * twitter
26
  * facebook
27
  * linkedin
@@ -35,22 +35,21 @@ The aim of Ginger is to be a **complete plug'n play solution** that make your we
35
  * ShareThis
36
 
37
  = Activable Addons: =
 
38
  * Adsense
39
  * Analytics
40
  * WPML
41
  * Polylang
42
- * Custom Javascript url & Custom Iframe url
43
 
44
  = Coming soon: =
45
  * **Privacy Policy** Generator
46
- * **Logger** addon
47
  * **Multisite** addon
48
 
49
  More information [here: ginger-cookielaw.com](http://www.ginger-cookielaw.com/)
50
 
51
  **Send us [suggestions or bug report](https://wordpress.org/support/plugin/ginger)!**
52
 
53
-
54
  == Installation ==
55
 
56
  1. Upload ginger to the `/wp-content/plugins/` directory
@@ -71,6 +70,14 @@ Sure, you can choose opt-in or opt-out mode to let it work as you wish.
71
 
72
  No, you can be safe from plugins conflict. It's been developed using Cookies Enabler Js Library developed by Nicholas Ruggeri: https://github.com/nicholasruggeri/cookies-enabler
73
 
 
 
 
 
 
 
 
 
74
 
75
  == Screenshots ==
76
 
@@ -78,10 +85,21 @@ No, you can be safe from plugins conflict. It's been developed using Cookies Ena
78
  2. Banner setup: dialog or banner, colors, posizions, etc
79
  3. Privacy Policy Setup Page
80
  4. Front-end example of light banner in footer, with iframe locked before approvation in opt-in mode
 
 
 
 
 
81
 
82
  == Changelog ==
83
 
84
 
 
 
 
 
 
 
85
  = 2.1 =
86
  * Custom js/iframe addon
87
  * new addon page layout
4
  Tags: EU Cookie Law, cookie law, block cookie, cookie consent, cookie law, cookie policy, privacy policy, cookie banner, italian cookie law, cookie italia
5
  Requires at least: 3.0.1
6
  Tested up to: 4.2.3
7
+ Stable tag: 2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Ginger allows to show a configurable banner and blocks third party cookies complying with European Cookie Laws.
12
  == Description ==
13
 
14
+ Ginger is a **complete plug'n play solution** that make your website compliant with EU Cookie law. Configure your banner and block cookies **before** or **after** users' choise.
15
 
16
  = Features: =
17
  * really **plug'n play**: simply activate, and enjoy
18
  * complete **banner** configuration: style, position and colors
19
  * **Opt-in** mode enabler: block cookies BEFORE user acceptance (fit for **Italy** regulation)
20
  * Exclude Google Analytics cookie if not **anonymized**
21
+ * Compatible with server **caching**
22
 
23
 
24
+ = Natively Supports: =
25
  * twitter
26
  * facebook
27
  * linkedin
35
  * ShareThis
36
 
37
  = Activable Addons: =
38
+ * Custom Javascript url & Custom Iframe url to extend native support
39
  * Adsense
40
  * Analytics
41
  * WPML
42
  * Polylang
43
+ * Cookie Users' Acceptance Logger
44
 
45
  = Coming soon: =
46
  * **Privacy Policy** Generator
 
47
  * **Multisite** addon
48
 
49
  More information [here: ginger-cookielaw.com](http://www.ginger-cookielaw.com/)
50
 
51
  **Send us [suggestions or bug report](https://wordpress.org/support/plugin/ginger)!**
52
 
 
53
  == Installation ==
54
 
55
  1. Upload ginger to the `/wp-content/plugins/` directory
70
 
71
  No, you can be safe from plugins conflict. It's been developed using Cookies Enabler Js Library developed by Nicholas Ruggeri: https://github.com/nicholasruggeri/cookies-enabler
72
 
73
+ = What about other cookies not supported natively? =
74
+
75
+ You can enable **Custom JS & Iframe url** to add any javascript/iframe you need to manage and block.
76
+
77
+ = Is compatible with multilanguage websites? =
78
+
79
+ Yes, actually you we have 2 addons for multilanguages: wpml and polylang. Ask to our support forum for custom requestes
80
+
81
 
82
  == Screenshots ==
83
 
85
  2. Banner setup: dialog or banner, colors, posizions, etc
86
  3. Privacy Policy Setup Page
87
  4. Front-end example of light banner in footer, with iframe locked before approvation in opt-in mode
88
+ 5. Available addons/extensions
89
+ 6. Logger addon example
90
+ 7. Custom Javascript Configurator Addon
91
+ 8. Custom Iframe Configurator Addon
92
+
93
 
94
  == Changelog ==
95
 
96
 
97
+ = 2.3 =
98
+ * Logger addon
99
+
100
+ = 2.2 =
101
+ * Polylang support
102
+
103
  = 2.1 =
104
  * Custom js/iframe addon
105
  * new addon page layout
uninstall.php CHANGED
@@ -23,4 +23,7 @@ delete_option('gingerpolylang');
23
  delete_option('ginger_polylang_options');
24
 
25
  delete_option('gingeranalytics');
26
- delete_option('gingeranalytics_option');
 
 
 
23
  delete_option('ginger_polylang_options');
24
 
25
  delete_option('gingeranalytics');
26
+ delete_option('gingeranalytics_option');
27
+
28
+ global $wpdb;
29
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}logger_ginger" );