Make WordPress Core

Changeset 26094


Ignore:
Timestamp:
11/11/2013 09:53:08 PM (11 years ago)
Author:
wonderboymusic
Message:

Make HTML tag searches for <code> and <pre> case-insensitive in make_clickable().

Props bpetty.
Fixes #23756.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r26052 r26094  
    11711171function balanceTags( $text, $force = false ) {
    11721172    if ( $force || get_option('use_balanceTags') == 1 ) {
    1173         $balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '<!--more.*?-->', '<!--nextpage-->' ) ); 
     1173        $balance_tags_delimiters = apply_filters( 'balance_tags_delimiters', array( '<!--more.*?-->', '<!--nextpage-->' ) );
    11741174        // Capture lets PREG_SPLIT_DELIM_CAPTURE return the delimiters
    11751175        $delimiters_regex = '/(' . implode( '|', $balance_tags_delimiters ) . ')/';
     
    16101610    foreach ( $textarr as $piece ) {
    16111611
    1612         if ( preg_match( '|^<code[\s>]|', $piece ) || preg_match( '|^<pre[\s>]|', $piece ) )
     1612        if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
    16131613            $nested_code_pre++;
    1614         elseif ( ( '</code>' === $piece || '</pre>' === $piece ) && $nested_code_pre )
     1614        elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
    16151615            $nested_code_pre--;
    16161616
  • trunk/tests/phpunit/tests/formatting/MakeClickable.php

    r26052 r26094  
    302302            'URL before pre http://wordpress.org<pre>http://wordpress.org</pre>',
    303303            'URL before code http://wordpress.org<code>http://wordpress.org</code>',
    304             'URL after pre <pre>http://wordpress.org</pre>http://wordpress.org',
     304            'URL after pre <PRE>http://wordpress.org</PRE>http://wordpress.org',
    305305            'URL after code <code>http://wordpress.org</code>http://wordpress.org',
    306306            'URL before and after pre http://wordpress.org<pre>http://wordpress.org</pre>http://wordpress.org',
     
    318318            'URL before pre <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><pre>http://wordpress.org</pre>',
    319319            'URL before code <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><code>http://wordpress.org</code>',
    320             'URL after pre <pre>http://wordpress.org</pre><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
     320            'URL after pre <PRE>http://wordpress.org</PRE><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
    321321            'URL after code <code>http://wordpress.org</code><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
    322322            '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>',
Note: See TracChangeset for help on using the changeset viewer.