Skip to content

Commit

Permalink
#4342 Added in 1.0.50
Browse files Browse the repository at this point in the history
  • Loading branch information
Zabi09 committed May 15, 2020
1 parent d00f1ad commit 88f5ab1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions templates/features.php
Original file line number Diff line number Diff line change
Expand Up @@ -8174,6 +8174,7 @@ function ampforwp_add_fallback_element($content='',$tag=''){
$m_content = $matches[1][$i];
$m_content = ampforwp_imagify_webp_compatibility($m_content);
$m_content = ampforwp_ewww_webp_compatibility($m_content);
$m_content = ampforwp_wp_rocket_compatibility($m_content);
$m1_content = ampforwp_set_default_fallback_image($matches[1][$i]);
preg_match_all('/src="(.*?)"/', $m1_content,$fimgsrc);
preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
Expand Down Expand Up @@ -8354,6 +8355,17 @@ function ampforwp_rank_math_external_link_newtab($content){
}
return $content;
}
function ampforwp_wp_rocket_compatibility($content){
if(function_exists('rocket_activation')){
$cdn_url = get_option('wp_rocket_settings');
if($cdn_url['cdn'] == 1){
$cdn_url = $cdn_url["cdn_cnames"][0];
$content = preg_replace('/src="(.*?)\/\/(.*?)wp-content(.*?)"(.*?)>/', 'src="$1//'.$cdn_url.'/wp-content$3"$4>', $content);
$content = preg_replace('/srcset="(.*?)\/\/(.*?)wp-content(.*?),(.*?)\/\/(.*?)wp-content(.*?),(.*?)\/\/(.*?)wp-content(.*?)"/', 'srcset="$1//'.$cdn_url.'/wp-content$3,$4//'.$cdn_url.'/wp-content$6,$7//'.$cdn_url.'/wp-content$9"', $content);
}
}
return $content;
}
/* add_action( 'wp_ajax_ampforwp_referesh_related_post', 'ampforwp_referesh_related_post' );
function ampforwp_referesh_related_post(){
if(!wp_verify_nonce($_POST['verify_nonce'],'ampforwp_refresh_related_poost') ){
Expand Down

0 comments on commit 88f5ab1

Please sign in to comment.