| @@ -19,8 +19,16 @@ | ||
| 19 | 19 | // No update required |
| 20 | 20 | if($current_version == COOKIEADMIN_VERSION){ |
| 21 | 21 | return true; |
| 22 | 22 | } |
| 23 | + | |
| 24 | + // We added a option to disable Script Delaying | |
| 25 | + if($version < 120){ | |
| 26 | + $settings = get_option('cookieadmin_settings', []); | |
| 27 | + $settings['block_scripts'] = true; | |
| 28 | + | |
| 29 | + update_option('cookieadmin_settings', $settings); | |
| 30 | + } | |
| 23 | 31 | |
| 24 | 32 | // Save the new Version |
| 25 | 33 | update_option('cookieadmin_version', COOKIEADMIN_VERSION); |
| 26 | 34 | |
| @@ -69,9 +77,9 @@ | ||
| 69 | 77 | if(!cookieadmin_is_editor_mode()){ |
| 70 | 78 | add_action('wp_footer', '\CookieAdmin\Enduser::cookieadmin_show_banner'); |
| 71 | 79 | } |
| 72 | 80 | |
| 73 | - add_filter('script_loader_tag', '\CookieAdmin\Enduser::check_if_cookies_allowed', 10, 3); | |
| 81 | + add_action('template_redirect', '\CookieAdmin\Enduser::block_scripts', 1); | |
| 74 | 82 | |
| 75 | 83 | } |
| 76 | 84 | |
| 77 | 85 | function cookieadmin_load_plugin_admin(){ |
| @@ -110,8 +118,18 @@ | ||
| 110 | 118 | if (isset($_GET['pagelayer-live']) || isset($_GET['fl_builder'])) { |
| 111 | 119 | return true; |
| 112 | 120 | } |
| 113 | 121 | |
| 122 | + // Avada builder | |
| 123 | + if(isset($_GET['fb-edit']) || isset($_GET['builder']) || isset($_GET['builder_id'])){ | |
| 124 | + return true; | |
| 125 | + } | |
| 126 | + | |
| 127 | + // Bricks Builder | |
| 128 | + if(isset($_GET['bricks']) || isset($_GET['brickspreview'])){ | |
| 129 | + return true; | |
| 130 | + } | |
| 131 | + | |
| 114 | 132 | if(isset($_GET['vc_action']) && $_GET['vc_action'] == 'vc_inline'){ |
| 115 | 133 | return true; |
| 116 | 134 | } |
| 117 | 135 | |
| @@ -138,9 +156,11 @@ | ||
| 138 | 156 | 'scan_cookies' => '\CookieAdmin\Admin\Scan::scan_cookies_ajax', |
| 139 | 157 | 'cookieadmin-edit-cookie' => '\CookieAdmin\Admin\Scan::edit_cookies', |
| 140 | 158 | 'cookieadmin-delete-cookie' => '\CookieAdmin\Admin\Scan::delete_cookies', |
| 141 | 159 | 'close-update-notice' => '\CookieAdmin\Admin::close_plugin_update_notice', |
| 142 | - 'close-notice' => '\CookieAdmin\Admin::close_notices' | |
| 160 | + 'close-notice' => '\CookieAdmin\Admin::close_notices', | |
| 161 | + 'install_recommended_plugin' => '\CookieAdmin\Admin\Dashboard::install_recommended_plugin', | |
| 162 | + 'activate_recommended_plugin' => '\CookieAdmin\Admin\Dashboard::activate_recommended_plugin', | |
| 143 | 163 | ); |
| 144 | 164 | |
| 145 | 165 | $general_actions = array( |
| 146 | 166 | 'categorize_cookies' => 'cookieadmin_categorize_cookies', |
| @@ -199,64 +219,84 @@ | ||
| 199 | 219 | |
| 200 | 220 | return array_replace_recursive($j_policy, $policy); |
| 201 | 221 | } |
| 202 | 222 | |
| 203 | -function cookieadmin_load_strings(){ | |
| 223 | +function cookieadmin_load_strings($policy){ | |
| 204 | 224 | |
| 205 | 225 | $cookieadmin_powered_by_html = '<div class="cookieadmin-poweredby"><a href="https://cookieadmin.net/?utm_source=wpplugin&utm_medium=footer" target="_blank"><span>[[powered_by]]</span> [[logo_svg]]</a></div>'; |
| 206 | 226 | |
| 207 | 227 | $cookieadmin_powered_by_html = apply_filters('cookieadmin_powered_by_html', $cookieadmin_powered_by_html); |
| 228 | + $privacy_policy_links = apply_filters('cookieadmin_privacy_policy_links', array(), $policy); | |
| 229 | + $reconsent_icon_url = apply_filters('cookieadmin_reconsent_icon_url', '', $policy); | |
| 208 | 230 | |
| 231 | + $strings = [ | |
| 232 | + 'override_gpc' => apply_filters('cookieadmin_override_gpc_html', ''), | |
| 233 | + 'powered_by_html' => $cookieadmin_powered_by_html, | |
| 234 | + 'banner_policy_links' => !empty($privacy_policy_links['banner']) ? $privacy_policy_links['banner'] : '', | |
| 235 | + 'modal_policy_links' => !empty($privacy_policy_links['modal']) ? $privacy_policy_links['modal'] : '', | |
| 236 | + 'reconsent_icon_url' => esc_url($reconsent_icon_url), | |
| 237 | + 'logo_svg' => cookieadmin_logo_svg(), | |
| 238 | + 'plugin_url' => esc_url(COOKIEADMIN_PLUGIN_URL), | |
| 239 | + 'powered_by' => __('Powered by', 'cookieadmin'), | |
| 240 | + 'reconsent' => __('Re-consent', 'cookieadmin'), | |
| 241 | + 'cookie_preferences' => __('Cookie Preferences', 'cookieadmin'), | |
| 242 | + 'remark_standard' => __('Always Active', 'cookieadmin'), | |
| 243 | + 'remark' => __('Remark', 'cookieadmin'), | |
| 244 | + 'none' => __('None', 'cookieadmin'), | |
| 245 | + 'necessary_cookies' => __('Necessary Cookies', 'cookieadmin'), | |
| 246 | + 'necessary_cookies_desc' => __('Necessary cookies enable essential site features like secure log-ins and consent preference adjustments. They do not store personal data.', 'cookieadmin'), | |
| 247 | + 'functional_cookies' => __('Functional Cookies', 'cookieadmin'), | |
| 248 | + 'functional_cookies_desc' => __('Functional cookies support features like content sharing on social media, collecting feedback, and enabling third-party tools.', 'cookieadmin'), | |
| 249 | + 'analytical_cookies' => __('Analytical Cookies', 'cookieadmin'), | |
| 250 | + 'analytical_cookies_desc' => __('Analytical cookies track visitor interactions, providing insights on metrics like visitor count, bounce rate, and traffic sources.', 'cookieadmin'), | |
| 251 | + 'advertisement_cookies' => __('Advertisement Cookies', 'cookieadmin'), | |
| 252 | + 'advertisement_cookies_desc' => __('Advertisement cookies deliver personalized ads based on your previous visits and analyze the effectiveness of ad campaigns.', 'cookieadmin'), | |
| 253 | + 'unclassified_cookies' => __('Unclassified Cookies', 'cookieadmin'), | |
| 254 | + 'unclassified_cookies_desc' => __('Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies.', 'cookieadmin'), | |
| 255 | + ]; | |
| 209 | 256 | |
| 210 | - return [ | |
| 211 | - 'powered_by_html' => $cookieadmin_powered_by_html, | |
| 212 | - 'logo_svg' => cookieadmin_logo_svg(), | |
| 213 | - 'plugin_url' => esc_url(COOKIEADMIN_PLUGIN_URL), | |
| 214 | - 'powered_by' => __('Powered by', 'cookieadmin'), | |
| 215 | - 'reconsent' => __('Re-consent', 'cookieadmin'), | |
| 216 | - 'cookie_preferences' => __('Cookie Preferences', 'cookieadmin'), | |
| 217 | - 'remark_standard' => __('Always Active', 'cookieadmin'), | |
| 218 | - 'remark' => __('Remark', 'cookieadmin'), | |
| 219 | - 'none' => __('None', 'cookieadmin'), | |
| 220 | - 'necessary_cookies' => __('Necessary Cookies', 'cookieadmin'), | |
| 221 | - 'necessary_cookies_desc' => __('Necessary cookies enable essential site features like secure log-ins and consent preference adjustments. They do not store personal data.', 'cookieadmin'), | |
| 222 | - 'functional_cookies' => __('Functional Cookies', 'cookieadmin'), | |
| 223 | - 'functional_cookies_desc' => __('Functional cookies support features like content sharing on social media, collecting feedback, and enabling third-party tools.', 'cookieadmin'), | |
| 224 | - 'analytical_cookies' => __('Analytical Cookies', 'cookieadmin'), | |
| 225 | - 'analytical_cookies_desc' => __('Analytical cookies track visitor interactions, providing insights on metrics like visitor count, bounce rate, and traffic sources.', 'cookieadmin'), | |
| 226 | - 'advertisement_cookies' => __('Advertisement Cookies', 'cookieadmin'), | |
| 227 | - 'advertisement_cookies_desc' => __('Advertisement cookies deliver personalized ads based on your previous visits and analyze the effectiveness of ad campaigns.', 'cookieadmin'), | |
| 228 | - 'unclassified_cookies' => __('Unclassified Cookies', 'cookieadmin'), | |
| 229 | - 'unclassified_cookies_desc' => __('Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies.', 'cookieadmin'), | |
| 230 | - ]; | |
| 257 | + return apply_filters('cookieadmin_default_strings', $strings); | |
| 231 | 258 | } |
| 232 | 259 | |
| 233 | 260 | //Loads consent data from file |
| 234 | 261 | function cookieadmin_load_consent_template($policy, $view){ |
| 235 | 262 | |
| 263 | + $template = array(); | |
| 264 | + | |
| 236 | 265 | if(!file_exists(COOKIEADMIN_DIR.'assets/cookie/template.php')){ |
| 237 | - return false; | |
| 266 | + if(defined('WP_DEBUG') && WP_DEBUG){ | |
| 267 | + error_log('CookieAdmin: template file missing'); | |
| 268 | + } | |
| 269 | + return $template; | |
| 238 | 270 | } |
| 239 | 271 | |
| 240 | 272 | include_once(COOKIEADMIN_DIR.'assets/cookie/template.php'); |
| 241 | 273 | |
| 242 | 274 | if(empty($content)){ |
| 243 | - return false; | |
| 275 | + if(defined('WP_DEBUG') && WP_DEBUG){ | |
| 276 | + error_log('CookieAdmin: Could not load template file'); | |
| 277 | + } | |
| 278 | + return $template; | |
| 244 | 279 | } |
| 245 | 280 | |
| 246 | - $template = array(); | |
| 247 | 281 | $template[$view] = ($policy['cookieadmin_layout'] != 'popup') ? $content['cookieadmin_layout'][$policy['cookieadmin_layout']] : ''; |
| 248 | 282 | $template[$view] .= $content['cookieadmin_modal'][$policy['cookieadmin_modal']]; |
| 249 | - $template[$view] .= $content['cookieadmin_reconsent']; | |
| 250 | 283 | |
| 251 | - $cookieadmin_strings = cookieadmin_load_strings(); | |
| 284 | + global $cookieadmin_settings; | |
| 252 | 285 | |
| 286 | + // Show consent only if hide reconsent is not enabled | |
| 287 | + if(defined('COOKIEADMIN_PRO_VERSION') && empty($cookieadmin_settings['hide_reconsent'])){ | |
| 288 | + $template[$view] .= $content['cookieadmin_reconsent']; | |
| 289 | + } | |
| 290 | + | |
| 291 | + $cookieadmin_strings = cookieadmin_load_strings($policy); | |
| 292 | + | |
| 253 | 293 | foreach($cookieadmin_strings as $ck => $cv){ |
| 254 | 294 | $template[$view] = str_replace('[['.$ck.']]', $cv, $template[$view]); |
| 255 | 295 | } |
| 256 | 296 | |
| 257 | 297 | $template[$view] = apply_filters('cookieadmin_consent_banner_template', $template[$view]); |
| 258 | - | |
| 298 | + | |
| 259 | 299 | return $template; |
| 260 | 300 | |
| 261 | 301 | } |
| 262 | 302 | |
| @@ -446,8 +486,9 @@ | ||
| 446 | 486 | $allowed_tags['defs'] = array(); |
| 447 | 487 | |
| 448 | 488 | $allowed_tags['a'] = array( |
| 449 | 489 | 'href' => true, |
| 490 | + 'target' => true, | |
| 450 | 491 | ); |
| 451 | 492 | |
| 452 | 493 | $allowed_tags['br'] = array(); |
| 453 | 494 | |