diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index fc982cc410..eaa12de7f6 100644 --- a/src/wp-includes/formatting.php +++ b/src/wp-includes/formatting.php @@ -1170,7 +1170,7 @@ function convert_chars($content, $deprecated = '') { */ function balanceTags( $text, $force = false ) { if ( $force || get_option('use_balanceTags') == 1 ) { - $balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '', '' ) ); + $balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '', '' ) ); // Capture lets PREG_SPLIT_DELIM_CAPTURE return the delimiters $delimiters_regex = '/(' . implode( '|', $balance_tags_delimiters ) . ')/'; $parts = preg_split( $delimiters_regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); @@ -1609,9 +1609,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( '|^]|', $piece ) || preg_match( '|^]|', $piece ) )
+		if ( preg_match( '|^]|i', $piece ) || preg_match( '|^]|i', $piece ) )
 			$nested_code_pre++;
-		elseif ( ( '' === $piece || '
' === $piece ) && $nested_code_pre ) + elseif ( ( '' === strtolower( $piece ) || '' === strtolower( $piece ) ) && $nested_code_pre ) $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 221635d72a..f6ae895be5 100644 --- a/tests/phpunit/tests/formatting/MakeClickable.php +++ b/tests/phpunit/tests/formatting/MakeClickable.php @@ -301,7 +301,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase { 'http://wordpress.org', 'URL before pre http://wordpress.org
http://wordpress.org
', 'URL before code http://wordpress.orghttp://wordpress.org', - 'URL after pre
http://wordpress.org
http://wordpress.org', + 'URL after pre
http://wordpress.org
http://wordpress.org', 'URL after code http://wordpress.orghttp://wordpress.org', 'URL before and after pre http://wordpress.org
http://wordpress.org
http://wordpress.org', 'URL before and after code http://wordpress.orghttp://wordpress.orghttp://wordpress.org', @@ -317,7 +317,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase { 'http://wordpress.org', 'URL before pre http://wordpress.org
http://wordpress.org
', 'URL before code http://wordpress.orghttp://wordpress.org', - 'URL after pre
http://wordpress.org
http://wordpress.org', + 'URL after pre
http://wordpress.org
http://wordpress.org', 'URL after code http://wordpress.orghttp://wordpress.org', 'URL before and after pre http://wordpress.org
http://wordpress.org
http://wordpress.org', 'URL before and after code http://wordpress.orghttp://wordpress.orghttp://wordpress.org',