ception, to be handled by whatever Exception handling logic is available in this context.
if ( in_array( $number, array( E_USER_ERROR, E_RECOVERABLE_ERROR ) ) && $error_is_enabled ) {
throw new ErrorException( $errstr, 0, $errno, $errfile, $errline );
} elseif ( $error_is_enabled ) {
// Log the error if it's enabled. Otherwise, just ignore it.
error_log( $string, 0 );
// Make sure this ends up in $php_errormsg, if appropriate.
return false;
}
}
protected function increment_attempts( $item ) {
$batch = $this->get_batch();
$item_feed = rgar( $item, 'feed' );
$item_entry_id = rgar( $item, 'entry_id' );
foreach ( $batch->data as $key => $task ) {
$task_feed = rgar( $task, 'feed' );
$task_entry_id = rgar( $task, 'entry_id' );
if ( $item_feed['id'] === $task_feed['id'] && $item_entry_id === $task_entry_id ) {
$batch->data[ $key ]['attempts'] = isset( $batch->data[ $key ]['attempts'] ) ? $batch->data[ $key ]['attempts'] + 1 : 1;
$item['attempts'] = $batch->data[ $key ]['attempts'];
break;
}
}
$this->update( $batch->key, $batch->data );
return $item;
}
}
/**
* Returns an instance of the GF_Feed_Processor class
*
* @see GF_Feed_Processor::get_instance()
* @return GF_Feed_Processor
*/
function gf_feed_processor() {
return GF_Feed_Processor::get_instance();
}
X$ uuuu
$ X ffff sell P s;
/**
* The legal version is only updated when document contents or the questioX ng to it are changed
* 1: start version
* 2: introduction of US privacy questions
* 3: new questions
* 4: new questions
* 5: UK as separate region
* 6: CA as separate region
* 7: Impressum in germany
* */
define( 'CMPLZ_LEGAL_VERSION', '8' );
//common options type
$this->yes_no = array(
'yes' => __( 'Yes', 'complianz-gdpr' ),
'no' => __( 'No', 'complianz-gdpr' ),
);
$this->premium_geo_ip
= cmplz_sprintf( __( "To enable the warning only for countries with a cookie law, %sget premium%s.",
'complianz-gdpr' ),
'', '' )
. " ";
$this->premium_ab_testing
= cmplz_sprintf( __( "If you want to run a/b testing to track which banner gets the highest acceptance ratio, %sget premium%s.",
'complianz-gdpr' ),
'', '' )
. " ";
$this->placeholders = array(
'default' => __('Default','complianz-gdpr'),
'calendly' => 'Calendly',
'facebook' => 'Facebook',
'google-maps' => 'Google Maps',
'google-recaptcha' => 'Google Recaptcha',
'instagram' => 'Instagram',
'openstreetmaps' => 'Open Street Maps',
'soundcloud' => 'SoundCloud',
'spotify' => 'Spotify',
'ted' => 'Ted',
'twitter' => 'Twitter',
'tiktok' => 'Tik Tok'
);
/* config files */
require_once( cmplz_path . '/config/countries.php' );
require_once( cmplz_path . '/config/purpose.php' );
require_once( cmplz_path . '/config/steps.php' );
require_once( cmplz_path . '/config/general-settings.php' );
require_once( cmplz_path . '/config/questions-wizard.php' );
require_once( cmplz_path . '/config/dynamic-fields.php' );
require_once( cmplz_path . '/config/documents/documents.php' );
require_once( cmplz_path . '/config/documents/cookie-policy-eu.php' );
require_once( cmplz_path . '/config/documents/cookie-policy-us.php' );
require_once( cmplz_path . '/config/documents/cookie-policy-uk.php' );
require_once( cmplz_path . '/config/documents/cookie-policy-ca.php' );
require_once( cmplz_path . '/config/documents/cookie-policy-au.php' );
require_once( cmplz_path . '/config/documents/cookie-policy-za.php' );
require_once( cmplz_path . '/config/documents/cookie-policy-br.php' );
require_once(cmplz_path . '/cookiebanner/settings.php' );
if ( file_exists( cmplz_path . '/pro/config/' ) ) {
require_once( cmplz_path . '/pro/config/includes.php' );
}
/**
* Preload fields with a filter, to allow for overriding types
*/
add_action( 'plugins_loaded', array( $this, 'preload_init' ), 10 );
/**
* The integrations are loaded with priority 10
* Because we want to initialize after that, we use 15 here
*/
if ( is_admin() ) {
add_action( 'plugins_loaded', array( $this, 'load_warning_types' ) );
}
add_action( 'plugins_loaded', array( $this, 'init' ), 15 );
}
static function this() {
return self::$_this;
}
/**
* Get full array of regions, but only active ones
* @return array
*/
public function active_regions(){
return array_intersect_key( COMPLIANZ::$config->regions, cmplz_get_regions() );
}
public function get_section_by_id( $id ) {
$steps = $this->steps['wizard'];
foreach ( $steps as $step ) {
if ( ! isset( $step['sections'] ) ) {
continue;
}
$sections = $step['sections'];
//because the step arrays start with one instead of 0, we increase with one
return array_search( $id, array_column( $sections, 'id' ) ) + 1;
}
}
public function get_step_by_id( $id ) {
$steps = $this->steps['wizard'];
//because the step arrays start with one instead of 0, we increase with one
return array_search( $id, array_column( $steps, 'id' ) ) + 1;
}
public function fields(
$page = false, $step = false, $section = false,
$get_by_fieldname = false
) {
$output = array();
$fields = $this->fields;
if ( $page ) {
$fields = cmplz_array_filter_multidimensional( $this->fields, 'source', $page );
}
$order = 100;
foreach ( $fields as $fieldname => $field ) {
if ( $get_by_fieldname && $fieldname !== $get_by_fieldname ) {
continue;
}
$field = wp_parse_args( $field, array( 'order'=> $order ) );
$order++;
if ( $step ) {
if ( $section && isset( $field['section'] ) ) {
if ( ( $field['step'] == $step
|| ( is_array( $field['step'] )
&& in_array( $step, $field['step'] ) ) )
&& ( $field['section'] == $section )
) {
$output[ $fieldname ] = $field;
}
} else {
if ( ( $field['step'] == $step )
|| ( is_array( $field['step'] )
&& in_array( $step, $field['step'] ) )
) {
$output[ $fieldname ] = $field;
}
}
}
if ( ! $step ) {
$output[ $fieldname ] = $field;
}
}
//maybe sort by order
if ( $section ){
uasort($output, function($a, $b) {
return $a["order"] - $b["order"];
});
}
return $output;
}
public function has_sections( $page, $step ) {
if ( isset( $this->steps[ $page ][ $step ]["sections"] ) ) {
return true;
}
return false;
}
public function preload_init(){
$this->stats_markers = apply_filters( 'cmplz_stats_markers', $this->stats_markers );
$this->fields = apply_filters( 'cmplz_fields_load_types', $this->fields );
$this->pages = apply_filters( 'cmplz_pages_load_types', $this->pages );
}
public function init() {
$this->steps = apply_filters('cmplz_steps', $this->steps );
$this->fields = apply_filters( 'cmplz_fields', $this->fields );
if ( ! is_admin() ) {
$regions = cmplz_get_regions(true);
foreach ( $regions as $region => $label ) {
if ( !isset( $this->pages[ $region ] ) ) continue;
foreach ( $this->pages[ $region ] as $type => $data ) {
$this->pages[ $region ][ $type ]['document_elements']
= apply_filters( 'cmplz_document_elements',
$this->pages[ $region ][ $type ]['document_elements'],
$region, $type, $this->fields() );
}
}
}
}
public function load_warning_types() {
$banner_url = admin_url(add_query_arg(array('page'=>'cmplz-cookiebanner','id'=>cmplz_get_default_banner_id()),'admin.php'));
$this->warning_types = apply_filters('cmplz_warning_types' ,array(
'datarequests' => array(
'warning_condition' => 'cmplz_upgraded_to_current_version',
'open' => __( 'New Feature: Data requests for Privacy Statements.', 'complianz-gdpr' ).cmplz_read_more('https://complianz.io/data-requests/'),
'plus_one' => true,
'include_in_progress' => false,
),
'upgraded_to_6' => array(
'warning_condition' => 'cmplz_upgraded_to_current_version',
'open' => cmplz_sprintf(__( 'Complianz GDPR/CCPA %s. Learn more about our newest release.', 'complianz-gdpr' ).cmplz_read_more('https://complianz.io/meet-complianz-6-0/'),'6.0.0' ).' '.
'
'.cmplz_sprintf(__('We have changed our Cookie Banner template for future capabilities, please check your %sCookie Banner settings%s.','complianz-gdpr'),'','').' '.
__('You can reset to default values, if needed.','complianz-gdpr'),
'admin_notice' => true,
),
'wizard-incomplete' => array(
'success_conditions' => array(
'wizard->all_required_fields_completed_wizard'
),
'completed' => __( 'The wizard has been completed.', 'complianz-gdpr' ),
'urgent' => __( 'Not all fields have been entered, or you have not clicked the "finish" button yet.', 'complianz-gdpr' ),
'plus_one' => true,
'include_in_progress' => true,
'dismissible' => false,
),
'no-dnt' => array(
'success_conditions' => array(
'get_value_respect_dnt==yes'
),
'completed' => __( 'Do Not Track and Global Privacy Control are respected.', 'complianz-gdpr' ),
'open' => cmplz_sprintf( __( 'Do Not Track and Global Privacy Control are not yet respected. - (%spremium%s)', 'complianz-gdpr' ), '', '' ),
),
'drop-elementor-banner' => array(
'plus_one' => true,
'success_conditions' => array(
'NOT get_option_cmplz_elementor_banner_dropped'
),
'urgent' => __( 'We have dropped support for creating a cookie banner with Elementor Pro. Your banner defaults to a standard cookie banner.', 'complianz-gdpr' ).cmplz_read_more("https://complianz.io/elementor-pro-support"),
),
'has_formal' => array(
'success_conditions' => array(
'NOT document->locale_has_formal_variant',
),
'open' => cmplz_sprintf( __( 'You have currently selected an informal language, which will result in informal use of language on the legal documents. If you prefer the formal style, you can activate this in the %sgeneral settings%s.', 'complianz-gdpr' ), '', '' ).
cmplz_read_more('https://complianz.io/informal-language-in-legal-documents/'),
'include_in_progress' => true,
),
'cookies-changed' => array(
'plus_one' => true,
'warning_condition' => 'cookie_admin->cookies_changed',
'success_conditions' => array(
),
'completed' => __( 'No cookie changes have been detected.', 'complianz-gdpr' ),
'open' => __( 'Cookie changes have been detected.', 'complianz-gdpr' ) . " " . cmplz_sprintf( __( 'Please review step %s of the wizard for changes in cookies.', 'complianz-gdpr' ), STEP_COOKIES ),
'include_in_progress' => true,
),
'no-cookie-scan' => array(
'success_conditions' => array(
'cookie_admin->get_last_cookie_scan_date',
),
'completed' => cmplz_sprintf( __( 'Last cookie scan completed on %s.', 'complianz-gdpr' ), COMPLIANZ::$cookie_admin->get_last_cookie_scan_date() ),
'open' => __( 'No cookie scan has been completed yet.', 'complianz-gdpr' ),
'include_in_progress' => true,
'dismissible' => false,
),
'all-pages-created' => array(
'warning_condition' => 'wizard->wizard_completed_once',
'success_conditions' => array(
'document->all_required_pages_created',
),
'completed' => __( 'All required pages have been generated.', 'complianz-gdpr' ),
'open' => __( 'Not all required pages have been generated.', 'complianz-gdpr' ),
'include_in_progress' => true,
),
'no-ssl' => array(
'success_conditions' => array(
'is_ssl'
),
'completed' => __( "Great! You're already on SSL!", 'complianz-gdpr' ),
'open' => cmplz_sprintf( __( "You don't have SSL on your site yet. Install SSL for Free with %sReally Simple SSL%s", 'complianz-gdpr' ),
'', '' ),
'include_in_progress' => true,
),
'ga-needs-configuring' => array(
'warning_condition' => 'cookie_admin->uses_google_analytics',
'success_conditions' => array(
'cookie_admin->analytics_configured',
),
'open' => __( 'Google Analytics is being used, but is not configured in Complianz.', 'complianz-gdpr' ),
'include_in_progress' => true,
),
'gtm-needs-configuring' => array(
'warning_condition' => 'cookie_admin->uses_google_tagmanager',
'success_conditions' => array(
'cookie_admin->tagmanager_configured',
),
'open' => __( 'Google Tag Manager is being used, but is not configured in Complianz.', 'complianz-gdpr' ),
'include_in_progress' => true,
),
'matomo-needs-configuring' => array(
'warning_condition' => 'cookie_admin->uses_matomo',
'success_conditions' => array(
'cookie_admin->matomo_configured',
),
'open' => __( 'Matomo is being used, but is not configured in Complianz.', 'complianz-gdpr' ),
'include_in_progress' => true,
),
'docs-need-updating' => array(
'success_conditions' => array(
'NOT document->documents_need_updating'
),
'open' => __( 'Your documents have not been updated in the past 12 months. Run the wizard to check your settings.', 'complianz-gdpr' ),
'include_in_progress' => true,
),
'cookies-incomplete' => array(
'warning_condition' => 'NOT cookie_admin->use_cdb_api',
'success_conditions' => array(
'NOT cookie_admin->has_empty_cookie_descriptions',
),
'open' => __( 'You have cookies with incomplete descriptions.', 'complianz-gdpr' ) . " "
. cmplz_sprintf( __( 'Enable the cookiedatabase.org API for automatic descriptions, or add these %smanually%s.', 'complianz-gdpr' ), '', '' ),
'include_in_progress' => true,
),
'double-stats' => array(
'success_conditions' => array(
'NOT get_option_cmplz_double_stats',
),
'open' => __( 'You have a duplicate implementation of your statistics tool on your site.', 'complianz-gdpr' ) .
__( 'After the issue has been resolved, please re-run a scan to clear this message.', 'complianz-gdpr' )
. cmplz_read_more( 'https://complianz.io/duplicate-implementation-of-analytics/' ),
'include_in_progress' => true,
'dismissible' => true,
),
'console-errors' => array(
'warning_condition' => 'cookie_admin->site_needs_cookie_warning',
'success_conditions' => array(
'NOT cmplz_get_console_errors',
),
'open' => __( 'Javascript errors are detected on the front-end of your site. This may break the cookie banner functionality.', 'complianz-gdpr' )
. '
'.__("Last error in the console:", "complianz-gdpr")
.'