: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
padding: 10px 15px 10px 15px;
border-radius: 0 3px 3px 0;
background-color: rgba(0,0,0,0.5);
/* Position the "next button" to the right */
border-radius: 3px 0 0 3px;
border-radius: 3px 0 0 3px;
/* On hover, add a black background color with a little bit see-through */
.nonamp-prev:hover, .nonamp-next:hover {
/* Number text (1/3 etc) */
/* The dots/bullets/indicators */
transition: background-color 0.6s ease;
background-color: #717171;
-webkit-animation-name: fade;
-webkit-animation-duration: 1.5s;
animation-duration: 1.5s;
@-webkit-keyframes fade {
/* On smaller screens, decrease text size */
@media only screen and (max-width: 300px) {
.nonamp-prev, .nonamp-next,.text {font-size: 11px}
showSlides(slideIndex += n);
function currentSlide(n) {
showSlides(slideIndex = n);
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
var heads = document.getElementsByClassName("heads");
if (n >= slides.length) {slideIndex = 0}
if (n < 0) {slideIndex = slides.length-1}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" how-current", "");
for (i = 0; i < heads.length; i++) {
heads[i].className = heads[i].className.replace(" how-current", "");
slides[slideIndex].style.display = "block";
dots[slideIndex].className += " how-current";
heads[slideIndex].className += " how-current";
showDivs(slideIndex = n);
var x = document.getElementsByClassName("mySlides");
if (n > x.length) {slideIndex = 1}
if (n < 0) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
x[slideIndex].style.display = "block";
.cntr img{width:100%;height:auto !important;}
.slid-prv{width:100%;text-align: center;margin-top: 10px;display: inline-block;}
.amp-featured-image img{width:100%;height:auto;}
.content-wrapper, .header, .header-2, .header-3{width:100% !important;}
.image-mod img{width:100%;}
$re = '/<style\s*type="text\/css">(.*?)<\/style>/si';
$subst = "<style type=\"text/css\">$1 ".$nonampCss.$galleryCss."</style>";
$returnData = preg_replace($re, $subst, $returnData);
$returnData = preg_replace(
'/<amp-youtube\sdata-videoid="(.*?)"(.*?)><\/amp-youtube>/',
'<iframe src="'. esc_url("https://www.youtube.com/embed/$1").'" style="width:100%;height:360px;" ></iframe>', $returnData);
$returnData = preg_replace_callback(
'/<amp-iframe(.*?)src="(.*?)"(.*?)><\/amp-iframe>/',
return '<iframe src="'.esc_url($matches[2]).'" style="width:100%;height:400px;" ></iframe>';
$returnData = preg_replace_callback('/<amp-carousel\s(.*?)>(.*?)<\/amp-carousel>/s', 'ampforwp_non_amp_gallery', $returnData );
$returnData = preg_replace('/on="tap(.*?).goToSlide(.*?)"/', 'onclick="currentDiv$2"', $returnData);
$returnData = preg_replace('/<span on="tap:AMP\.setState\((.*?)\s:\showSectionSelected\.howSlide - 1(.*?)\)(.*?)/', '<span onclick="plusSlides(-1)$3"', $returnData);
$returnData = preg_replace('/<span on="tap:AMP\.setState\((.*?)\s:\showSectionSelected\.howSlide \+ 1(.*?)\)(.*?)>/', '<span onclick="plusSlides(+1)$3">', $returnData);
$returnData = str_replace('</footer>', '</footer>'.$galleryJs, $returnData);
// wp_update_nav_menu #3052
add_action('wp_update_nav_menu', 'ampforwp_wp_update_nav_menu', 10 , 1 );
if ( ! function_exists('ampforwp_wp_update_nav_menu') ) {
function ampforwp_wp_update_nav_menu( $menu_id ) {
if ( false != get_transient('ampforwp_header_menu') ) {
delete_transient('ampforwp_header_menu');
if ( false != get_transient('ampforwp_footer_menu') ) {
delete_transient('ampforwp_footer_menu');
// Delete Menu Transients on Saving AMP Settings #3052
if ( ! function_exists('ampforwp_menu_transient_on_save') ){
function ampforwp_menu_transient_on_save($redux_builder_amp, $this_transients_changed_values) {
if ( isset($this_transients_changed_values['amp-design-selector']) ) {
if ( false != get_transient('ampforwp_header_menu') ) {
delete_transient('ampforwp_header_menu');
if ( false != get_transient('ampforwp_footer_menu') ) {
delete_transient('ampforwp_footer_menu');
add_action("redux/options/redux_builder_amp/saved",'ampforwp_menu_transient_on_save', 10, 2);
if ( ! function_exists('ampforwp_remove_protocol') ) {
function ampforwp_remove_protocol($url){
$url = preg_replace('#^https?://#', '//', $url);
if ( ! function_exists('ampforwp_sanitize_i_amphtml') ) {
function ampforwp_sanitize_i_amphtml($data){
$data = preg_replace_callback('/.i-amphtml-(.*?){(.*?)}/s',function($matches){ if(!empty($matched)){ return ''; } }, $data);
function checkAMPforPageBuilderStatus($postId){
$postId = (is_object($post)? $post->ID: '');
if( ampforwp_is_front_page() ){
$postId = ampforwp_get_frontpage_id();
if ( empty( $postId ) ) {
$amp_builder = get_post_field('amp-page-builder',$postId);
$amp_pd_data = json_decode($amp_builder);
$ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
if( $ampforwp_pagebuilder_enable=='yes' && true == ampforwp_get_setting('ampforwp-pagebuilder') && ( function_exists('amppb_post_content') && !empty($amp_pd_data->rows))){
$response = apply_filters( 'ampforwp_pagebuilder_status_modify', $response, $postId );
function ampforwp_new_gallery_images($images_markup, $image, $markup_arr){
add_action('amp_post_template_css', 'ampforwp_additional_gallery_style');
add_filter('amp_post_template_data','ampforwp_carousel_bind_script');
add_action('amp_post_template_css', 'ampforwp_additional_style_carousel_caption');
if( ! function_exists( 'ampforwp_additional_gallery_style' ) ){
function ampforwp_additional_gallery_style(){
global $carousel_markup_all;
$design_type = ampforwp_get_setting('ampforwp-gallery-design-type');
if(isset($design_type) && $design_type!==''){
echo $carousel_markup_all[$design_type]['gallery_css'];
// amp-bind for carousel with captions
function ampforwp_carousel_bind_script($data){
if( 1 == ampforwp_get_setting('ampforwp-gallery-design-type') || 2 == ampforwp_get_setting('ampforwp-gallery-design-type') ){
if ( empty( $data['amp_component_scripts']['amp-bind'] ) ) {
$data['amp_component_scripts']['amp-bind'] = 'https://cdn.ampproject.org/v0/amp-bind-0.1.js';
if( 3 == ampforwp_get_setting('ampforwp-gallery-design-type') || true == ampforwp_get_setting('ampforwp-gallery-lightbox') ){
if ( empty( $data['amp_component_scripts']['amp-image-lightbox'] ) ) {
$data['amp_component_scripts']['amp-image-lightbox'] = 'https://cdn.ampproject.org/v0/amp-image-lightbox-0.1.js';
function ampforwp_new_thumbnail_images($amp_images, $uniqueid, $markup_arr){
if(!isset($markup_arr['carousel_with_thumbnail_html'])){return '';}
$amp_thumb_image_buttons = array();
foreach ($amp_images as $key => $value) {
$returnHtml = $markup_arr['carousel_with_thumbnail_html'];
$returnHtml = str_replace('{{thumbnail}}', $value , $returnHtml);
$returnHtml = str_replace('{{unique_id}}', $uniqueid , $returnHtml);
$returnHtml = str_replace('{{unique_index}}', $key , $returnHtml);
$amp_thumb_image_buttons[$key] = $returnHtml;
return $amp_thumb_image_buttons;
if( ! function_exists( 'ampforwp_additional_style_carousel_caption' ) ){
function ampforwp_additional_style_carousel_caption(){ ?>
.collapsible-captions {--caption-height: 32px; --image-height: 100%; --caption-padding:1rem; --button-size: 28px; --caption-color: #f5f5f5;; --caption-bg-color: #111;}
.collapsible-captions * {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
.collapsible-captions .amp-carousel-container {position: relative; width: 100%;}
.collapsible-captions amp-img img {object-fit: contain; }
.collapsible-captions figure { margin: 0; padding: 0; }
.collapsible-captions figcaption { position: absolute; bottom: 0;width: 100%;
max-height: var(--caption-height);margin-bottom:0;
line-height: var(--caption-height);
padding: 0 var(--button-size) 0 5px;
transition: max-height 200ms cubic-bezier(0.4, 0, 0.2, 1);
color: var(--caption-color);
background: rgba(0, 0, 0, 0.6);
.collapsible-captions figcaption.expanded {
.collapsible-captions figcaption:focus { outline: none; border: none; }
.collapsible-captions figcaption span { display: block; position: absolute;
top: calc((var(--caption-height) - var(--button-size)) / 2);
right: 2px; width: var(--button-size); height: var(--button-size);
line-height: var(--button-size); text-align: center; font-size: 12px; color: inherit;
figcaption{ margin-bottom: 20px; }
function ampforwp_role_based_access_options(){
$currentUser = wp_get_current_user();
$amp_roles = ampforwp_get_setting('ampforwp-role-based-access');
$currentuserrole = (array) $currentUser->roles;
$hasrole = array_intersect( $currentuserrole, $amp_roles );
$user_role = apply_filters('ampforwp_modify_user_access_role', $user_role, $currentUser, $amp_roles, $hasrole );
if(!function_exists('ampforwp_sassy_share_icons')){
function ampforwp_sassy_share_icons($ampforwp_the_content) {
if(function_exists('heateor_sss_run')){
global $heateor_sss;global $post;
$sassy_options = $heateor_sss->options;
$post_url = get_the_permalink($post);
if(isset($sassy_options['horizontal_counts'])){
$post_id = ampforwp_get_the_ID();
if ( $post_id == 'custom' ) {
$share_counts = get_option( 'heateor_sss_custom_url_shares' ) ;
} elseif ( $post_url == home_url() ) {
$share_counts = get_option( 'heateor_sss_homepage_shares' );
} elseif ( $post_id > 0 ) {
$share_counts = get_post_meta( $post_id, '_heateor_sss_shares_meta', true );
if(isset($sassy_options['horizontal_re_providers'])){
$share_icons = $sassy_options['horizontal_re_providers'];
foreach($share_icons as $i){
if(isset($share_counts[$i])){
$total_share += round($share_counts[$i]);
$_append = '<a class="heateor_sss_amp heateor-total-share-count">
<span class="sss_share_count">'.intval($total_share).'</span> <span class="sss_share_lbl">Shares</span></a>';
preg_match_all('/<div class="heateorSssClear"><\/div><div class="heateor_sss_sharing_container (.*)">(.*)<div class="heateorSssClear"><\/div><\/div><div class="heateorSssClear"><\/div>/', $ampforwp_the_content, $matches);
if(isset($matches[1][0])){
$_replace = '<div class="heateorSssClear"></div><div class="heateor_sss_sharing_container '.$matches[1][0].'"></amp-img></a>'.$_append.'</div><div class="heateorSssClear"></div><div class="heateorSssClear"></div>';
$ampforwp_the_content = str_replace($_actual, $_replace, $ampforwp_the_content);
return $ampforwp_the_content;
function ampforwp_dev_mode_notice(){
global $redux_builder_amp;
if(isset($redux_builder_amp['ampforwp-development-mode']) && $redux_builder_amp['ampforwp-development-mode']) {
$message = ' Please turn off Development mode, when you are done.';?>
<div class="notice notice-success amp-dev-notice" style="position:relative;
height: 40px; overflow: hidden; ">
<div class="ampforwp-dev-mode-message" style="margin-top: 10px;">
<?php echo '<strong>'. esc_html__('AMP Dev mode is Enabled!', 'accelerated-mobile-pages').'</strong>'. esc_html__($message, 'accelerated-mobile-pages'); ?>
function ampforwp_seo_selection_notice() {
if(function_exists('genesis_theme_support')){
if(class_exists('WPSEO_Options')){
if(class_exists('All_in_One_SEO_Pack')){
if(function_exists( 'the_seo_framework' )){
$seo = 'The SEO Framework';
if(function_exists('qode_header_meta')){
$seo = 'Bridge Qode SEO';
if(defined( 'RANK_MATH_FILE' )){
if(defined( 'SQ_ALL_PATTERNS' )){
if(class_exists('Smartcrawl_Loader')){
if(function_exists('seopress_activation')){
if(class_exists('WPSEO_Options') && 'yoast' != ampforwp_get_setting('ampforwp-seo-selection')){
else if (defined( 'RANK_MATH_FILE' ) && 'rank_math' != ampforwp_get_setting('ampforwp-seo-selection')){
else if (class_exists('All_in_One_SEO_Pack') && 'aioseo' != ampforwp_get_setting('ampforwp-seo-selection')){
else if (function_exists( 'the_seo_framework' ) && 'seo_framework' != ampforwp_get_setting('ampforwp-seo-selection')){
else if (defined( 'SQ_ALL_PATTERNS' ) && 'squirrly' != ampforwp_get_setting('ampforwp-seo-selection')){
else if (class_exists('Smartcrawl_Loader') && 'smartcrawl' != ampforwp_get_setting('ampforwp-seo-selection')){
else if (function_exists('genesis_theme_support') && 'genesis' != ampforwp_get_setting('ampforwp-seo-selection') && !class_exists('WPSEO_Options') && !defined( 'RANK_MATH_FILE' ) && !class_exists('All_in_One_SEO_Pack') && !defined( 'SQ_ALL_PATTERNS' ) && !class_exists('Smartcrawl_Loader') && !function_exists('seopress_activation')){
else if (function_exists('seopress_activation') && 'seopress' != ampforwp_get_setting('ampforwp-seo-selection')){
else if (function_exists('qode_header_meta') && 'bridge' != ampforwp_get_setting('ampforwp-seo-selection')){
if($seosel && ( '' != ampforwp_get_setting('ampforwp-seo-selection') ) ){
echo sprintf(('<div class="notice notice-error"><p>%s</p></div>'), esc_html__('Incorrect SEO plugin has been selected in AMPforWP SEO Settings, Please select '.esc_html($seo).' from SEO Settings.','accelerated-mobile-pages'));
if('' != ampforwp_get_setting('ampforwp-seo-selection')){
echo sprintf(('<div class="notice notice-error"><p>%s </p></div>'), esc_html__('The configuration of AMPforWP and '.esc_html($seo).' plugin is seems incorrect. Please go to AMPforWP plugin settings -> SEO -> SEO Plugin Integration and select '.esc_html($seo).' plugin from the drop down.','accelerated-mobile-pages'));
add_action('wp_ajax_ampforwp_subscribe_newsletter','ampforwp_subscribe_for_newsletter');
add_action('wp_ajax_nopriv_ampforwp_subscribe_newsletter','ampforwp_subscribe_for_newsletter');
function ampforwp_subscribe_for_newsletter(){
$api_url = 'http://magazine3.company/wp-json/api/central/email/subscribe';
'name' => sanitize_text_field($_POST['name']),
'email'=> sanitize_text_field($_POST['email']),
'website'=> sanitize_text_field($_POST['website']),
$response = wp_remote_post( $api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
$response = wp_remote_retrieve_body( $response );
function ampforwp_mobile_redirection_notice(){
if(false == ampforwp_get_setting('amp-mobile-redirection')){
if(function_exists('rocket_load_textdomain') && (function_exists('get_rocket_option') && 0 == get_rocket_option( 'do_caching_mobile_files' ))){
$option = 'Separate cache files for mobile devices';
if(function_exists('wp_super_cache_init_action')) {
global $wp_cache_mobile_enabled;
if(0 == $wp_cache_mobile_enabled){
$plugin = 'WP Super Cache';
$option = 'Mobile device support';
if(function_exists('litespeed_purge_single_post') && !LiteSpeed_Cache_Admin_Rules::get_instance()->get_rewrite_rule_mobile_agents()) {
$plugin = 'LiteSpeed Cache';
$option = 'Cache Mobile';
if(function_exists('wpfastestcache_activate') && isset($GLOBALS["wp_fastest_cache_options"]->wpFastestCacheMobile) && 'on' != $GLOBALS["wp_fastest_cache_options"]->wpFastestCacheMobile) {
$plugin = 'WP Fastest Cache';
if(!empty($plugin) && !empty($option)){
echo sprintf(('<div class="notice notice-error"><p>%s <a target="_blank" href="%s">%s</a></p></div>'), esc_html__('You need to enable the option of "'.esc_html($option).'" in '.esc_html($plugin).' plugin for mobile redirection to work properly in AMP','accelerated-mobile-pages'),esc_url('https://ampforwp.com/tutorials/article/how-to-redirect-all-mobile-visitors-to-amp/'),esc_html__('Click here for more info','accelerated-mobile-pages')); }
function ampforwp_category_base_remove_notice(){
if(true == ampforwp_get_setting('ampforwp-category-base-removel-link')){
if(class_exists('WPSEO_Options') && method_exists('WPSEO_Options', 'get') && WPSEO_Options::get( 'stripcategorybase' ) == true ){
echo sprintf(('<div class="notice notice-error"><p>%s <a href="%s">%s</a>%s<a href="%s">%s</a></p></div>'), esc_html__('We have detected that you removed Category Base from Yoast SEO plugin but not from AMPforWP settings. Please','accelerated-mobile-pages'),
esc_url('admin.php?page=amp_options&tab=17'),
esc_html__('Click here','accelerated-mobile-pages'),
esc_html__(' to set up to make sure AMP pages work properly on category pages or ','accelerated-mobile-pages'),
esc_url('https://ampforwp.com/tutorials/article/how-to-remove-the-category-base-in-the-amp/'),esc_html__('Click here for the tutorial','accelerated-mobile-pages'),esc_html__('Click here for the tutorial','accelerated-mobile-pages'));