WordPress.org

Make WordPress Core

Ticket #15556: 15556.2.patch

File 15556.2.patch, 2.2 KB (added by SergeyBiryukov, 5 years ago)
  • wp-includes/formatting.php

     
    2828 */ 
    2929function wptexturize($text) { 
    3030        global $wp_cockneyreplace; 
    31         static $static_setup = false, $opening_quote, $closing_quote, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements; 
     31        static $static_setup = false, $opening_quote, $closing_quote, $en_dash, $em_dash, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements; 
    3232        $output = ''; 
    3333        $curl = ''; 
    3434        $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); 
     
    4040                $opening_quote = _x('&#8220;', 'opening curly quote'); 
    4141                /* translators: closing curly quote */ 
    4242                $closing_quote = _x('&#8221;', 'closing curly quote'); 
     43                /* translators: en dash */ 
     44                $en_dash = _x('&#8211;', 'en dash'); 
     45                /* translators: em dash */ 
     46                $em_dash = _x('&#8212;', 'em dash'); 
    4347 
    4448                $default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt'); 
    4549                $default_no_texturize_shortcodes = array('code'); 
     
    5458                } 
    5559 
    5660                $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn&#8211;', '...', '``', '\'\'', ' (tm)'), $cockney); 
    57                 $static_replacements = array_merge(array('&#8212;', ' &#8212; ', '&#8211;', ' &#8211; ', 'xn--', '&#8230;', $opening_quote, $closing_quote, ' &#8482;'), $cockneyreplace); 
     61                $static_replacements = array_merge(array($em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--', '&#8230;', $opening_quote, $closing_quote, ' &#8482;'), $cockneyreplace); 
    5862 
    5963                $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/'); 
    6064                $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');