From 2ccc1010500eb39efa3861bf7cb0df44578ee4b3 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 11 Nov 2013 21:53:08 +0000 Subject: [PATCH] Make HTML tag searches for `` and `
`
 case-insensitive in `make_clickable()`.

Props bpetty.
Fixes #23756.



git-svn-id: https://develop.svn.wordpress.org/trunk@26094 602fd350-edb4-49c9-b593-d223f7449a82
---
 src/wp-includes/formatting.php                   | 6 +++---
 tests/phpunit/tests/formatting/MakeClickable.php | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

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',