: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( ! defined( 'ABSPATH' ) ) {
function amp_gdpr_output(){
global $redux_builder_amp;
$headline = $accept = $reject = $settings = $user_data = $form_url = '';
$headline = $redux_builder_amp['amp-gdpr-compliance-headline-text'];
$accept = $redux_builder_amp['amp-gdpr-compliance-accept-text'];
$reject = $redux_builder_amp['amp-gdpr-compliance-reject-text'];
$settings = $redux_builder_amp['amp-gdpr-compliance-settings-text'];
$user_data = !empty($redux_builder_amp['amp-gdpr-compliance-textarea'])?$redux_builder_amp['amp-gdpr-compliance-textarea']:'You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:';
$form_url = admin_url('admin-ajax.php?action=amp_consent_submission&verify_nonce='.wp_create_nonce('amp_consent'));
$form_url = preg_replace('#^https?:#', '', $form_url);
$more_info = $redux_builder_amp['amp-gdpr-compliance-for-more-privacy-info'];
$cookie_enable = isset($redux_builder_amp['amp-gdpr-compliance-enable-options'])? $redux_builder_amp['amp-gdpr-compliance-enable-options'] :null;
$cookie_options = isset($redux_builder_amp['amp-gdpr-compliance-options'])? $redux_builder_amp['amp-gdpr-compliance-options'] :null;
$cookie_toggle = isset($redux_builder_amp['amp-gdpr-compliance-enable-toggle'])? $redux_builder_amp['amp-gdpr-compliance-enable-toggle'] :null;
$privacy_button_text = '';
if(isset($redux_builder_amp['amp-gdpr-compliance-select-privacy-page']) && $redux_builder_amp['amp-gdpr-compliance-select-privacy-page']){
$privacy_page = get_permalink($redux_builder_amp['amp-gdpr-compliance-select-privacy-page']);}
if(isset($redux_builder_amp['amp-gdpr-compliance-privacy-page-button-text']) && $redux_builder_amp['amp-gdpr-compliance-privacy-page-button-text']){
$privacy_button_text = $redux_builder_amp['amp-gdpr-compliance-privacy-page-button-text'];
$gdpr_countries = array("AT","BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IS", "IE", "IT", "LV", "LI", "LT", "LU", "MT", "NL", "NO", "PL", "PT", "RO", "SK", "SI", "ES", "SE", "GB", "AX", "IC", "EA", "GF", "PF", "TF", "GI", "GP", "GG", "JE", "MQ", "YT", "NC", "RE", "BL", "MF", "PM", "SJ", "VA", "WF", "EZ", "CH","BR");
$gdpr_countries = apply_filters( 'ampforwp_gdpr_country_list' , $gdpr_countries );
$gdpr_text = array("headline"=>$headline,"user_data"=>$user_data,"accept"=>$accept,"reject"=>$reject,"settings"=>$settings,"more_info "=>$more_info,"privacy_button_text"=>$privacy_button_text );
$gdpr_text = apply_filters('ampforwp_modify_gdpr_output',$gdpr_text);
$headline = $gdpr_text['headline'];
$user_data = $gdpr_text['user_data'];
$accept = $gdpr_text['accept'];
$reject = $gdpr_text['reject'];
$settings = $gdpr_text['settings'];
$more_info = isset($gdpr_text['more_info']) ? $gdpr_text['more_info'] : "";
$privacy_button_text = $gdpr_text['privacy_button_text'];
<amp-geo layout="nodisplay">
<script type="application/json">
"eea": [ "preset-eea", "unknown" ]
<amp-consent id="ampforwpConsent" layout="nodisplay">
<script type="application/json">{
"consentInstanceId": "ampforwp-consent",
"consentRequired": false,
"postPromptUI": "post-consent-ui"
<div class="gdpr" id="gdpr_c">
<div class="gdpr_x" role="button" tabindex="0" on="tap:ampforwpConsent.dismiss">X</div>
<h3><?php echo esc_html__($headline,'accelerated-mobile-pages'); ?></h3>
<p><?php echo esc_html__($user_data,'accelerated-mobile-pages'); ?></p>
<?php $cookie_options = is_array($cookie_options)?$cookie_options:null;?>
<?php if (ampforwp_get_setting('amp-gdpr-newguidelines-switch') || $cookie_enable) { ?>
<?php if ($cookie_options==null || (isset($cookie_options['marketing']) && $cookie_options['marketing'] ==1)) { ?>
<label class="consentLabel" for="consent-purpose-marketing">
<input id="consent-purpose-marketing" type="checkbox" on="change:ampforwpConsent.setPurpose(purpose-marketing=event.checked)">
<?php echo esc_html__('Marketing cookies','accelerated-mobile-pages'); ?>
<?php if ($cookie_options==null || (isset($cookie_options['conversion']) && $cookie_options['conversion'] ==1)) { ?>
<label class="consentLabel" for="consent-purpose-conversion">
<input id="consent-purpose-conversion" type="checkbox" on="change:ampforwpConsent.setPurpose(purpose-conversion=event.checked)">
<?php echo esc_html__('Conversion tracking cookies','accelerated-mobile-pages'); ?>
<?php if ($cookie_options==null || (isset($cookie_options['analytics']) && $cookie_options['analytics'] ==1)) { ?>
<label class="consentLabel" for="consent-purpose-analytics">
<input id="consent-purpose-analytics" type="checkbox" on="change:ampforwpConsent.setPurpose(purpose-analytics=event.checked)">
<?php echo esc_html__('Analytics','accelerated-mobile-pages'); ?>
</div><?php if(isset($redux_builder_amp['amp-gdpr-compliance-select-privacy-page']) && $redux_builder_amp['amp-gdpr-compliance-select-privacy-page']){?>
<span><?php echo esc_html__($more_info,'accelerated-mobile-pages'); ?></span>
<a class="gdpr_fmi pri_page_link" href="<?php echo esc_attr($privacy_page); ?>" target="_blank"><?php echo esc_html__($privacy_button_text,'accelerated-mobile-pages'); ?></a>
<div id="gdpr_yn" class="gdpr_yn">
<form class="acp" action-xhr="<?php echo esc_url($form_url); ?>" method="post" target="_top">
<button type="submit" on="tap:ampforwpConsent.accept(purposeConsentDefault=false)" class="btn gdpr_y btn"><?php echo esc_html__($accept,'accelerated-mobile-pages'); ?></button>
<form class="rej" action-xhr="<?php echo esc_url($form_url); ?>" method="post" target="_top">
<button type="submit" on="tap:ampforwpConsent.reject" class="btn gdpr_n"><?php echo esc_html__($reject,'accelerated-mobile-pages'); ?></button>
<div id="post-consent-ui">
<?php if($cookie_toggle ==null || $cookie_toggle == 1){ ?>
<a href="#" on="tap:ampforwpConsent.prompt()" class="btn"><?php echo esc_html__($settings,'accelerated-mobile-pages'); ?></a>
if (ampforwp_get_setting('amp-gdpr-compliance-switch') || (isset($loadComponent['AMP-gdpr']) && true == $loadComponent['AMP-gdpr'] )) {
if(!isset($_COOKIE['ampforwp_gdpr_action'])){
add_filter('amp_post_template_data' , 'ampforwp_gdpr_data', 15);
add_action('amp_post_template_css' , 'ampforwp_gdpr_css');
add_action('wp_ajax_amp_consent_submission','amp_consent_submission');
add_action('wp_ajax_nopriv_amp_consent_submission','amp_consent_submission');
function ampforwp_gdpr_data( $data ) {
global $redux_builder_amp;
if ( empty( $data['amp_component_scripts']['amp-consent'] ) ) {
$data['amp_component_scripts']['amp-consent'] = 'https://cdn.ampproject.org/v0/amp-consent-0.1.js';
if ( empty( $data['amp_component_scripts']['amp-form'] ) ) {
$data['amp_component_scripts']['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
if ( empty( $data['amp_component_scripts']['amp-geo'] ) ) {
$data['amp_component_scripts']['amp-geo'] = 'https://cdn.ampproject.org/v0/amp-geo-0.1.js';
function ampforwp_gdpr_css(){
global $redux_builder_amp;
if($redux_builder_amp['gdpr-type'] == '1'){?>
.gdpr{position: fixed; top: 0; bottom: 0; left: 0; right: 0; background: rgba(0, 0, 0, 0.7);color: #333;z-index:9999999;line-height:1.3;height: 100vh;width: 100vw}
.gdpr_w{padding: 2rem;background: #fff;max-width: 700px;width: 95%;margin: 5% auto;text-align: center;position:fixed;left: 0;right: 0;margin:10% auto;}
.gdpr_t{margin-bottom:15px;}
.gdpr_t h3{font-size: 30px;margin:0px 0 10px 0;}
.gdpr_t p{font-size: 16px;line-height: 1.45;margin:0;}
.gdpr_x {position: absolute; right: 24px; top: 16px; cursor:pointer;}
.gdpr_yn{margin-top:10px;}
.gdpr_yn form{display: inline;}
.gdpr_yn button{background: #37474F;border: none;color: #fff;padding: 8px 30px;font-size: 13px;margin: 0 3px;}
.gdpr_yn .gdpr_n{background: #fff;color: #222;border: 1px solid #999;}
amp-consent{margin-left: 10px;top: 2px;width: auto;background: transparent;}
#footer .gdpr_fmi span, .gdpr_fmi span {
color: <?php echo ampforwp_sanitize_color( ampforwp_get_setting('swift-color-scheme','color') ); ?>;
.gdpr_w{width: 85%;margin:0 auto;padding:1.5rem;}
.gdpr_w{margin:0 auto; width: 85%;}
if($redux_builder_amp['gdpr-type'] == '2'){
$position = ampforwp_get_setting('amp-gdpr-type2-position');
.gdpr{position: fixed; <?php if($position==1){?>top: 0;<?php }else{?> bottom: 0;<?php }?> left: 0; right: 0; z-index:99999;}
.gdpr_w{padding:20px 40px;background: #383B75;width: 95%;position: relative;margin: 0% auto;display: inline-flex;}
text-decoration:underline;
.gdpr_x {position: absolute;right: 18px;top: 6px; cursor:pointer;color: #fff;visibility: hidden;}
.gdpr_yn form{display: inline;}
.gdpr_yn button{background: #FFFC26;border: none;color: #333;padding: 8px 40px;font-size: 15px;margin: 0 3px;font-weight: 600;cursor: pointer;}
.gdpr_yn .gdpr_n{background: transparent;}
amp-consent{position: relative;margin-left: 10px;width: auto;background: transparent;margin:0;left:40%;}
.gdpr_fmi span, .gdpr_fmi a:before{
text-decoration:underline;
.gdpr-l{display:inline-block;}
.gdpr_w{padding:10px 15px;
display:inline-block;text-align:left;
if ( '1' === $redux_builder_amp['amp-design-selector'] ) { ?>
if ( '3' === $redux_builder_amp['amp-design-selector'] ) {?>
amp-consent{background:none}
#footer amp-consent a{font-size:12px;margin-top:7px;display:inline-block;}
if ( '4' === $redux_builder_amp['amp-design-selector'] ) {?>
footer amp-consent.amp-active {
body[class*="amp-iso-country-"] .amp-active{
function amp_consent_submission(){
if(wp_verify_nonce( $_REQUEST['verify_nonce'], 'amp_consent' ) ) {
//setcookie('ampforwp_gdpr_action','true', time() + (86400 * 30), "/");
$current_url = $site_url = $site_host = $amp_site = '';
$current_url = wp_get_referer();
$site_url = parse_url( get_site_url() );
$site_host = $site_url['host'];
$amp_site = $site_url['scheme'] . '://' . $site_url['host'];
header("AMP-Access-Control-Allow-Source-Origin: ".esc_url($amp_site));
header("AMP-Redirect-To: ".esc_url($current_url));
echo wp_json_encode(array("status"=>300,"message"=>esc_html__('Request not valid','accelerated-mobile-pages')));