Make WordPress Core

Ticket #28575: wptexturize.patch

File wptexturize.patch, 1014 bytes (added by dllh, 11 years ago)
  • wp-includes/formatting.php

     
    210210
    211211        $textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
    212212
     213        $do_image_sizer_check = false;
     214                       
     215        if ( 1 === preg_match( '/(?<=\d)x-?\d/', $text ) ) {
     216                $do_image_sizer_check = true;
     217        }
     218
    213219        foreach ( $textarr as &$curl ) {
    214220                // Only call _wptexturize_pushpop_element if $curl is a delimeter.
    215221                $first = $curl[0];
     
    238244                        $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    239245
    240246                        // 9x9 (times), but never 0x9999
    241                         if ( 1 === preg_match( '/(?<=\d)x-?\d/', $text ) ) {
     247                        if ( $do_image_sizer_check ) {
    242248                                // Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
    243249                                $curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(-?\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
    244250                        }