Make WordPress Core


Ignore:
Timestamp:
11/19/2015 11:31:00 PM (10 years ago)
Author:
pento
Message:

Texturize: Only convert & to & within text nodes.

Previously, & would be converted everywhere, which caused problems when it was converted within a <script>, for example.

convert_chars() is now removed from the the_content filter, as it was doing the same job as wptexturize().

KSES correctly handles converting & within HTML attributes, so there's no need for wptexturize() and convert_chars() to do the same job.

Fixes #34698.

File:
1 edited

Legend:

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

    r35555 r35709  
    277277                $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
    278278            }
    279         }
    280     }
    281     $text = implode( '', $textarr );
    282 
    283     // Replace each & with &#038; unless it already looks like an entity.
    284     return preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $text );
     279
     280            // Replace each & with &#038; unless it already looks like an entity.
     281            $curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $curl );
     282        }
     283    }
     284
     285    return implode( '', $textarr );
    285286}
    286287
Note: See TracChangeset for help on using the changeset viewer.