Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,439 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
class cmplz_integrations {
|
||||
private static $_this;
|
||||
|
||||
function __construct() {
|
||||
if ( isset( self::$_this ) ) {
|
||||
wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.', get_class( $this ) ) );
|
||||
}
|
||||
self::$_this = $this;
|
||||
|
||||
add_filter( "cmplz_do_action", array( $this, 'integrations_data' ), 10, 3 );
|
||||
add_filter( "cmplz_warning_types", array( $this, 'notify_of_plugin_integrations' ), 10, 3 );
|
||||
add_action( "cmplz_after_save_field", array( $this, 'sync_services' ), 10, 4 );
|
||||
add_filter( 'cmplz_default_value', array($this, 'set_default'), 10, 3 );
|
||||
}
|
||||
|
||||
static function this() {
|
||||
return self::$_this;
|
||||
}
|
||||
|
||||
public function headers(){
|
||||
return function_exists('rsssl_get_option') && rsssl_get_option('hsts') &&
|
||||
rsssl_get_option('x_frame_options')!=='disabled' &&
|
||||
rsssl_get_option('x_content_type_options') &&
|
||||
rsssl_get_option('x_xss_protection')!=='disabled' &&
|
||||
rsssl_get_option('referrer_policy')==='strict-origin-when-cross-origin';
|
||||
}
|
||||
|
||||
public function hardening(){
|
||||
return function_exists('rsssl_get_option') &&
|
||||
rsssl_get_option('disable_file_editing') &&
|
||||
rsssl_get_option('block_code_execution_uploads') &&
|
||||
rsssl_get_option('hide_wordpress_version') &&
|
||||
rsssl_get_option('disable_login_feedback') &&
|
||||
rsssl_get_option('disable_indexing') &&
|
||||
rsssl_get_option('disable_user_enumeration');
|
||||
}
|
||||
|
||||
public function set_default( $value, $fieldname, $field ) {
|
||||
if ( function_exists( 'rsssl_get_option' ) && $fieldname === 'which_personal_data_secure' ) {
|
||||
if ( !is_array($value)) $value = array();
|
||||
if ( ! isset( $value['6'] ) && rsssl_get_option( 'enable_vulnerability_scanner' ) ) {
|
||||
$value[] = '6';
|
||||
}
|
||||
|
||||
if ( ! isset( $value['4'] ) && $this->headers() ) {
|
||||
$value[] = '4';
|
||||
}
|
||||
|
||||
if ( ! isset( $value['5'] ) && $this->hardening() ) {
|
||||
$value[] = '5';
|
||||
}
|
||||
|
||||
if ( ! isset( $value['3'] ) && rsssl_get_option( 'ssl_enabled' ) ) {
|
||||
$value[] = '3';
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep services in the settings in sync with services in the database
|
||||
* @return void
|
||||
*/
|
||||
public function sync_services($fieldname, $fieldvalue, $prev_value, $type) {
|
||||
if ( !cmplz_user_can_manage() ) {
|
||||
return;
|
||||
}
|
||||
if ($fieldname==='uses_thirdparty_services' || $fieldname==='thirdparty_services_on_site') {
|
||||
$thirdparty_services = COMPLIANZ::$config->thirdparty_services;
|
||||
foreach ( $thirdparty_services as $service => $label ) {
|
||||
$service_obj = new CMPLZ_SERVICE($service);
|
||||
if ( cmplz_uses_thirdparty($service) ) {
|
||||
if (!$service_obj->ID ) {
|
||||
$service_obj->add( $label, COMPLIANZ::$banner_loader->get_supported_languages(), false, 'utility' );
|
||||
}
|
||||
} else if ($service_obj) {
|
||||
$service_obj->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($fieldname==='uses_social_media' || $fieldname==='socialmedia_on_site') {
|
||||
$socialmedia = COMPLIANZ::$config->thirdparty_socialmedia;
|
||||
foreach ( $socialmedia as $service => $label ) {
|
||||
$service_obj = new CMPLZ_SERVICE( $service );
|
||||
if ( cmplz_uses_thirdparty( $service ) ) {
|
||||
if (!$service_obj->ID ){
|
||||
$service_obj->add( $label, COMPLIANZ::$banner_loader->get_supported_languages(), false, 'social' );
|
||||
}
|
||||
} else if ( $service_obj ) {
|
||||
$service_obj->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle rest api integration updates
|
||||
* @return array
|
||||
*/
|
||||
public function integrations_data( $data, $action, $request ) {
|
||||
if (!cmplz_user_can_manage()) {
|
||||
return $data;
|
||||
}
|
||||
if ( $action === 'get_integrations_data' ) {
|
||||
$blocked_scripts = array_keys(COMPLIANZ::$cookie_blocker->blocked_scripts());
|
||||
//create a key => key array from the $blocked_scripts array
|
||||
$blocked_scripts = array_combine($blocked_scripts, $blocked_scripts);
|
||||
$data = [
|
||||
'plugins' => $this->get_plugins(),
|
||||
'services' => $this->get_services(),
|
||||
'scripts' => $this->get_scripts(),
|
||||
'placeholders' => COMPLIANZ::$config->placeholders,
|
||||
'blocked_scripts' => $blocked_scripts,
|
||||
];
|
||||
} else if ( $action === 'update_placeholder_status' ) {
|
||||
$data = $request->get_json_params();
|
||||
$id = isset($data['id']) ? sanitize_title($data['id']) : '';
|
||||
$enabled = $data['enabled'] ?? false;
|
||||
$disabled_placeholders = get_option( 'cmplz_disabled_placeholders', array() );
|
||||
if ( $enabled ) {
|
||||
$key = array_search( $id, $disabled_placeholders, true );
|
||||
if ( $key !== false ) {
|
||||
unset( $disabled_placeholders[ $key ] );
|
||||
}
|
||||
} else if ( ! in_array( $id, $disabled_placeholders, true ) ) {
|
||||
$disabled_placeholders[] = $id;
|
||||
}
|
||||
update_option( 'cmplz_disabled_placeholders', $disabled_placeholders );
|
||||
$data = [
|
||||
'success' => true,
|
||||
];
|
||||
} else if ( $action === 'update_plugin_status' ){
|
||||
$data = $request->get_json_params('plugin');
|
||||
$plugin = isset($data['plugin']) ? sanitize_title($data['plugin']) : '';
|
||||
$enabled = $data['enabled'] ?? false;
|
||||
$plugins = get_option( 'complianz_options_integrations', [] );
|
||||
$plugins[ $plugin ] = (bool) $enabled;
|
||||
update_option( 'complianz_options_integrations', $plugins );
|
||||
$data = [
|
||||
'success' => true,
|
||||
];
|
||||
} else if ( $action === 'update_scripts') {
|
||||
$data = $request->get_json_params('plugin');
|
||||
|
||||
//clear blocked scripts transient on edits.
|
||||
cmplz_delete_transient('cmplz_blocked_scripts');
|
||||
|
||||
$scripts = $data['scripts'] ?? [];
|
||||
$scripts = $this->parse_args($scripts);
|
||||
$scripts = $this->sanitize_scripts($scripts);
|
||||
update_option( 'complianz_options_custom-scripts', $scripts );
|
||||
} else if ( $action === 'get_security_measures_data' ) {
|
||||
$is_7 = defined('rsssl_version') && version_compare( rsssl_version,'7','>=' ) ? true : false;
|
||||
$measures = [];
|
||||
$measures[] = [
|
||||
'id' => 'vulnerability_detection',
|
||||
'enabled' => $is_7 && rsssl_get_option('enable_vulnerability_scanner')
|
||||
];
|
||||
$measures[] = [
|
||||
'id' => 'recommended_headers',
|
||||
'enabled' => $this->headers(),
|
||||
];
|
||||
|
||||
$measures[] = [
|
||||
'id' => 'ssl',
|
||||
'enabled' => $is_7 && rsssl_get_option('ssl_enabled'),
|
||||
];
|
||||
|
||||
$measures[] = [
|
||||
'id' => 'hardening',
|
||||
'enabled' => $this->hardening(),
|
||||
];
|
||||
|
||||
$data = [
|
||||
'measures' => $measures,
|
||||
'has_7' => $is_7,
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
||||
private function get_scripts() : array {
|
||||
$scripts = get_option("complianz_options_custom-scripts", [] );
|
||||
return $this->parse_args($scripts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function parse_args($scripts){
|
||||
$defaults_block_script = [
|
||||
'enable' => 1,
|
||||
'name' => '',
|
||||
'urls' => [],
|
||||
'category' => 'marketing',
|
||||
'enable_placeholder' => false,
|
||||
'iframe' => false,
|
||||
'placeholder_class' => '',
|
||||
'placeholder' => '',
|
||||
'enable_dependency' => '',
|
||||
'dependency' => [],//maps.google.com => cmplz_divi_init_map
|
||||
];
|
||||
$defaults_add_script = [
|
||||
'enable' => 1,
|
||||
'name' => '',
|
||||
'urls' => [],
|
||||
'category' => 'marketing',
|
||||
'enable_placeholder' => false,
|
||||
'iframe' => false,
|
||||
'placeholder_class' => '',
|
||||
'placeholder' => '',
|
||||
'editor' => '',
|
||||
'async' => '',
|
||||
];
|
||||
$defaults_whitelist_script = [
|
||||
'enable' => 1,
|
||||
'name' => '',
|
||||
'urls' => [],
|
||||
];
|
||||
$defaults = [
|
||||
'block_script' => [],
|
||||
'add_script' => [],
|
||||
'whitelist_script' => [],
|
||||
];
|
||||
|
||||
$default_values_add_script = array(
|
||||
array(
|
||||
'name' => __("Example", 'complianz-gdpr'),
|
||||
'editor' => 'console.log("fire marketing script")',
|
||||
'async' => '0',
|
||||
'category' => 'marketing',
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'your-css-class',
|
||||
'placeholder' => 'default',
|
||||
'enable' => '0',
|
||||
),
|
||||
);
|
||||
|
||||
$default_values_block_script = array(
|
||||
array(
|
||||
'name' => __("Example", 'complianz-gdpr'),
|
||||
'urls' => array('https://block-example.com'),
|
||||
'category' => 'marketing',
|
||||
'enable_placeholder' => '1',
|
||||
'iframe' => '1',
|
||||
'placeholder_class' => 'your-css-class',
|
||||
'placeholder' => 'default',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => array(),
|
||||
'enable' => '0',
|
||||
),
|
||||
);
|
||||
|
||||
$default_values_whitelist_script = array(
|
||||
array(
|
||||
'name' => __("Example", 'complianz-gdpr'),
|
||||
'urls' => array('https://block-example.com'),
|
||||
'enable' => '0',
|
||||
),
|
||||
);
|
||||
|
||||
$scripts = wp_parse_args( $scripts, $defaults );
|
||||
foreach ( $scripts as $type => $script ) {
|
||||
if ( empty( $script ) ) {
|
||||
$scripts[ $type ] = ${"default_values_$type"};
|
||||
}
|
||||
foreach ( $script as $key => $value ) {
|
||||
$scripts[ $type ][ $key ] = wp_parse_args( $value, ${"defaults_$type"} );
|
||||
//drop id
|
||||
unset($scripts[ $type ][ $key ]['id']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $scripts as $type => $scripts_array ) {
|
||||
//ensure that the keys in $scripts_array start at 0, and are sequential
|
||||
$scripts_array = array_values($scripts_array);
|
||||
$scripts[ $type ] = $scripts_array;
|
||||
}
|
||||
return $scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize scripts
|
||||
* @param array $scripts
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sanitize_scripts($scripts): array {
|
||||
foreach ( $scripts as $type => $script ) {
|
||||
if ( ! is_array( $script ) ) {
|
||||
$scripts[ $type ] = [];
|
||||
}
|
||||
foreach ( $script as $key => $value ) {
|
||||
$scripts[ $type ][ $key ]['name'] = sanitize_text_field( $value['name'] );
|
||||
$scripts[ $type ][ $key ]['enable'] = (bool) $value['enable'];
|
||||
|
||||
if (isset($value['placeholder_class']) ) $scripts[ $type ][ $key ]['placeholder_class'] = sanitize_text_field( $value['placeholder_class'] );
|
||||
if (isset($value['placeholder']) ) $scripts[ $type ][ $key ]['placeholder'] = sanitize_text_field( $value['placeholder'] );
|
||||
if (isset($value['urls']) ) $scripts[ $type ][ $key ]['urls'] = array_map( function ( $url ) {
|
||||
return sanitize_text_field( $url );
|
||||
}, $value['urls'] );
|
||||
if (isset($value['dependency']) ) $scripts[ $type ][ $key ]['dependency'] = array_map( function ( $url ) {
|
||||
return sanitize_text_field( $url );
|
||||
}, $value['dependency'] );
|
||||
if (isset($value['category']) ) $scripts[ $type ][ $key ]['category'] = cmplz_sanitize_category( $value['category'] );
|
||||
if (isset($value['enable_placeholder']) ) $scripts[ $type ][ $key ]['enable_placeholder'] = (bool) $value['enable_placeholder'];
|
||||
if (isset($value['iframe']) ) $scripts[ $type ][ $key ]['iframe'] = (bool) $value['iframe'];
|
||||
if (isset($value['enable_dependency']) ) $scripts[ $type ][ $key ]['enable_dependency'] = (bool) $value['enable_dependency'];
|
||||
|
||||
if (isset($value['editor']) ) $scripts[ $type ][ $key ]['editor'] = $value['editor'];
|
||||
if (isset($value['async']) ) $scripts[ $type ][ $key ]['async'] = (bool) $value['async'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $scripts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of plugins
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_plugins(): array {
|
||||
$plugins = [];
|
||||
if (!cmplz_user_can_manage()) {
|
||||
return $plugins;
|
||||
}
|
||||
global $cmplz_integrations_list;
|
||||
foreach ( $cmplz_integrations_list as $plugin => $details ) {
|
||||
$file = apply_filters( 'cmplz_integration_path', cmplz_path . "integrations/plugins/$plugin.php", $plugin );
|
||||
if ( file_exists( $file ) && cmplz_integration_plugin_is_active( $plugin ) ) {
|
||||
$plugins[] = [
|
||||
'id' => $plugin,
|
||||
'label' => $details['label'],
|
||||
'enabled' => cmplz_integration_plugin_is_enabled($plugin),
|
||||
'placeholder' => $this->get_placeholder_status($plugin),
|
||||
];
|
||||
}
|
||||
}
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of services active on the site
|
||||
* @return array[]
|
||||
*/
|
||||
private function get_services(){
|
||||
if (!cmplz_user_can_manage()) {
|
||||
return [];
|
||||
}
|
||||
$services = [
|
||||
[
|
||||
'id' => 'advertising',
|
||||
'label' => __('Advertising', 'complianz-gdpr'),
|
||||
'source' => 'uses_ad_cookies',
|
||||
'placeholder' => 'none',
|
||||
],
|
||||
];
|
||||
|
||||
$thirdparty_services = COMPLIANZ::$config->thirdparty_services;
|
||||
foreach ( $thirdparty_services as $service => $label ) {
|
||||
|
||||
$services[] = [
|
||||
'id' => $service,
|
||||
'label' => $label,
|
||||
'source' => 'thirdparty_services_on_site',
|
||||
'placeholder' => $this->get_placeholder_status($service),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
$socialmedia = COMPLIANZ::$config->thirdparty_socialmedia;
|
||||
foreach ( $socialmedia as $service => $label ) {
|
||||
$services[] = [
|
||||
'id' => $service,
|
||||
'label' => $label,
|
||||
'source' => 'socialmedia_on_site',
|
||||
'placeholder' => $this->get_placeholder_status($service),
|
||||
];
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status of a placeholder
|
||||
*
|
||||
* @param string $service
|
||||
*
|
||||
* @return string //none, disabled, enabled
|
||||
*/
|
||||
private function get_placeholder_status( string $service): string {
|
||||
if ( !$this->has_placeholder($service) ) {
|
||||
return 'none';
|
||||
}
|
||||
|
||||
$disabled_placeholders = get_option( 'cmplz_disabled_placeholders', array() );
|
||||
if ( in_array( $service, $disabled_placeholders ) ) {
|
||||
return 'disabled';
|
||||
}
|
||||
return 'enabled';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a service or plugin has a placeholder
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function has_placeholder( string $name): bool {
|
||||
$_name = str_replace('-', '_', $name);
|
||||
return function_exists( "cmplz_{$name}_placeholder") || function_exists( "cmplz_{$_name}_placeholder" );
|
||||
}
|
||||
|
||||
public function notify_of_plugin_integrations( $warnings ){
|
||||
$plugins = $this->get_plugins();
|
||||
foreach ($plugins as $plugin ) {
|
||||
if ( !$plugin['enabled']) continue;
|
||||
$warnings['integration_enabled'] = array(
|
||||
'open' => __('We have enabled integrations for plugins and services, please double-check your configuration.', 'complianz-gdpr' ),
|
||||
'url' => 'https://complianz.io/enabled-integration/',
|
||||
'include_in_progress' => false,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return $warnings;
|
||||
}
|
||||
|
||||
}
|
||||
$integrations = new cmplz_integrations();
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
function cmplz_consent_box_required_on_form() {
|
||||
$contact = cmplz_forms_used_on_sites();
|
||||
$permission_needed = ( cmplz_get_option( 'contact_processing_data_lawfull' )
|
||||
=== '1' ) ? true : false;
|
||||
|
||||
return ( $contact && $permission_needed );
|
||||
}
|
||||
|
||||
function cmplz_forms_used_on_sites() {
|
||||
$purpose = cmplz_get_option( 'purpose_personaldata' );
|
||||
if ( isset( $purpose['contact'] ) && $purpose['contact'] == 1 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function cmplz_site_uses_contact_forms() {
|
||||
if ( get_option( 'cmplz_detected_forms' )
|
||||
&& is_array( get_option( 'cmplz_detected_forms' ) )
|
||||
&& count( get_option( 'cmplz_detected_forms' ) ) > 0
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do stuff after a page from the wizard is saved.
|
||||
*
|
||||
* */
|
||||
|
||||
function cmplz_forms_maybe_add_consent_checkbox() {
|
||||
//preload form options. Otherwise we could get conflicts with custom form fields
|
||||
$preload_forms = apply_filters( 'cmplz_get_forms', array() );
|
||||
update_option( 'cmplz_detected_forms', $preload_forms, false );
|
||||
|
||||
$forms = cmplz_get_option( 'add_consent_to_forms' );
|
||||
if ( ! $forms || ! is_array( $forms ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$forms = array_filter( $forms, function ( $el ) {
|
||||
return ( $el == 1 );
|
||||
} );
|
||||
foreach ( $forms as $form_id => $checked ) {
|
||||
$type = cmplz_get_form_type( $form_id );
|
||||
do_action( "cmplz_add_consent_box_$type", $form_id );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'cmplz_wizard_wizard', 'cmplz_forms_maybe_add_consent_checkbox', 10, 1 );
|
||||
|
||||
|
||||
/**
|
||||
* Get the type of a saved form
|
||||
*
|
||||
* @param $form_id
|
||||
*
|
||||
* @return bool|int;
|
||||
*/
|
||||
|
||||
function cmplz_get_form_type( $form_id ) {
|
||||
$form_types = apply_filters( 'cmplz_form_types', array() );
|
||||
foreach ( $form_types as $key => $type ) {
|
||||
if ( strpos( $form_id, $key ) !== false ) {
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Silence is golden.
|
||||
@@ -0,0 +1,896 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
if ( cmplz_admin_logged_in() ) {
|
||||
require_once( 'admin/integrations.php' );
|
||||
}
|
||||
require_once( trailingslashit(cmplz_path) . 'integrations/forms.php' );
|
||||
|
||||
global $cmplz_integrations_list;
|
||||
$cmplz_integrations_list = apply_filters( 'cmplz_integrations', array(
|
||||
'advanced-nocaptcha-recaptcha' => array(
|
||||
'constant_or_function' => 'ANR_PLUGIN_VERSION',
|
||||
'label' => 'Advanced noCaptcha & invisible Captcha',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'advanced-ads' => array(
|
||||
'constant_or_function' => 'ADVADS_VERSION',
|
||||
'label' => 'Advanced Ads',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
// 'hcaptcha' => array(
|
||||
// 'constant_or_function' => 'HCAPTCHA_VERSION',
|
||||
// 'label' => 'hCaptcha for WordPress',
|
||||
// 'firstparty_marketing' => false,
|
||||
// ),
|
||||
|
||||
|
||||
'wp-consent-api' => array(
|
||||
'constant_or_function' => 'WP_CONSENT_API_VERSION',
|
||||
'label' => 'WP Consent API',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'omnisend' => array(
|
||||
'constant_or_function' => 'OMNISEND_SETTINGS_PAGE',
|
||||
'label' => 'Email Marketing for WooCommerce by Omnisend',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'bb-powerpack' => array(
|
||||
'constant_or_function' => 'BB_PowerPack',
|
||||
'label' => 'Beaver Builder Power Pack',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'content-views-plugin' => array(
|
||||
'constant_or_function' => 'PT_CV_VERSION',
|
||||
'label' => 'Content Views – Post Grid & Filter for WordPress',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'divi' => array(
|
||||
'constant_or_function' => 'Divi',
|
||||
'label' => 'Divi',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'divi-plugin' => array(
|
||||
'constant_or_function' => 'ET_BUILDER_PLUGIN_DIR',
|
||||
'label' => 'Divi Plugin',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'agile-store-locator' => array(
|
||||
'constant_or_function' => 'ASL_PLUGIN_PATH',
|
||||
'label' => 'Agile Store Locator',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'lead-forensics' => array(
|
||||
'constant_or_function' => 'LFRTrackingCode',
|
||||
'label' => 'Lead Forensics',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'mailchimp-woocommerce' => array(
|
||||
'constant_or_function' => 'MAILCHIMP_WOOCOMMERCE_NEWSLETTER_VERSION',
|
||||
'label' => 'Mailchimp for Woocommerce',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'burst-statistics' => array(
|
||||
'constant_or_function' => 'burst_version',
|
||||
'label' => 'Burst Statistics',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'beaver-builder' => array(
|
||||
'constant_or_function' => 'FL_BUILDER_VERSION',
|
||||
'label' => 'Beaver Builder',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'theeventscalendar' => array(
|
||||
'constant_or_function' => 'TRIBE_EVENTS_FILE',
|
||||
'label' => 'The Events Calendar',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'themify-builder' => array(
|
||||
'constant_or_function' => 'themify_builder_theme_check',
|
||||
'label' => 'Themify Builder',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'meks-easy-maps' => array(
|
||||
'constant_or_function' => 'MKS_MAP_VER',
|
||||
'label' => 'Meks Easy Maps',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'wp-video-lightbox' => array(
|
||||
'constant_or_function' => 'WP_VIDEO_LIGHTBOX_VERSION',
|
||||
'label' => 'WP Video Lightbox',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'woocommerce-variation-swatches' => array(
|
||||
'constant_or_function' => 'woo_variation_swatches',
|
||||
'label' => 'Variation Swatches for WooCommerce',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'ultimate-addons-elementor' => array(
|
||||
'constant_or_function' => 'UAEL_FILE',
|
||||
'label' => 'Ultimate Addons for Elementor - Google Maps',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'invisible-recaptcha' => array(
|
||||
'constant_or_function' => 'InvisibleReCaptcha',
|
||||
'label' => 'Google Invisible reCaptcha voor WordPress',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'easy-fancybox' => array(
|
||||
'constant_or_function' => 'EASY_FANCYBOX_VERSION',
|
||||
'label' => 'Easy FancyBox',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'novo-map' => array(
|
||||
'constant_or_function' => 'NOVO_MAP_VERSION',
|
||||
'label' => 'Novo-Map',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'wpadverts' => array(
|
||||
'constant_or_function' => 'ADVERTS_PATH',
|
||||
'label' => 'WP Adverts',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'citadela-directory' => array(
|
||||
'constant_or_function' => 'CITADELA_DIRECTORY_LITE_PLUGIN',
|
||||
'label' => 'Citadela Directory',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'elementor' => array(
|
||||
'constant_or_function' => 'ELEMENTOR_VERSION',
|
||||
'label' => 'Elementor',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'elementor-pro/elementor-pro' => array(
|
||||
'constant_or_function' => 'ELEMENTOR_PRO_VERSION',
|
||||
'label' => 'Elementor Pro',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'nudgify' => array(
|
||||
'constant_or_function' => 'NUDGIFY_PLUGIN_VERSION',
|
||||
'label' => 'Nudgify',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'generatepress-maps' => array(
|
||||
'constant_or_function' => 'GeneratePress',
|
||||
'label' => 'GeneratePress Maps',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'avada-maps' => array(
|
||||
'constant_or_function' => 'FUSION_BUILDER_VERSION',
|
||||
'label' => 'Avada Fusion Builder',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'volocation' => array(
|
||||
'constant_or_function' => 'VOSL_VERSION',
|
||||
'label' => 'VO Locator',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'trustpulse' => array(
|
||||
'constant_or_function' => 'TRUSTPULSE_PLUGIN_VERSION',
|
||||
'label' => 'TrustPulse',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'addtoany' => array(
|
||||
'constant_or_function' => 'A2A_SHARE_SAVE_init',
|
||||
'label' => 'Add To Any',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'amp' => array(
|
||||
'constant_or_function' => 'AMP__VERSION',
|
||||
'label' => 'AMP (official AMP plugin for WordPress)',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'podcast-player' => array(
|
||||
'constant_or_function' => 'PODCAST_PLAYER_VERSION',
|
||||
'label' => 'Podcast Player',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'google-maps-easy' => array(
|
||||
'constant_or_function' => 'toeGetClassNameGmp',
|
||||
'label' => 'Google Maps Easy',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'flexible-map' => array(
|
||||
'constant_or_function' => 'FLXMAP_PLUGIN_VERSION',
|
||||
'label' => 'Flexible Map',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'activecampaign' => array(
|
||||
'constant_or_function' => 'ACTIVECAMPAIGN_URL',
|
||||
'label' => 'Active Campaign',
|
||||
'firstparty_marketing' => true,
|
||||
),
|
||||
|
||||
'google-site-kit' => array(
|
||||
'constant_or_function' => 'GOOGLESITEKIT_VERSION',
|
||||
'label' => 'Google Site Kit',
|
||||
),
|
||||
|
||||
'clarity' => array(
|
||||
'constant_or_function' => 'clarity_add_origins',
|
||||
'label' => 'Microsoft Clarity',
|
||||
),
|
||||
|
||||
'beehive' => array(
|
||||
'constant_or_function' => 'BEEHIVE_PRO',
|
||||
'label' => 'Beehive',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'easy-liveblogs' => array(
|
||||
'constant_or_function' => 'ELB_NAME',
|
||||
'label' => 'Easy Liveblogs',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'simple-business-directory' => array(
|
||||
'constant_or_function' => 'QCSBD_DIR',
|
||||
'label' => 'Simple Business Directory',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'acf' => array(
|
||||
'constant_or_function' => 'ACF_VERSION',
|
||||
'label' => 'Advanced Custom Fields',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'pixelyoursite' => array(
|
||||
'constant_or_function' => 'PYS_FREE_VERSION',
|
||||
'label' => 'PixelYourSite',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'pixelyoursite-pro' => array(
|
||||
'constant_or_function' => 'PYS_VERSION',
|
||||
'label' => 'PixelYourSite Pro',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'pixelyoursite-pinterest' => array(
|
||||
'constant_or_function' => 'PYS_PINTEREST_VERSION',
|
||||
'label' => 'PixelYourSite Pinterest',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'pixelyoursite-bing' => array(
|
||||
'constant_or_function' => 'PYS_BING_VERSION',
|
||||
'label' => 'PixelYourSite Bing',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'weglot-translate' => array(
|
||||
'constant_or_function' => 'WEGLOT_VERSION',
|
||||
'label' => 'Weglot Translate',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'colibriwp' => array(
|
||||
'constant_or_function' => 'COLIBRI_PAGE_BUILDER_VERSION',
|
||||
'label' => 'ColibriWP Page Builder',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'user-registration' => array(
|
||||
'constant_or_function' => 'UR',
|
||||
'label' => 'User Registration',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'user-registration-pro' => array(
|
||||
'constant_or_function' => 'User_Registration_Pro_Shortcodes',
|
||||
'label' => 'User Registration Pro',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'contact-form-7' => array(
|
||||
'constant_or_function' => 'WPCF7_VERSION',
|
||||
'label' => 'Contact Form 7',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'disable-and-remove-google-fonts' => array(
|
||||
'constant_or_function' => 'drgf_dequeueu_fonts',
|
||||
'label' => 'Disable and remove Google Fonts',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'embed-google-fonts' => array(
|
||||
'constant_or_function' => 'Embed_Google_Fonts_Proxy',
|
||||
'label' => 'Embed Google Fonts',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'omgf' => array(
|
||||
'constant_or_function' => 'OMGF_PLUGIN_DIR',
|
||||
'label' => 'OMGF',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'local-google-fonts' => array(
|
||||
'constant_or_function' => 'LGF_PLUGIN_FILE',
|
||||
'label' => 'Local Google Fonts',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'olympus-google-fonts' => array(
|
||||
'constant_or_function' => 'ogf_initiate',
|
||||
'label' => 'Fonts Plugin | Google Fonts Typography',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'use-any-font' => array(
|
||||
'constant_or_function' => 'UAF_FILE_PATH',
|
||||
'label' => 'Use Any Font',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'facebook-for-wordpress' => array(
|
||||
'constant_or_function' => 'FacebookPixelPlugin\\FacebookForWordpress',
|
||||
'label' => 'Official Facebook Pixel',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'facebook-for-woocommerce' => array(
|
||||
'constant_or_function' => 'facebook_for_woocommerce',
|
||||
'label' => 'Facebook for WooCommerce',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'google-tagmanager-for-wordpress' => array(
|
||||
'constant_or_function' => 'GTM4WP_VERSION',
|
||||
'label' => 'Google Tag Manager for WordPress',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'jetpack' => array(
|
||||
'constant_or_function' => 'JETPACK__VERSION',
|
||||
'label' => 'JetPack',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'g1-gmaps' => array(
|
||||
'constant_or_function' => 'G1_GMaps',
|
||||
'label' => 'G1 GMAPS',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'monsterinsights' => array(
|
||||
'constant_or_function' => 'MonsterInsights',
|
||||
'label' => 'MonsterInsights',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'map-multi-marker' => array(
|
||||
'constant_or_function' => 'MapMultiMarker',
|
||||
'label' => 'Map Multi Marker',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'caos-host-analytics-local' => array(
|
||||
'constant_or_function' => 'CAOS_STATIC_VERSION',
|
||||
'label' => 'CAOS host analytics locally',
|
||||
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'wp-google-maps' => array(
|
||||
'constant_or_function' => 'WPGMZA_VERSION',
|
||||
'label' => 'WP Go Maps',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'wp-google-map-plugin' => array(
|
||||
'constant_or_function' => 'WPGMP_VERSION',
|
||||
'label' => 'WP Google Map Plugin',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'woocommerce-google-analytics-pro' => array(
|
||||
'constant_or_function' => 'WC_Google_Analytics_Pro_Loader',
|
||||
'label' => 'Woocommerce Google Analytics Pro',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'woocommerce-google-analytics-integration' => array(
|
||||
'constant_or_function' => 'WC_Google_Analytics_Integration',
|
||||
'label' => 'Woocommerce Google Analytics Integration',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'woocommerce' => array(
|
||||
'constant_or_function' => 'WC_PLUGIN_FILE',
|
||||
'label' => 'WooCommerce',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'geo-my-wp' => array(
|
||||
'constant_or_function' => 'GMW_VERSION',
|
||||
'label' => 'Geo My WP',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'google-analytics-dashboard-for-wp' => array(
|
||||
'constant_or_function' => 'EXACTMETRICS_VERSION',
|
||||
'label' => 'ExactMetrics',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'wp-google-maps-widget' => array(
|
||||
'constant_or_function' => 'GMW_PLUGIN_DIR',
|
||||
'label' => 'Maps Widget for Google Maps',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'wp-donottrack' => array(
|
||||
'constant_or_function' => 'wp_donottrack_config',
|
||||
'label' => 'WP Do Not Track',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'pixel-caffeine' => array(
|
||||
'constant_or_function' => 'AEPC_PIXEL_VERSION',
|
||||
'label' => 'Pixel Caffeine',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'rate-my-post' => array(
|
||||
'constant_or_function' => 'RATE_MY_POST_VERSION',
|
||||
'label' => 'Rate My Post',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'super-socializer' => array(
|
||||
'constant_or_function' => 'THE_CHAMP_SS_VERSION',
|
||||
'label' => 'Super Socializer',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'tidio-live-chat' => array(
|
||||
'constant_or_function' => 'TIDIOCHAT_VERSION',
|
||||
'label' => 'Tidio Live Chat',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'sumo' => array(
|
||||
'constant_or_function' => 'SUMOME__PLUGIN_DIR',
|
||||
'label' => 'Sumo – Boost Conversion and Sales',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'wpforms' => array(
|
||||
'constant_or_function' => 'wpforms',
|
||||
'label' => 'WP Forms',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'wp-rocket' => array(
|
||||
'constant_or_function' => 'WP_ROCKET_VERSION',
|
||||
'label' => 'WP Rocket',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'uncode' => array(
|
||||
'constant_or_function' => 'UncodeCore_Plugin',
|
||||
'label' => 'Uncode Google Maps',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'forminator' => array(
|
||||
'constant_or_function' => 'FORMINATOR_VERSION',
|
||||
'label' => 'Forminator',
|
||||
'early_load' => 'forminator-addon-registration.php',
|
||||
'callback_condition' => array(
|
||||
'regions' => array( 'eu', 'uk', 'za'),
|
||||
),
|
||||
'firstparty_marketing' => false,
|
||||
|
||||
),
|
||||
|
||||
'happyforms' => array(
|
||||
'constant_or_function' => 'HAPPYFORMS_VERSION',
|
||||
'label' => 'Happy Forms',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'lazy-loader' => array(
|
||||
'constant_or_function' => 'FlorianBrinkmann\LazyLoadResponsiveImages\Plugin',
|
||||
'label' => 'Lazy Loader',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'osm' => array(
|
||||
'constant_or_function' => 'OSM_PLUGIN_URL',
|
||||
'label' => 'OSM - OpenStreetMap',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'primavera' => array(
|
||||
'constant_or_function' => 'Primavera',
|
||||
'label' => 'Primavera Theme',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'so-widgets-bundle' => array(
|
||||
'constant_or_function' => 'SOW_BUNDLE_VERSION',
|
||||
'label' => 'SiteOrigin Widgets Bundle',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'superfly-menu' => array(
|
||||
'constant_or_function' => 'SFM_VERSION_KEY',
|
||||
'label' => 'Superfly Menu',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
|
||||
'wp-store-locator' => array(
|
||||
'constant_or_function' => 'WPSL_VERSION_NUM',
|
||||
'label' => 'WP Store Locator',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'thrive' => array(
|
||||
'constant_or_function' => 'Thrive_Product_Manager',
|
||||
'label' => 'Thrive',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'gravity-forms' => array(
|
||||
'constant_or_function' => 'GF_MIN_WP_VERSION',
|
||||
'label' => 'Gravity Forms',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'qtranslate' => array(
|
||||
'constant_or_function' => 'QTX_VERSION',
|
||||
'label' => 'qTranslate-XT',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'welaunch-store-locator' => array(
|
||||
'constant_or_function' => 'run_WordPress_Store_Locator',
|
||||
'label' => 'WeLaunch Store Locator',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'presto-player' => array(
|
||||
'constant_or_function' => 'PRESTO_PLAYER_PLUGIN_FILE',
|
||||
'label' => 'Presto Player',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'yotu-wp' => array(
|
||||
'constant_or_function' => 'YOTUWP_VERSION',
|
||||
'label' => 'Video Gallery – YouTube Playlist, Channel Gallery by YotuWP',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'buttonizer' => array(
|
||||
'constant_or_function' => 'BUTTONIZER_VERSION',
|
||||
'label' => 'Buttonizer',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
'greenshift' => array(
|
||||
'constant_or_function' => 'GREENSHIFT_DIR_URL',
|
||||
'label' => 'Greenshift',
|
||||
'firstparty_marketing' => false,
|
||||
),
|
||||
) );
|
||||
|
||||
|
||||
/**
|
||||
* WordPress, include always
|
||||
*/
|
||||
require_once( 'wordpress/wordpress.php' );
|
||||
|
||||
foreach ( $cmplz_integrations_list as $plugin => $details ) {
|
||||
if ( ! isset( $details['early_load'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! file_exists( WP_PLUGIN_DIR . "/" . $plugin . "/" . $plugin . ".php" ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$early_load = $details['early_load'];
|
||||
$file = apply_filters( 'cmplz_early_load_path', cmplz_path . "integrations/plugins/$early_load", $details );
|
||||
|
||||
if ( file_exists( $file ) ) {
|
||||
require_once( $file );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a plugin from the integrations list is active
|
||||
*
|
||||
* @param string $plugin
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_integration_plugin_is_enabled( string $plugin ): bool {
|
||||
//because we need a default, we don't use the get_value from complianz. The fields array is not loaded yet, so there are no defaults
|
||||
$fields = get_option( 'complianz_options_integrations', [] );
|
||||
$enabled = ! isset( $fields[ $plugin ] ) || $fields[ $plugin ];
|
||||
return cmplz_integration_plugin_is_active( $plugin ) && $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a plugin from the integrations list is activated
|
||||
*
|
||||
* @param string $plugin
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_integration_plugin_is_active( string $plugin ): bool {
|
||||
global $cmplz_integrations_list;
|
||||
if ( !isset($cmplz_integrations_list[ $plugin ]) ) {
|
||||
return false;
|
||||
}
|
||||
$details = $cmplz_integrations_list[ $plugin ];
|
||||
$theme = wp_get_theme();
|
||||
$active = defined( $details['constant_or_function'] )
|
||||
|| function_exists( $details['constant_or_function'] )
|
||||
|| class_exists( $details['constant_or_function'] )
|
||||
|| ( $theme && ( $theme->name === $details['constant_or_function'] ) )
|
||||
|| ( $theme->parent() !== false && trim( $theme->parent()->Name ) === trim( $details['constant_or_function'] ) );
|
||||
return $active;
|
||||
}
|
||||
|
||||
/**
|
||||
* code loaded without privileges to allow integrations between plugins and services, when enabled.
|
||||
*/
|
||||
|
||||
function cmplz_integrations() {
|
||||
global $cmplz_integrations_list;
|
||||
$stored_integrations_count = get_option('cmplz_active_integrations', 0 );
|
||||
$actual_integrations_count = 0;
|
||||
foreach ( $cmplz_integrations_list as $plugin => $details ) {
|
||||
if ( cmplz_integration_plugin_is_enabled( $plugin ) ) {
|
||||
$actual_integrations_count++;
|
||||
$file = apply_filters( 'cmplz_integration_path', cmplz_path . "integrations/plugins/$plugin.php", $plugin );
|
||||
if ( file_exists( $file ) ) {
|
||||
require_once( $file );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//cannot be an absolute match.
|
||||
if ( $stored_integrations_count != $actual_integrations_count) {
|
||||
update_option('cmplz_active_integrations', $actual_integrations_count);
|
||||
update_option('cmplz_integrations_changed', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Services
|
||||
*/
|
||||
|
||||
$services = COMPLIANZ::$config->thirdparty_service_markers;
|
||||
$services = array_keys( $services );
|
||||
foreach ( $services as $service ) {
|
||||
if ( cmplz_uses_thirdparty( $service ) ) {
|
||||
if ( file_exists( cmplz_path . "integrations/services/$service.php" ) ) {
|
||||
require_once( "services/$service.php" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$services = COMPLIANZ::$config->social_media_markers;
|
||||
$services = array_keys( $services );
|
||||
foreach ( $services as $service ) {
|
||||
if ( cmplz_uses_thirdparty( $service ) ) {
|
||||
if ( file_exists( cmplz_path . "integrations/services/$service.php" ) ) {
|
||||
require_once( "services/$service.php" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* statistics
|
||||
*/
|
||||
|
||||
$statistics = cmplz_get_option( 'compile_statistics' );
|
||||
if ( $statistics === 'google-analytics' ) {
|
||||
require_once( 'statistics/google-analytics.php' );
|
||||
}
|
||||
if ( $statistics === 'matomo' && cmplz_get_option('configuration_by_complianz') !=='yes' ) {
|
||||
require_once( 'statistics/matomo.php' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'plugins_loaded', 'cmplz_integrations', 10 );
|
||||
|
||||
|
||||
/**
|
||||
* Check if a third party is used on this site
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool uses_thirdparty
|
||||
*/
|
||||
|
||||
function cmplz_uses_thirdparty( $name ) {
|
||||
if ( cmplz_get_option( 'uses_thirdparty_services' ) === 'yes' ) {
|
||||
$thirdparty_types = cmplz_get_option( 'thirdparty_services_on_site' );
|
||||
|
||||
if ( is_array($thirdparty_types) && in_array( $name, $thirdparty_types) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( cmplz_get_option( 'uses_social_media' ) === 'yes' ) {
|
||||
$social_media_types = cmplz_get_option( 'socialmedia_on_site' );
|
||||
if ( is_array($social_media_types) && in_array( $name, $social_media_types) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to check if google maps is used
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_uses_google_maps(){
|
||||
return cmplz_uses_thirdparty('google-maps');
|
||||
}
|
||||
|
||||
function cmplz_google_maps_integration_enabled(){
|
||||
return defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE');
|
||||
}
|
||||
|
||||
function cmplz_uses_woocmmerce(){
|
||||
return cmplz_uses_thirdparty('google-maps');
|
||||
}
|
||||
|
||||
/**
|
||||
* placeholders that are disabled will be removed by hook here.
|
||||
*
|
||||
* This only applies to the non iframe placeholders. Other placeholders are blocked using the cmplz_placeholder_disabled function
|
||||
*/
|
||||
|
||||
//add_action( "plugins_loaded", 'cmplz_unset_placeholder_hooks' );
|
||||
//function cmplz_unset_placeholder_hooks() {
|
||||
// $disabled_placeholders = get_option( 'cmplz_disabled_placeholders', array() );
|
||||
// foreach ( $disabled_placeholders as $service ) {
|
||||
// $has_placeholder = ( function_exists( "cmplz_{$service}_placeholder" ) );
|
||||
// if ( $has_placeholder ) {
|
||||
// remove_filter( 'cmplz_placeholder_markers', "cmplz_{$service}_placeholder" );
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* check if the placeholder for a service is disabled
|
||||
*
|
||||
* @param string $service
|
||||
*
|
||||
* @return bool $disabled
|
||||
*/
|
||||
|
||||
function cmplz_placeholder_disabled( $service ) {
|
||||
$disabled_placeholders = get_option( 'cmplz_disabled_placeholders',
|
||||
array() );
|
||||
|
||||
if ( in_array( $service, $disabled_placeholders ) ) {
|
||||
return true;
|
||||
}
|
||||
//check also other variation
|
||||
$service = str_replace( '-', "_", $service );
|
||||
if ( in_array( $service, $disabled_placeholders ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* check if we should use placeholders
|
||||
*
|
||||
* @param string|bool $src
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
function cmplz_use_placeholder( $src = false ) {
|
||||
if ( cmplz_get_option( 'dont_use_placeholders' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! $src ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//no placeholder on facebook like button
|
||||
if ( strpos( $src, 'like.php' ) !== false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//get service from $src
|
||||
$service = cmplz_get_service_by_src( $src );
|
||||
if ( cmplz_placeholder_disabled( $service ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a service by string, looking at the src of a frame or script
|
||||
*
|
||||
* @param string $src
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
|
||||
function cmplz_get_service_by_src( $src ) {
|
||||
$type = false;
|
||||
$services = COMPLIANZ::$config->thirdparty_service_markers;
|
||||
$social = COMPLIANZ::$config->social_media_markers;
|
||||
$stats = COMPLIANZ::$config->stats_markers;
|
||||
$all = $services+$social+$stats;
|
||||
foreach ( $all as $service_id => $markers ) {
|
||||
$service = cmplz_strpos_arr($src, $markers);
|
||||
if ( $service !== FALSE ) {
|
||||
$type = $service_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $type ) {
|
||||
$type = COMPLIANZ::$banner_loader->parse_for_social_media( $src, true );
|
||||
if ( ! $type ) {
|
||||
$type = COMPLIANZ::$banner_loader->parse_for_thirdparty_services( $src, true );
|
||||
}
|
||||
}
|
||||
return $type ?: 'general';
|
||||
}
|
||||
|
||||
/**
|
||||
* Maybe update css if integrations have been changed
|
||||
*/
|
||||
|
||||
function cmplz_maybe_update_css(){
|
||||
|
||||
if ( !cmplz_admin_logged_in() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$integrations_changed = get_option('cmplz_integrations_changed', false );
|
||||
if ( $integrations_changed ) {
|
||||
cmplz_update_all_banners();
|
||||
}
|
||||
update_option('cmplz_integrations_changed', false );
|
||||
}
|
||||
add_action('admin_init', 'cmplz_maybe_update_css');
|
||||
|
||||
/**
|
||||
* Check if this plugin's integration is enabled
|
||||
*
|
||||
* @param string $plugin_name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_is_integration_enabled( string $plugin_name ): bool {
|
||||
global $cmplz_integrations_list;
|
||||
if ( ! array_key_exists( $plugin_name, $cmplz_integrations_list ) ) {
|
||||
return false;
|
||||
}
|
||||
$fields = get_option( 'complianz_options_integrations' );
|
||||
//default enabled, which means it's enabled when not set.
|
||||
return ! ( isset( $fields[ $plugin_name ] ) && $fields[ $plugin_name ] != 1 );
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
if ( !cmplz_integration_plugin_is_enabled( 'google-maps-easy' ) &&
|
||||
!cmplz_integration_plugin_is_enabled( 'g1-maps' ) &&
|
||||
!cmplz_integration_plugin_is_enabled( 'generatepress-maps' ) &&
|
||||
!cmplz_integration_plugin_is_enabled( 'map-multi-marker' ) &&
|
||||
!cmplz_integration_plugin_is_enabled( 'wp-google-maps' ) &&
|
||||
!cmplz_integration_plugin_is_enabled( 'avada-maps' ) &&
|
||||
!cmplz_integration_plugin_is_enabled( 'uncode' ) &&
|
||||
!cmplz_integration_plugin_is_enabled( 'wp-google-maps-widget' )
|
||||
) {
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_acf_script' );
|
||||
}
|
||||
function cmplz_acf_script( $tags ) {
|
||||
if( acf_get_setting('enqueue_google_maps') ) {
|
||||
$tags[] = [
|
||||
'name' => 'acf-custom-maps',
|
||||
'urls' => [
|
||||
'google.maps.MapTypeId',
|
||||
'maps.googleapis.com/maps/api/js'
|
||||
],
|
||||
'category' => 'marketing',
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder' => 'google-maps',
|
||||
'placeholder_class' => 'acf-map',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
'maps.googleapis.com/maps/api/js' => 'google.maps.MapTypeId'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Add activecampaign track event
|
||||
*/
|
||||
function cmplz_activecampaign_event() {
|
||||
?>
|
||||
<script>
|
||||
if ( typeof vgo === 'function' ) {
|
||||
document.addEventListener("cmplz_fire_categories", function (e) {
|
||||
var consentedCategories = e.detail.categories;
|
||||
if (cmplz_in_array('marketing', consentedCategories)) {
|
||||
vgo('process', 'allowTracking');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_footer', 'cmplz_activecampaign_event' );
|
||||
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_activecampaign_plugin_detected_services( $services ) {
|
||||
|
||||
if ( ! in_array( 'activecampaign', $services ) ) {
|
||||
$services[] = 'activecampaign';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_activecampaign_plugin_detected_services' );
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
// add_filter( 'cmplz_known_script_tags', 'cmplz_addtoany_script' );
|
||||
// function cmplz_addtoany_script( $tags ) {
|
||||
// if ( !cmplz_consent_api_active() ) {
|
||||
// $tags[] = array(
|
||||
// 'name' => 'addtoany',
|
||||
// 'category' => 'marketing',
|
||||
// 'urls' => array(
|
||||
// 'static.addtoany.com/menu/page.js',
|
||||
// ),
|
||||
// 'enable_placeholder' => '0',
|
||||
// );
|
||||
// }
|
||||
// return $tags;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Add a warning that integrations changed.
|
||||
*
|
||||
* @param array $warnings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
//function cmplz_wp_consent_api_warnings_add_to_any($warnings)
|
||||
//{
|
||||
// if ( !cmplz_consent_api_active() ){
|
||||
// $warnings['wp_consent-api'] = array(
|
||||
// 'plus_one' => false,
|
||||
// 'dismissable' => true,
|
||||
// 'warning_condition' => '_true_',
|
||||
// 'open' => __( 'You have installed the Add To Any plugin that uses the WP Consent API.', 'complianz-gdpr' ),
|
||||
// 'url' => 'https://complianz.io/proposal-to-add-a-consent-api-to-wordpress/',
|
||||
// );
|
||||
// }
|
||||
// return $warnings;
|
||||
//}
|
||||
//add_filter('cmplz_warning_types', 'cmplz_wp_consent_api_warnings_add_to_any');
|
||||
//
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param array $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_addtoany_detected_social_media( $social_media ) {
|
||||
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
if ( ! in_array( 'twitter', $social_media ) ) {
|
||||
$social_media[] = 'twitter';
|
||||
}
|
||||
if ( ! in_array( 'pinterest', $social_media ) ) {
|
||||
$social_media[] = 'pinterest';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
add_filter( 'cmplz_detected_social_media', 'cmplz_addtoany_detected_social_media' );
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param array $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_addtoany_detected_services( $services ) {
|
||||
if ( ! in_array( 'addtoany', $services ) ) {
|
||||
$services[] = 'addtoany';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_addtoany_detected_services' );
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Whitelist a string for the cookie blocker
|
||||
* @param string $class
|
||||
* @param int $total_match
|
||||
* @param bool $found
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param array $whitelisted_script_tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_advanced_ads_whitelisted_script_tags( $whitelisted_script_tags ) {
|
||||
$whitelisted_script_tags[] = 'window.advanced_ads_ready_queue'; //'string from inline script or source that should be whitelisted'
|
||||
return $whitelisted_script_tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_advanced_ads_whitelisted_script_tags', 10, 1 );
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Add blocklist tags
|
||||
* @param array $tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_advanced_captcha_nocaptcha_script( $tags ) {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return $tags;
|
||||
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){
|
||||
$tags[] = array(
|
||||
'name' => 'advanced-nocaptcha-recaptcha',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-recaptcha',
|
||||
'urls' => array(
|
||||
'google.com/recaptcha/api.js',
|
||||
'var anr_captcha',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'anr_captcha_field_div',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'google.com/recaptcha/api.js' => 'var anr_captcha',
|
||||
],
|
||||
);
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_advanced_captcha_nocaptcha_script' );
|
||||
|
||||
/**
|
||||
* Add css
|
||||
*/
|
||||
function cmplz_advanced_captcha_nocaptcha_css() {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return;
|
||||
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){
|
||||
?>
|
||||
.anr_captcha_field .cmplz-blocked-content-container {
|
||||
max-width: initial !important;
|
||||
height: 80px !important;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 400px) {
|
||||
.anr_captcha_field .cmplz-blocked-content-container, {
|
||||
height: 100px !important
|
||||
}
|
||||
}
|
||||
|
||||
.anr_captcha_field .cmplz-blocked-content-container .cmplz-blocked-content-notice{
|
||||
max-width: initial;
|
||||
padding: 7px;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'cmplz_banner_css', 'cmplz_advanced_captcha_nocaptcha_css' );
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_advanced_captcha_nocaptcha_services( $services ) {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return $services;
|
||||
|
||||
if ( ! in_array( 'google-recaptcha', $services ) ) {
|
||||
$services[] = 'google-recaptcha';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_advanced_captcha_nocaptcha_services' );
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
|
||||
/**
|
||||
* Block the Maps API and site_script.js, let the Maps API wait for site_script.js
|
||||
* @param $tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_agile_store_locator_scripts( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'agile-store-locator',
|
||||
'category' => 'marketing',
|
||||
'urls' => array(
|
||||
'maps.googleapis.com',
|
||||
'/plugins/agile-store-locator/public/js/',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder' => 'google-maps',
|
||||
'placeholder_class' => 'asl-map-canv',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com' => '/plugins/agile-store-locator/public/js/',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_agile_store_locator_scripts' );
|
||||
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
if ( ! class_exists( "cmplz_amp" ) ) {
|
||||
class cmplz_amp {
|
||||
/**
|
||||
* @var CMPLZ_COOKIEBANNER
|
||||
*/
|
||||
private $banner;
|
||||
private static $_this;
|
||||
|
||||
function __construct() {
|
||||
if ( isset( self::$_this ) ) {
|
||||
wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.',
|
||||
get_class( $this ) ) );
|
||||
}
|
||||
|
||||
self::$_this = $this;
|
||||
add_filter( 'amp_post_template_data', array( $this, 'enqueue_amp_assets' ), 10 );
|
||||
add_action( 'amp_post_template_footer', array( $this, 'get_amp_banner' ), 9999 );
|
||||
add_action( 'wp_footer', array( $this, 'get_amp_banner' ), 9999 );
|
||||
add_action( 'wp_ajax_cmplz_amp_endpoint', array( $this, 'amp_endpoint' ) );
|
||||
add_action( 'wp_ajax_nopriv_cmplz_amp_endpoint', array( $this, 'amp_endpoint' ) );
|
||||
add_action( 'amp_post_template_css', array( $this, 'amp_styles' ) );
|
||||
add_action( 'plugins_loaded', array( $this, 'init' ), 11 );
|
||||
add_action( 'cmplz_amp_tags', array( $this, 'handle_anonymous_settings' ) );
|
||||
add_action('wp', array($this, 'custom_amp_css') );
|
||||
|
||||
add_filter('cmplz_cookieblocker_amp', array($this, 'cookieblocker_for_amp') );
|
||||
}
|
||||
|
||||
static function this() {
|
||||
return self::$_this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function cookieblocker_for_amp( $output ) {
|
||||
$amp_tags = COMPLIANZ::$config->amp_tags;
|
||||
|
||||
$amp_tags = apply_filters( 'cmplz_amp_tags', $amp_tags );
|
||||
foreach ( $amp_tags as $amp_tag ) {
|
||||
$output = str_replace( '<' . $amp_tag . ' ',
|
||||
'<' . $amp_tag . ' data-block-on-consent ', $output );
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function custom_amp_css(){
|
||||
|
||||
if ( ! cmplz_is_amp() ) {
|
||||
return;
|
||||
}
|
||||
wp_register_style( 'cmplz_amp_css', false );
|
||||
wp_enqueue_style( 'cmplz_amp_css' );
|
||||
ob_start();
|
||||
$this->amp_styles($post=false);;
|
||||
$css = ob_get_clean();
|
||||
wp_add_inline_style( 'cmplz_amp_css', $css );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* If set up anonymously, remove the analytics tag
|
||||
*
|
||||
* @param $amp_tags
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
public function handle_anonymous_settings( $amp_tags ) {
|
||||
|
||||
if ( COMPLIANZ::$banner_loader->statistics_privacy_friendly() ) {
|
||||
unset( $amp_tags['amp-analytics'] );
|
||||
}
|
||||
|
||||
return $amp_tags;
|
||||
}
|
||||
|
||||
public function init() {
|
||||
|
||||
//load default banner for settings
|
||||
$banner_id = cmplz_get_default_banner_id();
|
||||
$this->banner = new CMPLZ_COOKIEBANNER( $banner_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Include AMP component scripts.
|
||||
*
|
||||
* @filter amp_post_template_data
|
||||
*
|
||||
* @param array $data Input from filter.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function enqueue_amp_assets( $data ) {
|
||||
if ( ! cmplz_is_amp() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$custom_component_scripts = array(
|
||||
'amp-geo' => 'https://cdn.ampproject.org/v0/amp-geo-0.1.js',
|
||||
'amp-consent' => 'https://cdn.ampproject.org/v0/amp-consent-0.1.js',
|
||||
);
|
||||
|
||||
$data['amp_component_scripts']
|
||||
= array_merge( $data['amp_component_scripts'],
|
||||
$custom_component_scripts );
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function get_amp_banner() {
|
||||
if ( ! cmplz_is_amp() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$consentHrefUrl = add_query_arg( 'action', 'cmplz_amp_endpoint', admin_url( 'admin-ajax.php' ) );
|
||||
|
||||
//amp only accepts https or //
|
||||
$consentHrefUrl = str_replace( "http://", "//", $consentHrefUrl );
|
||||
//check if we're on cookie policy page. If so, we offer a revoke option
|
||||
$is_policy = cmplz_page_is_of_type('cookie-statement');
|
||||
$postPromptUI = $is_policy ? '"cmplz-post-consent-ui"' : 'false';
|
||||
$revoke_text = $this->banner->revoke_x;
|
||||
$dismiss_text = $this->banner->dismiss_x['text'];
|
||||
$revoke = $is_policy
|
||||
? '<div id="cmplz-post-consent-ui"><button on="tap:consent-element.prompt" role="button">'
|
||||
. $revoke_text . '</button></div>' : "";
|
||||
$html = '
|
||||
<amp-geo layout="nodisplay">
|
||||
<script type="application/json">
|
||||
{
|
||||
"ISOCountryGroups": {
|
||||
"eu": ["preset-eea"]
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</amp-geo>
|
||||
<amp-consent layout="nodisplay" id="consent-element">
|
||||
<script type="application/json">
|
||||
{
|
||||
|
||||
"consents": {
|
||||
"cmplz-consent": {
|
||||
"promptIfUnknownForGeoGroup": "eu",
|
||||
"checkConsentHref": "' . $consentHrefUrl . '",
|
||||
"promptUI": "cmplz-consent-ui"
|
||||
}
|
||||
},
|
||||
"postPromptUI": ' . $postPromptUI . '
|
||||
}
|
||||
</script>
|
||||
<div id="cmplz-consent-ui">
|
||||
<div class="cmplz-consent-message">'
|
||||
. $this->banner->message_optin_x . '</div>
|
||||
<button on="tap:consent-element.accept" role="button">'
|
||||
. $this->banner->accept_x . '</button>
|
||||
<button on="tap:consent-element.reject" role="button">'
|
||||
. $dismiss_text . '</button>
|
||||
</div>
|
||||
' . $revoke . '
|
||||
|
||||
</amp-consent>';
|
||||
echo apply_filters( 'cmplz_amp_html', $html );
|
||||
|
||||
|
||||
// if dismiss is needed
|
||||
//<button on="tap:consent-element.dismiss" role="button">Dismiss</button>
|
||||
}
|
||||
|
||||
|
||||
public function amp_endpoint() {
|
||||
if ( ! cmplz_is_amp() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//check global cookie warning requirement
|
||||
//we currently check only for EU region. In other regions, the banner is not shown, using geo ip from Google AMP (free feature).
|
||||
$active
|
||||
= COMPLIANZ::$banner_loader->site_needs_cookie_warning( 'eu' )
|
||||
|| COMPLIANZ::$banner_loader->site_needs_cookie_warning( 'uk' );
|
||||
//
|
||||
//check if this user's region reguires a cookie warning
|
||||
$payload
|
||||
= file_get_contents( 'php://input' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
||||
if ( ! empty( $payload ) ) {
|
||||
$payload = json_decode( $payload, true );
|
||||
|
||||
if ( ! empty( $payload['consentInstanceId'] )
|
||||
&& 'cmplz-consent' === $payload['consentInstanceId']
|
||||
) {
|
||||
}
|
||||
}
|
||||
wp_send_json( array('promptIfUnknown' => $active ), 200 );
|
||||
}
|
||||
|
||||
|
||||
public function amp_styles( $post_template ) {
|
||||
if ( ! cmplz_is_amp() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
printf(
|
||||
'
|
||||
.cmplz-hidden{display:none!important;}
|
||||
.cmplz-revoke-custom {
|
||||
display:none;
|
||||
}
|
||||
#cmplz-consent-ui, #cmplz-post-consent-ui {
|
||||
background-color: %s;
|
||||
}
|
||||
#cmplz-consent-ui .cmplz-consent-message {
|
||||
color: %s;
|
||||
padding:6px 0 0 6px;
|
||||
}
|
||||
#cmplz-consent-ui button, #cmplz-post-consent-ui button {
|
||||
background-color: %s;
|
||||
color: %s;
|
||||
padding: 6px 11px;
|
||||
margin: 8px;
|
||||
}
|
||||
',
|
||||
|
||||
$this->banner->colorpalette_background['color'],
|
||||
$this->banner->colorpalette_text['color'],
|
||||
$this->banner->colorpalette_button_accept['background'],
|
||||
$this->banner->colorpalette_button_accept['text']
|
||||
);
|
||||
if ( $this->banner->use_custom_cookie_css && !empty( $this->banner->custom_css ) ) {
|
||||
echo $this->banner->custom_css;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$amp = new cmplz_amp;
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
|
||||
|
||||
if ( cmplz_uses_thirdparty('youtube') ) {
|
||||
|
||||
if (!function_exists('cmplz_bb_powerpack_script')) {
|
||||
function cmplz_bb_powerpack_script() {
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
<?php //make sure the ajax loaded lightbox gets a blocked content container ?>
|
||||
setInterval(function () {
|
||||
cmplz_set_blocked_content_container();
|
||||
}, 2000);
|
||||
|
||||
function cmplz_bb_add_event(event, selector, callback ) {
|
||||
document.addEventListener(event, e => {
|
||||
if ( e.target.closest(selector) ) {
|
||||
callback(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
<?php //If the marketing is accepted on the video, the lightbox dismisses the vidoe. We open it again. ?>
|
||||
cmplz_bb_add_event('click', '.fancybox-container .cmplz-accept-category, .fancybox-container .cmplz-accept-service',
|
||||
function(e){
|
||||
document.querySelector('.pp-video-play-icon').click();
|
||||
}
|
||||
)
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_bb_powerpack_script',PHP_INT_MAX );
|
||||
}
|
||||
|
||||
function cmplz_beaver_builder_powerpack_whitelist( $tags ){
|
||||
$tags[] = 'pp-video-lightbox-content';
|
||||
return $tags;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_beaver_builder_powerpack_whitelist');
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
function cmplz_beaver_builder_whitelist($tags){
|
||||
$tags[] = 'FLBuilderLayout';
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_beaver_builder_whitelist');
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Set analytics as suggested stats tool in the wizard
|
||||
*/
|
||||
add_filter( 'cmplz_default_value', 'cmplz_beehive_set_default', 20, 3 );
|
||||
function cmplz_beehive_set_default( $value, $fieldname, $field ) {
|
||||
if ( $fieldname === 'compile_statistics' ) {
|
||||
return "google-analytics";
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* We remove some actions to integrate fully
|
||||
* */
|
||||
function cmplz_beehive_remove_scripts_others() {
|
||||
remove_action( 'cmplz_statistics_script', array( COMPLIANZ::$banner_loader, 'get_statistics_script' ), 10 );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'cmplz_beehive_remove_scripts_others' );
|
||||
|
||||
/**
|
||||
* Remove stats
|
||||
*
|
||||
* */
|
||||
function cmplz_beehive_show_compile_statistics_notice($notices) {
|
||||
//find notice with field_id 'compile_statistics' and replace it with our own
|
||||
$text = '';
|
||||
if ( cmplz_no_ip_addresses() ) {
|
||||
$text .= __( "You have selected you anonymize IP addresses. This setting is now enabled in Beehive.",
|
||||
'complianz-gdpr' );
|
||||
}
|
||||
if ( cmplz_statistics_no_sharing_allowed() ) {
|
||||
$text .= __( "You have selected you do not share data with third-party networks. Display advertising is now disabled in Beehive.",
|
||||
'complianz-gdpr' );
|
||||
}
|
||||
$notice = [
|
||||
'field_id' => 'compile_statistics',
|
||||
'label' => 'default',
|
||||
'title' => __( "Statistics plugin detected", 'complianz-gdpr' ),
|
||||
'text' => cmplz_sprintf( __( "You use %s, which means the answer to this question should be Google Analytics.", 'complianz-gdpr' ), 'Beehive' )
|
||||
.' '.$text,
|
||||
];
|
||||
|
||||
$found_key = false;
|
||||
foreach ($notices as $key=>$notice) {
|
||||
if ($notice['field_id']==='compile_statistics') {
|
||||
$found_key = $key;
|
||||
}
|
||||
}
|
||||
if ($found_key){
|
||||
$notices[$found_key] = $notice;
|
||||
} else {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
return $notices;
|
||||
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_beehive_show_compile_statistics_notice' );
|
||||
|
||||
add_filter( 'beehive_get_options', 'cmplz_beehive_options', 10, 2 );
|
||||
function cmplz_beehive_options( $options, $network ) {
|
||||
//handle anonymization
|
||||
if ( cmplz_no_ip_addresses() ) {
|
||||
$options['general']['anonymize'] = true;
|
||||
}
|
||||
|
||||
//handle sharing of data
|
||||
if ( cmplz_statistics_no_sharing_allowed() ) {
|
||||
$options['general']['advertising'] = false;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_beehive_filter_warnings( $warnings ) {
|
||||
unset( $warnings[ 'ga-needs-configuring' ] );
|
||||
return $warnings;
|
||||
}
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_beehive_filter_warnings' );
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when Beehive is enabled.
|
||||
*
|
||||
* @param $fields
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_beehive_filter_fields( $fields ) {
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info', $fields);
|
||||
if ($index!==false) unset($fields[$index]['help']);
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'consent-mode',
|
||||
'gtag-basic-consent-mode',
|
||||
'cmplz-gtag-urlpassthrough',
|
||||
'cmplz-gtag-ads_data_redaction',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_fields', 'cmplz_beehive_filter_fields', 200, 1 );
|
||||
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Conditional notices for fields
|
||||
*
|
||||
* @param array $notices
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_burst_statistics_integration_show_compile_statistics_notice(array $notices): array {
|
||||
if ( ! cmplz_user_can_manage() ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$notices[] = [
|
||||
'field_id' => 'install-burst',
|
||||
'label' => 'default',
|
||||
'title' => "Burst Statistics",
|
||||
'text' => __( "Burst Statistics will be configured automatically.", "complianz-gdpr" ),
|
||||
];
|
||||
|
||||
return $notices;
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_burst_statistics_integration_show_compile_statistics_notice', 10, 1 );
|
||||
|
||||
function cmplz_burst_statistics_activate_burst() {
|
||||
ob_start(); ?>
|
||||
<script>
|
||||
function ensure_complianz_is_loaded() {
|
||||
let timeout = 30000000; // 30 seconds
|
||||
let start = Date.now();
|
||||
return new Promise(wait_for_complianz);
|
||||
|
||||
function wait_for_complianz(resolve, reject) {
|
||||
if (window.cmplz_get_cookie) // if complianz is loaded, resolve the promise
|
||||
resolve(window.cmplz_get_cookie);
|
||||
else if (timeout && (Date.now() - start) >= timeout)
|
||||
reject(new Error("timeout"));
|
||||
else
|
||||
setTimeout(wait_for_complianz.bind(this, resolve, reject), 30);
|
||||
}
|
||||
}
|
||||
|
||||
// This runs the promise code
|
||||
ensure_complianz_is_loaded().then(function(){
|
||||
|
||||
<?php if ( burst_get_value('enable_cookieless_tracking') ) {
|
||||
// if cookieless tracking is enabled, we need to add a listener to the consent change
|
||||
// to turn off cookieless tracking and set a cookie
|
||||
// ?>
|
||||
|
||||
document.addEventListener("burst_before_track_hit", function(burstData) {
|
||||
if ( cmplz_has_consent('statistics') ) {
|
||||
window.burst_enable_cookieless_tracking = 0;
|
||||
}
|
||||
});
|
||||
document.addEventListener("cmplz_status_change", function (){
|
||||
if ( cmplz_has_consent('statistics') ) {
|
||||
window.burst_enable_cookieless_tracking = 0;
|
||||
let event = new CustomEvent('burst_enable_cookies');
|
||||
document.dispatchEvent( event );
|
||||
}
|
||||
});
|
||||
|
||||
<?php } else { ?>
|
||||
// cookieless tracking is disabled
|
||||
document.addEventListener("cmplz_cookie_warning_loaded", function(consentData) {
|
||||
let region = consentData.detail;
|
||||
if (region !== 'uk') {
|
||||
let scriptElements = document.querySelectorAll('script[data-service="burst"]');
|
||||
scriptElements.forEach(obj => {
|
||||
if (obj.classList.contains('cmplz-activated') || obj.getAttribute('type') === 'text/javascript') {
|
||||
return;
|
||||
}
|
||||
obj.classList.add('cmplz-activated');
|
||||
let src = obj.getAttribute('src');
|
||||
if (src) {
|
||||
obj.setAttribute('type', 'text/javascript');
|
||||
cmplz_run_script(src, 'statistics', 'src');
|
||||
obj.parentNode.removeChild(obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_burst_fire_domContentLoadedEvent);
|
||||
|
||||
function cmplz_burst_fire_domContentLoadedEvent() {
|
||||
let event = new CustomEvent('burst_fire_hit');
|
||||
document.dispatchEvent(event);
|
||||
}
|
||||
<?php } ?>
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
||||
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_burst_statistics_activate_burst',PHP_INT_MAX );
|
||||
|
||||
/**
|
||||
* If checked for privacy friendly, and the user select "none of the above", return true, as it's burst.
|
||||
* @param $is_privacy_friendly
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_burst_statistics_privacy_friendly($is_privacy_friendly){
|
||||
$statistics = cmplz_get_option( 'compile_statistics' );
|
||||
if ($statistics==='yes') {
|
||||
$is_privacy_friendly = true;
|
||||
}
|
||||
return $is_privacy_friendly;
|
||||
}
|
||||
add_filter('cmplz_cookie_warning_required_stats', 'cmplz_burst_statistics_privacy_friendly');
|
||||
add_filter('cmplz_statistics_privacy_friendly', 'cmplz_burst_statistics_privacy_friendly');
|
||||
|
||||
|
||||
/**
|
||||
* Add a script to the blocked list
|
||||
* @param array $tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_burst_script( $tags ) {
|
||||
//if cookieless tracking enabled, do not block.
|
||||
if ( burst_get_option('enable_cookieless_tracking') ) {
|
||||
return $tags;
|
||||
}
|
||||
|
||||
$tags[] = array(
|
||||
'name' => 'burst',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'assets/js/build/burst.js',
|
||||
'assets/js/build/burst.min.js',
|
||||
'helpers/timeme/timeme.js',
|
||||
'helpers/timeme/timeme.min.js',
|
||||
|
||||
),
|
||||
'enable_placeholder' => '0',
|
||||
'enable_dependency' => '0',
|
||||
);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_burst_script' );
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function cmplz_buttonizer_consent() {
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener('cmplz_before_cookiebanner', function() {
|
||||
if (cmplz_has_consent('statistics')) {
|
||||
enableButtonizer();
|
||||
}
|
||||
});
|
||||
document.addEventListener('cmplz_status_change', function (e) {
|
||||
if (e.detail.category === 'statistics' && e.detail.value==='allow') {
|
||||
enableButtonizer();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_footer', 'cmplz_buttonizer_consent' );
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_caos_script' );
|
||||
function cmplz_caos_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'caos-analytics',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'analytics.js',
|
||||
'gtag.js',
|
||||
'ga.js',
|
||||
'caos-analytics',
|
||||
'uploads/caos',
|
||||
'caosLocalGa',
|
||||
'CaosGtag',
|
||||
),
|
||||
);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* We remove some actions to integrate fully
|
||||
* */
|
||||
|
||||
function cmplz_caos_remove_scripts_others() {
|
||||
remove_action( 'cmplz_statistics_script', array( COMPLIANZ::$banner_loader, 'get_statistics_script' ), 10 );
|
||||
}
|
||||
|
||||
add_action( 'after_setup_theme', 'cmplz_caos_remove_scripts_others' );
|
||||
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when caos is enabled.
|
||||
*
|
||||
* @param $fields
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_caos_filter_fields( $fields ) {
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info', $fields);
|
||||
if ($index!==false) unset($fields[$index]['help']);
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'consent-mode',
|
||||
'gtag-basic-consent-mode',
|
||||
'cmplz-gtag-urlpassthrough',
|
||||
'cmplz-gtag-ads_data_redaction',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_fields', 'cmplz_caos_filter_fields', 200 );
|
||||
|
||||
|
||||
add_filter( 'cmplz_default_value', 'cmplz_caos_set_default', 20, 3 );
|
||||
function cmplz_caos_set_default( $value, $fieldname, $field ) {
|
||||
if ( $fieldname === 'compile_statistics' ) {
|
||||
return "google-analytics";
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove stats
|
||||
*
|
||||
* */
|
||||
function cmplz_caos_show_compile_statistics_notice($notices) {
|
||||
//find notice with field_id 'compile_statistics' and replace it with our own
|
||||
$found_key = false;
|
||||
foreach ($notices as $key=>$notice) {
|
||||
if ($notice['field_id']==='compile_statistics') {
|
||||
$found_key = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$notice = [
|
||||
'field_id' => 'compile_statistics',
|
||||
'label' => 'default',
|
||||
'title' => __( "Statistics plugin detected", 'complianz-gdpr' ),
|
||||
'text' => cmplz_sprintf( __( "You use %s, which means the answer to this question should be Google Analytics.", 'complianz-gdpr' ), 'CAOS host analytics locally' ),
|
||||
];
|
||||
if ($found_key){
|
||||
$notices[$found_key] = $notice;
|
||||
} else {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
return $notices;
|
||||
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_caos_show_compile_statistics_notice' );
|
||||
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_caos_filter_warnings( $warnings ) {
|
||||
unset( $warnings[ 'ga-needs-configuring' ] );
|
||||
return $warnings;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_caos_filter_warnings' );
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_citadela_directory_script' );
|
||||
function cmplz_citadela_directory_script( $tags ) {
|
||||
$tags[] = 'leaflet-maps-initializer.js';
|
||||
$tags[] = array(
|
||||
'name' => 'citadela-directory',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'openstreetmaps',
|
||||
'urls' => array(
|
||||
'leaflet-maps-initializer.js',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'citadela-openstreetmap',
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_citadela_directory_detected_services( $services ) {
|
||||
if ( ! in_array( 'openstreetmaps', $services ) ) {
|
||||
$services[] = 'openstreepmaps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_citadela_directory_detected_services' );
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Kept simple, no intervention with wizard to allow other analtyics tooling
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_clarity_script' );
|
||||
function cmplz_clarity_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'clarity',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'clarity.ms',
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
* ColibriWP - Complianz Compatibility
|
||||
* Provided by ExtendThemes
|
||||
*/
|
||||
|
||||
add_action( 'init', 'colibri_complianz_remove_video_shortcode', 20 );
|
||||
function colibri_complianz_remove_video_shortcode() {
|
||||
remove_shortcode( 'colibri_video_player' );
|
||||
}
|
||||
|
||||
add_action( 'init', function() {
|
||||
add_shortcode( 'colibri_video_player', function( $atts ) {
|
||||
ob_start();
|
||||
if ($atts['type']==='external') {
|
||||
printf(
|
||||
'<iframe src="%1$s" class="h-video-main" %2$s allowfullscreen></iframe>',
|
||||
esc_url( $atts['url'] ),
|
||||
(($atts['autoplay'] === 'true') ? 'allow="autoplay"' : '')
|
||||
);
|
||||
} else {
|
||||
printf(
|
||||
'<video class="h-video-main" %1$s ><source src="%2$s" type="video/mp4" /></video>',
|
||||
(($atts['autoplay'] === 'true') ? 'allow="autoplay"' : ''),
|
||||
esc_url( $atts['url'] )
|
||||
);
|
||||
}
|
||||
|
||||
return ob_get_clean();
|
||||
} );
|
||||
}, 30 );
|
||||
|
||||
add_action( 'wp_head', function() {
|
||||
echo '
|
||||
<style type="text/css">
|
||||
.h-map > div {
|
||||
height: inherit !important;
|
||||
}
|
||||
.video-container .ratio-inner.cmplz-blocked-content-container {
|
||||
position: absolute;
|
||||
top: 0; left: 0; right: 0; bottom: 0;
|
||||
}
|
||||
</style>
|
||||
';
|
||||
}, 999 );
|
||||
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
function cmplz_cf7_initDomContentLoaded() {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return;
|
||||
|
||||
if (class_exists('IQFix_WPCF7_Deity')) return;
|
||||
|
||||
|
||||
$service = WPCF7_RECAPTCHA::get_instance();
|
||||
if ( $service->is_active() ) {
|
||||
ob_start();
|
||||
if (version_compare(WPCF7_VERSION, 5.2, '>=') ) {
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_cf7_fire_domContentLoadedEvent);
|
||||
function cmplz_cf7_fire_domContentLoadedEvent() {
|
||||
wpcf7_recaptcha.execute = function (action) {
|
||||
grecaptcha.execute(
|
||||
wpcf7_recaptcha.sitekey,
|
||||
{action: action}
|
||||
).then(function (token) {
|
||||
var event = new CustomEvent('wpcf7grecaptchaexecuted', {
|
||||
detail: {
|
||||
action: action,
|
||||
token: token,
|
||||
},
|
||||
});
|
||||
|
||||
document.dispatchEvent(event);
|
||||
});
|
||||
};
|
||||
|
||||
wpcf7_recaptcha.execute_on_homepage = function () {
|
||||
wpcf7_recaptcha.execute(wpcf7_recaptcha.actions['homepage']);
|
||||
};
|
||||
|
||||
wpcf7_recaptcha.execute_on_contactform = function () {
|
||||
wpcf7_recaptcha.execute(wpcf7_recaptcha.actions['contactform']);
|
||||
};
|
||||
|
||||
grecaptcha.ready(
|
||||
wpcf7_recaptcha.execute_on_homepage
|
||||
);
|
||||
|
||||
document.addEventListener('change',
|
||||
wpcf7_recaptcha.execute_on_contactform
|
||||
);
|
||||
|
||||
document.addEventListener('wpcf7submit',
|
||||
wpcf7_recaptcha.execute_on_homepage
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
} else {?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_cf7_fire_domContentLoadedEvent);
|
||||
function cmplz_cf7_fire_domContentLoadedEvent() {
|
||||
//fire a DomContentLoaded event, so the Contact Form 7 reCaptcha integration will work
|
||||
window.document.dispatchEvent(new Event("DOMContentLoaded", {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}));
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script);
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_cf7_initDomContentLoaded', PHP_INT_MAX );
|
||||
|
||||
|
||||
/**
|
||||
* Customize the error message on submission of the form before consent
|
||||
*
|
||||
* @param $message
|
||||
* @param $status
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function cmplz_contactform7_errormessage( $message, $status ) {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return $message;
|
||||
|
||||
if ( $status === 'spam' ) {
|
||||
|
||||
|
||||
if ( version_compare(WPCF7_VERSION, 5.4, '<') ) {
|
||||
$message = apply_filters( 'cmplz_accept_cookies_contactform7', __( 'Click to accept marketing cookies and enable this form', 'complianz-gdpr' ) );
|
||||
$message = '<span class="cmplz-blocked-content-notice cmplz-accept-marketing"><a href="#" role="button">' . $message . '</a></span>';
|
||||
} else {
|
||||
$message = apply_filters( 'cmplz_accept_cookies_contactform7', __( 'Please accept marketing cookies to enable this form', 'complianz-gdpr' ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
add_filter( 'wpcf7_display_message', 'cmplz_contactform7_errormessage', 20, 2 );
|
||||
|
||||
/**
|
||||
* Add the CF7 form type
|
||||
*
|
||||
* @param $formtypes
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function cmplz_contactform7_form_types( $formtypes ) {
|
||||
$formtypes['cf7_'] = 'contact-form-7';
|
||||
|
||||
return $formtypes;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_form_types', 'cmplz_contactform7_form_types' );
|
||||
|
||||
/**
|
||||
* Conditionally add the dependency from the CF 7 inline script to the .js file
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_dependencies', 'cmplz_contactform7_dependencies' );
|
||||
function cmplz_contactform7_dependencies( $tags ) {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return $tags;
|
||||
|
||||
if (class_exists('IQFix_WPCF7_Deity')) return $tags;
|
||||
|
||||
$service = WPCF7_RECAPTCHA::get_instance();
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){
|
||||
if ( $service->is_active() ) {
|
||||
if (version_compare(WPCF7_VERSION, 5.2, '>=')){
|
||||
$tags['recaptcha/api.js'] = 'modules/recaptcha/script.js';
|
||||
} else {
|
||||
$tags['recaptcha/api.js'] = 'grecaptcha';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_contactform7_script' );
|
||||
function cmplz_contactform7_script( $tags ) {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return $tags;
|
||||
|
||||
$service = WPCF7_RECAPTCHA::get_instance();
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){
|
||||
if ( $service->is_active() ) {
|
||||
$tags[] = 'modules/recaptcha/script.js';
|
||||
$tags[] = 'recaptcha/index.js';
|
||||
$tags[] = 'recaptcha/api.js';
|
||||
}
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get list of CF7 contact forms
|
||||
*
|
||||
* @param $input_forms
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_contactform7_get_plugin_forms( $input_forms ) {
|
||||
$forms = get_posts( array( 'post_type' => 'wpcf7_contact_form' ) );
|
||||
$forms = wp_list_pluck( $forms, "post_title", "ID" );
|
||||
foreach ( $forms as $id => $title ) {
|
||||
$input_forms[ 'cf7_' . $id ] = $title . " " . '(Contact form 7)';
|
||||
}
|
||||
|
||||
return $input_forms;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_get_forms', 'cmplz_contactform7_get_plugin_forms' );
|
||||
|
||||
/**
|
||||
* Add consent checkbox to CF 7
|
||||
*
|
||||
* @param $form_id
|
||||
*/
|
||||
function cmplz_contactform7_add_consent_checkbox( $form_id ) {
|
||||
$form_id = str_replace( 'cf7_', '', $form_id );
|
||||
|
||||
$warning = 'acceptance_as_validation: on';
|
||||
$label
|
||||
= cmplz_sprintf( __( 'To submit this form, you need to accept our %sPrivacy Statement%s',
|
||||
'complianz-gdpr' ),
|
||||
'<a href="' . COMPLIANZ::$document->get_permalink( 'privacy-statement',
|
||||
'eu', true ) . '">', '</a>' );
|
||||
|
||||
$tag = "\n" . '[acceptance cmplz-acceptance]' . $label . '[/acceptance]'
|
||||
. "\n\n";
|
||||
|
||||
$contact_form = wpcf7_contact_form( $form_id );
|
||||
|
||||
if ( ! $contact_form ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$properties = $contact_form->get_properties();
|
||||
$title = $contact_form->title();
|
||||
$locale = $contact_form->locale();
|
||||
|
||||
//check if it's already there
|
||||
if ( strpos( $properties['form'], '[acceptance' ) === false ) {
|
||||
$properties['form'] = str_replace( '[submit', $tag . '[submit',
|
||||
$properties['form'] );
|
||||
}
|
||||
|
||||
if ( strpos( $properties['additional_settings'], $warning ) === false ) {
|
||||
$properties['additional_settings'] .= "\n" . $warning;
|
||||
}
|
||||
|
||||
//replace [submit
|
||||
$args = array(
|
||||
'id' => $form_id,
|
||||
'title' => $title,
|
||||
'locale' => $locale,
|
||||
'form' => $properties['form'],
|
||||
'mail' => $properties['mail'],
|
||||
'mail_2' => $properties['mail_2'],
|
||||
'messages' => $properties['messages'],
|
||||
'additional_settings' => $properties['additional_settings'],
|
||||
);
|
||||
remove_action( 'wpcf7_after_save', 'wpcf7_mch_save_mailchimp' );
|
||||
wpcf7_save_contact_form( $args );
|
||||
}
|
||||
|
||||
add_action( "cmplz_add_consent_box_contact-form-7",
|
||||
'cmplz_contactform7_add_consent_checkbox' );
|
||||
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_contactform7_detected_services( $services ) {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return $services;
|
||||
|
||||
$recaptcha = WPCF7_RECAPTCHA::get_instance();
|
||||
|
||||
if ( $recaptcha->is_active()
|
||||
&& ! in_array( 'google-recaptcha', $services )
|
||||
) {
|
||||
$services[] = 'google-recaptcha';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_contactform7_detected_services' );
|
||||
|
||||
/**
|
||||
* Add a warning that we're dropping support for further Contact Form 7 changes
|
||||
*
|
||||
* @param array $warnings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_cf7_warnings_types($warnings)
|
||||
{
|
||||
$warnings['contact-form-7'] = array(
|
||||
'plus_one' => true,
|
||||
'warning_condition' => '_true_',
|
||||
'open' => __( 'Due to continuous breaking changes in Contact Form 7 we are dropping the CF7 integration as of CF7 5.4. We have concluded that the only viable solution is for Contact Form 7 to integrate with the WP Consent API.', 'complianz-gdpr' ),
|
||||
'url' => 'https://complianz.io/why-the-wp-consent-api-is-important-a-case-study-with-cf7-and-recaptcha/',
|
||||
);
|
||||
|
||||
return $warnings;
|
||||
}
|
||||
add_filter('cmplz_warning_types', 'cmplz_cf7_warnings_types');
|
||||
|
||||
/**
|
||||
* Check if cf7 recaptch activate for >5.4 versions.
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
function cmplz_cf7_recaptcha_active(){
|
||||
//it works before 5.4.
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '<')) {
|
||||
return false;
|
||||
}
|
||||
$recaptcha = WPCF7_RECAPTCHA::get_instance();
|
||||
if ( $recaptcha->is_active() ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
function cmplz_content_views_cookieblocker($html){
|
||||
return COMPLIANZ::$cookie_blocker->replace_tags($html);
|
||||
}
|
||||
add_filter( 'pt_cv_view_html', 'cmplz_content_views_cookieblocker' );
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
if ( !defined("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE") ) define("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE", true);
|
||||
|
||||
|
||||
function cmplz_disable_and_remove_gf_filter_pro_fields($fields) {
|
||||
$index = cmplz_get_field_index('self_host_google_fonts', $fields);
|
||||
if ($index!==false) {
|
||||
$fields[ $index ]['help'] = [
|
||||
'label' => 'default',
|
||||
'title' => __( 'Self-hosting Google Fonts', 'complianz-gdpr' ),
|
||||
'text' => sprintf( __( "You have %s installed. We recommend saying 'Yes' to self-hosting Google Fonts", "complianz-gdpr" ), "Disable and remove Google Fonts" ),
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
add_filter('cmplz_fields', 'cmplz_disable_and_remove_gf_filter_pro_fields', 200);
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
//is the same for divi.
|
||||
require_once( __DIR__.'/divi.php' );
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
//ensure it's only loaded once, because of theme and plugin possibility
|
||||
if ( !function_exists('cmplz_divi_map_script')) {
|
||||
if ( !defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE') ) define('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE', true);
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_divi_map_script' );
|
||||
function cmplz_divi_map_script( $tags ) {
|
||||
if ( !cmplz_uses_thirdparty('google-maps') ) {
|
||||
return $tags;
|
||||
}
|
||||
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'maps.googleapis.com',
|
||||
'cmplz_divi_init_map'
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'et_pb_map',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com' => 'cmplz_divi_init_map',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
function cmplz_divi_whitelist($tags){
|
||||
$tags[] = 'et_animation_data';
|
||||
$tags[] = 'Divi/core/admin/js/recaptcha.js';
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_divi_whitelist');
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_divi_map_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_divi_map_detected_services' );
|
||||
|
||||
/**
|
||||
* Initialize recaptcha
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_divi_init_recaptcha() {
|
||||
if ( !cmplz_uses_thirdparty('google-recaptcha') ){
|
||||
return;
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
let cmplz_activated_divi_recaptcha = false;
|
||||
document.addEventListener("cmplz_enable_category", function (e) {
|
||||
if (!cmplz_activated_divi_recaptcha && (e.detail.category==='marketing' || e.detail.service === 'google-recaptcha') ){
|
||||
cmplz_divi_init_recaptcha();
|
||||
}
|
||||
});
|
||||
|
||||
function cmplz_divi_init_recaptcha() {
|
||||
if ('undefined' === typeof window.jQuery || 'undefined' === typeof window.etCore ) {
|
||||
setTimeout(cmplz_divi_init_recaptcha, 500);
|
||||
} else {
|
||||
window.etCore.api.spam.recaptcha.init();
|
||||
cmplz_activated_divi_recaptcha = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_divi_init_recaptcha',PHP_INT_MAX );
|
||||
|
||||
/**
|
||||
* Init Google Maps
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function cmplz_divi_init_maps() {
|
||||
if ( !cmplz_uses_thirdparty('google-maps') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
let cmplz_activated_divi_maps = false;
|
||||
document.addEventListener("cmplz_enable_category", function (e) {
|
||||
if (!cmplz_activated_divi_maps && (e.detail.category==='marketing' || e.detail.service === 'google-maps') ){
|
||||
cmplz_divi_init_map();
|
||||
}
|
||||
});
|
||||
|
||||
function cmplz_divi_init_map() {
|
||||
if ('undefined' === typeof window.jQuery || 'undefined' === typeof window.et_pb_map_init ) {
|
||||
setTimeout(cmplz_divi_init_map, 1000);
|
||||
} else {
|
||||
let map_container = jQuery(".et_pb_map_container");
|
||||
map_container.each(function () {
|
||||
window.et_pb_map_init(jQuery(this));
|
||||
cmplz_activated_divi_maps = true;
|
||||
})
|
||||
}
|
||||
}
|
||||
setTimeout(cmplz_divi_init_map, 300);
|
||||
</script>
|
||||
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_divi_init_maps',PHP_INT_MAX );
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_easy_fancybox_script' );
|
||||
function cmplz_easy_fancybox_script( $tags ) {
|
||||
if ( cmplz_uses_thirdparty('youtube') ) {
|
||||
// $tags[] = 'plugins/easy-fancybox/';
|
||||
$tags[] = array(
|
||||
'name' => 'easy-fancybox',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'youtube',
|
||||
'urls' => array(
|
||||
'fancybox-youtube',
|
||||
),
|
||||
);
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
function cmplz_elb_cookieblocker($html){
|
||||
return COMPLIANZ::$cookie_blocker->replace_tags($html);
|
||||
}
|
||||
|
||||
add_filter( 'elb_entry_content', 'cmplz_elb_cookieblocker' );
|
||||
|
||||
/**
|
||||
* Add custom elb placeholder css
|
||||
*/
|
||||
|
||||
function cmplz_elb_css() {
|
||||
?>
|
||||
<style>
|
||||
#elb-liveblog [class^="cmplz-placeholder-"] {
|
||||
height: 300px;
|
||||
</style>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
add_action( 'wp_footer', 'cmplz_elb_css' );
|
||||
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
use Elementor\TemplateLibrary\Source_Local;
|
||||
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
|
||||
/**
|
||||
* Main Plugin Class
|
||||
*
|
||||
* Register new elementor widget.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class CMPLZ_Elementor_Pro {
|
||||
public $banner_active;
|
||||
public $create_legal_hub = false;
|
||||
public $create_cookiebanner = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
|
||||
public function __construct() {
|
||||
add_filter( 'cmplz_field_notices', [$this, 'field_notices'], 30, 1 );
|
||||
add_filter( 'cmplz_fields', [ $this, 'filter_elementor_pro_fields' ], 200, 1);
|
||||
add_action( "cmplz_after_save_field", [$this, "update_legal_banner" ], 10, 4 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditional notices for fields
|
||||
*
|
||||
* @param array $notices
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function field_notices(array $notices): array {
|
||||
if ( ! cmplz_user_can_manage() ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if ( get_option('cmplz_elementor_hub_autogenerated') ) {
|
||||
$notices[] = [
|
||||
'field_id' => 'create_legal_hub_elementor',
|
||||
'label' => 'default',
|
||||
'title' => __( "Generated template", 'complianz-gdpr' ),
|
||||
'text' => __( "A legal hub template has been generated. Click the more info link to edit it.", 'complianz-gdpr' ),
|
||||
'url' => add_query_arg(['post' => (int) get_option('cmplz_elementor_hub_autogenerated'),'action' => 'edit'], admin_url('post.php') ),
|
||||
];
|
||||
} else {
|
||||
$notices[] = [
|
||||
'label' => 'default',
|
||||
'title' => __( "Legal Hub", 'complianz-gdpr' ),
|
||||
'text' => __( 'If you choose to create your Legal Hub with Elementor Pro we will import our default template.', 'complianz-gdpr' ),
|
||||
'url' => 'https://complianz.io/creating-the-legal-hub/',
|
||||
];
|
||||
}
|
||||
|
||||
return $notices;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add fields for elementor
|
||||
* @param array $fields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filter_elementor_pro_fields( $fields ) {
|
||||
$fields = array_merge( $fields,
|
||||
[
|
||||
[
|
||||
'id' => 'create_legal_hub_elementor',
|
||||
'menu_id' => 'plugins',
|
||||
'label' => __('Do you want to create a Legal Hub with Elementor Pro?', "complianz-gdpr"),
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
'yes' => __('Yes', "complianz-gdpr"),
|
||||
'no' => __('No', "complianz-gdpr"),
|
||||
],
|
||||
'required' => false,
|
||||
],
|
||||
]
|
||||
);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function update_legal_banner( string $name, $value, $prev_value, $type){
|
||||
if ( !cmplz_user_can_manage() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $name==='create_legal_hub_elementor' && $value==='yes'){
|
||||
$this->create_legal_hub = true;
|
||||
$this->maybe_import_templates();
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function maybe_import_templates() {
|
||||
if ( !cmplz_user_can_manage() ) {
|
||||
return;
|
||||
}
|
||||
if ( $this->create_legal_hub ) {
|
||||
$post_id = get_option( 'cmplz_elementor_hub_autogenerated' );
|
||||
$post = get_post($post_id);
|
||||
if ( ! $post || $post->post_status === 'trash') {
|
||||
if ( file_exists( cmplz_path . 'integrations/plugins/elementor-pro/legal-hub-template.json' ) ) {
|
||||
if ( !class_exists('Source_Local') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
//create backup. Elementor deletes the file
|
||||
copy( cmplz_path . 'integrations/plugins/elementor-pro/legal-hub-template.json', cmplz_path . 'integrations/plugins/elementor-pro/legal-hub-template-bkp.json' );
|
||||
require_once WP_PLUGIN_DIR . '/elementor/includes/template-library/sources/local.php';
|
||||
$local = new Source_Local();
|
||||
$import = $local->import_template( 'legal-hub-template.json', cmplz_path . 'integrations/plugins/elementor-pro/legal-hub-template.json' );
|
||||
//restore backup
|
||||
copy( cmplz_path . 'integrations/plugins/elementor-pro/legal-hub-template-bkp.json', cmplz_path . 'integrations/plugins/elementor-pro/legal-hub-template.json' );
|
||||
unlink( cmplz_path . 'integrations/plugins/elementor-pro/legal-hub-template-bkp.json');
|
||||
if ( is_array( $import ) && isset( $import[0] ) && isset( $import[0]['template_id'] ) ) {
|
||||
$post_id = $import[0]['template_id'];
|
||||
}
|
||||
}
|
||||
|
||||
//set to draft by default
|
||||
$args = array(
|
||||
'post_status' => 'draft',
|
||||
'ID' => $post_id,
|
||||
);
|
||||
wp_update_post($args);
|
||||
update_option('cmplz_elementor_hub_autogenerated', $post_id, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new CMPLZ_Elementor_Pro();
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,246 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
|
||||
/**
|
||||
* Whitelist Elementor Add on
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_elementor_whitelist($tags){
|
||||
$tags[] = 'elementorFrontendConfig';
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_elementor_whitelist');
|
||||
|
||||
/**
|
||||
* Add script to remove the placeholders which are left in place when the consent is already given and the popup is opened.
|
||||
* @return void
|
||||
*/
|
||||
function cmplz_elementor_popup_content_blocking() {
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
if ('undefined' != typeof window.jQuery) {
|
||||
jQuery(document).ready(function ($) {
|
||||
$(document).on('elementor/popup/show', () => {
|
||||
let rev_cats = cmplz_categories.reverse();
|
||||
for (let key in rev_cats) {
|
||||
if (rev_cats.hasOwnProperty(key)) {
|
||||
let category = cmplz_categories[key];
|
||||
if (cmplz_has_consent(category)) {
|
||||
document.querySelectorAll('[data-category="' + category + '"]').forEach(obj => {
|
||||
cmplz_remove_placeholder(obj);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let services = cmplz_get_services_on_page();
|
||||
for (let key in services) {
|
||||
if (services.hasOwnProperty(key)) {
|
||||
let service = services[key].service;
|
||||
let category = services[key].category;
|
||||
if (cmplz_has_service_consent(service, category)) {
|
||||
document.querySelectorAll('[data-service="' + service + '"]').forEach(obj => {
|
||||
cmplz_remove_placeholder(obj);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_elementor_popup_content_blocking', PHP_INT_MAX );
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_elementor_initDomContentLoaded() {
|
||||
if ( cmplz_uses_thirdparty('youtube') || cmplz_uses_thirdparty('facebook') || cmplz_uses_thirdparty('twitter') ) {
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_enable_category", function(consentData) {
|
||||
var category = consentData.detail.category;
|
||||
var services = consentData.detail.services;
|
||||
var blockedContentContainers = [];
|
||||
let selectorVideo = '.cmplz-elementor-widget-video-playlist[data-category="'+category+'"],.elementor-widget-video[data-category="'+category+'"]';
|
||||
let selectorGeneric = '[data-cmplz-elementor-href][data-category="'+category+'"]';
|
||||
for (var skey in services) {
|
||||
if (services.hasOwnProperty(skey)) {
|
||||
let service = skey;
|
||||
selectorVideo +=',.cmplz-elementor-widget-video-playlist[data-service="'+service+'"],.elementor-widget-video[data-service="'+service+'"]';
|
||||
selectorGeneric +=',[data-cmplz-elementor-href][data-service="'+service+'"]';
|
||||
}
|
||||
}
|
||||
document.querySelectorAll(selectorVideo).forEach(obj => {
|
||||
let elementService = obj.getAttribute('data-service');
|
||||
if ( cmplz_is_service_denied(elementService) ) {
|
||||
return;
|
||||
}
|
||||
if (obj.classList.contains('cmplz-elementor-activated')) return;
|
||||
obj.classList.add('cmplz-elementor-activated');
|
||||
|
||||
if ( obj.hasAttribute('data-cmplz_elementor_widget_type') ){
|
||||
let attr = obj.getAttribute('data-cmplz_elementor_widget_type');
|
||||
obj.classList.removeAttribute('data-cmplz_elementor_widget_type');
|
||||
obj.classList.setAttribute('data-widget_type', attr);
|
||||
}
|
||||
if (obj.classList.contains('cmplz-elementor-widget-video-playlist')) {
|
||||
obj.classList.remove('cmplz-elementor-widget-video-playlist');
|
||||
obj.classList.add('elementor-widget-video-playlist');
|
||||
}
|
||||
obj.setAttribute('data-settings', obj.getAttribute('data-cmplz-elementor-settings'));
|
||||
blockedContentContainers.push(obj);
|
||||
});
|
||||
|
||||
document.querySelectorAll(selectorGeneric).forEach(obj => {
|
||||
let elementService = obj.getAttribute('data-service');
|
||||
if ( cmplz_is_service_denied(elementService) ) {
|
||||
return;
|
||||
}
|
||||
if (obj.classList.contains('cmplz-elementor-activated')) return;
|
||||
|
||||
if (obj.classList.contains('cmplz-fb-video')) {
|
||||
obj.classList.remove('cmplz-fb-video');
|
||||
obj.classList.add('fb-video');
|
||||
}
|
||||
|
||||
obj.classList.add('cmplz-elementor-activated');
|
||||
obj.setAttribute('data-href', obj.getAttribute('data-cmplz-elementor-href'));
|
||||
blockedContentContainers.push(obj.closest('.elementor-widget'));
|
||||
});
|
||||
|
||||
/**
|
||||
* Trigger the widgets in Elementor
|
||||
*/
|
||||
for (var key in blockedContentContainers) {
|
||||
if (blockedContentContainers.hasOwnProperty(key) && blockedContentContainers[key] !== undefined) {
|
||||
let blockedContentContainer = blockedContentContainers[key];
|
||||
if (elementorFrontend.elementsHandler) {
|
||||
elementorFrontend.elementsHandler.runReadyTrigger(blockedContentContainer)
|
||||
}
|
||||
var cssIndex = blockedContentContainer.getAttribute('data-placeholder_class_index');
|
||||
blockedContentContainer.classList.remove('cmplz-blocked-content-container');
|
||||
blockedContentContainer.classList.remove('cmplz-placeholder-' + cssIndex);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script);
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_elementor_initDomContentLoaded',PHP_INT_MAX );
|
||||
|
||||
/**
|
||||
* Filter cookie blocker output
|
||||
*/
|
||||
|
||||
function cmplz_elementor_cookieblocker( $output ){
|
||||
|
||||
if ( cmplz_uses_thirdparty('youtube') ) {
|
||||
$iframe_pattern = '/elementor-widget elementor-widget-video[ |\"][^>]+?data-settings="[^"]+?youtube_url[^;]*?":"(.+?(?="))"/is';
|
||||
if ( preg_match_all( $iframe_pattern, $output, $matches, PREG_PATTERN_ORDER ) ) {
|
||||
foreach ( $matches[0] as $key => $total_match ) {
|
||||
$placeholder = '';
|
||||
if ( cmplz_use_placeholder('youtube') && isset($matches[1][$key]) ) {
|
||||
$youtube_url = $matches[1][$key];
|
||||
$placeholder = 'data-placeholder-image="'.cmplz_placeholder( false, stripcslashes($youtube_url) ).'" ';
|
||||
}
|
||||
|
||||
$new_match = str_replace('data-settings', $placeholder.' data-category="marketing" data-service="youtube" data-cmplz-elementor-settings', $total_match);
|
||||
$new_match = str_replace('elementor-widget-video', 'elementor-widget-video cmplz-placeholder-element', $new_match);
|
||||
$output = str_replace($total_match, $new_match, $output);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Playlist
|
||||
*/
|
||||
$iframe_pattern = '/elementor-widget elementor-widget-video-playlist[^>]+?data-settings="[^"]+?youtube_url[^;]*?":"(.+?(?="))"/is';
|
||||
if ( preg_match_all( $iframe_pattern, $output, $matches, PREG_PATTERN_ORDER ) ) {
|
||||
foreach ( $matches[0] as $key => $total_match ) {
|
||||
$placeholder = '';
|
||||
if ( cmplz_use_placeholder('youtube') && isset($matches[1][$key]) ) {
|
||||
$youtube_url = $matches[1][$key];
|
||||
$placeholder = 'data-placeholder-image="'.cmplz_placeholder( false, stripcslashes($youtube_url) ).'" ';
|
||||
}
|
||||
|
||||
$new_match = str_replace('data-settings', $placeholder.' data-category="marketing" data-service="youtube" data-cmplz-elementor-settings', $total_match);
|
||||
$new_match = str_replace('data-widget_type', 'data-cmplz_elementor_widget_type', $new_match);
|
||||
$new_match = str_replace('elementor-widget-video-playlist', 'cmplz-elementor-widget-video-playlist cmplz-placeholder-element', $new_match);
|
||||
$output = str_replace($total_match, $new_match, $output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( cmplz_uses_thirdparty('facebook') ) {
|
||||
$iframe_pattern = '/elementor-widget-facebook-.*?data-href="(.*?)"/is';
|
||||
if ( preg_match_all( $iframe_pattern, $output, $matches, PREG_PATTERN_ORDER ) ) {
|
||||
foreach ( $matches[0] as $key => $total_match ) {
|
||||
$placeholder = '';
|
||||
|
||||
if ( cmplz_use_placeholder('facebook') ) {
|
||||
$placeholder = 'data-placeholder-image="'.cmplz_placeholder( 'facebook' ).'" ';
|
||||
}
|
||||
$new_match = str_replace('data-href="', $placeholder.'data-category="marketing" data-service="facebook" data-cmplz-elementor-href="', $total_match);
|
||||
$new_match = str_replace('fb-video', 'cmplz-fb-video', $new_match);
|
||||
|
||||
$new_match = str_replace('elementor-facebook-widget', 'elementor-facebook-widget cmplz-placeholder-element', $new_match);
|
||||
$output = str_replace($total_match, $new_match, $output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( cmplz_uses_thirdparty('twitter') ) {
|
||||
$iframe_pattern = '/elementor-widget-twitter-.*?data-href="(.*?)"/is';
|
||||
if ( preg_match_all( $iframe_pattern, $output, $matches, PREG_PATTERN_ORDER ) ) {
|
||||
foreach ( $matches[0] as $key => $total_match ) {
|
||||
$placeholder = '';
|
||||
if ( cmplz_use_placeholder('twitter') ) {
|
||||
$placeholder = 'data-placeholder-image="'.cmplz_placeholder( 'twitter' ).'" ';
|
||||
}
|
||||
$new_match = str_replace('data-href="', $placeholder.'data-category="marketing" data-service="twitter" data-cmplz-elementor-href="', $total_match);
|
||||
$output = str_replace($total_match, $new_match, $output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
add_filter('cmplz_cookie_blocker_output', 'cmplz_elementor_cookieblocker');
|
||||
|
||||
add_action( 'cmplz_banner_css', 'cmplz_elementor_css' );
|
||||
function cmplz_elementor_css() {
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){ ?>
|
||||
.cmplz-blocked-content-container.elementor-g-recaptcha {
|
||||
max-width: initial !important;
|
||||
height: 80px !important;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 400px) {
|
||||
.cmplz-blocked-content-container.elementor-g-recaptcha{
|
||||
height: 100px !important
|
||||
}
|
||||
}
|
||||
.cmplz-blocked-content-container.elementor-g-recaptcha .cmplz-blocked-content-notice {
|
||||
max-width: initial;
|
||||
padding: 7px;
|
||||
position:relative !important;
|
||||
transform:initial;
|
||||
top:initial;
|
||||
left:initial;
|
||||
}
|
||||
<?php }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
if ( !defined("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE") ) define("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE", true);
|
||||
|
||||
function cmplz_embed_google_fonts_filter_pro_fields($fields) {
|
||||
$index = cmplz_get_field_index('self_host_google_fonts', $fields);
|
||||
$fields[$index]['help'] = [
|
||||
'label' => 'default',
|
||||
'title' => __('Self-hosting Google Fonts', 'complianz-gdpr'),
|
||||
'text' => sprintf( __("You have %s installed. We recommend saying 'Yes' to self-hosting Google Fonts", "complianz-gdpr") ,"Embed Google Fonts"),
|
||||
];
|
||||
return $fields;
|
||||
}
|
||||
add_filter('cmplz_fields', 'cmplz_embed_google_fonts_filter_pro_fields', 200, 1);
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_facebookforwoocommerce_script' );
|
||||
function cmplz_facebookforwoocommerce_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'facebook',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'facebook',
|
||||
'urls' => array(
|
||||
'connect.facebook.net',
|
||||
'fbq',
|
||||
),
|
||||
);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_facebookforwoocommerce_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_social_media',
|
||||
'cmplz_facebookforwoocommerce_detected_social_media' );
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_facebookforwordpress_script' );
|
||||
function cmplz_facebookforwordpress_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'facebook',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'facebook',
|
||||
'urls' => array(
|
||||
'fbq',
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_facebookforwordpress_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_social_media',
|
||||
'cmplz_facebookforwordpress_detected_social_media' );
|
||||
|
||||
/**
|
||||
* Block pixel image
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_image_tags', 'cmplz_facebookforwordpress_imagetags' );
|
||||
function cmplz_facebookforwordpress_imagetags( $tags ) {
|
||||
$tags[] = 'https://www.facebook.com/tr';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
if ( !defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE') ) define('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE', true);
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_flexible_map_script' );
|
||||
function cmplz_flexible_map_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'maps.google.com',
|
||||
'flexible-map.min.js',
|
||||
'flexible-map.js',
|
||||
'FlexibleMap'
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'flxmap-container',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.google.com' => 'flexible-map',
|
||||
'flexible-map' => 'FlexibleMap',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Novo Map
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_flexible_map_initDomContentLoaded() {
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_novo_fire_domContentLoadedEvent);
|
||||
function cmplz_novo_fire_domContentLoadedEvent() {
|
||||
window.document.dispatchEvent(new Event("DOMContentLoaded", {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}));
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_flexible_map_initDomContentLoaded',PHP_INT_MAX );
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_flexible_map_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_flexible_map_detected_services' );
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
final class CMPLZ_Forminator_Addon_V2 extends Forminator_Integration {
|
||||
|
||||
private static $_instance = null;
|
||||
/**
|
||||
* Use this trait to mark this addon as PRO
|
||||
*/
|
||||
protected $_slug = 'complianz';
|
||||
protected $_version = cmplz_version;
|
||||
protected $_min_forminator_version = '1.1';
|
||||
protected $_short_title = 'Complianz';
|
||||
protected $_title = 'Complianz Privacy Suite';
|
||||
protected $_url = 'https://complianz.io';
|
||||
protected $_full_path = __FILE__;
|
||||
|
||||
public function __construct() {
|
||||
// late init to allow translation
|
||||
$this->_description
|
||||
= __( 'Integrate Forminator with Complianz Privacy Suite',
|
||||
"complianz-gdpr" );
|
||||
$this->_activation_error_message
|
||||
= __( 'Sorry but we failed to activate the Complianz integration',
|
||||
"complianz-gdpr" );
|
||||
$this->_deactivation_error_message
|
||||
= __( 'Sorry but we failed to deactivate the Complianz integration, please try again',
|
||||
"complianz-gdpr" );
|
||||
|
||||
$this->_update_settings_error_message = __(
|
||||
'Sorry, we failed to update settings, please check your form and try again',
|
||||
"complianz-gdpr"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return self|null
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag for check if and addon connected (global settings suchs as api key complete)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_connected() {
|
||||
$fields = get_option( 'complianz_options_integrations' );
|
||||
if ( ! isset( $fields["forminator"] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( isset( $fields["forminator"] ) && $fields["forminator"] == 1 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag for check if and addon connected to a form(form settings suchs as list name completed)
|
||||
*
|
||||
* @param $form_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_form_connected( $form_id ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Image
|
||||
*
|
||||
* @return string
|
||||
* @since 1.1
|
||||
*/
|
||||
public function get_image() {
|
||||
return cmplz_url . 'assets/images/icon-logo.svg';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Retina image
|
||||
*
|
||||
* @return string
|
||||
* @since 1.1
|
||||
*/
|
||||
public function get_image_x2() {
|
||||
return cmplz_url . 'assets/images/icon-256x256.png';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon
|
||||
*
|
||||
* @return string
|
||||
* @since 1.1
|
||||
*/
|
||||
public function get_icon() {
|
||||
return cmplz_url . 'assets/images/icon-logo.svg';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Retina icon
|
||||
*
|
||||
* @return string
|
||||
* @since 1.1
|
||||
*/
|
||||
public function get_icon_x2() {
|
||||
return cmplz_url . 'assets/images/icon-256x256.png';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
final class CMPLZ_Forminator_Addon extends Forminator_Addon_Abstract {
|
||||
|
||||
private static $_instance = null;
|
||||
/**
|
||||
* Use this trait to mark this addon as PRO
|
||||
*/
|
||||
protected $_slug = 'complianz';
|
||||
protected $_version = cmplz_version;
|
||||
protected $_min_forminator_version = '1.1';
|
||||
protected $_short_title = 'Complianz';
|
||||
protected $_title = 'Complianz Privacy Suite';
|
||||
protected $_url = 'https://complianz.io';
|
||||
protected $_full_path = __FILE__;
|
||||
protected $_icon;
|
||||
protected $_icon_x2;
|
||||
protected $_image = '';
|
||||
protected $_image_x2 = '';
|
||||
|
||||
public function __construct() {
|
||||
$this->_icon = cmplz_url . 'assets/images/icon-logo.svg';
|
||||
$this->_icon_x2 = cmplz_url . 'assets/images/icon-256x256.png';
|
||||
// late init to allow translation
|
||||
$this->_description
|
||||
= __( 'Integrate Forminator with Complianz Privacy Suite',
|
||||
"complianz-gdpr" );
|
||||
$this->_activation_error_message
|
||||
= __( 'Sorry but we failed to activate the Complianz integration',
|
||||
"complianz-gdpr" );
|
||||
$this->_deactivation_error_message
|
||||
= __( 'Sorry but we failed to deactivate the Complianz integration, please try again',
|
||||
"complianz-gdpr" );
|
||||
|
||||
$this->_update_settings_error_message = __(
|
||||
'Sorry, we failed to update settings, please check your form and try again',
|
||||
"complianz-gdpr"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return self|null
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( is_null( self::$_instance ) ) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag for check if and addon connected (global settings suchs as api key complete)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_connected() {
|
||||
$fields = get_option( 'complianz_options_integrations' );
|
||||
if ( ! isset( $fields["forminator"] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( isset( $fields["forminator"] ) && $fields["forminator"] == 1 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag for check if and addon connected to a form(form settings suchs as list name completed)
|
||||
*
|
||||
* @param $form_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_form_connected( $form_id ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
add_action( 'forminator_addons_loaded', 'cmplz_load_forminator_addon' );
|
||||
function cmplz_load_forminator_addon() {
|
||||
|
||||
if ( class_exists( 'Forminator_Integration_Loader' ) ) {
|
||||
require_once dirname( __FILE__ ) . '/forminator-addon-class-v2.php';
|
||||
|
||||
Forminator_Integration_Loader::get_instance()
|
||||
->register( 'CMPLZ_Forminator_Addon_V2' );
|
||||
} elseif ( class_exists( 'Forminator_Addon_Loader' ) ) {
|
||||
require_once dirname( __FILE__ ) . '/forminator-addon-class.php';
|
||||
|
||||
Forminator_Addon_Loader::get_instance()
|
||||
->register( 'CMPLZ_Forminator_Addon' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Override the forminator captcha message so users understand it doesn't work because recaptcha is blocked.
|
||||
*
|
||||
*/
|
||||
|
||||
add_filter( 'forminator_invalid_captcha_message',
|
||||
'cmplz_forminator_override_recaptcha_error', 10, 4 );
|
||||
function cmplz_forminator_override_recaptcha_error(
|
||||
$invalid_captcha_message, $element_id, $field, $verify
|
||||
) {
|
||||
$invalid_captcha_message
|
||||
= __( "Please accept cookies so we can validate your request with reCaptcha, and submit this form",
|
||||
"complianz-gdpr" );
|
||||
|
||||
return $invalid_captcha_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add forminator as formtype to the list
|
||||
*
|
||||
* @param $formtypes
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function cmplz_forminator_form_types( $formtypes ) {
|
||||
$formtypes['fn_'] = 'forminator';
|
||||
|
||||
return $formtypes;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_form_types', 'cmplz_forminator_form_types' );
|
||||
|
||||
/**
|
||||
* Get list of Forminator forms
|
||||
*
|
||||
* @param array $input_forms
|
||||
*
|
||||
* @return array $input_forms
|
||||
*/
|
||||
|
||||
function cmplz_forminator_get_plugin_forms( $input_forms ) {
|
||||
$forms = Forminator_API::get_forms();
|
||||
if ( is_array( $forms ) ) {
|
||||
$forms = wp_list_pluck( $forms, "name", "id" );
|
||||
foreach ( $forms as $id => $title ) {
|
||||
$input_forms[ 'fn_' . $id ] = $title . " " . '(Forminator)';
|
||||
}
|
||||
}
|
||||
|
||||
return $input_forms;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_get_forms', 'cmplz_forminator_get_plugin_forms' );
|
||||
|
||||
/**
|
||||
* Adds a consent box the a Forminator form
|
||||
*
|
||||
* @param $form_id
|
||||
*/
|
||||
function cmplz_forminator_add_consent_checkbox( $form_id ) {
|
||||
|
||||
$form_id = str_replace( 'fn_', '', $form_id );
|
||||
$gdpr_field = Forminator_API::get_form_fields_by_type( $form_id,
|
||||
'gdprcheckbox' );
|
||||
if ( is_wp_error( $gdpr_field ) ) {
|
||||
$data = array(
|
||||
'condition_action' => 'show',
|
||||
'condition_rule' => 'any',
|
||||
'type' => 'gdprcheckbox',
|
||||
"required" => true,
|
||||
'cols' => '12',
|
||||
'validation' => '',
|
||||
'gdpr_description' => cmplz_sprintf( __( "Yes, I agree with the %sPrivacy Statement%s",
|
||||
"complianz-gdpr" ), '<a href="'
|
||||
. COMPLIANZ::$document->get_permalink( 'privacy-statement',
|
||||
'eu', true ) . '">', '</a>' ),
|
||||
'field_label' => __( 'Privacy', "complianz-gdpr" ),
|
||||
'description' => '',
|
||||
'validation_text' => '',
|
||||
'custom-class' => ''
|
||||
);
|
||||
|
||||
Forminator_API::add_form_field( $form_id, 'gdprcheckbox', $data );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( "cmplz_add_consent_box_forminator",
|
||||
'cmplz_forminator_add_consent_checkbox' );
|
||||
|
||||
|
||||
add_filter( 'cmplz_placeholder_markers', 'cmplz_forminator_placeholder' );
|
||||
function cmplz_forminator_placeholder( $tags ) {
|
||||
$tags['google-recaptcha'][] = 'forminator-g-recaptcha';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add some custom css for the placeholder
|
||||
*/
|
||||
|
||||
add_action( 'cmplz_banner_css', 'cmplz_forminator_css' );
|
||||
function cmplz_forminator_css() {
|
||||
?>
|
||||
.cmplz-blocked-content-container.forminator-g-recaptcha {
|
||||
max-width: initial !important;
|
||||
height: 90px !important
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 400px) {
|
||||
.cmplz-blocked-content-container.forminator-g-recaptcha {
|
||||
height: 100px !important
|
||||
}
|
||||
}
|
||||
|
||||
.cmplz-blocked-content-container.forminator-g-recaptcha .cmplz-blocked-content-notice {
|
||||
top: unset;
|
||||
left: unset;
|
||||
transform: unset;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
|
||||
;
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
if ( !defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE') ) define('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE', true);
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_g1_gmaps_script' );
|
||||
function cmplz_g1_gmaps_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'g1-gmaps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'g1-gmaps.js',
|
||||
'infobox_packed.js',
|
||||
'maps.googleapis.com',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'g1gmap-main',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com' => 'g1-gmaps.js',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_g1_gmaps_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_g1_gmaps_detected_services' );
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_custom_googlemaps_script' );
|
||||
|
||||
/**
|
||||
* Block the script, and an inline script with string 'initMap'.
|
||||
* initMap can also be something else. That's the problem with custom maps :)
|
||||
*
|
||||
* @param $tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_custom_googlemaps_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'show_google_map_acf.js',
|
||||
'maps.googleapis.com/maps/api/js',
|
||||
),
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com/maps/api/' => 'show_google_map_acf.js',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_geo_my_wp_script' );
|
||||
function cmplz_geo_my_wp_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'GMW_Map',
|
||||
'gmw.',
|
||||
'apis.google.com',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'gmw-map-cover',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'gmw.map.min.js' => "GMW_Maps['kleo_geo']",
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_geo_my_wp_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_geo_my_wp_detected_services' );
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Keep GADWP settings in sync with Complianz
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @param string $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function cmplz_gadwp_options( $value, $key, $default ) {
|
||||
|
||||
if ( $key === 'anonymize_ips' ) {
|
||||
if (cmplz_no_ip_addresses()){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $key === 'demographics' ) {
|
||||
if (cmplz_statistics_no_sharing_allowed()){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'exactmetrics_get_option', 'cmplz_gadwp_options' , 10, 3 );
|
||||
/**
|
||||
* Set analytics as suggested stats tool in the wizard
|
||||
*/
|
||||
|
||||
function cmplz_gadwp_set_default( $value, $fieldname, $field ) {
|
||||
if ( $fieldname === 'compile_statistics' ) {
|
||||
return "google-analytics";
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'cmplz_default_value', 'cmplz_gadwp_set_default', 20, 3 );
|
||||
|
||||
/**
|
||||
* Add notice to tell a user to choose Analytics
|
||||
*
|
||||
* @param $notices
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_gadwp_show_compile_statistics_notice($notices) {
|
||||
$text = '';
|
||||
if ( cmplz_no_ip_addresses() ) {
|
||||
$text .= cmplz_sprintf(__( "You have selected you anonymize IP addresses. This setting is now enabled in %s.",
|
||||
'complianz-gdpr' ), 'Google Analytics Dashboard for WP' );
|
||||
}
|
||||
if ( cmplz_statistics_no_sharing_allowed() ) {
|
||||
$text .= cmplz_sprintf( __( "You have selected you do not share data with third-party networks. Display advertising is now disabled in %s.",
|
||||
'complianz-gdpr' ), 'Google Analytics Dashboard for WP' ) ;
|
||||
}
|
||||
$found_key = false;
|
||||
//find notice with field_id 'compile_statistics' and replace it with our own
|
||||
foreach ($notices as $key=>$notice) {
|
||||
if ($notice['field_id']==='compile_statistics') {
|
||||
$found_key = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$notice = [
|
||||
'field_id' => 'compile_statistics',
|
||||
'label' => 'default',
|
||||
'title' => __( "Statistics plugin detected", 'complianz-gdpr' ),
|
||||
'text' => cmplz_sprintf( __( "You use %s, which means the answer to this question should be Google Analytics.", 'complianz-gdpr' ), 'ExactMetrics' )
|
||||
.' '.$text,
|
||||
];
|
||||
|
||||
if ($found_key){
|
||||
$notices[$found_key] = $notice;
|
||||
} else {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
return $notices;
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_gadwp_show_compile_statistics_notice' );
|
||||
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_gadwp_filter_warnings( $warnings ) {
|
||||
unset( $warnings[ 'ga-needs-configuring' ] );
|
||||
unset( $warnings[ 'gtm-needs-configuring' ] );
|
||||
return $warnings;
|
||||
}
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_gadwp_filter_warnings' );
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when gadwp is enabled.
|
||||
*
|
||||
* @param $fields
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_gadwp_filter_fields( $fields ) {
|
||||
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info', $fields);
|
||||
if ($index!==false) unset($fields[$index]['help']);
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'consent-mode',
|
||||
'gtag-basic-consent-mode',
|
||||
'cmplz-gtag-urlpassthrough',
|
||||
'cmplz-gtag-ads_data_redaction',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
add_filter( 'cmplz_fields', 'cmplz_gadwp_filter_fields', 200, 1 );
|
||||
|
||||
/**
|
||||
* We remove some actions to integrate fully
|
||||
* */
|
||||
function cmplz_gadwp_remove_scripts_others() {
|
||||
remove_action( 'cmplz_statistics_script', array( COMPLIANZ::$banner_loader, 'get_statistics_script' ), 10 );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'cmplz_gadwp_remove_scripts_others' );
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
if ( !defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE') ) define('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE', true);
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_google_maps_easy_script' );
|
||||
function cmplz_google_maps_easy_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'google-maps-easy',
|
||||
'maps.googleapis.com',
|
||||
'frontend.gmap.js',
|
||||
'frontend.gmap-js-extra',
|
||||
|
||||
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'gmpMapDetailsContainer',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com' => 'google-maps-easy',
|
||||
'maps.googleapis.com' => 'frontend.gmap.js',
|
||||
'maps.googleapis.com' => 'frontend.gmap-js-extra',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_google_maps_easy_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_google_maps_easy_detected_services' );
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Conditional notices for fields
|
||||
*
|
||||
* @param array $notices
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_google_site_kit_show_compile_statistics_notice(array $notices): array {
|
||||
if ( ! cmplz_user_can_manage() ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
//don't run integration if WP Consent API is active
|
||||
if (defined('WP_CONSENT_API_VERSION')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$notices[] = [
|
||||
'field_id' => 'consent-mode',
|
||||
'label' => 'warning',
|
||||
'url' => 'https://complianz.io/configuring-google-site-kit/',
|
||||
'title' => "Google Site Kit",
|
||||
'text' => cmplz_sprintf( __( "Because you're using %s, you can choose which plugin should insert the relevant snippet. If you want to use Google Consent Mode, you can only use the default, advanced mode. You can read more about configuring SiteKit and the different Consent Mode below.", 'complianz-gdpr' ), "Google Site Kit" ),
|
||||
];
|
||||
|
||||
return $notices;
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_google_site_kit_show_compile_statistics_notice', 10, 1 );
|
||||
|
||||
/**
|
||||
* We remove some actions to integrate fully
|
||||
* */
|
||||
function cmplz_google_site_kit_remove_scripts_others() {
|
||||
if ( cmplz_consent_mode() || defined('WP_CONSENT_API_VERSION') ) {
|
||||
remove_action( 'cmplz_statistics_script', array( COMPLIANZ::$banner_loader, 'get_statistics_script' ), 10 );
|
||||
}
|
||||
}
|
||||
add_action( 'after_setup_theme', 'cmplz_google_site_kit_remove_scripts_others' );
|
||||
|
||||
function cmplz_google_sitekit_script() {
|
||||
//don't run integration if WP Consent API is active
|
||||
if (defined('WP_CONSENT_API_VERSION')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! cmplz_consent_mode() ) {
|
||||
return;
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
<?php
|
||||
$statistics = cmplz_get_option( 'compile_statistics' );
|
||||
$script = '';
|
||||
if ( $statistics === 'google-analytics' ) {
|
||||
$enable_tcf_support = cmplz_tcf_active() ? 'true' : 'false';
|
||||
$ads_data_redaction = cmplz_get_option( "cmplz-gtag-ads_data_redaction" )==='yes' ? 'true' : 'false';
|
||||
$urlpassthrough = cmplz_get_option( "cmplz-gtag-urlpassthrough" )==='yes' ? 'true' : 'false';
|
||||
$script = cmplz_get_template( "statistics/gtag-consent-mode-sitekit.js" );
|
||||
$script = str_replace( array('{enable_tcf_support}', '{ads_data_redaction}', '{url_passthrough}'), array($enable_tcf_support, $ads_data_redaction, $urlpassthrough), $script );
|
||||
}
|
||||
echo apply_filters( 'cmplz_script_filter', $script );
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'google_gtagjs', $script, 'before' );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_google_sitekit_script', 100 );
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_google_site_filter_warnings( $warnings ) {
|
||||
unset( $warnings[ 'ga-needs-configuring' ] );
|
||||
unset( $warnings[ 'gtm-needs-configuring' ] );
|
||||
return $warnings;
|
||||
}
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_google_site_filter_warnings' );
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when gadwp is enabled.
|
||||
*
|
||||
* @param $fields
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_google_site_kit_filter_fields( $fields ) {
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info', $fields);
|
||||
if ($index!==false) unset($fields[$index]['help']);
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'gtag-basic-consent-mode',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
add_filter( 'cmplz_fields', 'cmplz_google_site_kit_filter_fields', 200, 1 );
|
||||
|
||||
/**
|
||||
* Whitelist a string for the cookie blocker
|
||||
* @param string $class
|
||||
* @param int $total_match
|
||||
* @param bool $found
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param array $whitelisted_script_tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_google_site_kit_whitelisted_script_tags( $whitelisted_script_tags ) {
|
||||
$whitelisted_script_tags[] = 'google_gtagjs-js-after'; //'string from inline script or source that should be whitelisted'
|
||||
$whitelisted_script_tags[] = 'google_gtagjs-js'; //'string from inline script or source that should be whitelisted'
|
||||
return $whitelisted_script_tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_google_site_kit_whitelisted_script_tags', 10, 1 );
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Set analytics as suggested stats tool in the wizard
|
||||
*/
|
||||
add_filter( 'cmplz_default_value', 'cmplz_gtm4wp_set_default', 20, 3 );
|
||||
function cmplz_gtm4wp_set_default( $value, $fieldname, $field ) {
|
||||
if ( $fieldname === 'compile_statistics' ) {
|
||||
return "google-tag-manager";
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove stats
|
||||
*
|
||||
* */
|
||||
function cmplz_gtm4wp_show_compile_statistics_notice($notices) {
|
||||
$text = '';
|
||||
if ( cmplz_no_ip_addresses() ) {
|
||||
$text .= cmplz_sprintf( __( "You have selected you anonymize IP addresses. This setting is now enabled in %s.", 'complianz-gdpr' ), 'Google Tag Manager for WordPress' ) ;
|
||||
}
|
||||
if ( cmplz_statistics_no_sharing_allowed() ) {
|
||||
$text .= cmplz_sprintf( __( "You have selected you do not share data with third-party networks. Remarketing is now disabled in %s.", 'complianz-gdpr' ), 'Google Tag Manager for WordPress' ) ;
|
||||
}
|
||||
//find notice with field_id 'compile_statistics' and replace it with our own
|
||||
$found_key = false;
|
||||
foreach ($notices as $key=>$notice) {
|
||||
if ($notice['field_id']==='compile_statistics') {
|
||||
$found_key = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$notice = [
|
||||
'field_id' => 'compile_statistics',
|
||||
'label' => 'default',
|
||||
'title' => __( "Statistics plugin detected", 'complianz-gdpr' ),
|
||||
'text' => cmplz_sprintf( __( "You use %s, which means the answer to this question should be Google Tag Manager.", 'complianz-gdpr' ), 'Google Tag Manager for WordPress' )
|
||||
.' '.$text,
|
||||
];
|
||||
|
||||
if ($found_key){
|
||||
$notices[$found_key] = $notice;
|
||||
} else {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
return $notices;
|
||||
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_gtm4wp_show_compile_statistics_notice' );
|
||||
|
||||
|
||||
/**
|
||||
* Configure options for GTM4WP
|
||||
*/
|
||||
function cmplz_gtm4wp_options() {
|
||||
if ( !defined('GTM4WP_OPTIONS')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$storedoptions = (array) get_option( GTM4WP_OPTIONS );
|
||||
$save = false;
|
||||
|
||||
if ( defined('GTM4WP_OPTION_INCLUDE_VISITOR_IP' ) ) {
|
||||
if ( isset( $storedoptions[ GTM4WP_OPTION_INCLUDE_VISITOR_IP ] ) ) {
|
||||
if ( cmplz_no_ip_addresses() && $storedoptions[ GTM4WP_OPTION_INCLUDE_VISITOR_IP ]
|
||||
) {
|
||||
$storedoptions[ GTM4WP_OPTION_INCLUDE_VISITOR_IP ] = false;
|
||||
$save = true;
|
||||
} elseif ( ! cmplz_no_ip_addresses() && ! ! $storedoptions[ GTM4WP_OPTION_INCLUDE_VISITOR_IP ]
|
||||
) {
|
||||
$save = true;
|
||||
$storedoptions[ GTM4WP_OPTION_INCLUDE_VISITOR_IP ] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//handle sharing of data
|
||||
//since 1.15.1 remarketing constant has been removed
|
||||
if (defined('GTM4WP_OPTION_INCLUDE_REMARKETING')) {
|
||||
if ( isset( $storedoptions[ GTM4WP_OPTION_INCLUDE_REMARKETING ] ) ) {
|
||||
if ( cmplz_statistics_no_sharing_allowed()
|
||||
&& $storedoptions[ GTM4WP_OPTION_INCLUDE_REMARKETING ]
|
||||
) {
|
||||
$save = true;
|
||||
$storedoptions[ GTM4WP_OPTION_INCLUDE_REMARKETING ] = false;
|
||||
|
||||
} elseif ( ! cmplz_statistics_no_sharing_allowed()
|
||||
&& ! $storedoptions[ GTM4WP_OPTION_INCLUDE_REMARKETING ]
|
||||
) {
|
||||
$save = true;
|
||||
$storedoptions[ GTM4WP_OPTION_INCLUDE_REMARKETING ] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( $save ) {
|
||||
update_option( GTM4WP_OPTIONS, $storedoptions );
|
||||
}
|
||||
}
|
||||
add_action( 'admin_init', 'cmplz_gtm4wp_options' );
|
||||
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_gtm4wp_filter_warnings( $warnings ) {
|
||||
unset($warnings['gtm-needs-configuring']);
|
||||
return $warnings;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_gtm4wp_filter_warnings' );
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when gtm4wp is enabled.
|
||||
*
|
||||
* @param $fields
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_gtm4wp_filter_fields( $fields ) {
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info_tag_manager', $fields);
|
||||
if ( $index!==false ) {
|
||||
unset($fields[$index]['help']);
|
||||
}
|
||||
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'consent-mode',
|
||||
'gtag-basic-consent-mode',
|
||||
'cmplz-gtag-urlpassthrough',
|
||||
'cmplz-gtag-ads_data_redaction',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_fields', 'cmplz_gtm4wp_filter_fields', 2000, 1 );
|
||||
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Add some custom css for the recaptcha integration
|
||||
*/
|
||||
function cmplz_gravityforms_recaptcha_css() {
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){
|
||||
?>
|
||||
.cmplz-gf-recaptcha {
|
||||
background-image:url(<?php echo cmplz_placeholder('google-recaptcha')?>) !important;
|
||||
cursor:pointer;
|
||||
white-space: normal;
|
||||
text-transform: initial;
|
||||
z-index: 98;
|
||||
line-height: 23px;
|
||||
height:80px !important;
|
||||
background: #FFF;
|
||||
border: 0;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 1px 0 rgba(0,0,0,0.5), 0 1px 10px 0 rgba(0,0,0,0.15);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-repeat: no-repeat !important;
|
||||
background-size: cover !important;
|
||||
position: relative;
|
||||
}
|
||||
@media only screen and (max-width: 400px) {
|
||||
.cmplz-gf-recaptcha {
|
||||
height: 100px !important
|
||||
}
|
||||
}
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action( 'cmplz_banner_css', 'cmplz_gravityforms_recaptcha_css' );
|
||||
|
||||
/**
|
||||
* Initialize the form after cookies have been accepted, to ensure recaptcha is enabled.
|
||||
*/
|
||||
|
||||
function cmplz_gravifyforms_initform() {
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
//store the container where gf recaptcha resides
|
||||
let recaptcha_field = document.querySelector('.ginput_recaptcha');
|
||||
if (recaptcha_field) {
|
||||
let reCaptchaContainer = recaptcha_field.closest('.gfield');
|
||||
let html = '<span class="cmplz-gf-recaptcha cmplz-accept-marketing"><?php esc_html_e(__( "Click to accept reCaptcha validation.", 'complianz-gdpr' ))?></span>';
|
||||
reCaptchaContainer.insertAdjacentHTML('beforeend', html);
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_cf7_fire_post_render);
|
||||
}
|
||||
function cmplz_cf7_fire_post_render() {
|
||||
//fire a DomContentLoaded event, so the Contact Form 7 reCaptcha integration will work
|
||||
window.document.dispatchEvent(new Event("gform_post_render", {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}));
|
||||
let obj = document.querySelector('.cmplz-gf-recaptcha');
|
||||
if (obj){
|
||||
obj.parentNode.removeChild(obj)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_gravifyforms_initform', PHP_INT_MAX );
|
||||
|
||||
/**
|
||||
* Add gravify forms as form type
|
||||
* @param $formtypes
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_gravityforms_form_types( $formtypes ) {
|
||||
$formtypes['gf_'] = 'gravity-forms';
|
||||
|
||||
return $formtypes;
|
||||
}
|
||||
add_filter( 'cmplz_form_types', 'cmplz_gravityforms_form_types' );
|
||||
|
||||
function cmplz_gravityforms_get_plugin_forms( $input_forms ) {
|
||||
$forms = GFAPI::get_forms();
|
||||
if ( is_array( $forms ) ) {
|
||||
$forms = wp_list_pluck( $forms, "title", "id" );
|
||||
foreach ( $forms as $id => $title ) {
|
||||
$input_forms[ 'gf_' . $id ] = $title . " " . '(Gravity Forms)';
|
||||
}
|
||||
}
|
||||
|
||||
return $input_forms;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_get_forms', 'cmplz_gravityforms_get_plugin_forms' );
|
||||
|
||||
function cmplz_gravityforms_add_consent_checkbox( $form_id ) {
|
||||
|
||||
$form_id = str_replace( 'gf_', '', $form_id );
|
||||
$label
|
||||
= __( 'To submit this form, you need to accept our Privacy Statement',
|
||||
'complianz-gdpr' );
|
||||
|
||||
$form = GFAPI::get_form( $form_id );
|
||||
$new_field_id = 1;
|
||||
$complianz_field_exists = false;
|
||||
foreach ( $form['fields'] as $field ) {
|
||||
$field_id = $field->id;
|
||||
if ( $field_id > $new_field_id ) {
|
||||
$new_field_id = $field_id;
|
||||
}
|
||||
if ( $field->adminLabel == 'complianz_consent' ) {
|
||||
$complianz_field_exists = true;
|
||||
};
|
||||
}
|
||||
|
||||
$new_field_id ++;
|
||||
|
||||
if ( ! $complianz_field_exists ) {
|
||||
$inputs = array(
|
||||
array(
|
||||
'id' => $new_field_id . '.1',
|
||||
'label' => __( 'Accept', 'complianz-gdpr' ),
|
||||
),
|
||||
);
|
||||
$choices = array(
|
||||
array(
|
||||
'text' => __( 'Accept', 'complianz-gdpr' ),
|
||||
'value' => __( 'Accept', 'complianz-gdpr' ),
|
||||
'isSelected' => false,
|
||||
),
|
||||
);
|
||||
|
||||
$consent_box = new GF_Field_Checkbox();
|
||||
$consent_box->label = $label;
|
||||
$consent_box->adminLabel = 'complianz_consent';
|
||||
$consent_box->id = $new_field_id;
|
||||
$consent_box->description = '<a href="'
|
||||
. COMPLIANZ::$document->get_permalink( 'privacy-statement',
|
||||
'eu', true ) . '">' . __( "Privacy Statement",
|
||||
"complianz-gdpr" ) . '</a>';
|
||||
$consent_box->isRequired = true;
|
||||
$consent_box->choices = $choices;
|
||||
$consent_box->inputs = $inputs;
|
||||
$consent_box->conditionalLogic = false;
|
||||
$form['fields'][] = $consent_box;
|
||||
|
||||
GFAPI::update_form( $form );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( "cmplz_add_consent_box_gravity-forms", 'cmplz_gravityforms_add_consent_checkbox' );
|
||||
|
||||
/**
|
||||
* Update form permalink on last wizard step
|
||||
* Fixes an issue where permalink is empty after checkbox has been created but wizard hasn't been completed
|
||||
* @return void
|
||||
*/
|
||||
function cmplz_gravityforms_update_consent_checkbox() {
|
||||
|
||||
$forms = cmplz_get_option( 'add_consent_to_forms' );
|
||||
|
||||
if ( ! $forms || ! is_array( $forms ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $forms as $form_id => $checked ) {
|
||||
|
||||
// Skip when not a GF form
|
||||
if ( stripos( $form_id, 'gf_' ) === false ) continue;
|
||||
|
||||
$form_id = str_replace( 'gf_', '', $form_id );
|
||||
$form = GFAPI::get_form( $form_id );
|
||||
|
||||
foreach ( $form['fields'] as $field ) {
|
||||
if ( $field->adminLabel === 'complianz_consent') {
|
||||
$field->description = '<a href="'
|
||||
. COMPLIANZ::$document->get_permalink( 'privacy-statement',
|
||||
'eu', true ) . '">' . __( "Privacy Statement",
|
||||
"complianz-gdpr" ) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
GFAPI::update_form( $form );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( "cmplz_finish_wizard", 'cmplz_gravityforms_update_consent_checkbox' );
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_greenshift_script' );
|
||||
function cmplz_greenshift_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'youtube',
|
||||
'placeholder' => 'youtube',
|
||||
'category' => 'marketing',
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'gs-video-element',
|
||||
'urls' => array(
|
||||
'greenshift-video',
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_greenshift_detected_services( $services ) {
|
||||
if ( ! in_array( 'youtube', $services ) ) {
|
||||
$services[] = 'youtube';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_greenshift_detected_services' );
|
||||
|
||||
// Replace watch?v= with embed in the cookie blocker output, as Greenshift loads the video in an iFrame
|
||||
function cmplz_greenshift_cookieblocker( $output ) {
|
||||
if ( cmplz_uses_thirdparty('youtube') ) {
|
||||
// This regex pattern finds iframes with YouTube watch URLs, handling both single and double quotes
|
||||
$iframe_pattern = '/<iframe[^>]*?(?:src|data-src-cmplz)=((["\'])(https:\/\/www\.youtube\.com\/watch\?v=([^"&\']+))\2)[^>]*?>/is';
|
||||
if ( preg_match_all( $iframe_pattern, $output, $matches, PREG_PATTERN_ORDER ) ) {
|
||||
foreach ( $matches[0] as $key => $total_match ) {
|
||||
if ( isset($matches[4][$key]) ) {
|
||||
$video_id = $matches[4][$key];
|
||||
$embed_url = "https://www.youtube.com/embed/" . $video_id;
|
||||
// Replace both src and data-src-cmplz with the YouTube embed URL
|
||||
$new_match = str_replace($matches[3][$key], $embed_url, $total_match);
|
||||
$output = str_replace($total_match, $new_match, $output);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
add_filter('cmplz_cookie_blocker_output', 'cmplz_greenshift_cookieblocker');
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* If reCaptcha is enabled in Happy Forms. Block front-end script
|
||||
*
|
||||
*/
|
||||
|
||||
if (cmplz_get_option('block_recaptcha_service') === 'yes'){
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_happyforms_script' );
|
||||
function cmplz_happyforms_script( $tags ) {
|
||||
$tags[] = 'recaptchav3/frontend.js';
|
||||
return $tags;
|
||||
}
|
||||
}
|
||||
|
||||
function cmplz_happyforms_initform() {
|
||||
ob_start();
|
||||
/**
|
||||
* Happy form requires jquery
|
||||
*/
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function ($) {
|
||||
$(document).on("cmplz_run_after_all_scripts", cmplzRunHappyFormsScript);
|
||||
function cmplzRunHappyFormsScript() {
|
||||
if ($('.happyforms-form').length) $('.happyforms-form').happyForm();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'jquery', $script );
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_happyforms_initform' );
|
||||
|
||||
|
||||
/**
|
||||
* Add happyforms as formtype to the list
|
||||
*
|
||||
* @param $formtypes
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function cmplz_happyforms_form_types( $formtypes ) {
|
||||
$formtypes['hf_'] = 'happyforms';
|
||||
|
||||
return $formtypes;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_form_types', 'cmplz_happyforms_form_types' );
|
||||
|
||||
/**
|
||||
* Get list of happyforms forms
|
||||
*
|
||||
* @param array $input_forms
|
||||
*
|
||||
* @return array $input_forms
|
||||
*/
|
||||
|
||||
function cmplz_happyforms_get_plugin_forms( $input_forms ) {
|
||||
|
||||
$forms = get_posts( array(
|
||||
'post_type' => 'happyform',
|
||||
'post_status' => 'publish',
|
||||
'numberposts' => - 1,
|
||||
) );
|
||||
$forms = wp_list_pluck( $forms, "post_title", "ID" );
|
||||
foreach ( $forms as $id => $title ) {
|
||||
$input_forms[ 'hf_' . $id ] = $title . " " . '(Happy Forms)';
|
||||
}
|
||||
|
||||
return $input_forms;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_get_forms', 'cmplz_happyforms_get_plugin_forms' );
|
||||
|
||||
|
||||
/**
|
||||
* Adds a consent box the a happyforms form
|
||||
*
|
||||
* @param $form_id
|
||||
*/
|
||||
function cmplz_happyforms_add_consent_checkbox( $form_id ) {
|
||||
$form_id = str_replace( 'hf_', '', $form_id );
|
||||
|
||||
if ( !file_exists(happyforms_get_include_folder() . '/core/classes/class-form-controller.php')) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once( happyforms_get_include_folder()
|
||||
. '/core/classes/class-form-controller.php' );
|
||||
require_once( happyforms_get_include_folder()
|
||||
. '/core/classes/class-form-part-library.php' );
|
||||
require_once( happyforms_get_include_folder()
|
||||
. '/core/classes/class-form-styles.php' );
|
||||
require_once( happyforms_get_include_folder()
|
||||
. '/core/classes/class-session.php' );
|
||||
require_once( happyforms_get_include_folder()
|
||||
. '/core/helpers/helper-form-templates.php' );
|
||||
require_once( happyforms_get_include_folder()
|
||||
. '/core/helpers/helper-validation.php' );
|
||||
|
||||
$form_controller = happyforms_get_form_controller();
|
||||
|
||||
// Get the new form default data
|
||||
$form_data = $form_controller->get( $form_id );
|
||||
$count = count( $form_data['parts'] ) + 1;
|
||||
$has_checkbox = false;
|
||||
if ( is_array( $form_data['parts'] ) ) {
|
||||
foreach ( $form_data['parts'] as $part ) {
|
||||
if ( $part['type'] === 'legal' ) {
|
||||
$has_checkbox = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $has_checkbox ) {
|
||||
$part_data = array(
|
||||
'type' => 'legal',
|
||||
'legal_text' => cmplz_sprintf( __( "Yes, I agree with the %sprivacy statement%s",
|
||||
"complianz-gdpr" ), '<a href="'
|
||||
. COMPLIANZ::$document->get_permalink( 'privacy-statement',
|
||||
'eu', true ) . '">', '</a>' ),
|
||||
'width' => 'full',
|
||||
'required' => 1,
|
||||
'label' => __( 'Privacy', "complianz-gdpr" ),
|
||||
'id' => 'legal_' . $count,
|
||||
);
|
||||
$form_data['parts'][] = $part_data;
|
||||
$form_controller->update( $form_data );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( "cmplz_add_consent_box_happyforms",
|
||||
'cmplz_happyforms_add_consent_checkbox' );
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_hcaptcha_script' );
|
||||
function cmplz_hcaptcha_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'hcaptcha',
|
||||
'category' => 'marketing',
|
||||
'urls' => array(
|
||||
'hcaptcha.com',
|
||||
'hcaptcha.js',
|
||||
),
|
||||
);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_hcaptcha_detected_services( $services ) {
|
||||
if ( ! in_array( 'hcaptcha', $services ) ) {
|
||||
$services[] = 'hcaptcha';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_services',
|
||||
'cmplz_hcaptcha_detected_services' );
|
||||
|
||||
|
||||
if (cmplz_integration_plugin_is_enabled( 'wpforms' )) {
|
||||
|
||||
add_action( 'cmplz_banner_css', 'cmplz_hcaptcha_css' );
|
||||
function cmplz_hcaptcha_css() {
|
||||
?>
|
||||
div.wpforms-container-full .wpforms-form .h-captcha[data-size="normal"], .h-captcha[data-size="normal"] {
|
||||
display: none;
|
||||
}
|
||||
.cmplz-marketing .h-captcha {
|
||||
display: block!important;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Silence is golden.
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_invisible_captcha_nocaptcha_services( $services ) {
|
||||
if (defined('WPCF7_VERSION') && version_compare(WPCF7_VERSION, 5.4, '>=')) return $services;
|
||||
|
||||
if ( ! in_array( 'google-recaptcha', $services ) ) {
|
||||
$services[] = 'google-recaptcha';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_invisible_captcha_nocaptcha_services' );
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_jetpack_script' );
|
||||
function cmplz_jetpack_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'jetpack-statistics',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'pixel.wp.com',
|
||||
'stats.wp.com',
|
||||
),
|
||||
);
|
||||
|
||||
$tags[] = array(
|
||||
'name' => 'jetpack-twitter',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'twitter',
|
||||
'urls' => array(
|
||||
'/twitter-timeline.min.js',
|
||||
'/twitter-timeline.js',
|
||||
),
|
||||
'enable_placeholder' => 1,
|
||||
'placeholder_class' => 'widget_twitter_timeline',
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure it's set as not anonymous when tracking enabled
|
||||
* @param bool $stats_category_required
|
||||
*/
|
||||
function cmplz_jetpack_set_statistics_required( $stats_category_required ){
|
||||
if ( class_exists( 'JetPack' ) && Jetpack::is_module_active( 'stats' ) ) {
|
||||
$stats_category_required = true;
|
||||
}
|
||||
return $stats_category_required;
|
||||
}
|
||||
add_filter('cmplz_cookie_warning_required_stats', 'cmplz_jetpack_set_statistics_required');
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
/**
|
||||
* Ensure the Lazy Load plugin knows it has work to do by replacing the lazyloaded class back to lazyload, after consent is given.
|
||||
* @return void
|
||||
*/
|
||||
function cmplz_lazyloader_convert_data_src() {
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_enable_category", function(){
|
||||
document.querySelectorAll('.lazyloaded').forEach(obj => {
|
||||
obj.classList.remove('lazyloaded');
|
||||
obj.classList.add('lazyload');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_lazyloader_convert_data_src',PHP_INT_MAX );
|
||||
|
||||
|
||||
/**
|
||||
* Tell complianz to replace the source to data-src instead of src
|
||||
*
|
||||
* @param string $target
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
function cmplz_lazyloader_data_target($target, $total_match){
|
||||
return 'data-src';
|
||||
}
|
||||
add_filter('cmplz_data_target', 'cmplz_lazyloader_data_target', 100, 2);
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_lead_forensics_script' );
|
||||
function cmplz_lead_forensics_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'lead-forensics',
|
||||
'category' => 'marketing',
|
||||
'urls' => array(
|
||||
'secure.lead5beat.com',
|
||||
),
|
||||
'enable_placeholder' => '0',
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
if ( !defined("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE") ) define("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE", true);
|
||||
|
||||
function cmplz_local_google_fonts_filter_pro_fields($fields) {
|
||||
$index = cmplz_get_field_index('self_host_google_fonts', $fields);
|
||||
if ($index!==false) {
|
||||
$fields[ $index ]['help'] = [
|
||||
'label' => 'default',
|
||||
'title' => __( 'Self-hosting Google Fonts', 'complianz-gdpr' ),
|
||||
'text' => sprintf( __( "You have %s installed. We recommend saying 'Yes' to self-hosting Google Fonts", "complianz-gdpr" ), "Local Google Fonts" ),
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
add_filter('cmplz_fields', 'cmplz_local_google_fonts_filter_pro_fields', 200, 1);
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
// cookies used
|
||||
// mailchimp_user_email
|
||||
// mailchimp_landing_site
|
||||
// mailchimp_campaign_id
|
||||
// mailchimp_user_previous_email
|
||||
// the cookie name will be whatever we're trying to set. return true if allowed, false if not allowed.
|
||||
|
||||
|
||||
function cmplz_custom_cookie_callback_function($mailchimp_landing_site) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only add filter when no marketing consent has been given
|
||||
if ( ! cmplz_has_consent('marketing') ) {
|
||||
add_filter( 'mailchimp_allowed_to_use_cookie', 'cmplz_custom_cookie_callback_function', 10, 1 );
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* add the dependency
|
||||
* $deps['wait-for-this-script'] = 'script-that-should-wait';
|
||||
*/
|
||||
if ( !defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE') ) define('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE', true);
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_multimarker_script' );
|
||||
/**
|
||||
* Block the scripts.
|
||||
* initMap can also be something else. That's the problem with custom maps :)
|
||||
*
|
||||
* @param $tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_multimarker_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'maps.googleapis.com/maps/api/js',
|
||||
'map-multi-marker/asset/js/',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => "map-multi-marker",
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com/maps/api/js' => 'map-multi-marker/asset/js/',
|
||||
],
|
||||
);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_multimarker_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_multimarker_detected_services' );
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_meks_plugin_script' );
|
||||
function cmplz_meks_plugin_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'main-osm.js',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'mks-maps',
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_meks_plugin_detected_services( $services ) {
|
||||
|
||||
if ( ! in_array( 'openstreetmaps', $services ) ) {
|
||||
$services[] = 'openstreetmaps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_meks_plugin_detected_services' );
|
||||
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Set analytics as suggested stats tool in the wizard
|
||||
*/
|
||||
|
||||
function cmplz_monsterinsights_set_default( $value, $fieldname, $field ) {
|
||||
if ( $fieldname === 'compile_statistics' ) {
|
||||
return "google-analytics";
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'cmplz_default_value', 'cmplz_monsterinsights_set_default', 20, 3 );
|
||||
|
||||
/**
|
||||
* Add blocked scripts
|
||||
*
|
||||
* @param array $tags
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function cmplz_monsterinsights_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-analytics',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'monsterinsights_scroll_tracking_load',
|
||||
'google-analytics-premium/pro/assets/',
|
||||
'mi_version',
|
||||
),
|
||||
);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_monsterinsights_script' );
|
||||
|
||||
/**
|
||||
* Remove stats
|
||||
*
|
||||
* */
|
||||
function cmplz_monsterinsights_show_compile_statistics_notice($notices) {
|
||||
$text = '';
|
||||
if ( cmplz_no_ip_addresses() ) {
|
||||
$text .= __( "You have selected you anonymize IP addresses. This setting is now enabled in MonsterInsights.", 'complianz-gdpr' );
|
||||
}
|
||||
|
||||
if ( cmplz_statistics_no_sharing_allowed() ) {
|
||||
$text .= __( "You have selected you do not share data with third-party networks. Demographics is now disabled in MonsterInsights.", 'complianz-gdpr' );
|
||||
}
|
||||
|
||||
$found_key = false;
|
||||
foreach ($notices as $key=>$notice) {
|
||||
if ($notice['field_id']==='compile_statistics') {
|
||||
$found_key = $key;
|
||||
}
|
||||
}
|
||||
$notice = [
|
||||
'field_id' => 'compile_statistics',
|
||||
'label' => 'default',
|
||||
'title' => __( "Statistics plugin detected", 'complianz-gdpr' ),
|
||||
'text' => cmplz_sprintf( __( "You use %s, which means the answer to this question should be Google Analytics.", 'complianz-gdpr' ), 'Monsterinsights' )
|
||||
.' '.$text,
|
||||
];
|
||||
if ($found_key){
|
||||
$notices[$found_key] = $notice;
|
||||
} else {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
return $notices;
|
||||
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_monsterinsights_show_compile_statistics_notice' );
|
||||
|
||||
/**
|
||||
* We remove some actions to integrate fully
|
||||
* */
|
||||
function cmplz_monsterinsights_remove_scripts_others() {
|
||||
remove_action( 'wp_head', 'monsterinsights_tracking_script', 6 );
|
||||
remove_action( 'cmplz_statistics_script', array( COMPLIANZ::$banner_loader, 'get_statistics_script' ), 10 );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'cmplz_monsterinsights_remove_scripts_others' );
|
||||
|
||||
/**
|
||||
* Execute the monsterinsights script at the right point
|
||||
*/
|
||||
add_action( 'cmplz_before_statistics_script', 'monsterinsights_tracking_script', 10, 1 );
|
||||
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when monsterinsights is enabled.
|
||||
*
|
||||
* @param $fields
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_monsterinsights_filter_fields( $fields ) {
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info', $fields);
|
||||
if ($index!==false) unset($fields[$index]['help']);
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'consent-mode',
|
||||
'gtag-basic-consent-mode',
|
||||
'cmplz-gtag-urlpassthrough',
|
||||
'cmplz-gtag-ads_data_redaction',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
add_filter( 'cmplz_fields', 'cmplz_monsterinsights_filter_fields', 200 );
|
||||
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_monsterinsights_filter_warnings( $warnings ) {
|
||||
unset( $warnings[ 'ga-needs-configuring' ] );
|
||||
return $warnings;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_monsterinsights_filter_warnings' );
|
||||
|
||||
/**
|
||||
* Make sure Monsterinsights returns true for anonymize IP's when this option is selected in the wizard
|
||||
*
|
||||
* @param $value
|
||||
* @param $key
|
||||
* @param $default
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_monsterinsights_force_anonymize_ips( $value, $key, $default ) {
|
||||
if ( cmplz_no_ip_addresses() ) {
|
||||
return true;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'monsterinsights_get_option_anonymize_ips', 'cmplz_monsterinsights_force_anonymize_ips', 30, 3 );
|
||||
|
||||
/**
|
||||
* Make sure Monsterinsights returns false for third party sharing when this option is selected in the wizard
|
||||
*
|
||||
* @param $value
|
||||
* @param $key
|
||||
* @param $default
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_monsterinsights_force_demographics( $value, $key, $default ) {
|
||||
if ( cmplz_statistics_no_sharing_allowed() ) {
|
||||
return false;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'monsterinsights_get_option_demographics', 'cmplz_monsterinsights_force_demographics', 30, 3 );
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
if ( !defined('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE') ) define('CMPLZ_GOOGLE_MAPS_INTEGRATION_ACTIVE', true);
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_novo_map_script' );
|
||||
function cmplz_novo_map_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'new google.maps',
|
||||
'maps.googleapis.com',
|
||||
'infobox.js',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'novo-map-container',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com' => 'new google.maps',
|
||||
'new google.maps' => 'infobox.js',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_novo_map_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_novo_map_detected_services' );
|
||||
|
||||
/**
|
||||
* Initialize Novo Map
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_novo_initDomContentLoaded() {
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_novo_fire_domContentLoadedEvent);
|
||||
function cmplz_novo_fire_domContentLoadedEvent() {
|
||||
dispatchEvent(new Event('load'));
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_novo_initDomContentLoaded',PHP_INT_MAX );
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_nudgify_script' );
|
||||
function cmplz_nudgify_script( $tags ) {
|
||||
|
||||
$tags[] = 'pixel.nudgify.com';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
if ( !defined("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE") ) define("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE", true);
|
||||
|
||||
function cmplz_ogf_filter_pro_fields($fields) {
|
||||
$index = cmplz_get_field_index('self_host_google_fonts', $fields);
|
||||
if ($index!==false) {
|
||||
$fields[ $index ]['help'] = [
|
||||
'label' => 'default',
|
||||
'title' => __( 'Self-hosting Google Fonts', 'complianz-gdpr' ),
|
||||
'text' => sprintf( __( "You have %s installed. We recommend saying 'Yes' to self-hosting Google Fonts", "complianz-gdpr" ), "Fonts Plugin | Google Fonts Typography" ),
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
add_filter('cmplz_fields', 'cmplz_ogf_filter_pro_fields', 200, 1);
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
if ( !defined("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE") ) define("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE", true);
|
||||
function cmplz_omgf_filter_pro_fields($fields) {
|
||||
$index = cmplz_get_field_index('self_host_google_fonts', $fields);
|
||||
if ($index!==false) {
|
||||
$fields[$index]['help'] = [
|
||||
'label' => 'default',
|
||||
'title' => __('Self-hosting Google Fonts', 'complianz-gdpr'),
|
||||
'text' => sprintf( __("You have %s installed. We recommend saying 'Yes' to self-hosting Google Fonts", "complianz-gdpr") ,"OMGF"),
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
add_filter('cmplz_fields', 'cmplz_omgf_filter_pro_fields', 200, 1);
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Kept simple, no intervention with wizard to allow other analtyics tooling
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_omnisend_script' );
|
||||
function cmplz_omnisend_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'omnisend',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'omnisend',
|
||||
'omnisnippet1.com'
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_openstreetmaps_plugin_script' );
|
||||
function cmplz_openstreetmaps_plugin_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'openstreetmaps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'openstreetmaps',
|
||||
'urls' => array(
|
||||
'ol.js',
|
||||
'var raster = getTileLayer',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'map',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'ol.js' => 'var raster = getTileLayer',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_openstreetmaps_plugin_detected_services( $services ) {
|
||||
if ( ! in_array( 'openstreetmaps', $services ) ) {
|
||||
$services[] = 'openstreetmaps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_openstreetmaps_plugin_detected_services' );
|
||||
|
||||
/**
|
||||
* Add some custom css for the placeholder
|
||||
*/
|
||||
|
||||
add_action( 'cmplz_banner_css', 'cmplz_openstreetmaps_plugin_css' );
|
||||
function cmplz_openstreetmaps_plugin_css() {
|
||||
?>
|
||||
.cmplz-placeholder-element .ol-popup {
|
||||
display: none;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_pixel_caffeine_script' );
|
||||
function cmplz_pixel_caffeine_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'facebook',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'facebook',
|
||||
'urls' => array(
|
||||
'pixel-caffeine/build/frontend.js',
|
||||
'connect.facebook.net',
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_pixelcaffeine_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_social_media', 'cmplz_pixelcaffeine_detected_social_media' );
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_pixelyoursite_bing_script' );
|
||||
function cmplz_pixelyoursite_bing_script( $tags ) {
|
||||
$tags[] = 'pixelyoursite-bing/dist';
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_pixelyoursite_pinterest_script' );
|
||||
function cmplz_pixelyoursite_pinterest_script( $tags ) {
|
||||
$tags[] = 'pixelyoursite-pinterest/dist';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_pixelyoursite_pinterest_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'pinterest', $social_media ) ) {
|
||||
$social_media[] = 'pinterest';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_social_media', 'cmplz_pixelyoursite_pinterest_detected_social_media' );
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_pixelyoursite_pro_script' );
|
||||
function cmplz_pixelyoursite_pro_script( $tags ) {
|
||||
$tags[] = 'pixelyoursite/dist';
|
||||
$tags[] = 'pixelyoursite-pro/dist';
|
||||
$tags[] = 'pysOptions';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_pixelyoursite_pro_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_social_media', 'cmplz_pixelyoursite_pro_detected_social_media' );
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_pixelyoursite_script' );
|
||||
function cmplz_pixelyoursite_script( $tags ) {
|
||||
$tags[] = 'pixelyoursite/dist';
|
||||
$tags[] = array(
|
||||
'name' => 'facebook',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'facebook',
|
||||
'urls' => array(
|
||||
'pixelyoursite/dist',
|
||||
'pys-js-extra',
|
||||
'pysOptions',
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_pixelyoursite_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
return $social_media;
|
||||
}
|
||||
add_filter( 'cmplz_detected_social_media', 'cmplz_pixelyoursite_detected_social_media' );
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Whitelisting podcast player inline script.
|
||||
* Compatiblity fix for Complianz GDPR/CCPA
|
||||
*
|
||||
* https://wordpress.org/support/plugin/podcast-player/
|
||||
* author: @vedathemes
|
||||
*/
|
||||
|
||||
add_filter ( 'cmplz_service_category',
|
||||
function( $category, $total_match, $found ) {
|
||||
if ( $found && false !== strpos( $total_match, 'pppublic-js-extra' ) ) {
|
||||
$category = 'functional';
|
||||
}
|
||||
return $category;
|
||||
}, 10 , 3
|
||||
);
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_presto_video_lightbox_script' );
|
||||
function cmplz_presto_video_lightbox_script( $tags ) {
|
||||
// Do not block anything on self-hosted videos
|
||||
global $post;
|
||||
if ( $post && strpos( $post->post_content, 'presto-player/self-hosted') !== false ) {
|
||||
return $tags;
|
||||
}
|
||||
|
||||
if ( cmplz_uses_thirdparty('youtube') ) {
|
||||
$tags[] = array(
|
||||
'name' => 'youtube',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'youtube',
|
||||
'urls' => array(
|
||||
'//www.youtube.com/embed',
|
||||
'presto-player/src/player/player-static',
|
||||
'presto-player',
|
||||
'presto-components-static',
|
||||
'presto-fallback-iframe',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( cmplz_uses_thirdparty('vimeo') ) {
|
||||
$tags[] = array(
|
||||
'name' => 'vimeo',
|
||||
'category' => 'statistics',
|
||||
'placeholder' => 'vimeo',
|
||||
'urls' => array(
|
||||
'https://vimeo.com/',
|
||||
'player.vimeo.com/video/',
|
||||
'presto-player/src/player/player-static',
|
||||
'presto-player',
|
||||
'presto-components-static',
|
||||
'presto-fallback-iframe',
|
||||
),
|
||||
);
|
||||
}
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php defined( 'ABSPATH' ) or die();
|
||||
/**
|
||||
* was changed to position unset for primavera theme compat,
|
||||
* but has unexpected side effects. Set to "relative"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function cmplz_primavera_css() {
|
||||
?>
|
||||
<style>
|
||||
.cmplz-wp-video {
|
||||
position:unset;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_footer', 'cmplz_primavera_css' );
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php defined( 'ABSPATH' ) or die();
|
||||
/**
|
||||
* Make options translatable in qtranslate
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_qtranslatex_options($options){
|
||||
$keys = array(
|
||||
'header',
|
||||
'accept_optin',
|
||||
'accept_optout',
|
||||
'manage_consent',
|
||||
'manage_options',
|
||||
'save_settings',
|
||||
'dismiss',
|
||||
'message_optout',
|
||||
'message_optin',
|
||||
'category_functional',
|
||||
'category_preferences',
|
||||
'category_statistics',
|
||||
'functional_text',
|
||||
'statistics_text',
|
||||
'statistics_text_anonymous',
|
||||
'preferences_text',
|
||||
'marketing_text',
|
||||
'category_marketing',
|
||||
);
|
||||
|
||||
foreach($keys as $key){
|
||||
if ( isset($options[$key]['text']) && is_string($options[$key]['text']) ){
|
||||
$options[$key]['text'] = __($options[$key]['text']);
|
||||
} else if ( isset($options[$key]) && is_string($options[$key]) ) {
|
||||
$options[$key] = __($options[$key]);
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
add_filter('cmplz_cookiebanner_settings_html','cmplz_qtranslatex_options',10,1);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* When the recaptcha integration is enabled, rate my post won't work anymore before consent.
|
||||
* We have to add the script to the cookieblocker to prevent dependency issues.
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_ratemypost_script' );
|
||||
function cmplz_ratemypost_script( $tags ) {
|
||||
|
||||
if (cmplz_uses_thirdparty('google-recaptcha')) {
|
||||
$tags[] = '/js/rate-my-post';
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_sbd_script' );
|
||||
function cmplz_sbd_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'maps.googleapis.com',
|
||||
'directory-script.js',
|
||||
'category-tab.js',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'sbd-single-item-map',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com' => 'directory-script.js',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_sbd_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_sbd_detected_services' );
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_so_widgets_bundle_widget_script' );
|
||||
function cmplz_so_widgets_bundle_widget_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'sow.google-map.min.js',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'so-widget-sow-google-map',
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_so_widgets_bundle_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_so_widgets_bundle_detected_services' );
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
function cmplz_sumo_script( $tags ) {
|
||||
$tags[] = 'dataset.sumoSiteId';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_sumo_script' );
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_sumo_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
if ( ! in_array( 'twitter', $social_media ) ) {
|
||||
$social_media[] = 'twitter';
|
||||
}
|
||||
if ( ! in_array( 'pinterest', $social_media ) ) {
|
||||
$social_media[] = 'pinterest';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_social_media', 'cmplz_sumo_detected_social_media' );
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_super_socializer_script' );
|
||||
function cmplz_super_socializer_script( $tags ) {
|
||||
$tags[] = 'super-socializer';
|
||||
$tags[] = 'theChampFBKey';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add social media to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $social_media
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_super_socializer_detected_social_media( $social_media ) {
|
||||
if ( ! in_array( 'facebook', $social_media ) ) {
|
||||
$social_media[] = 'facebook';
|
||||
}
|
||||
if ( ! in_array( 'twitter', $social_media ) ) {
|
||||
$social_media[] = 'twitter';
|
||||
}
|
||||
if ( ! in_array( 'pinterest', $social_media ) ) {
|
||||
$social_media[] = 'pinterest';
|
||||
}
|
||||
|
||||
return $social_media;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_social_media', 'cmplz_super_socializer_detected_social_media' );
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Whitelist a string for the cookie blocker
|
||||
* @param string $class
|
||||
* @param int $total_match
|
||||
* @param bool $found
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param array $whitelisted_script_tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_superfly_menu_whitelisted_script_tags( $whitelisted_script_tags ) {
|
||||
$whitelisted_script_tags[] = 'SFM_template'; //'string from inline script or source that should be whitelisted'
|
||||
return $whitelisted_script_tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_superfly_menu_whitelisted_script_tags', 10, 1 );
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_theeventscalendar_script' );
|
||||
function cmplz_theeventscalendar_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'the-events-calendar/src/resources/js/embedded-map.',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'tribe-events-venue-map',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
'maps.googleapis.com' => 'the-events-calendar/src/resources/js/embedded-map.',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Whitelisting Themify Bulder due to YouTube loader.
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_themify_whitelist($tags){
|
||||
$tags[] = 'themify-builder-loader-js';
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_themify_whitelist');
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
/**
|
||||
* Filter Custom method from Thrive
|
||||
*
|
||||
* @param string $html
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
function cmplz_thrive_page_content_cookieblocker( $html ) {
|
||||
if ( ! is_admin() && ! cmplz_is_pagebuilder_preview() ) {
|
||||
$html = COMPLIANZ::$cookie_blocker->replace_tags( $html );
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
add_filter( 'tve_landing_page_content', 'cmplz_thrive_page_content_cookieblocker' );
|
||||
|
||||
/**
|
||||
* Whitelist youtube and video from being blocked, in the text/templates scripts of the Trhive quiz builder
|
||||
*
|
||||
* @param $tags
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function cmplz_thrive_whitelist( $tags ) {
|
||||
$tags[] = '//www.youtube.com/embed/<#=';
|
||||
$tags[] = '//player.vimeo.com/video/<#=';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_thrive_whitelist' );
|
||||
|
||||
/**
|
||||
* Add inline css, as Thrive removes it
|
||||
*
|
||||
* @param string $html
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function cmplz_thrive_inline_css( $html ) {
|
||||
$html .= '<style> .cmplz-hidden{display:none !important;}</style>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
add_filter( "cmplz_banner_html", 'cmplz_thrive_inline_css' );
|
||||
|
||||
/**
|
||||
* Filter cookie blocker output
|
||||
*/
|
||||
|
||||
function cmplz_thrive_cookieblocker( $output ) {
|
||||
$iframe_pattern = '/thrv_responsive_video[ |\"][^>]+?data-url="(.*?)">/is';
|
||||
|
||||
if ( preg_match_all( $iframe_pattern, $output, $matches, PREG_PATTERN_ORDER ) ) {
|
||||
foreach ( $matches[0] as $key => $total_match ) {
|
||||
$placeholder = '';
|
||||
|
||||
// Determine if it's YouTube or Vimeo based on the URL in the data-url attribute
|
||||
if ( strpos( $matches[1][ $key ], 'youtube.com' ) !== false && cmplz_uses_thirdparty( 'youtube' ) ) {
|
||||
if ( cmplz_use_placeholder( 'youtube' ) && isset( $matches[1][ $key ] ) ) {
|
||||
$youtube_url = $matches[1][ $key ];
|
||||
$placeholder = 'data-placeholder-image="' . cmplz_placeholder( false, stripcslashes( $youtube_url ) ) . '" ';
|
||||
}
|
||||
$new_match = str_replace( 'data-url', $placeholder . ' data-category="marketing" data-service="youtube" data-src-cmplz', $total_match );
|
||||
|
||||
} elseif ( strpos( $matches[1][ $key ], 'vimeo.com' ) !== false && cmplz_uses_thirdparty( 'vimeo' ) ) {
|
||||
if ( cmplz_use_placeholder( 'vimeo' ) && isset( $matches[1][ $key ] ) ) {
|
||||
$vimeo_url = $matches[1][ $key ];
|
||||
$placeholder = 'data-placeholder-image="' . cmplz_placeholder( false, stripcslashes( $vimeo_url ) ) . '" ';
|
||||
}
|
||||
$new_match = str_replace( 'data-url', $placeholder . ' data-category="statistics" data-service="vimeo" data-src-cmplz', $total_match );
|
||||
} else {
|
||||
// If it's neither Vimeo nor YouTube, skip this iteration and proceed to the next match
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_match = str_replace( 'thrv_responsive_video', 'thrv_responsive_video cmplz-placeholder-element', $new_match );
|
||||
$output = str_replace( $total_match, $new_match, $output );
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_cookie_blocker_output', 'cmplz_thrive_cookieblocker' );
|
||||
|
||||
/**
|
||||
* @param string $target
|
||||
* @param string $total_match
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function cmplz_thrive_data_target( $target, $total_match ) {
|
||||
// Look for thrive class in iframe here
|
||||
if ( strpos( $total_match, 'data-url' ) !== false &&
|
||||
( cmplz_uses_thirdparty( 'youtube' ) || cmplz_uses_thirdparty( 'vimeo' ) ) ) {
|
||||
return 'data-url';
|
||||
}
|
||||
|
||||
return $target;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_data_target', 'cmplz_thrive_data_target', 100, 2 );
|
||||
|
||||
/**
|
||||
* Initialize thrive youtube iframe
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_thrive_initDomContentLoaded() {
|
||||
if ( ! cmplz_uses_thirdparty( 'youtube' ) ) {
|
||||
return;
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_thrive_fire_domContentLoadedEvent);
|
||||
|
||||
function cmplz_thrive_fire_domContentLoadedEvent() {
|
||||
dispatchEvent(new Event('load'));
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace( array( '<script>', '</script>' ), '', $script );
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_thrive_initDomContentLoaded', PHP_INT_MAX );
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_tidio_live_chat_script' );
|
||||
function cmplz_tidio_live_chat_script( $tags ) {
|
||||
|
||||
$tags[] = 'document.tidioChatCode';
|
||||
$tags[] = 'code.tidio.co';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Because Tidio default loads async, but the onload even already has passed when the user accepts, we have to disable this.
|
||||
*
|
||||
* @param $async
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_tidio_live_chat_force_non_async( $async ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
add_filter( 'option_tidio-async-load', 'cmplz_tidio_live_chat_force_non_async' );
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_trustpulse_script' );
|
||||
function cmplz_trustpulse_script( $tags ) {
|
||||
|
||||
$tags[] = 'trustpulse.com';
|
||||
$tags[] = 'trstplse.com';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
function cmplz_uafe_initDomContentLoaded() {
|
||||
if ( cmplz_uses_thirdparty('google-maps') ) {
|
||||
ob_start();
|
||||
/**
|
||||
* Using the frontend init method is not very nice, as it has some unwanted side effects, but in this case using the runReadyTrigger does not seem to work because UAFE
|
||||
* is adding their own hook. This hook isn't fired with runreadytrigger. As a result, the map does not initialize.
|
||||
*/
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_uafe_fire_initOnReadyComponents);
|
||||
function cmplz_uafe_fire_initOnReadyComponents() {
|
||||
setTimeout(cmplz_uafe_trigger_element, 2000);
|
||||
}
|
||||
|
||||
function cmplz_uafe_trigger_element()
|
||||
{
|
||||
window.elementorFrontend.init();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script);
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_uafe_initDomContentLoaded', PHP_INT_MAX );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_uafe_script' );
|
||||
function cmplz_uafe_script( $tags ) {
|
||||
|
||||
$tags[] = 'uael-google-map.js';
|
||||
$tags[] = 'uael-google-map.js';
|
||||
$tags[] = 'maps.googleapis.com';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_uafe_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_uafe_detected_services' );
|
||||
|
||||
|
||||
/**
|
||||
* Add placeholder for google maps
|
||||
*
|
||||
* @param $tags
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_uafe_placeholder( $tags ) {
|
||||
$tags['google-maps'][] = 'uael-google-map-wrap';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_placeholder_markers', 'cmplz_uafe_placeholder' );
|
||||
|
||||
|
||||
/**
|
||||
* Conditionally add the dependency from the plugin core file to the api files
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_dependencies', 'cmplz_uafe_dependencies' );
|
||||
function cmplz_uafe_dependencies( $tags ) {
|
||||
|
||||
$tags['maps.googleapis.com'] = 'uael-google-map.js';
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/* Uncode theme Google Maps integration */
|
||||
|
||||
function cmplz_uncode_googlemaps_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'uncode.gmaps.min.js',
|
||||
'maps.googleapis.com'
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'uncode-map-wrapper',
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
'maps.googleapis.com' => 'uncode.gmaps.min.js',
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_uncode_googlemaps_script' );
|
||||
|
||||
/**
|
||||
* Trigger the DomContentLoaded event
|
||||
* This is not always needed, but in a plugin initializes on document load or ready, the map won't show on consent because this event already ran.
|
||||
* This will re-trigger that.
|
||||
*
|
||||
*/
|
||||
|
||||
function cmplz_uncode_maps_initDomContentLoaded() {
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
document.addEventListener("cmplz_run_after_all_scripts", cmplz_fire_domContentLoadedEvent);
|
||||
function cmplz_fire_domContentLoadedEvent() {
|
||||
dispatchEvent(new Event('load'));
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$script = ob_get_clean();
|
||||
$script = str_replace(array('<script>', '</script>'), '', $script);
|
||||
wp_add_inline_script( 'cmplz-cookiebanner', $script );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'cmplz_uncode_maps_initDomContentLoaded',PHP_INT_MAX );
|
||||
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_uncode_maps_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_uncode_maps_detected_services' );
|
||||
?>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
if ( !defined("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE") ) define("CMPLZ_SELF_HOSTED_PLUGIN_ACTIVE", true);
|
||||
|
||||
function cmplz_uaf_filter_pro_fields($fields) {
|
||||
$index = cmplz_get_field_index('self_host_google_fonts', $fields);
|
||||
if ($index!==false) {
|
||||
$fields[$index]['help'] = [
|
||||
'label' => 'default',
|
||||
'title' => __('Self-hosting Google Fonts', 'complianz-gdpr'),
|
||||
'text' => sprintf( __("You have %s installed. We recommend saying 'Yes' to self-hosting Google Fonts", "complianz-gdpr") ,"Use Any Font"),
|
||||
];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
add_filter('cmplz_fields', 'cmplz_uaf_filter_pro_fields', 200, 1);
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* WPEverest User Registration Pro
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_user_registration_pro_script' );
|
||||
function cmplz_user_registration_pro_script( $tags ) {
|
||||
$recaptcha_enabled
|
||||
= get_option( 'user_registration_login_options_enable_recaptcha',
|
||||
'no' );
|
||||
|
||||
if ( 'yes' == $recaptcha_enabled ) {
|
||||
$tags[] = 'user-registration-pro-frontend.min.js';
|
||||
$tags[] = 'user-registration-pro-frontend.js';
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally add the dependency
|
||||
* $deps['wait-for-this-script'] = 'script-that-should-wait';
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_dependencies', 'cmplz_userregistrationpro_dependencies' );
|
||||
function cmplz_userregistrationpro_dependencies( $tags ) {
|
||||
$recaptcha_enabled
|
||||
= get_option( 'user_registration_login_options_enable_recaptcha',
|
||||
'no' );
|
||||
|
||||
if ( 'yes' == $recaptcha_enabled ) {
|
||||
$tags['recaptcha/api.js'] = 'user-registration-pro-frontend.min.js';
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* User Registration https://nl.wordpress.org/plugins/user-registration/
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_user_registration_script' );
|
||||
function cmplz_user_registration_script( $tags ) {
|
||||
$recaptcha_enabled
|
||||
= get_option( 'user_registration_login_options_enable_recaptcha',
|
||||
'no' );
|
||||
|
||||
if ( 'yes' == $recaptcha_enabled ) {
|
||||
$tags[] = 'user-registration.min.js';
|
||||
$tags[] = 'user-registration.js';
|
||||
$tags[] = 'user-registration-form-validator.min.js';
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally add the dependency
|
||||
* $deps['wait-for-this-script'] = 'script-that-should-wait';
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_dependencies', 'cmplz_userregistration_dependencies' );
|
||||
function cmplz_userregistration_dependencies( $tags ) {
|
||||
$recaptcha_enabled
|
||||
= get_option( 'user_registration_login_options_enable_recaptcha',
|
||||
'no' );
|
||||
|
||||
if ( 'yes' == $recaptcha_enabled ) {
|
||||
$tags['recaptcha/api.js'] = 'user-registration-form-validator.min.js';
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_volocation_script' );
|
||||
function cmplz_volocation_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'maps.googleapis.com',
|
||||
'markerclusterer.js',
|
||||
'locator.js',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => 'voslpmapcontainer',
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_volocation_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_volocation_detected_services' );
|
||||
|
||||
/**
|
||||
* Hide element based on consent
|
||||
*/
|
||||
|
||||
add_action( 'cmplz_banner_css', 'cmplz_volocation_css' );
|
||||
function cmplz_volocation_css() {
|
||||
?>
|
||||
.cmplz-functional .voslpsearch, .cmplz-functional .col-lg-8,
|
||||
.cmplz-functional #maplist .col-lg-3.overflowscroll {
|
||||
display:none;
|
||||
}
|
||||
.cmplz-functional.cmplz-google-maps .voslpsearch, .cmplz-functional.cmplz-google-maps .col-lg-8 ,
|
||||
.cmplz-functional.cmplz-google-maps #maplist .col-lg-3.overflowscroll {
|
||||
display:block;
|
||||
}
|
||||
|
||||
.cmplz-functional.cmplz-marketing .voslpsearch, .cmplz-marketing .col-lg-8 ,
|
||||
.cmplz-functional.cmplz-marketing #maplist .col-lg-3.overflowscroll {
|
||||
display:none;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die();
|
||||
|
||||
add_filter( 'weglot_get_regex_checkers', 'cmplz_weglot_add_regex_checkers' );
|
||||
function cmplz_weglot_add_regex_checkers( $regex_checkers ) {
|
||||
$regex_checkers[] = new \Weglot\Parser\Check\Regex\RegexChecker( '#var complianz = ({.*})#', 'JSON', 1, array( 'placeholdertext', 'title' ) );
|
||||
return $regex_checkers;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Block the script.
|
||||
*
|
||||
* @param $tags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_wordpress_store_locator_googlemaps_script( $tags ) {
|
||||
|
||||
global $post;
|
||||
|
||||
//[wordpress_store_locator] contains all stores on one map which has a different class
|
||||
if ( $post && has_shortcode($post->post_content, 'wordpress_store_locator')) {
|
||||
$class = 'store_locator_map';
|
||||
} else {
|
||||
$class = 'store_locator_single_map';
|
||||
}
|
||||
|
||||
|
||||
$tags[] = array(
|
||||
'name' => 'google-maps',
|
||||
'category' => 'marketing',
|
||||
'placeholder' => 'google-maps',
|
||||
'urls' => array(
|
||||
'wordpress-store-locator-public',
|
||||
'var store_locator_options',
|
||||
),
|
||||
'enable_placeholder' => '1',
|
||||
'placeholder_class' => $class,
|
||||
'enable_dependency' => '1',
|
||||
'dependency' => [
|
||||
//'wait-for-this-script' => 'script-that-should-wait'
|
||||
],
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_wordpress_store_locator_googlemaps_script' );
|
||||
|
||||
/**
|
||||
* Add services to the list of detected items, so it will get set as default, and will be added to the notice about it
|
||||
*
|
||||
* @param $services
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_wordpress_store_locator_googlemaps_detected_services( $services ) {
|
||||
if ( ! in_array( 'google-maps', $services ) ) {
|
||||
$services[] = 'google-maps';
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
add_filter( 'cmplz_detected_services', 'cmplz_wordpress_store_locator_googlemaps_detected_services' );
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Make sure it's set as not anonymous when tracking enabled
|
||||
* @param bool $stats_category_required
|
||||
*/
|
||||
function cmplz_wc_google_analytics_integration_set_statistics_required( $stats_category_required ){
|
||||
$settings = get_option('woocommerce_google_analytics_settings');
|
||||
if ( $settings && isset( $settings['ga_support_display_advertising']) && $settings['ga_support_display_advertising'] === 'yes' ) {
|
||||
$stats_category_required = true;
|
||||
}
|
||||
return $stats_category_required;
|
||||
}
|
||||
add_filter('cmplz_cookie_warning_required_stats', 'cmplz_wc_google_analytics_integration_set_statistics_required');
|
||||
|
||||
/**
|
||||
* Set analytics as suggested stats tool in the wizard
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_default_value', 'cmplz_wc_google_analytics_integration_set_default', 20, 3 );
|
||||
function cmplz_wc_google_analytics_integration_set_default( $value, $fieldname, $field ) {
|
||||
if ( $fieldname === 'compile_statistics' ) {
|
||||
return "google-analytics";
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
/**
|
||||
* If display ads is enabled, ensure a marketing category is added to the banner
|
||||
* @param bool $uses_marketing_cookies
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function cmplz_wc_google_analytics_integration_uses_marketing_cookies( $uses_marketing_cookies ) {
|
||||
$settings = get_option('woocommerce_google_analytics_settings');
|
||||
if ( $settings && isset( $settings['ga_support_display_advertising']) && $settings['ga_support_display_advertising'] === 'yes' ) {
|
||||
$uses_marketing_cookies = true;
|
||||
}
|
||||
|
||||
return $uses_marketing_cookies;
|
||||
}
|
||||
add_filter( 'cmplz_uses_marketing_cookies', 'cmplz_wc_google_analytics_integration_uses_marketing_cookies', 20, 2 );
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_wc_google_analytics_integration_script' );
|
||||
function cmplz_wc_google_analytics_integration_script( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-analytics',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'add_to_cart_button:not(.product_type_variable',
|
||||
"ga( 'send', 'pageview' )",
|
||||
'_gaq.push',
|
||||
'stats.g.doubleclick.net/dc.js',
|
||||
'gaProperty',
|
||||
'ga_orders',
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add notice to tell a user to choose Analytics
|
||||
*
|
||||
* @param $notices
|
||||
* @return array
|
||||
*/
|
||||
function cmplz_wc_google_analytics_integration_show_compile_statistics_notice($notices) {
|
||||
//find notice with field_id 'compile_statistics' and replace it with our own
|
||||
$found_key = false;
|
||||
foreach ($notices as $key=>$notice) {
|
||||
if ($notice['field_id']==='compile_statistics') {
|
||||
$found_key = $key;
|
||||
}
|
||||
}
|
||||
$notice = [
|
||||
'field_id' => 'compile_statistics',
|
||||
'label' => 'default',
|
||||
'title' => __( "Statistics plugin detected", 'complianz-gdpr' ),
|
||||
'text' => cmplz_sprintf( __( "You use %s, which means the answer to this question should be Google Analytics.", 'complianz-gdpr' ), 'WooCommerce Google Analytics Integration' ),
|
||||
];
|
||||
if ($found_key){
|
||||
$notices[$found_key] = $notice;
|
||||
} else {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
return $notices;
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_wc_google_analytics_integration_show_compile_statistics_notice' );
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when wc_google_analytics_integration is enabled.
|
||||
*
|
||||
* @param array $fields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
function cmplz_wc_google_analytics_integration_filter_fields( array $fields ): array {
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info', $fields);
|
||||
if ($index!==false) unset($fields[$index]['help']);
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'consent-mode',
|
||||
'gtag-basic-consent-mode',
|
||||
'cmplz-gtag-urlpassthrough',
|
||||
'cmplz-gtag-ads_data_redaction',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
add_filter( 'cmplz_fields', 'cmplz_wc_google_analytics_integration_filter_fields', 200 );
|
||||
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_wc_google_analytics_integration_filter_warnings( $warnings ) {
|
||||
unset( $warnings[ 'ga-needs-configuring' ] );
|
||||
return $warnings;
|
||||
}
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_wc_google_analytics_integration_filter_warnings' );
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Make sure it's set as not anonymous when tracking enabled
|
||||
* @param bool $stats_category_required
|
||||
*/
|
||||
function cmplz_wc_google_analytics_pro_set_statistics_required( $stats_category_required ){
|
||||
$settings = get_option('woocommerce_google_analytics_pro_settings');
|
||||
if ( $settings && isset( $settings['enable_displayfeatures']) && $settings['enable_displayfeatures'] === 'yes' ) {
|
||||
$stats_category_required = true;
|
||||
}
|
||||
return $stats_category_required;
|
||||
}
|
||||
add_filter('cmplz_cookie_warning_required_stats', 'cmplz_wc_google_analytics_pro_set_statistics_required');
|
||||
|
||||
|
||||
/**
|
||||
* Set analytics as suggested stats tool in the wizard
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_default_value', 'cmplz_wc_google_analytics_pro_set_default', 20, 3 );
|
||||
function cmplz_wc_google_analytics_pro_set_default( $value, $fieldname, $field ) {
|
||||
if ( $fieldname === 'compile_statistics' ) {
|
||||
return "google-analytics";
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* If display ads is enabled, ensure a marketing category is added to the banner
|
||||
* @param bool $uses_marketing_cookies
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
function cmplz_wc_google_analytics_pro_uses_marketing_cookies( $uses_marketing_cookies ) {
|
||||
$settings = get_option('woocommerce_google_analytics_pro_settings');
|
||||
if ( $settings && isset( $settings['enable_displayfeatures']) && $settings['enable_displayfeatures'] === 'yes' ) {
|
||||
$uses_marketing_cookies = true;
|
||||
}
|
||||
|
||||
return $uses_marketing_cookies;
|
||||
}
|
||||
add_filter( 'cmplz_uses_marketing_cookies', 'cmplz_wc_google_analytics_pro_uses_marketing_cookies', 20, 2 );
|
||||
|
||||
/**
|
||||
* Add markers to the statistics markers list
|
||||
* @param array $markers
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
add_filter( 'cmplz_known_script_tags', 'cmplz_wc_google_analytics_pro_stats_markers' );
|
||||
function cmplz_wc_google_analytics_pro_stats_markers( $tags ) {
|
||||
$tags[] = array(
|
||||
'name' => 'google-analytics',
|
||||
'category' => 'statistics',
|
||||
'urls' => array(
|
||||
'wc_google_analytics_pro_loaded',
|
||||
"ga( 'send', 'pageview' )",
|
||||
'_gaq.push',
|
||||
'stats.g.doubleclick.net/dc.js',
|
||||
'gaProperty',
|
||||
'GoogleAnalyticsObject',
|
||||
'add_to_cart_button',
|
||||
'wc_ga_pro',
|
||||
'ga_orders',
|
||||
),
|
||||
);
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add notice to tell a user to choose Analytics
|
||||
*
|
||||
* @param $notices
|
||||
*/
|
||||
|
||||
function cmplz_wc_google_analytics_pro_show_compile_statistics_notice($notices) {
|
||||
//find notice with field_id 'compile_statistics' and replace it with our own
|
||||
$found_key = false;
|
||||
foreach ($notices as $key=>$notice) {
|
||||
if ($notice['field_id']==='compile_statistics') {
|
||||
$found_key = $key;
|
||||
}
|
||||
}
|
||||
$notice = [
|
||||
'field_id' => 'compile_statistics',
|
||||
'label' => 'default',
|
||||
'title' => __( "Statistics plugin detected", 'complianz-gdpr' ),
|
||||
'text' => cmplz_sprintf( __( "You use %s, which means the answer to this question should be Google Analytics.", 'complianz-gdpr' ), 'WooCommerce Google Analytics Pro' ),
|
||||
];
|
||||
if ($found_key){
|
||||
$notices[$found_key] = $notice;
|
||||
} else {
|
||||
$notices[] = $notice;
|
||||
}
|
||||
return $notices;
|
||||
|
||||
}
|
||||
add_filter( 'cmplz_field_notices', 'cmplz_wc_google_analytics_pro_show_compile_statistics_notice' );
|
||||
|
||||
/**
|
||||
* Hide the stats configuration options when wc_google_analytics_pro is enabled.
|
||||
*
|
||||
* @param $fields
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_wc_google_analytics_pro_filter_fields( $fields ) {
|
||||
$index = cmplz_get_field_index('compile_statistics_more_info', $fields);
|
||||
if ($index!==false) unset($fields[$index]['help']);
|
||||
return cmplz_remove_field( $fields,
|
||||
[
|
||||
'configuration_by_complianz',
|
||||
'ua_code',
|
||||
'aw_code',
|
||||
'additional_gtags_stats',
|
||||
'additional_gtags_marketing',
|
||||
'consent-mode',
|
||||
'gtag-basic-consent-mode',
|
||||
'cmplz-gtag-urlpassthrough',
|
||||
'cmplz-gtag-ads_data_redaction',
|
||||
'gtm_code',
|
||||
'cmplz-tm-template'
|
||||
]);
|
||||
}
|
||||
add_filter( 'cmplz_fields', 'cmplz_wc_google_analytics_pro_filter_fields', 200 );
|
||||
|
||||
/**
|
||||
* Make sure there's no warning about configuring GA anymore
|
||||
*
|
||||
* @param $warnings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
function cmplz_wc_google_analytics_pro_filter_warnings( $warnings ) {
|
||||
unset($warnings['ga-needs-configuring']);
|
||||
return $warnings;
|
||||
}
|
||||
add_filter( 'cmplz_warning_types', 'cmplz_wc_google_analytics_pro_filter_warnings' );
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
* Make sure swatches is released from the cookie blocker.
|
||||
* Can be used for other script ID's well. Copy/Paste/Rename
|
||||
*/
|
||||
|
||||
function cmplz_whitelist_woo_variation( $category, $total_match, $found ) {
|
||||
$string = 'woo-variation-swatches-js-extra'; //'string from inline script or source that should be whitelisted'
|
||||
if ( $found && false !== strpos( $total_match, $string ) ) {
|
||||
$category = 'functional';
|
||||
}
|
||||
return $category;
|
||||
}
|
||||
add_filter ( 'cmplz_service_category', 'cmplz_whitelist_woo_variation', 10 , 3 );
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
function cmplz_wc_stripe_whitelist($tags){
|
||||
$tags[] = 'var wc_stripe_params';
|
||||
return $tags;
|
||||
}
|
||||
add_filter( 'cmplz_whitelisted_script_tags', 'cmplz_wc_stripe_whitelist');
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
|
||||
|
||||
add_filter( 'cmplz_set_cookies_on_consent', 'cmplz_wp_donottrack_add_cookie' );
|
||||
function cmplz_wp_donottrack_add_cookie( $cookies ) {
|
||||
$cookies['dont_track_me'] = array( '0', '1' );
|
||||
|
||||
return $cookies;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user