Make WordPress Core

Changeset 16409


Ignore:
Timestamp:
11/16/2010 10:18:48 PM (13 years ago)
Author:
nacin
Message:

Revert changes to wptexturize() until test cases pass. Reverts [16280], [16378]. see #4539 and #15241.

File:
1 edited

Legend:

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

    r16378 r16409  
    5757        $static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace);
    5858
    59         $dynamic_map = array(
    60             '/\'(\d)/' => '’$1', // '99
    61            
    62             '/\'([^\']*)\'([^\']*)\'/' => '‘$1’$2’', // 'test's'
    63            
    64             '/(\w)\'(\w)/' => '$1’$2', // test's
    65 
    66             '/\'([^\']*)\'/' => '‘$1’', // 'asd'
    67             '/"([^"]*)"/' => $opening_quote . '$1' . $closing_quote, // "qwe"
    68            
    69             '/(\d)"/' => '$1″', // 9" -> 9″
    70             '/(\d)\'/' => '$1′', // 9' -> 9′
    71            
    72             '/\b(\d+)x(\d+)\b/' => '$1×$2' // 10. 97x34 => 97×34
    73         );
    74        
    75         $dynamic_characters = array_keys($dynamic_map);
    76         $dynamic_replacements = array_values($dynamic_map);
    77        
     59        $dynamic_characters = array('/\'(\d\d(?:&#8217;|\')?s)/', '/\'(\d)/', '/(\s|\A|[([{<]|")\'/', '/(\d)"/', '/(\d)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/');
     60        $dynamic_replacements = array('&#8217;$1','&#8217;$1', '$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '&#8217;$1', '$1&#215;$2');
     61
    7862        $static_setup = true;
    7963    }
     
    8670    $no_texturize_tags_stack = array();
    8771    $no_texturize_shortcodes_stack = array();
    88    
    89     $single_quote_state = '&#8216;';
    90     $double_quote_state = $opening_quote;
    9172
    9273    for ( $i = 0; $i < $stop; $i++ ) {
     
    10081            // regular expressions
    10182            $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    102             // quotes that span multiple tags & shortcodes
    103             while (($pos = strpos($curl, '\'')) !== FALSE) {
    104                 $curl = preg_replace('/\'/', $single_quote_state, $curl);
    105                 $single_quote_state = (($single_quote_state == '&#8216;') ? '&#8217;' : '&#8216;');
    106             }
    107             while (($pos = strpos($curl, '"')) !== FALSE) {
    108                 $curl = preg_replace('/"/', $double_quote_state, $curl);
    109                 $double_quote_state = (($double_quote_state == $opening_quote) ? $closing_quote : $opening_quote);
    110             }
    11183        } elseif (!empty($curl)) {
    11284            /*
Note: See TracChangeset for help on using the changeset viewer.