| @@ -54,13 +54,8 @@ | ||
| 54 | 54 | |
| 55 | 55 | if(empty($data->description)){ |
| 56 | 56 | $data->description = 'Not Available'; |
| 57 | 57 | } |
| 58 | - | |
| 59 | - $patterns = !empty($data->patterns) ? $data->patterns : ''; | |
| 60 | - if(!empty($patterns)){ | |
| 61 | - $patterns = strtr($patterns, ['[' => '', ']' => '', '"' => '']); | |
| 62 | - } | |
| 63 | 58 | |
| 64 | 59 | $categorized[$data->category] .= '<tr><td>'.esc_html($data->cookie_name).'</td><td>'.esc_html($data->description).'</td><td>'.esc_html($exp).'</td><td> <span class="dashicons dashicons-edit cookieadmin_edit_icon" id="edit_'.esc_attr($data->id).'"></span> <span class="dashicons dashicons-trash cookieadmin_delete_icon" id="delete_'.esc_attr($data->id).'"></span> </td></tr>'; |
| 65 | 60 | |
| 66 | 61 | $categorized_cookies[$data->id]['id'] = $data->id; |
| @@ -67,9 +62,8 @@ | ||
| 67 | 62 | $categorized_cookies[$data->id]['cookie_name'] = $data->cookie_name; |
| 68 | 63 | $categorized_cookies[$data->id]['description'] = $data->description; |
| 69 | 64 | $categorized_cookies[$data->id]['category'] = $data->category; |
| 70 | 65 | $categorized_cookies[$data->id]['expires'] = $expires; |
| 71 | - $categorized_cookies[$data->id]['patterns'] = $patterns; | |
| 72 | 66 | |
| 73 | 67 | } |
| 74 | 68 | |
| 75 | 69 | wp_register_script('cookieadmin_categorized_cookies', '', array('jquery'), COOKIEADMIN_VERSION, true); |
| @@ -178,19 +172,10 @@ | ||
| 178 | 172 | |
| 179 | 173 | <div class="cookieadmin_form-group"> |
| 180 | 174 | <label for="duration">'.esc_html__('Duration', 'cookieadmin').'</label> |
| 181 | 175 | <input type="number" min=0 id="cookieadmin-dialog-cookie-duration" Placeholder="'.esc_html__('Set 0 for Session or expiry in days', 'cookieadmin').'"> |
| 182 | - </div>'; | |
| 183 | - | |
| 184 | - if(empty($cookieadmin_requires_pro)){ | |
| 185 | - echo '<div class="cookieadmin_form-group"> | |
| 186 | - <label for="patterns">'.esc_html__('Scripts patterns', 'cookieadmin').'</label> | |
| 187 | - <span>'.__('If scripts has "src" attribute then paste the src or add comma separated patterns to match the scripts. Try choosing log patterns to block only targeted script', 'cookieadmin').'</span> | |
| 188 | - <br /><span><strong>'.__('Note: ', 'cookieadmin').'</strong>'.__('Wildcards (*, ?, ^, % etc) are not allowed', 'cookieadmin').'</span> | |
| 189 | - <textarea id="cookieadmin-dialog-cookie-patterns" Placeholder="'.esc_attr__('https://connect.facebook.net/en_US/fbevents.js OR fbq.push, window.facebookSignals', 'cookieadmin').'"></textarea> | |
| 190 | - </div>'; | |
| 191 | - } | |
| 192 | - echo '</div> | |
| 176 | + </div> | |
| 177 | + </div> | |
| 193 | 178 | <div class="cookieadmin_modal-footer"> |
| 194 | 179 | <span id="cookieadmin-message"></span> |
| 195 | 180 | <button class="cookieadmin-btn cookieadmin-btn-primary" id="cookieadmin_dialog_save_btn" form="edit-cookie-form">'.esc_html__('Save', 'cookieadmin').'</button> |
| 196 | 181 | </div> |
| @@ -464,13 +449,11 @@ | ||
| 464 | 449 | ); |
| 465 | 450 | } |
| 466 | 451 | |
| 467 | 452 | $cookie_info = map_deep(wp_unslash($_REQUEST['cookie_info']), 'sanitize_text_field'); |
| 468 | - // $scan_timestamp = $wpdb->get_col($wpdb->prepare("SELECT scan_timestamp FROM {$table_name} WHERE id = %d", $cookie_info['id'])); | |
| 469 | 453 | |
| 470 | - $scanned_cookies = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$table_name} WHERE id = %d", $cookie_info['id'])); | |
| 471 | - $scan_timestamp = !empty($scanned_cookies->scan_timestamp) ? $scanned_cookies->scan_timestamp : 0; | |
| 472 | - | |
| 454 | + $scan_timestamp = $wpdb->get_col($wpdb->prepare("SELECT scan_timestamp FROM {$table_name} WHERE id = %d", $cookie_info['id'])); | |
| 455 | + | |
| 473 | 456 | if(empty($scan_timestamp)){ |
| 474 | 457 | wp_send_json(['success' => false, |
| 475 | 458 | 'data' => null, |
| 476 | 459 | 'message' => __('Error : Invalid cookie record', 'cookieadmin')] |
| @@ -476,34 +459,16 @@ | ||
| 476 | 459 | 'message' => __('Error : Invalid cookie record', 'cookieadmin')] |
| 477 | 460 | ); |
| 478 | 461 | } |
| 479 | 462 | |
| 480 | - $calculated_expiry_seconds = ($cookie_info['duration'] * 86400) + $scan_timestamp; | |
| 463 | + $calculated_expiry_seconds = ($cookie_info['duration'] * 86400) + $scan_timestamp[0]; | |
| 481 | 464 | $calculated_expiry = date('Y-m-d H:i:s', $calculated_expiry_seconds); |
| 482 | - | |
| 483 | - // Update the additional patterns into the saved patterns | |
| 484 | - $patterns = '[]'; | |
| 485 | - if(!empty($cookie_info['patterns'])){ | |
| 486 | - $script_patterns = explode(',', $cookie_info['patterns']); | |
| 487 | - if(!empty($script_patterns) && is_array($script_patterns)){ | |
| 488 | - foreach($script_patterns as $pat){ | |
| 489 | - if(strlen(str_replace(['*', '?', '^', '%'], '', $pat)) < strlen($pat)){ | |
| 490 | - continue; | |
| 491 | - } | |
| 492 | - // do not ad comma if the saved pattern is empty | |
| 493 | - $comma = ($patterns === '[]') ? '' : ', '; | |
| 494 | - $patterns = str_replace(']', $comma . '"' .(string) trim($pat).'"]', $patterns); | |
| 495 | - } | |
| 496 | - } | |
| 497 | - }else{ | |
| 498 | - $patterns = !empty($scanned_cookies->patterns) ? $scanned_cookies->patterns : '[]'; | |
| 499 | - } | |
| 500 | 465 | |
| 501 | 466 | $resp = $wpdb->update( |
| 502 | 467 | $table_name, |
| 503 | - [ 'cookie_name' => $cookie_info['name'], 'description' => $cookie_info['description'], 'expires' => $calculated_expiry, 'category' => $cookie_info['type'], 'patterns' => $patterns, 'edited' => 1], // Data to update | |
| 468 | + [ 'cookie_name' => $cookie_info['name'], 'description' => $cookie_info['description'], 'expires' => $calculated_expiry, 'category' => $cookie_info['type'], 'edited' => 1], // Data to update | |
| 504 | 469 | [ 'id' => $cookie_info['id'] ], // WHERE |
| 505 | - [ '%s', '%s', '%s', '%s', '%s', '%d' ], // Format for the data | |
| 470 | + [ '%s', '%s', '%s', '%s', '%d' ], // Format for the data | |
| 506 | 471 | [ '%d' ] // Format for the WHERE clause |
| 507 | 472 | ); |
| 508 | 473 | |
| 509 | 474 | if ($wpdb->last_error || $resp === false) { |