Changeset 16409
- Timestamp:
- 11/16/2010 10:18:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r16378 r16409 57 57 $static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace); 58 58 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(?:’|\')?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'); 61 78 62 $static_setup = true; 79 63 } … … 86 70 $no_texturize_tags_stack = array(); 87 71 $no_texturize_shortcodes_stack = array(); 88 89 $single_quote_state = '‘';90 $double_quote_state = $opening_quote;91 72 92 73 for ( $i = 0; $i < $stop; $i++ ) { … … 100 81 // regular expressions 101 82 $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); 102 // quotes that span multiple tags & shortcodes103 while (($pos = strpos($curl, '\'')) !== FALSE) {104 $curl = preg_replace('/\'/', $single_quote_state, $curl);105 $single_quote_state = (($single_quote_state == '‘') ? '’' : '‘');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 }111 83 } elseif (!empty($curl)) { 112 84 /*
Note: See TracChangeset
for help on using the changeset viewer.