WordPress.org

Make WordPress Core

Ticket #15556: 15556.3.patch

File 15556.3.patch, 2.4 KB (added by SergeyBiryukov, 3 years ago)
  • wp-includes/formatting.php

     
    2828 */ 
    2929function wptexturize($text) { 
    3030        global $wp_cockneyreplace; 
    31         static $opening_quote, $closing_quote, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements; 
     31        static $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 
    3333        // No need to set up these static variables more than once 
    3434        if ( empty( $opening_quote ) ) { 
     
    3636                $opening_quote = _x('“', 'opening curly quote'); 
    3737                /* translators: closing curly quote */ 
    3838                $closing_quote = _x('”', 'closing curly quote'); 
     39                /* translators: en dash */ 
     40                $en_dash = _x('–', 'en dash'); 
     41                /* translators: em dash */ 
     42                $em_dash = _x('—', 'em dash'); 
    3943 
    4044                $default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt'); 
    4145                $default_no_texturize_shortcodes = array('code'); 
     
    4953                        $cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause"); 
    5054                } 
    5155 
    52                 $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney); 
    53                 $static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace); 
     56                $static_characters = array_merge( array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney ); 
     57                $static_replacements = array_merge( array($em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace ); 
    5458 
    5559                $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/'); 
    5660                $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');