diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index de7195682f..e1d0de749d 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -2195,9 +2195,9 @@ function make_clickable( $text ) { $nested_code_pre = 0; // Keep track of how many levels link is nested inside
 or 
 	foreach ( $textarr as $piece ) {
 
-		if ( preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) )
+		if ( preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) )
 			$nested_code_pre++;
-		elseif ( ( '' === strtolower( $piece ) || '
' === strtolower( $piece ) ) && $nested_code_pre ) + elseif ( $nested_code_pre && ( '' === strtolower( $piece ) || '' === strtolower( $piece ) || '' === strtolower( $piece ) || '' === strtolower( $piece ) ) ) $nested_code_pre--; if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { diff --git a/tests/phpunit/tests/formatting/MakeClickable.php b/tests/phpunit/tests/formatting/MakeClickable.php index dec5d404b0..46c70ee001 100644 --- a/tests/phpunit/tests/formatting/MakeClickable.php +++ b/tests/phpunit/tests/formatting/MakeClickable.php @@ -372,4 +372,30 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase { href='mailto:someone@example.com'>someone@example.com"; $this->assertEquals( $html, make_clickable( $html ) ); } + + /** + * @dataProvider data_script_and_style_tags + * @ticket 30162 + */ + public function test_dont_link_script_and_style_tags( $tag ) { + $this->assertEquals( $tag, make_clickable( $tag ) ); + } + + public function data_script_and_style_tags() { + return array( + array( + '', + ), + array( + '', + ), + array( + '', + ), + array( + '', + ), + ); + } + }