diff --git a/modules/clean-up.php b/modules/clean-up.php index ec20ed71..930235ef 100644 --- a/modules/clean-up.php +++ b/modules/clean-up.php @@ -92,6 +92,13 @@ function clean_style_tag($input) { */ function clean_script_tag($input) { $input = str_replace("type='text/javascript' ", '', $input); + $input = \preg_replace_callback( + '/document.write\(\s*\'(.+)\'\s*\)/is', + function ($m) { + return str_replace($m[1], addcslashes($m[1], '"'), $m[0]); + }, + $input + ); return str_replace("'", '"', $input); } add_filter('script_loader_tag', __NAMESPACE__ . '\\clean_script_tag');