Skip to content

Commit

Permalink
#4342 code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Zabi09 committed Apr 27, 2020
1 parent 1f9d97c commit 8fa149b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion templates/features.php
Original file line number Diff line number Diff line change
Expand Up @@ -8446,7 +8446,8 @@ function ampforwp_wp_rocket_compatibility($content){
$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="'.$cdn_url.'/wp-content$2"$3>', $content);
$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 8fa149b

Please sign in to comment.