moove_register_scripts(); $this->moove_register_ajax_actions(); add_action( 'gdpr_cookie_filter_settings', array( &$this, 'gdpr_remove_cached_scripts' ) ); add_action( 'gdpr_settings_tab_nav_extensions', array( &$this, 'gdpr_settings_tab_nav_extensions' ), 10, 1 ); add_action( 'gdpr_settings_category_nav_extensions', array( &$this, 'gdpr_settings_category_nav_extensions' ), 10, 1 ); add_action( 'gdpr_check_extensions', array( &$this, 'gdpr_check_extensions' ), 10, 2 ); add_action( 'gdpr_premium_section_ads', array( &$this, 'gdpr_premium_section_ads' ) ); add_action( 'gdpr_tab_cbm_ph', array( &$this, 'gdpr_premium_section_ads' ) ); add_action( 'gdpr_tab_cbm_ps', array( &$this, 'gdpr_premium_section_ads' ) ); add_action( 'gdpr_get_alertbox', array( 'Moove_GDPR_Content', 'gdpr_get_alertbox' ), 10, 3 ); add_action( 'gdpr_licence_input_field', array( 'Moove_GDPR_Content', 'gdpr_licence_input_field' ), 10, 2 ); add_action( 'gdpr_licence_action_button', array( 'Moove_GDPR_Content', 'gdpr_licence_action_button' ), 10, 2 ); add_action( 'gdpr_premium_update_alert', array( 'Moove_GDPR_Content', 'gdpr_premium_update_alert' ) ); add_action( 'gdpr_cdn_url', array( &$this, 'gdpr_cdn_base_url' ), 10, 1 ); add_action( 'gdpr_info_bar_button_extensions', array( &$this, 'gdpr_info_add_reject_button_extensions' ) ); add_action( 'gdpr_info_bar_button_extensions', array( &$this, 'gdpr_info_add_close_button_extensions' ) ); add_action( 'gdpr_info_bar_notice_content', array( &$this, 'gdpr_info_add_close_button_content' ) ); add_action( 'gdpr_support_sidebar_class', array( &$this, 'gdpr_support_sidebar_class' ), 10, 1 ); $gdpr_default_content = new Moove_GDPR_Content(); $option_key = $gdpr_default_content->moove_gdpr_get_key_name(); $gdpr_key = $gdpr_default_content->gdpr_get_activation_key( $option_key ); add_action( 'admin_enqueue_scripts', array( &$this, 'gdpr_thirdparty_admin_scripts' ) ); add_action( 'gdpr_cc_keephtml', array( &$this, 'gdpr_cc_keephtml' ), 10, 2 ); add_action( 'wp_footer', array( 'Moove_GDPR_Controller', 'moove_gdpr_cookie_popup_modal' ), 99 ); add_action( 'wp_head', array( 'Moove_GDPR_Content', 'gdpr_google_consent_mode2_snippet' ), 1 ); add_action( 'wp_head', array( 'Moove_GDPR_Content', 'gdpr_clarity_consent_snippet' ), 1 ); add_action( 'admin_init', array( 'Moove_GDPR_Controller', 'moove_gdpr_add_editor_styles' ) ); add_action( 'wp_footer', array( 'Moove_GDPR_Controller', 'moove_gdpr_cookie_popup_info' ) ); add_action( 'moove_gdpr_inline_styles', array( &$this, 'gdpr_custom_button_styles' ), 20, 3 ); // Get Option hook. add_action( 'pre_option_' . $gdpr_default_content->moove_gdpr_get_option_name(), array( &$this, 'gdpr_get_options' ), 99, 1 ); // Update Option Hook. add_action( 'pre_update_option_' . $gdpr_default_content->moove_gdpr_get_option_name(), array( &$this, 'gdpr_update_options' ), 99, 3 ); // Update Option Hook. add_action( 'delete_option_' . $gdpr_default_content->moove_gdpr_get_option_name(), array( &$this, 'gdpr_delete_options' ), 99, 1 ); add_action( 'gdpr_licence_key_visibility', array( &$this, 'gdpr_licence_key_visibility_hide' ), 10, 1 ); if ( $gdpr_key && ! isset( $gdpr_key['deactivation'] ) ) : do_action( 'gdpr_plugin_loaded' ); endif; // Admin CSS. add_action( 'admin_head', function() { ?> 'Google Tag Manager', 'desc' => 'Compatibility for GTM4WP', 'cookie_cat' => isset( $gdin_values['gtm4wp'] ) ? intval( $gdin_values['gtm4wp'] ) : 2, 'tacking_id' => isset( $storedoptions['gtm-code'] ) && $storedoptions['gtm-code'] ? esc_attr( $storedoptions['gtm-code'] ) : '', 'id_format' => 'G-XXXXXXX', 'atts' => array( 'toggle' => true, 'input' => 'disabled', ), 'status' => $status, ); endif; endif; return $gdin_modules; } /** * TranslatePress plugin support to switch language inside GDPR Cookie Compliance admin page * * @param string $url URL. */ public static function gdpr_form_admin_url_filter( $url ) { if ( strpos( $url, '?page=moove-gdpr' ) !== false && isset( $_GET['gdpr-lang'] ) ) : // phpcs:ignore $lang_code = sanitize_text_field( wp_unslash( $_GET['gdpr-lang'] ) ); // phpcs:ignore $url = remove_query_arg( 'gdpr-lang', $url ); $url = add_query_arg( 'gdpr-lang', $lang_code, $url ); endif; return $url; } /** * Prevent loading GDPR HTML templates to Divi Builder * * @param boolean $load Load. */ public static function gdpr_prevent_html_load_to_divi_builder( $load ) { if ( function_exists( 'et_core_is_fb_enabled' ) && et_core_is_fb_enabled() ) : $load = false; endif; return $load; } /** * TranslatePress Language selection * * @param string $language Language. */ public static function gdpr_translatepress_language_select_extension( $language ) { if ( function_exists( 'trp_get_languages' ) ) : $trp_languages = trp_get_languages(); global $TRP_LANGUAGE; // phpcs:ignore ?>
$lang_name ) : if ( $lang_name !== $language ) : ob_start(); ?> Switch language:
moove_gdpr_get_wpml_lang(); $falang_languages = Falang()->get_model()->get_languages_list(); ?>
locale ) ? $language->locale : ( isset( $language->slug ) ? $language->slug : '' ); if ( $lang_name !== $wpml_lang ) : ob_start(); ?> name ); ?> Switch language:
moove_gdpr_get_option_name(); $gdpr_options = get_option( $option_name ); if ( isset( $gdpr_options['gdpr_accesibility'] ) && intval( $gdpr_options['gdpr_accesibility'] ) === 1 ) : $tabindex = ' tabindex="0" '; else : $tabindex = ''; endif; return $tabindex; } /** * Tab main section premium class * * @param array $classes Classes. */ public static function gdpr_tab_section_cnt_class_filter( $classes = array() ) { if ( defined( 'GDPR_ADDON_VERSION' ) ) : $classes[] = 'gdpr-has-premium'; endif; return $classes; } /** * Using main domain for WP MultiSite - Subdomain installs * * @param string $attr Cookie attributes. */ public static function gdpr_cc_multisite_subdomain_url( $attr ) { $gdpr_default_content = new Moove_GDPR_Content(); $option_name = $gdpr_default_content->moove_gdpr_get_option_name(); $gdpr_options = get_option( $option_name ); if ( isset( $gdpr_options['moove_gdpr_sync_user_consent'] ) && intval( $gdpr_options['moove_gdpr_sync_user_consent'] ) ) : if ( function_exists( 'is_multisite' ) && is_multisite() && defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL === true ) : $site_url = network_site_url(); $current_site_url = get_bloginfo( 'url' ); $p_url = wp_parse_url( $site_url ); $domain = $p_url && isset( $p_url['host'] ) && $p_url['host'] ? $p_url['host'] : false; $domain = str_replace( 'www.', '', $domain ); if ( $domain && strpos( $current_site_url, $domain ) !== false && strpos( 'domain=', $attr ) === false ) : $domain = apply_filters( 'gdpr_cc_multisite_subdomain_main_domain', $domain ); $attr .= 'domain=.' . $domain . ';'; endif; endif; endif; return $attr; } /** * Licence key asterisks hide in admin area * * @param string $key Licence key. */ public static function gdpr_licence_key_visibility_hide( $key ) { if ( $key ) : $_key = explode( '-', $key ); if ( $_key && is_array( $_key ) ) : $_hidden_key = array(); $key_count = count( $_key ); for ( $i = 0; $i < $key_count; $i++ ) : if ( 0 === $i || ( $key_count - 1 ) === $i ) : $_hidden_key[] = $_key[ $i ]; else : $_hidden_key[] = '****'; endif; endfor; $key = implode( '-', $_hidden_key ); endif; endif; return $key; } /** * Enqueue a script in the WordPress admin, excluding GDPR Settings page. * * @param int $hook Hook suffix for the current admin page. */ public static function gdpr_thirdparty_admin_scripts( $hook ) { if ( 'toplevel_page_moove-gdpr' !== $hook && 'gdpr-cookie-compliance_page_moove-gdpr_help' !== $hook ) : return; endif; wp_enqueue_script( 'gdpr_colorpicker_script', esc_url( moove_gdpr_get_plugin_directory_url() ) . 'dist/scripts/colorpicker.js', array(), MOOVE_GDPR_VERSION, true ); wp_enqueue_script( 'gdpr_codemirror_script', esc_url( moove_gdpr_get_plugin_directory_url() ) . 'dist/scripts/codemirror.js', array(), MOOVE_GDPR_VERSION, true ); wp_enqueue_script( 'jquery-ui-sortable' ); } /** * Using custom database instead default WordPress options * * @param array $option_data Option data. */ public static function gdpr_get_options( $option_data ) { $gdpr_controller = new Moove_GDPR_Controller(); $database_options = gdpr_get_options(); if ( $database_options && ! empty( $database_options ) ) : $option_data = $database_options; else : if ( is_array( $option_data ) ) : foreach ( $option_data as $option_key => $option_value ) : gdpr_update_field( $option_key, $option_value ); endforeach; endif; endif; return $option_data; } /** * Using custom database instead default WordPress options * * @param mixed $new_value New Value.bx-loading. * @param mixed $old_value Old Value. * @param string $option Option. */ public static function gdpr_update_options( $new_value, $old_value, $option ) { if ( is_array( $new_value ) && ! empty( $new_value ) ) : foreach ( $new_value as $option_key => $option_value ) : if ( isset( $old_value[ $option_key ] ) ) : if ( $new_value[ $option_key ] !== $old_value[ $option_key ] ) : // updating option only if value was changed. gdpr_update_field( $option_key, $option_value ); endif; else : // creating new option value. gdpr_update_field( $option_key, $option_value ); endif; endforeach; endif; return ''; } /** * Using custom database instead default WordPress options * * @param string $option Option. */ public static function gdpr_delete_options( $option ) { gdpr_delete_option(); return $option; } /** * Extra class for admin sidebar widgets * * @param string $class Class name. * @return string $class */ public function gdpr_support_sidebar_class( $class ) { if ( class_exists( 'Moove_GDPR_Addon_View' ) ) : $class = 'm-plugin-box-highlighted'; endif; return $class; } /** * Custom button style extension * * @param string $styles CSS Styles. * @param string $primary Primary Colour hash. * @param string $secondary Secondary Colour hash. * @return string $styles */ public static function gdpr_custom_button_styles( $styles, $primary, $secondary ) { $gdpr_default_content = new Moove_GDPR_Content(); $option_name = $gdpr_default_content->moove_gdpr_get_option_name(); $gdpr_options = get_option( $option_name ); $css = ''; if ( isset( $gdpr_options['moove_gdpr_button_style'] ) && 'rounded' !== $gdpr_options['moove_gdpr_button_style'] ) : $css = apply_filters( 'gdpr_custom_button_styles', 'border-radius: 0;' ); else : $css = apply_filters( 'gdpr_custom_button_styles', '' ); endif; if ( $css ) : $styles .= '#moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder a.mgbutton, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder button.mgbutton, .gdpr-shr-button, #moove_gdpr_cookie_info_bar .moove-gdpr-infobar-close-btn { ' . $css . ' }'; endif; // The blocks below are templated, so buffer them into $styles rather than echoing them. ob_start(); // Reject Button - Settings Screen. $gdpr_reject_button_bhv_ss = isset( $gdpr_options['gdpr_reject_button_bhv_ss'] ) && intval( $gdpr_options['gdpr_reject_button_bhv_ss'] ) ? intval( $gdpr_options['gdpr_reject_button_bhv_ss'] ) : 1; if ( 2 === $gdpr_reject_button_bhv_ss ) : ?> #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder a.mgbutton.moove-gdpr-modal-reject-all, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder button.mgbutton.moove-gdpr-modal-reject-all, .gdpr_cookie_settings_shortcode_content .gdpr-shr-button.button-green.moove-gdpr-modal-reject-all { background-color: transparent; opacity: .7; color: #202020; } #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder a.mgbutton.moove-gdpr-modal-reject-all:hover, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder button.mgbutton.moove-gdpr-modal-reject-all:hover, .gdpr_cookie_settings_shortcode_content .gdpr-shr-button.button-green.moove-gdpr-modal-reject-all:hover { background-color: #202020; box-shadow: none; color: #fff; opacity: 1; } #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder a.mgbutton.moove-gdpr-modal-reject-all, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder button.mgbutton.moove-gdpr-modal-reject-all, .gdpr_cookie_settings_shortcode_content .gdpr-shr-button.button-green.moove-gdpr-modal-reject-all { background-color: ; border-color: ; color: ; } #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder a.mgbutton.moove-gdpr-modal-reject-all:hover, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder button.mgbutton.moove-gdpr-modal-reject-all:hover, .gdpr_cookie_settings_shortcode_content .gdpr-shr-button.button-green.moove-gdpr-modal-reject-all:hover { color: ; background-color: ; border-color: ; } #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton.moove-gdpr-infobar-reject-btn, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton.moove-gdpr-infobar-reject-btn { background-color: transparent; box-shadow: inset 0 0 0 1px currentColor; opacity: .7; color: #202020; } #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton.moove-gdpr-infobar-reject-btn:hover, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton.moove-gdpr-infobar-reject-btn:hover { background-color: #202020; box-shadow: none; color: #fff; opacity: 1; } #moove_gdpr_cookie_info_bar:not(.gdpr-full-screen-infobar).moove-gdpr-dark-scheme .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton.moove-gdpr-infobar-reject-btn, #moove_gdpr_cookie_info_bar:not(.gdpr-full-screen-infobar).moove-gdpr-dark-scheme .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton.moove-gdpr-infobar-reject-btn { background-color: transparent; box-shadow: inset 0 0 0 1px currentColor; opacity: .7; color: #fff; } #moove_gdpr_cookie_info_bar:not(.gdpr-full-screen-infobar).moove-gdpr-dark-scheme .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton.moove-gdpr-infobar-reject-btn:hover, #moove_gdpr_cookie_info_bar:not(.gdpr-full-screen-infobar).moove-gdpr-dark-scheme .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton.moove-gdpr-infobar-reject-btn:hover { box-shadow: none; opacity: 1; color: #202020; background-color: #fff; } #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton.moove-gdpr-infobar-reject-btn, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton.moove-gdpr-infobar-reject-btn { background-color: ; color: ; } #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton.moove-gdpr-infobar-reject-btn:hover, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton.moove-gdpr-infobar-reject-btn:hover { color: ; background-color: ; } #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main div.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main h2.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main h3.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main span.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-left-content #moove-gdpr-menu li a, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-left-content #moove-gdpr-menu li button, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-left-content .moove-gdpr-branding-cnt a, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder a.mgbutton, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-modal-footer-content .moove-gdpr-button-holder button.mgbutton, #moove_gdpr_cookie_modal .cookie-switch .cookie-slider:after, #moove_gdpr_cookie_modal .cookie-switch .slider:after, #moove_gdpr_cookie_modal .switch .cookie-slider:after, #moove_gdpr_cookie_modal .switch .slider:after, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content p, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content p a, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content a.mgbutton, #moove_gdpr_cookie_info_bar .moove-gdpr-info-bar-container .moove-gdpr-info-bar-content button.mgbutton, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main .moove-gdpr-tab-main-content h1, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main .moove-gdpr-tab-main-content h2, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main .moove-gdpr-tab-main-content h3, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main .moove-gdpr-tab-main-content h4, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main .moove-gdpr-tab-main-content h5, #moove_gdpr_cookie_modal .moove-gdpr-modal-content .moove-gdpr-tab-main .moove-gdpr-tab-main-content h6, #moove_gdpr_cookie_modal .moove-gdpr-modal-content.moove_gdpr_modal_theme_v2 .moove-gdpr-modal-title .tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content.moove_gdpr_modal_theme_v2 .moove-gdpr-tab-main div.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content.moove_gdpr_modal_theme_v2 .moove-gdpr-tab-main h2.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content.moove_gdpr_modal_theme_v2 .moove-gdpr-tab-main h3.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content.moove_gdpr_modal_theme_v2 .moove-gdpr-tab-main span.tab-title, #moove_gdpr_cookie_modal .moove-gdpr-modal-content.moove_gdpr_modal_theme_v2 .moove-gdpr-branding-cnt a { font-weight: } moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); $wpml_lang = $gdpr_default_content->moove_gdpr_get_wpml_lang(); $buttons_order = isset( $modal_options['gdpr_bs_buttons_order'] ) ? json_decode( $modal_options['gdpr_bs_buttons_order'], true ) : array( 'accept', 'reject', 'settings', 'close' ); if ( isset( $modal_options['moove_gdpr_reject_button_enable'] ) && intval( $modal_options['moove_gdpr_reject_button_enable'] ) === 1 ) : $button_label = isset( $modal_options[ 'moove_gdpr_infobar_reject_button_label' . $wpml_lang ] ) && $modal_options[ 'moove_gdpr_infobar_reject_button_label' . $wpml_lang ] ? $modal_options[ 'moove_gdpr_infobar_reject_button_label' . $wpml_lang ] : __( 'Reject', 'gdpr-cookie-compliance' ); $button_class = apply_filters( 'gdpr_reject_button_class_extension', '' ); $button_order = in_array( 'reject', $buttons_order ) ? array_search( 'reject', $buttons_order ) : 'auto'; // phpcs:ignore ?> moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); $buttons_order = isset( $modal_options['gdpr_bs_buttons_order'] ) ? json_decode( $modal_options['gdpr_bs_buttons_order'], true ) : array( 'accept', 'reject', 'settings', 'close' ); if ( isset( $modal_options['moove_gdpr_close_button_enable'] ) && intval( $modal_options['moove_gdpr_close_button_enable'] ) === 1 ) : $button_order = in_array( 'close', $buttons_order ) ? array_search( 'close', $buttons_order ) : 'auto'; // phpcs:ignore ?> moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); if ( isset( $modal_options['moove_gdpr_close_button_enable'] ) && intval( $modal_options['moove_gdpr_close_button_enable'] ) === 1 ) : ?> moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); return $plugin_url; } /** * Lock screen of premium tabs, visible in the free version */ public function gdpr_premium_section_ads() { if ( class_exists( 'Moove_GDPR_Addon_View' ) ) : $slug = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : false; $licence_manager = new Moove_GDPR_License_Manager(); $add_on_slug = $licence_manager->get_add_on_plugin_slug(); $view_path = $add_on_slug ? WP_PLUGIN_DIR . '/' . plugin_dir_path( $add_on_slug ) . '/views/moove/admin/settings/' . $slug . '.php' : false; $view_content = $slug && $view_path ? file_exists( $view_path ) : false; if ( ! $view_content && $slug && 'help' !== $slug ) : ?>

.


.


moove_gdpr_get_key_name(); $gdpr_key = $gdpr_default_content->gdpr_get_activation_key( $option_key ); ?>


"" .


get_add_on_plugin_slug(); $view_path = $add_on_slug ? WP_PLUGIN_DIR . '/' . plugin_dir_path( $add_on_slug ) . '/views/moove/admin/settings/' . $slug . '.php' : false; $view_content = $slug && $view_path ? file_exists( $view_path ) : false; if ( ! $view_content ) : $return = $return; else : $return = ''; endif; endif; return $return; } /** * Clearing AJAX transient cache */ public function gdpr_remove_cached_scripts() { $gdpr_default_content = new Moove_GDPR_Content(); $wp_lang = $gdpr_default_content->moove_gdpr_get_wpml_lang(); $transient_key = 'gdpr_cookie_cache' . $wp_lang . MOOVE_GDPR_VERSION; delete_transient( $transient_key ); } /** * Register Front-end / Back-end scripts * * @return void */ public function moove_register_scripts() { if ( ! is_admin() ) : add_action( 'wp_enqueue_scripts', array( &$this, 'moove_frontend_gdpr_scripts' ), 999 ); endif; } /** * Register global variables to head, AJAX, Form validation messages * * @param string $ascript The registered script handle you are attaching the data for. * @return void */ public function moove_localize_script( $ascript ) { $gdpr_default_content = new Moove_GDPR_Content(); $option_name = $gdpr_default_content->moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); $force_reload = isset( $modal_options['gdpr_force_reload'] ) && intval( $modal_options['gdpr_force_reload'] ) >= 0 ? intval( $modal_options['gdpr_force_reload'] ) : apply_filters( 'gdpr_force_reload', false ); $force_reload = $force_reload ? 'true' : 'false'; $wpml_lang = $gdpr_default_content->moove_gdpr_get_wpml_lang(); $geo_location_enabled = apply_filters( 'gdpr_cc_geolocation_status', 'false', $modal_options ); $cookie_expiration = isset( $modal_options['moove_gdpr_consent_expiration'] ) && intval( $modal_options['moove_gdpr_consent_expiration'] ) >= 0 ? intval( $modal_options['moove_gdpr_consent_expiration'] ) : 365; $hide_save_btn = apply_filters( 'gdpr_keep_save_changes_button_visible', true ); $hide_save_btn = $hide_save_btn ? 'false' : 'true'; $close_button_v = true; $gdpr_gs_buttons_order = isset( $modal_options['gdpr_gs_buttons_order'] ) ? json_decode( $modal_options['gdpr_gs_buttons_order'], true ) : array( 'enable', 'reject', 'save', 'close' ); if ( is_array( $gdpr_gs_buttons_order ) && in_array( 'close', $gdpr_gs_buttons_order ) && isset( $modal_options['moove_gdpr_cb_close_button_enable'] ) && 0 === intval( $modal_options['moove_gdpr_cb_close_button_enable'] ) ) : // phpcs:ignore $close_button_v = false; endif; $close_btn_action = isset( $modal_options['gdpr_close_button_bhv'] ) && intval( $modal_options['gdpr_close_button_bhv'] ) ? intval( $modal_options['gdpr_close_button_bhv'] ) : 1; $close_btn_redirect = 4 === $close_btn_action && isset( $modal_options['gdpr_close_button_bhv_redirect'] ) && esc_url_raw( wp_unslash( $modal_options['gdpr_close_button_bhv_redirect'] ) ) ? esc_url_raw( wp_unslash( $modal_options['gdpr_close_button_bhv_redirect'] ) ) : ''; $close_btn_redirect = apply_filters( 'gdpr_close_btn_redirect', $close_btn_redirect, $modal_options ); $initalization_delay = isset( $modal_options['gdpr_initialization_delay'] ) && intval( $modal_options['gdpr_initialization_delay'] ) >= 0 ? intval( $modal_options['gdpr_initialization_delay'] ) : apply_filters( 'gdpr_init_script_delay', 2000 ); $cookie_removal_static = isset( $modal_options['gdpr_cookie_removal'] ) ? intval( $modal_options['gdpr_cookie_removal'] ) : ! apply_filters( 'gdpr_ajax_cookie_removal', false ); $cookie_removal_static = $cookie_removal_static ? 'false' : 'true'; $loc_data = array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'post_id' => get_the_ID(), 'plugin_dir' => apply_filters( 'gdpr_cdn_url', plugins_url( basename( dirname( __FILE__ ) ) ) ), 'show_icons' => apply_filters( 'gdpr_show_icons', 'all' ), 'is_page' => is_page(), 'ajax_cookie_removal' => $cookie_removal_static, 'strict_init' => 2, 'enabled_default' => array( 'strict' => isset( $modal_options['moove_gdpr_strictly_necessary_cookies_functionality'] ) && intval( $modal_options['moove_gdpr_strictly_necessary_cookies_functionality'] ) ? intval( $modal_options['moove_gdpr_strictly_necessary_cookies_functionality'] ) : 1, 'third_party' => isset( $modal_options['moove_gdpr_third_party_cookies_enable_first_visit'] ) && intval( $modal_options['moove_gdpr_third_party_cookies_enable_first_visit'] ) ? intval( $modal_options['moove_gdpr_third_party_cookies_enable_first_visit'] ) : 0, 'advanced' => isset( $modal_options['moove_gdpr_advanced_cookies_enable_first_visit'] ) && intval( $modal_options['moove_gdpr_advanced_cookies_enable_first_visit'] ) ? intval( $modal_options['moove_gdpr_advanced_cookies_enable_first_visit'] ) : 0, 'performance' => 0, 'preference' => 0, ), 'geo_location' => $geo_location_enabled, 'force_reload' => $force_reload, 'is_single' => is_single(), 'hide_save_btn' => $hide_save_btn, 'current_user' => get_current_user_id(), 'cookie_expiration' => apply_filters( 'gdpr_cookie_expiration_days', $cookie_expiration ), 'script_delay' => $initalization_delay, 'close_btn_action' => $close_btn_action, 'close_btn_rdr' => $close_btn_redirect, ); $ajax_script_handler = isset( $modal_options['script_insertion_method'] ) && intval( $modal_options['script_insertion_method'] ) >= 0 ? intval( $modal_options['script_insertion_method'] ) : apply_filters( 'gdpr_cc_prevent_ajax_script_inject', true ); if ( $ajax_script_handler ) : $gdpr_controller = new Moove_GDPR_Controller(); $loc_data['scripts_defined'] = $gdpr_controller->moove_gdpr_get_static_scripts(); endif; $cookie_attributes = apply_filters( 'gdpr_cookie_custom_attributes', false ); if ( $cookie_attributes ) : $loc_data['cookie_attributes'] = $cookie_attributes; endif; $store_cookie_on_reject = apply_filters( 'gdpr_cc_store_cookie_on_reject', true ); $loc_data['gdpr_scor'] = $store_cookie_on_reject ? 'true' : 'false'; $loc_data['wp_lang'] = $wpml_lang; $loc_data['parent_domain_cookies'] = Moove_GDPR_Controller::moove_gdpr_get_parent_domain_cookies(); // Which categories the Google consent signals follow, so a withdrawal can deny // them in the current page before it reloads. $loc_data['consent_signals'] = Moove_GDPR_Content::gdpr_consent_signal_categories(); $loc_data['wp_consent_api'] = 'false'; if ( class_exists( 'WP_CONSENT_API' ) ) : $loc_data['wp_consent_api'] = 'true'; /** * Keep the JavaScript consent type in step with the PHP one by reading it back * through the API rather than resolving our own filter a second time. * * Only emit a value the API recognises: wp_has_consent() in JavaScript treats an * empty consent type as "no consent manager present" and grants every category, * so a blank value here would be worse than staying silent. */ $gdpr_consent_type = function_exists( 'wp_get_consent_type' ) && function_exists( 'wp_validate_consent_type' ) ? wp_validate_consent_type( wp_get_consent_type() ) : false; if ( $gdpr_consent_type ) : wp_add_inline_script( $ascript, 'window.wp_consent_type = "' . esc_js( $gdpr_consent_type ) . '";', 'before' ); endif; endif; $loc_data['gdpr_nonce'] = wp_create_nonce( "gdpr-cookie-compliance" ); /** * When the "Accessibility" option is set to "Cookie Banner", focus is moved to the * banner once it becomes visible. The banner renders on `wp_footer`; main.js moves it * to the start of regardless of this option, so it is always first in reading order. */ $focus_banner = isset( $modal_options['gdpr_accesibility'] ) && 1 === intval( $modal_options['gdpr_accesibility'] ); $loc_data['gdpr_focus_cb'] = apply_filters( 'gdpr_cc_focus_cookie_banner', $focus_banner ) ? 'true' : 'false'; /* translators: %s: name of the strictly necessary cookie category, as set in the plugin settings. */ $loc_data['gdpr_a11y_strict_first'] = __( 'Turn on %s first to change this setting.', 'gdpr-cookie-compliance' ); $this->gdpr_loc_data = apply_filters( 'gdpr_extend_loc_data', $loc_data ); /** * With geo location on, the banner decision comes only from the * moove_gdpr_localize_scripts AJAX request. Older Premium Add-On versions * also made one while rendering the page; when the two disagreed, or the * AJAX request failed, cookies stayed enabled by default next to a visible * banner. Discard the render-time decision so the configured defaults apply. */ if ( 'true' === $geo_location_enabled && isset( $this->gdpr_loc_data['display_cookie_banner'] ) ) : unset( $this->gdpr_loc_data['display_cookie_banner'] ); $this->gdpr_loc_data['enabled_default'] = $loc_data['enabled_default']; endif; wp_localize_script( $ascript, 'moove_frontend_gdpr_scripts', $this->gdpr_loc_data ); if ( function_exists( 'gdpr_cookie_is_accepted' ) ) : // Read consent state client-side from the cookie to ensure correct values // even when the page is served from a full-page cache (e.g. Breeze, WP Super Cache). $inline_consent_js = 'var gdpr_c=document.cookie.match(/(?:^|;\\s*)moove_gdpr_popup=([^;]*)/);' . 'var gdpr_d=gdpr_c?JSON.parse(decodeURIComponent(gdpr_c[1])):{};' . 'var gdpr_consent__strict=gdpr_d.strict==="1"?"true":"false";' . 'var gdpr_consent__thirdparty=gdpr_d.thirdparty==="1"?"true":"false";' . 'var gdpr_consent__advanced=gdpr_d.advanced==="1"?"true":"false";' . 'var gdpr_consent__performance=gdpr_d.performance==="1"?"true":"false";' . 'var gdpr_consent__preference=gdpr_d.preference==="1"?"true":"false";' . 'var _cc=[];' . 'if(gdpr_d.strict==="1")_cc.push("strict");' . 'if(gdpr_d.thirdparty==="1")_cc.push("thirdparty");' . 'if(gdpr_d.advanced==="1")_cc.push("advanced");' . 'if(gdpr_d.performance==="1")_cc.push("performance");' . 'if(gdpr_d.preference==="1")_cc.push("preference");' . 'var gdpr_consent__cookies=_cc.join("|");'; wp_add_inline_script( $ascript, $inline_consent_js ); endif; } /** * Registe FRONT-END Javascripts and Styles * * @return void */ public function moove_frontend_gdpr_scripts() { $disable_main_assets = apply_filters( 'gdpr_disable_main_assets_enqueue', false ); if ( ! $disable_main_assets ) : $gdpr_deps = array( 'jquery' ); /** * The WP Consent API documents that the consent manager must declare a dependency * on its script. Without it we rely on enqueue order alone, and any plugin that * defers, delays or combines JavaScript can leave wp_set_consent() undefined at * the point the banner needs it. */ if ( class_exists( 'WP_CONSENT_API' ) ) : $gdpr_deps[] = 'wp-consent-api'; endif; $gdpr_deps = apply_filters( 'gdpr_main_script_depends_on', $gdpr_deps ); wp_enqueue_script( 'moove_gdpr_frontend', plugins_url( basename( dirname( __FILE__ ) ) ) . '/dist/scripts/main.js', $gdpr_deps, MOOVE_GDPR_VERSION, true ); $gdpr_default_content = new Moove_GDPR_Content(); $option_name = $gdpr_default_content->moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); $wpml_lang = $gdpr_default_content->moove_gdpr_get_wpml_lang(); $css_file = 'gdpr-main.css'; if ( isset( $modal_options['moove_gdpr_plugin_font_type'] ) ) : if ( '1' === $modal_options['moove_gdpr_plugin_font_type'] ) : $css_file = 'gdpr-main.css'; elseif ( '2' === $modal_options['moove_gdpr_plugin_font_type'] ) : $css_file = 'gdpr-main-nf.css'; else : $css_file = isset( $modal_options['moove_gdpr_plugin_font_family'] ) && $modal_options['moove_gdpr_plugin_font_family'] && false === strpos( strtolower( $modal_options['moove_gdpr_plugin_font_family'] ), 'nunito' ) ? 'gdpr-main-nf.css' : 'gdpr-main.css'; endif; endif; // Allow disabling the bundled Nunito web-font without touching the DB. // Usage: add_filter( 'gdpr_cc_load_nunito', '__return_false' ); if ( ! apply_filters( 'gdpr_cc_load_nunito', 'gdpr-main-nf.css' !== $css_file ) ) : $css_file = 'gdpr-main-nf.css'; endif; wp_enqueue_style( 'moove_gdpr_frontend', plugins_url( basename( dirname( __FILE__ ) ) ) . '/dist/styles/' . $css_file, '', MOOVE_GDPR_VERSION ); $this->moove_localize_script( 'moove_gdpr_frontend' ); endif; wp_add_inline_style( 'moove_gdpr_frontend', gdpr_get_module( 'branding-styles' ) ); } /** * Registe BACK-END Javascripts and Styles * * @return void */ public static function moove_gdpr_admin_scripts() { wp_enqueue_script( 'moove_gdpr_backend', plugins_url( basename( dirname( __FILE__ ) ) ) . '/dist/scripts/admin.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-slider', 'jquery-ui-draggable' ), MOOVE_GDPR_VERSION, true ); wp_enqueue_style( 'moove_gdpr_backend', plugins_url( basename( dirname( __FILE__ ) ) ) . '/dist/styles/admin.css', '', MOOVE_GDPR_VERSION ); } /** * Register AJAX actions for the plugin */ public function moove_register_ajax_actions() { add_action( 'wp_ajax_moove_gdpr_get_scripts', array( 'Moove_GDPR_Controller', 'moove_gdpr_get_scripts' ) ); add_action( 'wp_ajax_nopriv_moove_gdpr_get_scripts', array( 'Moove_GDPR_Controller', 'moove_gdpr_get_scripts' ) ); add_action( 'wp_ajax_moove_gdpr_localize_scripts', array( 'Moove_GDPR_Controller', 'moove_gdpr_localize_scripts' ) ); add_action( 'wp_ajax_nopriv_moove_gdpr_localize_scripts', array( 'Moove_GDPR_Controller', 'moove_gdpr_localize_scripts' ) ); add_action( 'wp_ajax_moove_gdpr_remove_php_cookies', array( 'Moove_GDPR_Controller', 'moove_gdpr_remove_php_cookies' ) ); add_action( 'wp_ajax_nopriv_moove_gdpr_remove_php_cookies', array( 'Moove_GDPR_Controller', 'moove_gdpr_remove_php_cookies' ) ); add_action( 'wp_ajax_moove_hide_language_notice', array( 'Moove_GDPR_Controller', 'moove_hide_language_notice' ) ); add_action( 'wp_ajax_moove_hide_update_notice', array( 'Moove_GDPR_Actions', 'moove_hide_update_notice' ) ); } /** * Hides the premium add-on's update notice, through the add-on's own handler. * * The handler used to be registered as array( 'Moove_GDPR_Updater', ... ), but up to * add-on 4.11.2 it is an instance method: PHP 8 refuses that call, so dismissing the * notice failed with a fatal error, and PHP 7.4 raised a deprecation notice. Such a * handler is called on an instance made without the constructor, which would register * the add-on's update hooks a second time; the handler does not use $this. */ public static function moove_hide_update_notice() { if ( ! method_exists( 'Moove_GDPR_Updater', 'moove_hide_update_notice' ) ) : return; endif; $handler = new ReflectionMethod( 'Moove_GDPR_Updater', 'moove_hide_update_notice' ); $handler->invoke( $handler->isStatic() ? null : ( new ReflectionClass( 'Moove_GDPR_Updater' ) )->newInstanceWithoutConstructor() ); } /** * GDPR Modal Footer Branding */ public function moove_gdpr_footer_branding_content() { $gdpr_default_content = new Moove_GDPR_Content(); $option_name = $gdpr_default_content->moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); $wpml_lang = $gdpr_default_content->moove_gdpr_get_wpml_lang(); $powered_label = ( isset( $modal_options[ 'moove_gdpr_modal_powered_by_label' . $wpml_lang ] ) && $modal_options[ 'moove_gdpr_modal_powered_by_label' . $wpml_lang ] ) ? $modal_options[ 'moove_gdpr_modal_powered_by_label' . $wpml_lang ] : 'Powered by'; $link_target = apply_filters( 'gdpr_branding_link_target', 'target="_blank"' ); ob_start(); ?> class='moove-gdpr-branding'>  __( 'Global Policy Control (GPC)', 'gdpr-cookie-compliance' ), 'slug' => 'global-policy-control', ), array( 'name' => __( 'Export/Import Settings', 'gdpr-cookie-compliance' ), 'slug' => 'export-import', ), array( 'name' => __( 'Multisite Settings', 'gdpr-cookie-compliance' ), 'slug' => 'multisite-settings', ), array( 'name' => __( 'Accept on Scroll / Hide timer', 'gdpr-cookie-compliance' ), 'slug' => 'accept-on-scroll', ), array( 'name' => __( 'Full-screen / Cookiewall', 'gdpr-cookie-compliance' ), 'slug' => 'full-screen-mode', ), array( 'name' => __( 'Analytics', 'gdpr-cookie-compliance' ), 'slug' => 'stats', ), array( 'name' => __( 'Geo Location', 'gdpr-cookie-compliance' ), 'slug' => 'geo-location', ), array( 'name' => __( 'Hide Cookie Banner', 'gdpr-cookie-compliance' ), 'slug' => 'cookie-banner-manager', ), array( 'name' => __( 'Iframe Blocker', 'gdpr-cookie-compliance' ), 'slug' => 'iframe-blocker', ), array( 'name' => __( 'Cookie Declaration', 'gdpr-cookie-compliance' ), 'slug' => 'cookie-declaration', ), array( 'name' => __( 'Consent Log', 'gdpr-cookie-compliance' ), 'slug' => 'consent-log', ), array( 'name' => __( 'Renew Consent', 'gdpr-cookie-compliance' ), 'slug' => 'renew-consent', ), ); foreach ( $tab_data as $tab ) : ob_start(); ?> moove_gdpr_get_option_name(); $modal_options = get_option( $option_name ); $wpml_lang = $gdpr_default_content->moove_gdpr_get_wpml_lang( 'label' ); $tab_data = array( array( 'name' => isset( $modal_options[ 'moove_gdpr_performance_ccat_tab_title' . $wpml_lang ] ) && $modal_options[ 'moove_gdpr_performance_ccat_tab_title' . $wpml_lang ] ? $modal_options[ 'moove_gdpr_performance_ccat_tab_title' . $wpml_lang ] : __( 'Performance', 'gdpr-cookie-compliance' ), 'slug' => 'performance-cookie-cat', ), array( 'name' => isset( $modal_options[ 'moove_gdpr_preference_ccat_tab_title' . $wpml_lang ] ) && $modal_options[ 'moove_gdpr_preference_ccat_tab_title' . $wpml_lang ] ? $modal_options[ 'moove_gdpr_preference_ccat_tab_title' . $wpml_lang ] : __( 'Preference', 'gdpr-cookie-compliance' ), 'slug' => 'preferences-cookie-cat', ), ); foreach ( $tab_data as $tab ) : ob_start(); ?>