Version Description
- Enhancement: Disable cookie bar on page builders.
- Tested ok with Wordpress version 5.8
Download this release
Release Info
Developer | webtoffee |
Plugin | Cookie Law / GDPR Info |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- admin/modules/cookie-scaner/classes/class-cookie-law-info-cookie-scanner-ajax.php +5 -5
- admin/modules/cookie-scaner/classes/class-cookie-law-info-cookie-scanner-export.php +0 -144
- admin/modules/cookie-scaner/cookie-scaner.php +118 -67
- admin/modules/cookies/cookies.php +3 -3
- cookie-law-info.php +2 -2
- includes/class-cookie-law-info-cookieyes.php +1 -1
- includes/class-cookie-law-info.php +1 -1
- public/class-cookie-law-info-public.php +24 -5
- public/css/cookie-law-info-gdpr.css +8 -0
- public/js/cookie-law-info-public.js +1 -41
- public/views/cookie-law-info_popup_content.php +3 -1
- readme.txt +12 -8
admin/modules/cookie-scaner/classes/class-cookie-law-info-cookie-scanner-ajax.php
CHANGED
@@ -12,7 +12,7 @@ class Cookie_Law_Info_Cookie_Scanner_Ajax extends Cookie_Law_Info_Cookie_Scaner
|
|
12 |
*/
|
13 |
public function __construct() {
|
14 |
add_action( 'wp_ajax_cli_cookie_scaner', array( $this, 'ajax_cookie_scaner' ) );
|
15 |
-
add_action( 'wt_cli_ckyes_abort_scan', array( $this, 'update_abort_status'));
|
16 |
}
|
17 |
/**
|
18 |
* Ajax callback which handles the ajax calls from scanner.
|
@@ -206,7 +206,7 @@ class Cookie_Law_Info_Cookie_Scanner_Ajax extends Cookie_Law_Info_Cookie_Scaner
|
|
206 |
$this->set_ckyes_scan_status( 1 );
|
207 |
$estimate = ( isset( $response['estimatedTimeInSeconds'] ) ? $response['estimatedTimeInSeconds'] : 0 );
|
208 |
|
209 |
-
$this->set_ckyes_scan_estimate( $estimate );
|
210 |
$data['title'] = __( 'Scanning initiated successfully', 'cookie-law-info' );
|
211 |
$data['message'] = __( 'It might take a few minutes to a few hours to complete the scanning of your website. This depends on the number of pages to scan and the website speed. Once the scanning is complete, we will notify you by email.', 'cookie-law-info' );
|
212 |
$data['html'] = $this->get_scan_progress_html();
|
@@ -359,13 +359,13 @@ class Cookie_Law_Info_Cookie_Scanner_Ajax extends Cookie_Law_Info_Cookie_Scaner
|
|
359 |
global $wpdb;
|
360 |
$urls = array();
|
361 |
$url_table = $wpdb->prefix . $this->url_table;
|
362 |
-
$sql = "SELECT id_cli_cookie_scan_url,url FROM
|
363 |
-
$urls_from_db = $wpdb->get_results( $sql, ARRAY_A );
|
364 |
|
365 |
if ( ! empty( $urls_from_db ) ) {
|
366 |
foreach ( $urls_from_db as $data ) {
|
367 |
if ( isset( $data['url'] ) ) {
|
368 |
-
$urls[] = $data['url'];
|
369 |
}
|
370 |
}
|
371 |
}
|
12 |
*/
|
13 |
public function __construct() {
|
14 |
add_action( 'wp_ajax_cli_cookie_scaner', array( $this, 'ajax_cookie_scaner' ) );
|
15 |
+
add_action( 'wt_cli_ckyes_abort_scan', array( $this, 'update_abort_status' ) );
|
16 |
}
|
17 |
/**
|
18 |
* Ajax callback which handles the ajax calls from scanner.
|
206 |
$this->set_ckyes_scan_status( 1 );
|
207 |
$estimate = ( isset( $response['estimatedTimeInSeconds'] ) ? $response['estimatedTimeInSeconds'] : 0 );
|
208 |
|
209 |
+
$this->set_ckyes_scan_estimate( $estimate );
|
210 |
$data['title'] = __( 'Scanning initiated successfully', 'cookie-law-info' );
|
211 |
$data['message'] = __( 'It might take a few minutes to a few hours to complete the scanning of your website. This depends on the number of pages to scan and the website speed. Once the scanning is complete, we will notify you by email.', 'cookie-law-info' );
|
212 |
$data['html'] = $this->get_scan_progress_html();
|
359 |
global $wpdb;
|
360 |
$urls = array();
|
361 |
$url_table = $wpdb->prefix . $this->url_table;
|
362 |
+
$sql = $wpdb->prepare( "SELECT id_cli_cookie_scan_url,url FROM $url_table WHERE id_cli_cookie_scan=%d ORDER BY id_cli_cookie_scan_url ASC", $scan_id );
|
363 |
+
$urls_from_db = $wpdb->get_results( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
364 |
|
365 |
if ( ! empty( $urls_from_db ) ) {
|
366 |
foreach ( $urls_from_db as $data ) {
|
367 |
if ( isset( $data['url'] ) ) {
|
368 |
+
$urls[] = sanitize_text_field( $data['url'] );
|
369 |
}
|
370 |
}
|
371 |
}
|
admin/modules/cookie-scaner/classes/class-cookie-law-info-cookie-scanner-export.php
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/** */
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
exit;
|
5 |
-
}
|
6 |
-
/**
|
7 |
-
* The class which handles cookie export functionalities
|
8 |
-
*/
|
9 |
-
class Cookie_Law_Info_Cookie_Export {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Start exporting cookies
|
13 |
-
*
|
14 |
-
* @param int $scan_id scan ID.
|
15 |
-
* @param Cookie_Law_Info_Cookie_Scaner $scanner_obj scan object.
|
16 |
-
* @return void
|
17 |
-
*/
|
18 |
-
public function do_export( $scan_id, $scanner_obj ) {
|
19 |
-
global $wpdb;
|
20 |
-
$wpdb->hide_errors();
|
21 |
-
@set_time_limit( 0 );
|
22 |
-
if ( function_exists( 'apache_setenv' ) ) {
|
23 |
-
@apache_setenv( 'no-gzip', 1 );
|
24 |
-
}
|
25 |
-
@ini_set( 'zlib.output_compression', 0 );
|
26 |
-
@ob_clean();
|
27 |
-
|
28 |
-
header( 'Content-Type: text/csv; charset=UTF-8' );
|
29 |
-
header( 'Content-Disposition: attachment; filename=cli-scanned-cookies.csv' );
|
30 |
-
header( 'Pragma: no-cache' );
|
31 |
-
header( 'Expires: 0' );
|
32 |
-
|
33 |
-
$fp = fopen( 'php://output', 'w' );
|
34 |
-
$row = array();
|
35 |
-
$cookielaw_fields = array(
|
36 |
-
'post_title',
|
37 |
-
'post_content',
|
38 |
-
'post_status',
|
39 |
-
'_cli_cookie_headscript_meta',
|
40 |
-
'_cli_cookie_bodyscript_meta',
|
41 |
-
'_cli_cookie_slugid',
|
42 |
-
'_cli_cookie_type',
|
43 |
-
'_cli_cookie_sensitivity',
|
44 |
-
'_cli_cookie_duration',
|
45 |
-
'tax:cookielawinfo-category',
|
46 |
-
'cli_cookie_category_description',
|
47 |
-
);
|
48 |
-
|
49 |
-
// Export header rows.
|
50 |
-
foreach ( $cookielaw_fields as $column ) {
|
51 |
-
$row[] = self::format_data( $column );
|
52 |
-
}
|
53 |
-
|
54 |
-
$row = array_map( 'self::wrap_column', $row );
|
55 |
-
fwrite( $fp, implode( ',', $row ) . "\n" );
|
56 |
-
unset( $row );
|
57 |
-
|
58 |
-
$cookies = $scanner_obj->get_scan_cookies( $scan_id, 0, -1 ); // take all cookies.
|
59 |
-
|
60 |
-
// Loop cookies.
|
61 |
-
if ( $cookies['total'] > 0 ) {
|
62 |
-
foreach ( $cookies['cookies'] as $cookie ) {
|
63 |
-
|
64 |
-
$row = array();
|
65 |
-
// Export header rows.
|
66 |
-
foreach ( $cookielaw_fields as $column ) {
|
67 |
-
switch ( $column ) {
|
68 |
-
case 'post_title':
|
69 |
-
$row[] = self::format_data( $cookie['cookie_id'] );
|
70 |
-
break;
|
71 |
-
|
72 |
-
case 'post_content':
|
73 |
-
$row[] = self::format_data( $cookie['description'] );
|
74 |
-
break;
|
75 |
-
|
76 |
-
case 'post_status':
|
77 |
-
$row[] = 'publish';
|
78 |
-
break;
|
79 |
-
|
80 |
-
case '_cli_cookie_headscript_meta':
|
81 |
-
$row[] = '';
|
82 |
-
break;
|
83 |
-
|
84 |
-
case '_cli_cookie_bodyscript_meta':
|
85 |
-
$row[] = '';
|
86 |
-
break;
|
87 |
-
|
88 |
-
case '_cli_cookie_slugid':
|
89 |
-
$row[] = self::format_data( $cookie['cookie_id'] );
|
90 |
-
break;
|
91 |
-
|
92 |
-
case '_cli_cookie_type':
|
93 |
-
$row[] = self::format_data( $cookie['type'] );
|
94 |
-
break;
|
95 |
-
|
96 |
-
case '_cli_cookie_sensitivity':
|
97 |
-
$row[] = self::format_data( 'non-necessary' );
|
98 |
-
break;
|
99 |
-
|
100 |
-
case '_cli_cookie_duration':
|
101 |
-
$row[] = self::format_data( $cookie['expiry'] );
|
102 |
-
break;
|
103 |
-
|
104 |
-
case 'tax:cookielawinfo-category':
|
105 |
-
$row[] = self::format_data( $cookie['category'] );
|
106 |
-
break;
|
107 |
-
case 'cli_cookie_category_description':
|
108 |
-
$row[] = self::format_data( $cookie['cli_cookie_category_description'] );
|
109 |
-
break;
|
110 |
-
default:
|
111 |
-
break;
|
112 |
-
}
|
113 |
-
}
|
114 |
-
// Add to csv.
|
115 |
-
$row = array_map( 'self::wrap_column', $row );
|
116 |
-
fwrite( $fp, implode( ',', $row ) . "\n" );
|
117 |
-
unset( $row );
|
118 |
-
}
|
119 |
-
}
|
120 |
-
fclose( $fp );
|
121 |
-
exit;
|
122 |
-
|
123 |
-
}
|
124 |
-
/**
|
125 |
-
* Format the data before exporting
|
126 |
-
*
|
127 |
-
* @param array $data array of cookies.
|
128 |
-
* @return array
|
129 |
-
*/
|
130 |
-
public static function format_data( $data ) {
|
131 |
-
$enc = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true );
|
132 |
-
$data = ( $enc == 'UTF-8' ) ? $data : utf8_encode( $data );
|
133 |
-
return $data;
|
134 |
-
}
|
135 |
-
/**
|
136 |
-
* Wrap a column in quotes for the CSV
|
137 |
-
*
|
138 |
-
* @param string $data data to wrap.
|
139 |
-
* @return string
|
140 |
-
*/
|
141 |
-
public static function wrap_column( $data ) {
|
142 |
-
return '"' . str_replace( '"', '""', $data ) . '"';
|
143 |
-
}
|
144 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/modules/cookie-scaner/cookie-scaner.php
CHANGED
@@ -65,10 +65,9 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
65 |
add_action( 'admin_menu', array( $this, 'add_admin_pages' ), 5 );
|
66 |
add_action( 'wt_cli_cookie_scanner_body', array( $this, 'scanner_notices' ) );
|
67 |
add_action( 'init', array( $this, 'init' ) );
|
68 |
-
add_action( 'admin_init', array( $this, 'export_result' ) );
|
69 |
add_filter( 'wt_cli_cookie_scan_status', array( $this, 'check_scan_status' ) );
|
70 |
register_activation_hook( CLI_PLUGIN_FILENAME, array( $this, 'activator' ) );
|
71 |
-
add_action('wt_cli_initialize_plugin', array( $this, 'activator' ) );
|
72 |
add_action(
|
73 |
'rest_api_init',
|
74 |
function () {
|
@@ -278,9 +277,10 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
278 |
|
279 |
);
|
280 |
foreach ( $scanner_tables as $table ) {
|
281 |
-
$table_name
|
282 |
-
$
|
283 |
-
|
|
|
284 |
return false;
|
285 |
}
|
286 |
}
|
@@ -362,7 +362,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
362 |
protected function update_scan_entry( $data_arr, $scan_id ) {
|
363 |
global $wpdb;
|
364 |
$scan_table = $wpdb->prefix . $this->scan_table;
|
365 |
-
if ( $wpdb->update( $scan_table, $data_arr, array( 'id_cli_cookie_scan' => $scan_id ) ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
366 |
return true;
|
367 |
} else {
|
368 |
return false;
|
@@ -379,8 +379,8 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
379 |
global $wpdb;
|
380 |
$url_table = $wpdb->prefix . $this->url_table;
|
381 |
$data_arr = array(
|
382 |
-
'id_cli_cookie_scan' => $scan_id,
|
383 |
-
'url' => $permalink,
|
384 |
'scanned' => 0,
|
385 |
'total_cookies' => 0,
|
386 |
);
|
@@ -406,10 +406,21 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
406 |
$scan_table = $wpdb->prefix . $this->scan_table;
|
407 |
$data = array();
|
408 |
if ( true === $this->table_exists( $scan_table ) ) {
|
409 |
-
$sql
|
410 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
}
|
412 |
-
return
|
|
|
413 |
}
|
414 |
/**
|
415 |
* Return the current scan status progress, failed , or success.
|
@@ -467,13 +478,13 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
467 |
|
468 |
$last_scan = $this->get_last_scan();
|
469 |
|
470 |
-
$scan_notice
|
471 |
$show_results = false;
|
472 |
|
473 |
if ( $last_scan ) {
|
474 |
$scan_status = intval( ( isset( $last_scan['status'] ) ? $last_scan['status'] : 0 ) );
|
475 |
if ( 2 === $scan_status ) {
|
476 |
-
$scan_notice
|
477 |
$show_results = true;
|
478 |
} elseif ( 3 === $scan_status ) {
|
479 |
$scan_notice = $this->get_scan_abort_html( $last_scan );
|
@@ -486,7 +497,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
486 |
$notice .= $scan_notice;
|
487 |
$notice .= '</div>';
|
488 |
$notice .= '<div class="wt-cli-cookie-scanner-actions">' . $this->get_scan_btn() . '</div>';
|
489 |
-
if( true === $show_results ) {
|
490 |
$notice .= $this->get_scan_result_table();
|
491 |
}
|
492 |
return $notice;
|
@@ -710,7 +721,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
710 |
} else {
|
711 |
$ip_address = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
|
712 |
}
|
713 |
-
$ip_address = apply_filters('wt_cli_change_ip_address', $ip_address );
|
714 |
if ( in_array( $ip_address, $localhost_arr, true ) ) {
|
715 |
return true;
|
716 |
}
|
@@ -778,9 +789,29 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
778 |
*/
|
779 |
public function get_scan_history( $id ) {
|
780 |
global $wpdb;
|
781 |
-
$scan_table
|
782 |
-
$
|
783 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
784 |
}
|
785 |
/**
|
786 |
* Retuns scan results by ID
|
@@ -852,17 +883,17 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
852 |
);
|
853 |
|
854 |
$url_table = $wpdb->prefix . $this->url_table;
|
855 |
-
$count_sql = "SELECT COUNT(id_cli_cookie_scan_url) AS ttnum FROM $url_table WHERE id_cli_cookie_scan='$scan_id'";
|
856 |
|
|
|
857 |
$count_arr = $wpdb->get_row( $count_sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
858 |
|
859 |
if ( $count_arr ) {
|
860 |
$out['total'] = $count_arr['ttnum'];
|
861 |
}
|
862 |
-
|
863 |
-
$sql = "SELECT * FROM $url_table WHERE id_cli_cookie_scan='$scan_id' ORDER BY id_cli_cookie_scan_url ASC LIMIT $offset,$limit";
|
864 |
|
865 |
$data_arr = $wpdb->get_results( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
|
|
866 |
if ( $data_arr ) {
|
867 |
$out['urls'] = $data_arr;
|
868 |
}
|
@@ -878,25 +909,52 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
878 |
*/
|
879 |
public function get_scan_cookies( $scan_id, $offset = 0, $limit = 100 ) {
|
880 |
global $wpdb;
|
881 |
-
$out
|
882 |
'total' => 0,
|
883 |
'cookies' => array(),
|
884 |
);
|
885 |
-
|
|
|
886 |
$cookies_table = $wpdb->prefix . $this->cookies_table;
|
887 |
$url_table = $wpdb->prefix . $this->url_table;
|
888 |
$category_table = $wpdb->prefix . $this->category_table;
|
889 |
|
890 |
-
$count_sql = "SELECT COUNT(id_cli_cookie_scan_cookies) AS ttnum FROM $cookies_table WHERE id_cli_cookie_scan=
|
891 |
$count_arr = $wpdb->get_row( $count_sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
892 |
|
893 |
if ( $count_arr ) {
|
894 |
$out['total'] = $count_arr['ttnum'];
|
895 |
}
|
896 |
-
|
897 |
-
$
|
898 |
-
|
899 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
900 |
if ( $cookies ) {
|
901 |
$out['cookies'] = $cookies;
|
902 |
}
|
@@ -968,7 +1026,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
968 |
$scan_table = $wpdb->prefix . $this->scan_table;
|
969 |
$data_arr = array(
|
970 |
'created_at' => time(),
|
971 |
-
'total_url' => $total_url,
|
972 |
'total_cookies' => 0,
|
973 |
'current_action' => 'get_pages',
|
974 |
'status' => 1,
|
@@ -1017,7 +1075,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1017 |
* Save cookie data to cookies table
|
1018 |
*
|
1019 |
* @param array $cookie_data Array of data.
|
1020 |
-
* @return void
|
1021 |
*/
|
1022 |
public function save_cookie_data( $cookie_data ) {
|
1023 |
|
@@ -1029,10 +1087,11 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1029 |
if ( $cookie_data ) {
|
1030 |
if ( $scan_id !== false ) {
|
1031 |
|
1032 |
-
$sql = "SELECT id_cli_cookie_scan_url,url FROM
|
1033 |
$urls = $wpdb->get_results( $sql, ARRAY_A );
|
1034 |
foreach ( $urls as $url_data ) {
|
1035 |
-
$
|
|
|
1036 |
}
|
1037 |
$scan_data = ( isset( $cookie_data['scan_result'] ) ? json_decode( $cookie_data['scan_result'], true ) : array() );
|
1038 |
$scan_result_token = ( isset( $cookie_data['scan_result_token'] ) ? $cookie_data['scan_result_token'] : array() );
|
@@ -1042,9 +1101,12 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1042 |
}
|
1043 |
$this->insert_categories( $scan_data );
|
1044 |
foreach ( $scan_data as $key => $data ) {
|
1045 |
-
$cookies = ( isset( $data['cookies'] )
|
1046 |
$category = ( isset( $data['category'] ) ? $data['category'] : '' );
|
1047 |
-
|
|
|
|
|
|
|
1048 |
}
|
1049 |
}
|
1050 |
}
|
@@ -1058,7 +1120,7 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1058 |
*/
|
1059 |
public function validate_scan_instance( $instance ) {
|
1060 |
$last_instance = $this->get_ckyes_scan_instance();
|
1061 |
-
if ( $instance === $last_instance ) {
|
1062 |
return true;
|
1063 |
}
|
1064 |
return false;
|
@@ -1092,8 +1154,8 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1092 |
$cat_sql = "INSERT IGNORE INTO `$cat_table` (`cli_cookie_category_name`,`cli_cookie_category_description`) VALUES ";
|
1093 |
|
1094 |
foreach ( $categories as $id => $category_data ) {
|
1095 |
-
$category = ( isset( $category_data['category'] ) ? sanitize_text_field( $category_data['category'] ) : '' );
|
1096 |
-
$description = ( isset( $category_data['category_desc'] ) ? addslashes( sanitize_textarea_field( $category_data['category_desc'] ) ) : '' );
|
1097 |
|
1098 |
if ( ! empty( $category ) ) {
|
1099 |
$cat_arr[] = "('$category','$description')";
|
@@ -1123,18 +1185,22 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1123 |
$sql_arr = array();
|
1124 |
|
1125 |
foreach ( $cookie_data as $cookies ) {
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
|
|
|
|
|
|
1135 |
}
|
|
|
1136 |
$sql = $sql . implode( ',', $sql_arr );
|
1137 |
-
$wpdb->query( $sql );
|
1138 |
}
|
1139 |
/**
|
1140 |
* List the cookie scan features
|
@@ -1162,28 +1228,13 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1162 |
$html .= '</div>';
|
1163 |
return '<div class="wt-cli-cookie-scan-features-section">' . Cookie_Law_Info_Admin::wt_cli_admin_notice( 'success', $html ) . '</div>';
|
1164 |
}
|
1165 |
-
/**
|
1166 |
-
* Export handler
|
1167 |
-
*
|
1168 |
-
* @return void
|
1169 |
-
*/
|
1170 |
-
public function export_result() {
|
1171 |
-
if ( isset( $_GET['cli_scan_export'] ) && (int) $_GET['cli_scan_export'] > 0 && check_admin_referer( 'cli_cookie_scaner', 'cli_cookie_scaner' ) && current_user_can( 'manage_options' ) ) {
|
1172 |
-
include plugin_dir_path( __FILE__ ) . 'classes/class-cookie-law-info-cookie-scanner-export.php';
|
1173 |
-
|
1174 |
-
$cookie_serve_export = new Cookie_Law_Info_Cookie_Export();
|
1175 |
-
$cookie_serve_export->do_export( wp_unslash( $_GET['cli_scan_export'] ), $this ); // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
1176 |
-
|
1177 |
-
exit();
|
1178 |
-
}
|
1179 |
-
}
|
1180 |
public function get_scan_result_table() {
|
1181 |
|
1182 |
ob_start();
|
1183 |
-
$scan_results
|
1184 |
$cookie_list_page = admin_url( 'edit.php?post_type=' . CLI_POST_TYPE );
|
1185 |
-
$scan_status
|
1186 |
-
$scan_page_url
|
1187 |
|
1188 |
if ( 2 === $scan_status ) {
|
1189 |
include plugin_dir_path( __FILE__ ) . 'views/scan-results.php';
|
@@ -1215,8 +1266,8 @@ class Cookie_Law_Info_Cookie_Scaner extends Cookie_Law_Info_Cookieyes {
|
|
1215 |
if ( true === $strict ) {
|
1216 |
$show_btn = false;
|
1217 |
}
|
1218 |
-
}
|
1219 |
-
$show_btn
|
1220 |
}
|
1221 |
|
1222 |
return ( true === $show_btn ? '<a id="' . $scan_btn_id . '" class="button-primary pull-right">' . $scan_btn_text . '</a>' : '' );
|
65 |
add_action( 'admin_menu', array( $this, 'add_admin_pages' ), 5 );
|
66 |
add_action( 'wt_cli_cookie_scanner_body', array( $this, 'scanner_notices' ) );
|
67 |
add_action( 'init', array( $this, 'init' ) );
|
|
|
68 |
add_filter( 'wt_cli_cookie_scan_status', array( $this, 'check_scan_status' ) );
|
69 |
register_activation_hook( CLI_PLUGIN_FILENAME, array( $this, 'activator' ) );
|
70 |
+
add_action( 'wt_cli_initialize_plugin', array( $this, 'activator' ) );
|
71 |
add_action(
|
72 |
'rest_api_init',
|
73 |
function () {
|
277 |
|
278 |
);
|
279 |
foreach ( $scanner_tables as $table ) {
|
280 |
+
$table_name = $wpdb->prefix . $table;
|
281 |
+
$sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) );
|
282 |
+
|
283 |
+
if ( ! $wpdb->get_results( $sql, ARRAY_N ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
284 |
return false;
|
285 |
}
|
286 |
}
|
362 |
protected function update_scan_entry( $data_arr, $scan_id ) {
|
363 |
global $wpdb;
|
364 |
$scan_table = $wpdb->prefix . $this->scan_table;
|
365 |
+
if ( $wpdb->update( $scan_table, $data_arr, array( 'id_cli_cookie_scan' => esc_sql( $scan_id ) ) ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
366 |
return true;
|
367 |
} else {
|
368 |
return false;
|
379 |
global $wpdb;
|
380 |
$url_table = $wpdb->prefix . $this->url_table;
|
381 |
$data_arr = array(
|
382 |
+
'id_cli_cookie_scan' => esc_sql( $scan_id ),
|
383 |
+
'url' => esc_sql( $permalink ),
|
384 |
'scanned' => 0,
|
385 |
'total_cookies' => 0,
|
386 |
);
|
406 |
$scan_table = $wpdb->prefix . $this->scan_table;
|
407 |
$data = array();
|
408 |
if ( true === $this->table_exists( $scan_table ) ) {
|
409 |
+
$sql = "SELECT * FROM `$scan_table` ORDER BY id_cli_cookie_scan DESC LIMIT 1";
|
410 |
+
$raw_data = $wpdb->get_row( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
411 |
+
if ( $raw_data ) {
|
412 |
+
$data['id_cli_cookie_scan'] = isset( $raw_data['id_cli_cookie_scan'] ) ? absint( $raw_data['id_cli_cookie_scan'] ) : 0;
|
413 |
+
$data['status'] = isset( $raw_data['status'] ) ? absint( $raw_data['status'] ) : 1;
|
414 |
+
$data['created_at'] = isset( $raw_data['created_at'] ) ? sanitize_text_field( $raw_data['created_at'] ) : '';
|
415 |
+
$data['total_url'] = isset( $raw_data['total_url'] ) ? absint( $raw_data['total_url'] ) : 0;
|
416 |
+
$data['total_cookies'] = isset( $raw_data['total_cookies'] ) ? absint( $raw_data['total_cookies'] ) : 0;
|
417 |
+
$data['current_action'] = isset( $raw_data['current_action'] ) ? sanitize_text_field( $raw_data['current_action'] ) : '';
|
418 |
+
$data['current_offset'] = isset( $raw_data['current_offset'] ) ? (int) $raw_data['current_offset'] : -1;
|
419 |
+
return $data;
|
420 |
+
}
|
421 |
}
|
422 |
+
return false;
|
423 |
+
|
424 |
}
|
425 |
/**
|
426 |
* Return the current scan status progress, failed , or success.
|
478 |
|
479 |
$last_scan = $this->get_last_scan();
|
480 |
|
481 |
+
$scan_notice = $this->get_scan_default_html();
|
482 |
$show_results = false;
|
483 |
|
484 |
if ( $last_scan ) {
|
485 |
$scan_status = intval( ( isset( $last_scan['status'] ) ? $last_scan['status'] : 0 ) );
|
486 |
if ( 2 === $scan_status ) {
|
487 |
+
$scan_notice = $this->get_scan_success_html( $last_scan );
|
488 |
$show_results = true;
|
489 |
} elseif ( 3 === $scan_status ) {
|
490 |
$scan_notice = $this->get_scan_abort_html( $last_scan );
|
497 |
$notice .= $scan_notice;
|
498 |
$notice .= '</div>';
|
499 |
$notice .= '<div class="wt-cli-cookie-scanner-actions">' . $this->get_scan_btn() . '</div>';
|
500 |
+
if ( true === $show_results ) {
|
501 |
$notice .= $this->get_scan_result_table();
|
502 |
}
|
503 |
return $notice;
|
721 |
} else {
|
722 |
$ip_address = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
|
723 |
}
|
724 |
+
$ip_address = apply_filters( 'wt_cli_change_ip_address', $ip_address );
|
725 |
if ( in_array( $ip_address, $localhost_arr, true ) ) {
|
726 |
return true;
|
727 |
}
|
789 |
*/
|
790 |
public function get_scan_history( $id ) {
|
791 |
global $wpdb;
|
792 |
+
$scan_table = $wpdb->prefix . $this->scan_table;
|
793 |
+
$data = array();
|
794 |
+
$sql = $wpdb->prepare(
|
795 |
+
"SELECT * FROM {$scan_table} WHERE `id_cli_cookie_scan` = %d",
|
796 |
+
$id
|
797 |
+
);
|
798 |
+
$raw_data = $wpdb->get_row( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
799 |
+
|
800 |
+
if ( $raw_data ) {
|
801 |
+
|
802 |
+
$data['id_cli_cookie_scan'] = isset( $raw_data['id_cli_cookie_scan'] ) ? absint( $raw_data['id_cli_cookie_scan'] ) : 0;
|
803 |
+
$data['status'] = isset( $raw_data['status'] ) ? absint( $raw_data['status'] ) : 1;
|
804 |
+
$data['created_at'] = isset( $raw_data['created_at'] ) ? sanitize_text_field( $raw_data['created_at'] ) : '';
|
805 |
+
$data['total_url'] = isset( $raw_data['total_url'] ) ? absint( $raw_data['total_url'] ) : 0;
|
806 |
+
$data['total_cookies'] = isset( $raw_data['total_cookies'] ) ? absint( $raw_data['total_cookies'] ) : 0;
|
807 |
+
$data['current_action'] = isset( $raw_data['current_action'] ) ? sanitize_text_field( $raw_data['current_action'] ) : '';
|
808 |
+
$data['current_offset'] = isset( $raw_data['current_offset'] ) ? (int) $raw_data['current_offset'] : -1;
|
809 |
+
|
810 |
+
return $data;
|
811 |
+
}
|
812 |
+
return false;
|
813 |
+
|
814 |
+
|
815 |
}
|
816 |
/**
|
817 |
* Retuns scan results by ID
|
883 |
);
|
884 |
|
885 |
$url_table = $wpdb->prefix . $this->url_table;
|
|
|
886 |
|
887 |
+
$count_sql = $wpdb->prepare( "SELECT COUNT( id_cli_cookie_scan_url ) AS ttnum FROM $url_table WHERE id_cli_cookie_scan = %d", $scan_id );
|
888 |
$count_arr = $wpdb->get_row( $count_sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
889 |
|
890 |
if ( $count_arr ) {
|
891 |
$out['total'] = $count_arr['ttnum'];
|
892 |
}
|
893 |
+
$sql = $wpdb->prepare( "SELECT * FROM $url_table WHERE id_cli_cookie_scan = %d ORDER BY id_cli_cookie_scan_url ASC LIMIT %d,%d", $scan_id, $offset, $limit );
|
|
|
894 |
|
895 |
$data_arr = $wpdb->get_results( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
896 |
+
|
897 |
if ( $data_arr ) {
|
898 |
$out['urls'] = $data_arr;
|
899 |
}
|
909 |
*/
|
910 |
public function get_scan_cookies( $scan_id, $offset = 0, $limit = 100 ) {
|
911 |
global $wpdb;
|
912 |
+
$out = array(
|
913 |
'total' => 0,
|
914 |
'cookies' => array(),
|
915 |
);
|
916 |
+
$limits = '';
|
917 |
+
$cookies = array();
|
918 |
$cookies_table = $wpdb->prefix . $this->cookies_table;
|
919 |
$url_table = $wpdb->prefix . $this->url_table;
|
920 |
$category_table = $wpdb->prefix . $this->category_table;
|
921 |
|
922 |
+
$count_sql = $wpdb->prepare( "SELECT COUNT( id_cli_cookie_scan_cookies ) AS ttnum FROM $cookies_table WHERE id_cli_cookie_scan = %d", $scan_id );
|
923 |
$count_arr = $wpdb->get_row( $count_sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
924 |
|
925 |
if ( $count_arr ) {
|
926 |
$out['total'] = $count_arr['ttnum'];
|
927 |
}
|
928 |
+
$offset = (int) $offset;
|
929 |
+
$limit = (int) $limit;
|
930 |
+
|
931 |
+
$limits = $limit > 0 ? 'LIMIT ' . $offset . ',' . $limit : '';
|
932 |
+
|
933 |
+
$sql = $wpdb->prepare( "SELECT * FROM $cookies_table AS cookie INNER JOIN $category_table as category ON category.id_cli_cookie_category = cookie.category_id INNER JOIN $url_table as urls ON cookie.id_cli_cookie_scan_url = urls.id_cli_cookie_scan_url WHERE cookie.id_cli_cookie_scan = %s ORDER BY id_cli_cookie_scan_cookies ASC $limits", $scan_id );
|
934 |
+
|
935 |
+
$db_data = $wpdb->get_results( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
936 |
+
|
937 |
+
if ( is_array( $db_data ) && ! empty( $db_data ) ) {
|
938 |
+
foreach ( (array) $db_data as $raw_data ) {
|
939 |
+
$data = array();
|
940 |
+
$data['id_cli_cookie_scan_cookies'] = isset( $raw_data['id_cli_cookie_scan_cookies'] ) ? absint( $raw_data['id_cli_cookie_scan_cookies'] ) : 1;
|
941 |
+
$data['id_cli_cookie_scan'] = isset( $raw_data['id_cli_cookie_scan'] ) ? absint( $raw_data['id_cli_cookie_scan'] ) : 1;
|
942 |
+
$data['id_cli_cookie_scan_url'] = isset( $raw_data['id_cli_cookie_scan_url'] ) ? absint( $raw_data['id_cli_cookie_scan_url'] ) : 1;
|
943 |
+
$data['cookie_id'] = isset( $raw_data['cookie_id'] ) ? sanitize_text_field( $raw_data['cookie_id'] ) : '';
|
944 |
+
$data['expiry'] = isset( $raw_data['expiry'] ) ? sanitize_text_field( $raw_data['expiry'] ) : '';
|
945 |
+
$data['type'] = isset( $raw_data['type'] ) ? sanitize_text_field( $raw_data['type'] ) : 1;
|
946 |
+
$data['category'] = isset( $raw_data['category'] ) ? sanitize_text_field( $raw_data['category'] ) : '';
|
947 |
+
$data['category_id'] = isset( $raw_data['category_id'] ) ? absint( $raw_data['category_id'] ) : '';
|
948 |
+
$data['description'] = isset( $raw_data['description'] ) ? sanitize_textarea_field( $raw_data['description'] ) : '';
|
949 |
+
$data['id_cli_cookie_category'] = isset( $raw_data['id_cli_cookie_category'] ) ? absint( $raw_data['id_cli_cookie_category'] ) : '';
|
950 |
+
$data['cli_cookie_category_name'] = isset( $raw_data['cli_cookie_category_name'] ) ? sanitize_text_field( $raw_data['cli_cookie_category_name'] ) : '';
|
951 |
+
$data['cli_cookie_category_description'] = isset( $raw_data['cli_cookie_category_description'] ) ? sanitize_textarea_field( $raw_data['cli_cookie_category_description'] ) : '';
|
952 |
+
$data['url'] = isset( $raw_data['url'] ) ? esc_url( sanitize_text_field( $raw_data['url'] ) ) : '';
|
953 |
+
$data['scanned'] = isset( $raw_data['scanned'] ) ? absint( $raw_data['scanned'] ) : 0;
|
954 |
+
$data['total_cookies'] = isset( $raw_data['total_cookies'] ) ? absint( $raw_data['total_cookies'] ) : 0;
|
955 |
+
$cookies[] = $data;
|
956 |
+
}
|
957 |
+
}
|
958 |
if ( $cookies ) {
|
959 |
$out['cookies'] = $cookies;
|
960 |
}
|
1026 |
$scan_table = $wpdb->prefix . $this->scan_table;
|
1027 |
$data_arr = array(
|
1028 |
'created_at' => time(),
|
1029 |
+
'total_url' => absint( $total_url ),
|
1030 |
'total_cookies' => 0,
|
1031 |
'current_action' => 'get_pages',
|
1032 |
'status' => 1,
|
1075 |
* Save cookie data to cookies table
|
1076 |
*
|
1077 |
* @param array $cookie_data Array of data.
|
1078 |
+
* @return WP_Error|void
|
1079 |
*/
|
1080 |
public function save_cookie_data( $cookie_data ) {
|
1081 |
|
1087 |
if ( $cookie_data ) {
|
1088 |
if ( $scan_id !== false ) {
|
1089 |
|
1090 |
+
$sql = $wpdb->prepare( "SELECT id_cli_cookie_scan_url,url FROM $url_table WHERE id_cli_cookie_scan = %s ORDER BY id_cli_cookie_scan_url ASC", $scan_id );
|
1091 |
$urls = $wpdb->get_results( $sql, ARRAY_A );
|
1092 |
foreach ( $urls as $url_data ) {
|
1093 |
+
$url = isset( $url_data['url'] ) ? sanitize_text_field( $url_data['url'] ) : '';
|
1094 |
+
$scan_urls[ $url ] = isset( $url_data['id_cli_cookie_scan_url'] ) ? absint( $url_data['id_cli_cookie_scan_url'] ) : 1;
|
1095 |
}
|
1096 |
$scan_data = ( isset( $cookie_data['scan_result'] ) ? json_decode( $cookie_data['scan_result'], true ) : array() );
|
1097 |
$scan_result_token = ( isset( $cookie_data['scan_result_token'] ) ? $cookie_data['scan_result_token'] : array() );
|
1101 |
}
|
1102 |
$this->insert_categories( $scan_data );
|
1103 |
foreach ( $scan_data as $key => $data ) {
|
1104 |
+
$cookies = ( isset( $data['cookies'] ) && is_array( $data['cookies'] ) ) ? $data['cookies'] : array();
|
1105 |
$category = ( isset( $data['category'] ) ? $data['category'] : '' );
|
1106 |
+
|
1107 |
+
if ( ! empty( $cookies ) ) {
|
1108 |
+
$this->insert_cookies( $scan_id, $scan_urls, $cookies, $category );
|
1109 |
+
}
|
1110 |
}
|
1111 |
}
|
1112 |
}
|
1120 |
*/
|
1121 |
public function validate_scan_instance( $instance ) {
|
1122 |
$last_instance = $this->get_ckyes_scan_instance();
|
1123 |
+
if ( ( 0 !== $instance ) && ( $instance === $last_instance ) ) {
|
1124 |
return true;
|
1125 |
}
|
1126 |
return false;
|
1154 |
$cat_sql = "INSERT IGNORE INTO `$cat_table` (`cli_cookie_category_name`,`cli_cookie_category_description`) VALUES ";
|
1155 |
|
1156 |
foreach ( $categories as $id => $category_data ) {
|
1157 |
+
$category = ( isset( $category_data['category'] ) ? esc_sql( sanitize_text_field( $category_data['category'] ) ) : '' );
|
1158 |
+
$description = ( isset( $category_data['category_desc'] ) ? esc_sql( addslashes( sanitize_textarea_field( $category_data['category_desc'] ) ) ) : '' );
|
1159 |
|
1160 |
if ( ! empty( $category ) ) {
|
1161 |
$cat_arr[] = "('$category','$description')";
|
1185 |
$sql_arr = array();
|
1186 |
|
1187 |
foreach ( $cookie_data as $cookies ) {
|
1188 |
+
if ( is_array( $cookies ) && ! empty( $cookies ) ) {
|
1189 |
+
$cookie_id = isset( $cookies['cookie_id'] ) ? esc_sql( sanitize_text_field( $cookies['cookie_id'] ) ) : '';
|
1190 |
+
$description = isset( $cookies['description'] ) ? esc_sql( sanitize_textarea_field( $cookies['description'] ) ) : '';
|
1191 |
+
$expiry = isset( $cookies['duration'] ) ? esc_sql( sanitize_text_field( $cookies['duration'] ) ) : '';
|
1192 |
+
$type = isset( $cookies['type'] ) ? esc_sql( sanitize_text_field( $cookies['type'] ) ) : '';
|
1193 |
+
$category = esc_sql( sanitize_text_field( $category ) );
|
1194 |
+
$url_id = ( isset( $cookies['frist_found_url'] ) ? esc_sql( sanitize_text_field( $cookies['frist_found_url'] ) ) : '' );
|
1195 |
+
$url_id = ( isset( $urls[ $url_id ] ) ? esc_sql( $urls[ $url_id ] ) : 1 );
|
1196 |
+
$category_id = $wpdb->get_var( $wpdb->prepare( "SELECT `id_cli_cookie_category` FROM `$category_table` WHERE `cli_cookie_category_name` = %s;", array( $category ) ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
1197 |
+
$category_id = esc_sql( absint( $category_id ) );
|
1198 |
+
$sql_arr[] = "('$scan_id','$url_id','$cookie_id','$expiry','$type','$category','$category_id','$description')";
|
1199 |
+
}
|
1200 |
}
|
1201 |
+
|
1202 |
$sql = $sql . implode( ',', $sql_arr );
|
1203 |
+
$wpdb->query( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery,WordPress.DB.PreparedSQL.NotPrepared
|
1204 |
}
|
1205 |
/**
|
1206 |
* List the cookie scan features
|
1228 |
$html .= '</div>';
|
1229 |
return '<div class="wt-cli-cookie-scan-features-section">' . Cookie_Law_Info_Admin::wt_cli_admin_notice( 'success', $html ) . '</div>';
|
1230 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1231 |
public function get_scan_result_table() {
|
1232 |
|
1233 |
ob_start();
|
1234 |
+
$scan_results = $this->get_last_scan_result();
|
1235 |
$cookie_list_page = admin_url( 'edit.php?post_type=' . CLI_POST_TYPE );
|
1236 |
+
$scan_status = intval( ( isset( $scan_results['status'] ) ? $scan_results['status'] : 0 ) );
|
1237 |
+
$scan_page_url = admin_url( 'edit.php?post_type=' . CLI_POST_TYPE . '&page=cookie-law-info-cookie-scaner' );
|
1238 |
|
1239 |
if ( 2 === $scan_status ) {
|
1240 |
include plugin_dir_path( __FILE__ ) . 'views/scan-results.php';
|
1266 |
if ( true === $strict ) {
|
1267 |
$show_btn = false;
|
1268 |
}
|
1269 |
+
} elseif ( $this->get_cookieyes_status() === 2 ) {
|
1270 |
+
$show_btn = true;
|
1271 |
}
|
1272 |
|
1273 |
return ( true === $show_btn ? '<a id="' . $scan_btn_id . '" class="button-primary pull-right">' . $scan_btn_text . '</a>' : '' );
|
admin/modules/cookies/cookies.php
CHANGED
@@ -846,9 +846,9 @@ class Cookie_Law_Info_Cookies {
|
|
846 |
<p style="font-weight:500;font-size:1.05em;"><?php _e( 'Clicking “Migrate cookie categories” will auto migrate your existing cookie categories (Necessary and Non-necessary) to our new Cookie Category taxonomy. This action is required to enable the cookie scanner.', 'cookie-law-info' ); ?></p>
|
847 |
<h3 style="font-size:1.05em;"><?php echo __( 'What happens after migration?', 'cookie-law-info' ); ?></h3>
|
848 |
<ul>
|
849 |
-
<li><?php echo __( 'You no longer need to manage static cookie categories. After the migration, new cookie categories (Necessary, Functional, Analytics, Performance, Advertisement, and Others) will be created automatically. Also, you can easily add custom cookie categories and edit/delete the existing categories including the custom categories.', '
|
850 |
-
<li><?php echo __( 'If you have made any changes to the existing "Non-necessary" category we will migrate it to the newly created “Cookie Category” section. If not, we will delete the "Non-necessary" category automatically.', '
|
851 |
-
<li><?php echo __( 'During the migration phase your existing cookie category translations will be lost. Hence we request you to add it manually soon after the migration. You can access the existing translations by navigating to the string translation settings of your translator plugin.', '
|
852 |
</ul>
|
853 |
</div>
|
854 |
<div class="wt-cli-notice-actions">
|
846 |
<p style="font-weight:500;font-size:1.05em;"><?php _e( 'Clicking “Migrate cookie categories” will auto migrate your existing cookie categories (Necessary and Non-necessary) to our new Cookie Category taxonomy. This action is required to enable the cookie scanner.', 'cookie-law-info' ); ?></p>
|
847 |
<h3 style="font-size:1.05em;"><?php echo __( 'What happens after migration?', 'cookie-law-info' ); ?></h3>
|
848 |
<ul>
|
849 |
+
<li><?php echo __( 'You no longer need to manage static cookie categories. After the migration, new cookie categories (Necessary, Functional, Analytics, Performance, Advertisement, and Others) will be created automatically. Also, you can easily add custom cookie categories and edit/delete the existing categories including the custom categories.', 'cookie-law-info' ); ?></li>
|
850 |
+
<li><?php echo __( 'If you have made any changes to the existing "Non-necessary" category we will migrate it to the newly created “Cookie Category” section. If not, we will delete the "Non-necessary" category automatically.', 'cookie-law-info' ); ?></li>
|
851 |
+
<li><?php echo __( 'During the migration phase your existing cookie category translations will be lost. Hence we request you to add it manually soon after the migration. You can access the existing translations by navigating to the string translation settings of your translator plugin.', 'cookie-law-info' ); ?></li>
|
852 |
</ul>
|
853 |
</div>
|
854 |
<div class="wt-cli-notice-actions">
|
cookie-law-info.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: GDPR Cookie Consent
|
17 |
* Plugin URI: https://www.webtoffee.com/product/gdpr-cookie-consent/
|
18 |
* Description: A simple way to show your website complies with the EU Cookie Law / GDPR.
|
19 |
-
* Version: 2.0.
|
20 |
* Author: WebToffee
|
21 |
* Author URI: https://www.webtoffee.com/
|
22 |
* License: GPLv3
|
@@ -69,7 +69,7 @@ define ( 'CLI_ACTIVATION_ID','wtgdprcookieconsent');
|
|
69 |
* Currently plugin version.
|
70 |
* Rename this for your plugin and update it as you release new versions.
|
71 |
*/
|
72 |
-
define( 'CLI_VERSION', '2.0.
|
73 |
|
74 |
function wt_cookie_law_info_update_message( $data, $response )
|
75 |
{
|
16 |
* Plugin Name: GDPR Cookie Consent
|
17 |
* Plugin URI: https://www.webtoffee.com/product/gdpr-cookie-consent/
|
18 |
* Description: A simple way to show your website complies with the EU Cookie Law / GDPR.
|
19 |
+
* Version: 2.0.5
|
20 |
* Author: WebToffee
|
21 |
* Author URI: https://www.webtoffee.com/
|
22 |
* License: GPLv3
|
69 |
* Currently plugin version.
|
70 |
* Rename this for your plugin and update it as you release new versions.
|
71 |
*/
|
72 |
+
define( 'CLI_VERSION', '2.0.5' );
|
73 |
|
74 |
function wt_cookie_law_info_update_message( $data, $response )
|
75 |
{
|
includes/class-cookie-law-info-cookieyes.php
CHANGED
@@ -453,7 +453,7 @@ if ( ! class_exists( 'Cookie_Law_Info_Cookieyes' ) ) {
|
|
453 |
);
|
454 |
|
455 |
$this->ckyes_status = $cky_license['status'] = ( isset( $options['status'] ) ? intval( $options['status'] ) : 0 );
|
456 |
-
$this->token = $cky_license['token'] = isset( $options['token'] ) ? $options['token'] : '';
|
457 |
|
458 |
update_option( 'wt_cli_cookieyes_options', $cky_license );
|
459 |
}
|
453 |
);
|
454 |
|
455 |
$this->ckyes_status = $cky_license['status'] = ( isset( $options['status'] ) ? intval( $options['status'] ) : 0 );
|
456 |
+
$this->token = $cky_license['token'] = isset( $options['token'] ) ? sanitize_text_field( $options['token'] ) : '';
|
457 |
|
458 |
update_option( 'wt_cli_cookieyes_options', $cky_license );
|
459 |
}
|
includes/class-cookie-law-info.php
CHANGED
@@ -78,7 +78,7 @@ class Cookie_Law_Info {
|
|
78 |
}
|
79 |
else
|
80 |
{
|
81 |
-
$this->version = '2.0.
|
82 |
}
|
83 |
$this->plugin_name = 'cookie-law-info';
|
84 |
|
78 |
}
|
79 |
else
|
80 |
{
|
81 |
+
$this->version = '2.0.5';
|
82 |
}
|
83 |
$this->plugin_name = 'cookie-law-info';
|
84 |
|
public/class-cookie-law-info-public.php
CHANGED
@@ -238,9 +238,12 @@ class Cookie_Law_Info_Public
|
|
238 |
*/
|
239 |
public function cookielawinfo_inject_cli_script()
|
240 |
{
|
241 |
-
global $wp_customize;
|
242 |
$the_options = Cookie_Law_Info::get_settings();
|
243 |
-
|
|
|
|
|
|
|
|
|
244 |
// Output the HTML in the footer:
|
245 |
$message = nl2br($the_options['notify_message']);
|
246 |
$str = do_shortcode(stripslashes($message));
|
@@ -271,9 +274,6 @@ class Cookie_Law_Info_Public
|
|
271 |
}
|
272 |
}
|
273 |
}
|
274 |
-
if (isset($wp_customize)) {
|
275 |
-
$notify_html = '';
|
276 |
-
}
|
277 |
$notify_html = apply_filters('cli_show_cookie_bar_only_on_selected_pages', $notify_html, $post_slug);
|
278 |
require_once plugin_dir_path(__FILE__) . 'views/cookie-law-info_bar.php';
|
279 |
}
|
@@ -541,4 +541,23 @@ class Cookie_Law_Info_Public
|
|
541 |
}
|
542 |
return false;
|
543 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
}
|
238 |
*/
|
239 |
public function cookielawinfo_inject_cli_script()
|
240 |
{
|
|
|
241 |
$the_options = Cookie_Law_Info::get_settings();
|
242 |
+
$show_cookie_bar = true;
|
243 |
+
if(apply_filters('wt_cli_hide_bar_on_page_editor', true) && $this->is_page_editor_active()) {
|
244 |
+
$show_cookie_bar = false;
|
245 |
+
}
|
246 |
+
if ( $the_options['is_on'] == true && $show_cookie_bar ){
|
247 |
// Output the HTML in the footer:
|
248 |
$message = nl2br($the_options['notify_message']);
|
249 |
$str = do_shortcode(stripslashes($message));
|
274 |
}
|
275 |
}
|
276 |
}
|
|
|
|
|
|
|
277 |
$notify_html = apply_filters('cli_show_cookie_bar_only_on_selected_pages', $notify_html, $post_slug);
|
278 |
require_once plugin_dir_path(__FILE__) . 'views/cookie-law-info_bar.php';
|
279 |
}
|
541 |
}
|
542 |
return false;
|
543 |
}
|
544 |
+
/**
|
545 |
+
* Check whether any page editor is active or not
|
546 |
+
*
|
547 |
+
* @since 2.0.5
|
548 |
+
* @return bool
|
549 |
+
*/
|
550 |
+
public function is_page_editor_active() {
|
551 |
+
global $wp_customize;
|
552 |
+
if( isset($_GET['et_fb'])
|
553 |
+
|| (defined( 'ET_FB_ENABLED' ) && ET_FB_ENABLED)
|
554 |
+
|| isset($_GET['elementor-preview'])
|
555 |
+
|| isset($_POST['cs_preview_state'])
|
556 |
+
|| isset($wp_customize)
|
557 |
+
) {
|
558 |
+
return true;
|
559 |
+
}
|
560 |
+
|
561 |
+
return false;
|
562 |
+
}
|
563 |
}
|
public/css/cookie-law-info-gdpr.css
CHANGED
@@ -1372,4 +1372,12 @@ a.wt-cli-ccpa-opt-out {
|
|
1372 |
.cli-style-v2 .cli-bar-btn_container {
|
1373 |
flex-wrap: wrap;
|
1374 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1375 |
}
|
1372 |
.cli-style-v2 .cli-bar-btn_container {
|
1373 |
flex-wrap: wrap;
|
1374 |
}
|
1375 |
+
}
|
1376 |
+
/* Fix: HTML validation error due to the enclosing of <p> tags on category description */
|
1377 |
+
.wt-cli-cookie-description {
|
1378 |
+
font-size: 14px;
|
1379 |
+
line-height: 1.4;
|
1380 |
+
margin-top: 0;
|
1381 |
+
padding: 0;
|
1382 |
+
color: #000;
|
1383 |
}
|
public/js/cookie-law-info-public.js
CHANGED
@@ -667,47 +667,7 @@ var CLI=
|
|
667 |
reload_current_page:function()
|
668 |
{
|
669 |
|
670 |
-
|
671 |
-
{
|
672 |
-
window.location.href=this.add_clear_cache_url_query();
|
673 |
-
}else
|
674 |
-
{
|
675 |
-
window.location.reload(true);
|
676 |
-
}
|
677 |
-
},
|
678 |
-
add_clear_cache_url_query:function()
|
679 |
-
{
|
680 |
-
var cli_rand=new Date().getTime()/1000;
|
681 |
-
var cli_url=window.location.href;
|
682 |
-
var cli_hash_arr=cli_url.split('#');
|
683 |
-
var cli_urlparts= cli_hash_arr[0].split('?');
|
684 |
-
if(cli_urlparts.length>=2)
|
685 |
-
{
|
686 |
-
var cli_url_arr=cli_urlparts[1].split('&');
|
687 |
-
cli_url_temp_arr=new Array();
|
688 |
-
for(var cli_i=0; cli_i<cli_url_arr.length; cli_i++)
|
689 |
-
{
|
690 |
-
var cli_temp_url_arr=cli_url_arr[cli_i].split('=');
|
691 |
-
if(cli_temp_url_arr[0]=='cli_action')
|
692 |
-
{
|
693 |
-
|
694 |
-
}else
|
695 |
-
{
|
696 |
-
cli_url_temp_arr.push(cli_url_arr[cli_i]);
|
697 |
-
}
|
698 |
-
}
|
699 |
-
cli_urlparts[1]=cli_url_temp_arr.join('&');
|
700 |
-
cli_url=cli_urlparts.join('?')+(cli_url_temp_arr.length>0 ? '&': '')+'cli_action=';
|
701 |
-
}else
|
702 |
-
{
|
703 |
-
cli_url=cli_hash_arr[0]+'?cli_action=';
|
704 |
-
}
|
705 |
-
cli_url+=cli_rand;
|
706 |
-
if(cli_hash_arr.length>1)
|
707 |
-
{
|
708 |
-
cli_url+='#'+cli_hash_arr[1];
|
709 |
-
}
|
710 |
-
return cli_url;
|
711 |
},
|
712 |
closeOnScroll:function()
|
713 |
{
|
667 |
reload_current_page:function()
|
668 |
{
|
669 |
|
670 |
+
window.location.reload(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
},
|
672 |
closeOnScroll:function()
|
673 |
{
|
public/views/cookie-law-info_popup_content.php
CHANGED
@@ -101,7 +101,9 @@ $js_blocking_enabled = Cookie_Law_Info::wt_cli_is_js_blocking_active();
|
|
101 |
</div>
|
102 |
<div class="cli-tab-content">
|
103 |
<div class="cli-tab-pane cli-fade" data-id="<?php echo esc_attr( $key ); ?>">
|
104 |
-
<
|
|
|
|
|
105 |
</div>
|
106 |
</div>
|
107 |
</div>
|
101 |
</div>
|
102 |
<div class="cli-tab-content">
|
103 |
<div class="cli-tab-pane cli-fade" data-id="<?php echo esc_attr( $key ); ?>">
|
104 |
+
<div class="wt-cli-cookie-description">
|
105 |
+
<?php echo do_shortcode( $category_description, 'cookielawinfo-category' ); ?>
|
106 |
+
</div>
|
107 |
</div>
|
108 |
</div>
|
109 |
</div>
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: webtoffee, cookieyesdev
|
|
3 |
Donate link: https://www.webtoffee.com/plugins/
|
4 |
Tags: GDPR, CCPA, cookie notice, DSGVO, RGPD, LGPD, PIPEDA, cookies , cookie law, cookie consent, Opt-in, cookie policy, privacy, compliance
|
5 |
Requires at least: 4.4.0
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.0.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -31,7 +31,7 @@ The plugin is one of the best WordPress GDPR compliance plugins as it comes with
|
|
31 |
|
32 |
- With the help of this WordPress GDPR plugin, you can fully customise the cookie notice style so it blends with your existing website: change the colours, fonts, styles, the position on the page and even how it behaves when you click “Accept”.
|
33 |
|
34 |
-
- You can choose to make the cookie notice bar disappear after a few seconds (completely configurable) or to accept on scroll
|
35 |
|
36 |
- It also has a Cookie Audit module so you can easily show what cookies your site uses and display them neatly in a table on your Privacy & Cookies Policy page.
|
37 |
|
@@ -189,10 +189,15 @@ For every update of the plugin, you will be notified of the installed plugins pa
|
|
189 |
|
190 |
== Changelog ==
|
191 |
|
|
|
|
|
|
|
|
|
|
|
192 |
= 2.0.4 =
|
193 |
|
194 |
* Bug fix: Do not sell option appears before Accept all button option on the admin settings.
|
195 |
-
*
|
196 |
* Enhancement: Added escaping to input attributes.
|
197 |
|
198 |
= 2.0.3 =
|
@@ -519,8 +524,7 @@ For every update of the plugin, you will be notified of the installed plugins pa
|
|
519 |
|
520 |
== Upgrade Notice ==
|
521 |
|
522 |
-
= 2.0.
|
523 |
|
524 |
-
*
|
525 |
-
*
|
526 |
-
* Enhancement: Added escaping to input attributes.
|
3 |
Donate link: https://www.webtoffee.com/plugins/
|
4 |
Tags: GDPR, CCPA, cookie notice, DSGVO, RGPD, LGPD, PIPEDA, cookies , cookie law, cookie consent, Opt-in, cookie policy, privacy, compliance
|
5 |
Requires at least: 4.4.0
|
6 |
+
Tested up to: 5.8
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.0.5
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
31 |
|
32 |
- With the help of this WordPress GDPR plugin, you can fully customise the cookie notice style so it blends with your existing website: change the colours, fonts, styles, the position on the page and even how it behaves when you click “Accept”.
|
33 |
|
34 |
+
- You can choose to make the cookie notice bar disappear after a few seconds (completely configurable) or to accept on scroll.
|
35 |
|
36 |
- It also has a Cookie Audit module so you can easily show what cookies your site uses and display them neatly in a table on your Privacy & Cookies Policy page.
|
37 |
|
189 |
|
190 |
== Changelog ==
|
191 |
|
192 |
+
= 2.0.5 =
|
193 |
+
|
194 |
+
* Enhancement: Disable cookie bar on page builders.
|
195 |
+
* Tested ok with Wordpress version 5.8
|
196 |
+
|
197 |
= 2.0.4 =
|
198 |
|
199 |
* Bug fix: Do not sell option appears before Accept all button option on the admin settings.
|
200 |
+
* Tested ok with Wordpress version 5.6
|
201 |
* Enhancement: Added escaping to input attributes.
|
202 |
|
203 |
= 2.0.3 =
|
524 |
|
525 |
== Upgrade Notice ==
|
526 |
|
527 |
+
= 2.0.5 =
|
528 |
|
529 |
+
* Enhancement: Disable cookie bar on page builders.
|
530 |
+
* Tested ok with Wordpress version 5.8
|
|