array( 'title' => esc_html__( 'Documentation', 'gdpr-cookie-compliance' ), 'slug' => 'help', ), 'video-tutorial' => array( 'title' => esc_html__( 'Video Tutorial', 'gdpr-cookie-compliance' ), 'slug' => 'video-tutorial', ), 'support' => array( 'title' => esc_html__( 'Support', 'gdpr-cookie-compliance' ), 'slug' => 'support', ), 'licence' => array( 'title' => '' . esc_html__( 'Licence Manager', 'gdpr-cookie-compliance' ) . '', 'slug' => 'licence', ), ); $plugin_tabs = apply_filters( 'gdpr_admin_sidebar_nav_links', $plugin_tabs ); return $plugin_tabs; } endif; if ( ! function_exists( 'gdpr_shortcode_settings' ) ) : add_action('init', 'gdpr_shortcode_settings_register' ); function gdpr_shortcode_settings_register(){ add_shortcode( 'setting', 'gdpr_shortcode_settings' ); } function gdpr_shortcode_settings( $atts ) { return 'setting'; } endif; if ( ! function_exists( 'gdpr_get_site_id' ) ) : /** * Returns the current blog id as site_id */ function gdpr_get_site_id() { return function_exists( 'get_current_blog_id' ) ? get_current_blog_id() : 1; } endif; if ( ! function_exists( 'gdpr_get_integration_modules' ) ) : /** * Integration Modules Loading * * @param array $gdpr_options Plugin options. * @param array $gdin_values Integration modules. * @return array $extended integration modules */ function gdpr_get_integration_modules( $gdpr_options, $gdin_values ) { $integration_modules = array( 'ga4' => array( 'name' => 'Google Analytics 4', 'desc' => '', 'cookie_cat' => isset( $gdin_values['ga4'] ) ? intval( $gdin_values['ga4'] ) : 2, 'tacking_id' => isset( $gdin_values['ga4_id'] ) ? $gdin_values['ga4_id'] : '', 'id_format' => 'G-XXXXXXX', 'atts' => array( 'toggle' => true, 'input' => '', ), 'status' => isset( $gdin_values['ga4'] ), ), 'gtm' => array( 'name' => 'Google Tag Manager', 'desc' => 'Standard implementation', 'cookie_cat' => isset( $gdin_values['gtm'] ) ? intval( $gdin_values['gtm'] ) : 2, 'tacking_id' => isset( $gdin_values['gtm_id'] ) ? $gdin_values['gtm_id'] : '', 'id_format' => 'GTM-XXXXXX or G-XXXXXXX', 'atts' => array( 'toggle' => true, 'input' => '', ), 'status' => isset( $gdin_values['gtm'] ), ), 'gtmc2' => array( 'name' => 'Google Tag Manager', 'desc' => 'Consent Mode v2 [for advanced users only]', 'cookie_cat' => isset( $gdin_values['gtmc2'] ) ? intval( $gdin_values['gtmc2'] ) : 2, 'tacking_id' => isset( $gdin_values['gtmc2_id'] ) ? $gdin_values['gtmc2_id'] : '', 'id_format' => 'GTM-XXXXXX or G-XXXXXXX', 'atts' => array( 'toggle' => true, 'input' => '', ), 'status' => isset( $gdin_values['gtmc2'] ), ), 'gadc' => array( 'name' => 'Google Ads', 'desc' => '', 'cookie_cat' => isset( $gdin_values['gadc'] ) ? intval( $gdin_values['gadc'] ) : 2, 'tacking_id' => isset( $gdin_values['gadc_id'] ) ? $gdin_values['gadc_id'] : '', 'id_format' => 'AW-123456789', 'atts' => array( 'toggle' => true, 'input' => '', ), 'status' => isset( $gdin_values['gadc'] ), ), 'fbp' => array( 'name' => 'Meta Pixel', 'desc' => '(Formerly Facebook Pixel)', 'cookie_cat' => isset( $gdin_values['fbp'] ) ? intval( $gdin_values['fbp'] ) : 2, 'tacking_id' => isset( $gdin_values['fbp_id'] ) ? $gdin_values['fbp_id'] : '', 'id_format' => '[15 digit ID]', 'atts' => array( 'toggle' => true, 'input' => '', ), 'status' => isset( $gdin_values['fbp'] ), ), 'muet' => array( 'name' => 'Microsoft Advertising (UET)', 'desc' => 'Universal Event Tracking', 'cookie_cat' => isset( $gdin_values['muet'] ) ? intval( $gdin_values['muet'] ) : 2, 'tacking_id' => isset( $gdin_values['muet_id'] ) ? $gdin_values['muet_id'] : '', 'id_format' => 'xxxxxxxx', 'atts' => array( 'toggle' => true, 'input' => '', ), 'status' => isset( $gdin_values['muet'] ), ), 'clarity' => array( 'name' => 'Microsoft Clarity', 'desc' => 'Consent API v2 [requires Consent Mode enabled in the Clarity project]', 'cookie_cat' => isset( $gdin_values['clarity'] ) ? intval( $gdin_values['clarity'] ) : 2, 'tacking_id' => isset( $gdin_values['clarity_id'] ) ? $gdin_values['clarity_id'] : '', 'id_format' => '[10 character project ID]', 'atts' => array( 'toggle' => true, 'input' => '', ), 'status' => isset( $gdin_values['clarity'] ), ), ); $integration_modules = apply_filters( 'gdpr_integration_modules', $integration_modules, $gdpr_options, $gdin_values ); $integration_modules = is_array( $integration_modules ) ? $integration_modules : array(); /** * Normalise the module type. * * 'snippet' modules inject a tracking script once the visitor accepts the * mapped cookie category. 'blocker' modules do the opposite: the script is * emitted by another plugin or the theme, and we suppress it until consent * is given. Blocker modules have no tracking ID. */ foreach ( $integration_modules as $_gdin_slug => $_gdin_module ) : if ( ! isset( $integration_modules[ $_gdin_slug ]['type'] ) ) : $integration_modules[ $_gdin_slug ]['type'] = 'snippet'; endif; if ( ! isset( $integration_modules[ $_gdin_slug ]['premium'] ) ) : $integration_modules[ $_gdin_slug ]['premium'] = false; endif; // A module that registered itself is, by definition, usable. $integration_modules[ $_gdin_slug ]['available'] = true; endforeach; /** * Advertise premium modules the add-on would have registered. * * Only slugs the add-on did not register are added, so an active licence always * wins over the teaser. These rows are rendered locked and are never saved. */ foreach ( gdpr_get_premium_integration_teasers() as $_gdin_slug => $_gdin_teaser ) : if ( isset( $integration_modules[ $_gdin_slug ] ) ) : $integration_modules[ $_gdin_slug ]['premium'] = true; continue; endif; $integration_modules[ $_gdin_slug ] = array_merge( array( 'name' => '', 'desc' => '', 'type' => 'snippet', 'cookie_cat' => 2, 'tacking_id' => '', 'id_format' => '', 'atts' => array( 'toggle' => true, 'input' => 'disabled', ), 'status' => false, 'premium' => true, 'available' => false, ), $_gdin_teaser ); endforeach; return $integration_modules; } endif; if ( ! function_exists( 'gdpr_get_premium_integration_teasers' ) ) : /** * Premium-only integration modules, shown locked when the add-on is not active. * * Kept deliberately minimal - name and description only. The add-on owns the real * definition; this exists purely so the free plugin can advertise it. * * @return array */ function gdpr_get_premium_integration_teasers() { $teasers = array( 'recaptcha' => array( 'name' => 'Google reCAPTCHA', 'desc' => __( 'Blocks reCAPTCHA until the visitor accepts the selected category', 'gdpr-cookie-compliance' ), 'type' => 'blocker', ), ); return apply_filters( 'gdpr_premium_integration_teasers', $teasers ); } endif; if ( ! function_exists( 'gdpr_get_premium_upgrade_url' ) ) : /** * Where the locked premium rows send the site owner. * * @return string */ function gdpr_get_premium_upgrade_url() { return apply_filters( 'gdpr_premium_upgrade_url', 'https://www.mooveagency.com/wordpress-plugins/gdpr-cookie-compliance/' ); } endif; if ( ! function_exists( 'gdpr_integration_module_badge' ) ) : /** * Premium badge markup for an integration row. * * Shared by the global and the language specific integration tables so the two * cannot drift apart. * * @param array $gdin_module Integration module. * @return string Escaped markup, or an empty string for free modules. */ function gdpr_integration_module_badge( $gdin_module ) { if ( empty( $gdin_module['premium'] ) ) : return ''; endif; $locked = empty( $gdin_module['available'] ); $class = 'gdpr-premium-badge' . ( $locked ? ' gdpr-premium-badge-locked' : '' ); return ' ' . esc_html__( 'Premium', 'gdpr-cookie-compliance' ) . ''; } endif; if ( ! function_exists( 'gdpr_integration_module_needs_id' ) ) : /** * Whether an integration module requires a tracking ID to be stored. * * @param array $gdin_module Integration module. * @return bool */ function gdpr_integration_module_needs_id( $gdin_module ) { $type = isset( $gdin_module['type'] ) ? $gdin_module['type'] : 'snippet'; return 'blocker' !== $type; } endif; if ( ! function_exists( 'gdpr_get_cookie_cat_slug' ) ) : /** * Map a stored cookie category ID onto its consent cookie key. * * The IDs come from the category