Make WordPress Core

Changeset 19187


Ignore:
Timestamp:
11/06/2011 06:31:54 PM (14 years ago)
Author:
nacin
Message:

Allow 8212/8211 (em dash and en dash) to be translated in wptexturize(). props SergeyBiryukov, fixes #15556.

File:
1 edited

Legend:

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

    r19125 r19187  
    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
     
    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');
     
    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/');
Note: See TracChangeset for help on using the changeset viewer.