Skip to content

Commit

Permalink
#4342 Added in 1.0.51
Browse files Browse the repository at this point in the history
  • Loading branch information
Zabi09 committed May 27, 2020
1 parent aed46f3 commit 4118707
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions templates/features.php
Original file line number Diff line number Diff line change
Expand Up @@ -8376,9 +8376,11 @@ 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);
if(isset($cdn_url["cdn_cnames"][0]) && $cdn_url["cdn_cnames"][0]!=''){
$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;
Expand Down

0 comments on commit 4118707

Please sign in to comment.