Changeset 16280 for trunk/wp-includes/formatting.php
- Timestamp:
- 11/10/2010 07:23:57 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r16279 r16280 57 57 $static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace); 58 58 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 59 $dynamic_map = array( 60 '/\'(\d)/' => '’$1', // '99 61 62 '/\'([^\']*)\'([^\']*)\'/' => '‘$1’$2’', // 'test's' 63 64 '/\'([^\']*)\'/' => '‘$1’', // 'asd' 65 '/"([^"]*)"/' => $opening_quote . '$1' . $closing_quote, // "qwe" 66 67 '/(\w)\'(\w)/' => '$1’$2', // test's 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 62 78 $static_setup = true; 63 79 } … … 70 86 $no_texturize_tags_stack = array(); 71 87 $no_texturize_shortcodes_stack = array(); 88 89 $single_quote_state = '‘'; 90 $double_quote_state = $opening_quote; 72 91 73 92 for ( $i = 0; $i < $stop; $i++ ) { … … 81 100 // regular expressions 82 101 $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); 102 // quotes that span multiple tags & shortcodes 103 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 } 83 111 } elseif (!empty($curl)) { 84 112 /*
Note: See TracChangeset
for help on using the changeset viewer.