Make HTML tag searches for <code>
and <pre>
case-insensitive in make_clickable()
.
Props bpetty. Fixes #23756. git-svn-id: https://develop.svn.wordpress.org/trunk@26094 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8120f2861c
commit
2ccc101050
@ -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( '<!--more.*?-->', '<!--nextpage-->' ) );
|
||||
$balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '<!--more.*?-->', '<!--nextpage-->' ) );
|
||||
// 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 <pre> or <code>
|
||||
foreach ( $textarr as $piece ) {
|
||||
|
||||
if ( preg_match( '|^<code[\s>]|', $piece ) || preg_match( '|^<pre[\s>]|', $piece ) )
|
||||
if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
|
||||
$nested_code_pre++;
|
||||
elseif ( ( '</code>' === $piece || '</pre>' === $piece ) && $nested_code_pre )
|
||||
elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
|
||||
$nested_code_pre--;
|
||||
|
||||
if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
|
||||
|
@ -301,7 +301,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
|
||||
'<codecustomtag>http://wordpress.org</codecustomtag>',
|
||||
'URL before pre http://wordpress.org<pre>http://wordpress.org</pre>',
|
||||
'URL before code http://wordpress.org<code>http://wordpress.org</code>',
|
||||
'URL after pre <pre>http://wordpress.org</pre>http://wordpress.org',
|
||||
'URL after pre <PRE>http://wordpress.org</PRE>http://wordpress.org',
|
||||
'URL after code <code>http://wordpress.org</code>http://wordpress.org',
|
||||
'URL before and after pre http://wordpress.org<pre>http://wordpress.org</pre>http://wordpress.org',
|
||||
'URL before and after code http://wordpress.org<code>http://wordpress.org</code>http://wordpress.org',
|
||||
@ -317,7 +317,7 @@ class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
|
||||
'<codecustomtag><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a></codecustomtag>',
|
||||
'URL before pre <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><pre>http://wordpress.org</pre>',
|
||||
'URL before code <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><code>http://wordpress.org</code>',
|
||||
'URL after pre <pre>http://wordpress.org</pre><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
|
||||
'URL after pre <PRE>http://wordpress.org</PRE><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
|
||||
'URL after code <code>http://wordpress.org</code><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
|
||||
'URL before and after pre <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><pre>http://wordpress.org</pre><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
|
||||
'URL before and after code <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><code>http://wordpress.org</code><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
|
||||
|
Loading…
Reference in New Issue
Block a user