remove scripts later in the queue
This commit is contained in:
parent
9b642858f6
commit
72f12de96a
2 changed files with 4 additions and 4 deletions
|
@ -197,9 +197,6 @@ class Shortcodes {
|
||||||
|
|
||||||
$content = \get_post_field( 'post_content', $post );
|
$content = \get_post_field( 'post_content', $post );
|
||||||
|
|
||||||
// replace script and style elements
|
|
||||||
$content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
|
|
||||||
|
|
||||||
if ( 'yes' === $atts['apply_filters'] ) {
|
if ( 'yes' === $atts['apply_filters'] ) {
|
||||||
$content = \apply_filters( 'the_content', $content );
|
$content = \apply_filters( 'the_content', $content );
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,6 +205,9 @@ class Shortcodes {
|
||||||
$content = wp_filter_content_tags( $content );
|
$content = wp_filter_content_tags( $content );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// replace script and style elements
|
||||||
|
$content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
|
||||||
|
|
||||||
$content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
|
$content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Test_Activitypub_Shortcodes extends WP_UnitTestCase {
|
||||||
$post->post_date = current_time( 'mysql' );
|
$post->post_date = current_time( 'mysql' );
|
||||||
$post->post_date_gmt = current_time( 'mysql', 1 );
|
$post->post_date_gmt = current_time( 'mysql', 1 );
|
||||||
$post->post_title = 'Some title or other';
|
$post->post_title = 'Some title or other';
|
||||||
$post->post_content = '<script>test</script>hallo';
|
$post->post_content = '<script>test</script>hallo<script type="javascript">{"asdf": "qwerty"}</script><style></style>';
|
||||||
$post->post_status = 'publish';
|
$post->post_status = 'publish';
|
||||||
$post->comment_status = 'closed';
|
$post->comment_status = 'closed';
|
||||||
$post->ping_status = 'closed';
|
$post->ping_status = 'closed';
|
||||||
|
|
Loading…
Reference in a new issue