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; |
| 31 | static $opening_quote, $closing_quote, $opening_single_quote, $closing_single_quote, $en_dash, $em_dash, |
| 32 | $apos, $prime, $double_prime, $default_no_texturize_tags, $default_no_texturize_shortcodes, |
| 33 | $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements; |
35 | | /* translators: opening curly quote */ |
36 | | $opening_quote = _x('“', 'opening curly quote'); |
37 | | /* translators: closing curly quote */ |
38 | | $closing_quote = _x('”', 'closing curly quote'); |
| 37 | /* translators: opening curly double quote */ |
| 38 | $opening_quote = _x( '“', 'opening curly double quote' ); |
| 39 | /* translators: closing curly double quote */ |
| 40 | $closing_quote = _x( '”', 'closing curly double quote' ); |
| 41 | |
| 42 | /* translators: apostrophe, for example in 'cause or can't */ |
| 43 | $apos = _x( '’', 'apostrophe' ); |
| 44 | |
| 45 | /* translators: prime, for example in 9' (nine feet) */ |
| 46 | $prime = _x( '′', 'prime' ); |
| 47 | /* translators: double prime, for example in 9" (nine inches) */ |
| 48 | $double_prime = _x( '″', 'double prime' ); |
| 49 | |
| 50 | /* translators: opening curly single quote */ |
| 51 | $opening_single_quote = _x( '‘', 'opening curly single quote' ); |
| 52 | /* translators: closing curly single quote */ |
| 53 | $closing_single_quote = _x( '’', 'closing curly single quote' ); |
| 54 | |
| 67 | } elseif ( "'" != $apos ) { // Only bother if we're doing a replacement. |
| 68 | $cockney = array( "'tain't", "'twere", "'twas", "'tis", "'twill", "'til", "'bout", "'nuff", "'round", "'cause" ); |
| 69 | $cockneyreplace = array( $apos . "tain" . $apos . "t", $apos . "twere", $apos . "twas", $apos . "tis", $apos . "twill", $apos . "til", $apos . "bout", $apos . "nuff", $apos . "round", $apos . "cause" ); |
52 | | $cockney = array("'tain't","'twere","'twas","'tis","'twill","'til","'bout","'nuff","'round","'cause"); |
53 | | $cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause"); |
| 71 | $cockney = $cockneyreplace = array(); |
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 ); |
| 74 | $static_characters = array_merge( array( '---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)' ), $cockney ); |
| 75 | $static_replacements = array_merge( array( $em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--', '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace ); |
59 | | $dynamic_characters = array('/\'(\d\d(?:’|\')?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('’$1','’$1', '$1‘', '$1″', '$1′', '$1’$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '’$1', '$1×$2'); |
| 77 | $dynamic = array(); |
| 78 | if ( "'" != $apos ) { |
| 79 | $dynamic[ '/\'(\d\d(?:’|\')?s)/' ] = $apos . '$1'; // '99's |
| 80 | $dynamic[ '/\'(\d)/' ] = $apos . '$1'; // '99 |
| 81 | } |
| 82 | if ( "'" != $opening_single_quote ) |
| 83 | $dynamic[ '/(\s|\A|[([{<]|")\'/' ] = '$1' . $opening_single_quote; // opening single quote, even after (, {, <, [ |
| 84 | if ( '"' != $double_prime ) |
| 85 | $dynamic[ '/(\d)"/' ] = '$1' . $double_prime; // 9" (double prime) |
| 86 | if ( "'" != $prime ) |
| 87 | $dynamic[ '/(\d)\'/' ] = '$1' . $prime; // 9' (prime) |
| 88 | if ( "'" != $apos ) |
| 89 | $dynamic[ '/(\S)\'([^\'\s])/' ] = '$1' . $apos . '$2'; |
| 90 | if ( '"' != $opening_quote ) |
| 91 | $dynamic[ '/(\s|\A|[([{<])"(?!\s)/' ] = '$1' . $opening_quote . '$2'; // opening double quote, even after (, {, <, [ |
| 92 | if ( '"' != $closing_quote ) |
| 93 | $dynamic[ '/"(\s|\S|\Z)/' ] = $closing_quote . '$1'; // closing double quote |
| 94 | if ( "'" != $closing_single_quote ) |
| 95 | $dynamic[ '/\'([\s.]|\Z)/' ] = $closing_single_quote . '$2'; // closing single quote |
| 96 | |
| 97 | $dynamic[ '/\b(\d+)x(\d+)\b/' ] = '$1×$2'; // 9x9 (times) |
| 98 | |
| 99 | $dynamic_characters = array_keys( $dynamic ); |
| 100 | $dynamic_replacements = array_values( $dynamic ); |