Ticket #22692: miqro-22692.6.patch
| File miqro-22692.6.patch, 5.6 KB (added by , 13 years ago) |
|---|
-
wp-includes/formatting.php
73 73 $static_characters = array_merge( array( '---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)' ), $cockney ); 74 74 $static_replacements = array_merge( array( $em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--', '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace ); 75 75 76 // Pattern-based replacements of characters. 76 77 $dynamic = array(); 77 if ( "'" != $apos ) { 78 $dynamic[ '/\'(\d\d(?:’|\')?s)/' ] = $apos . '$1'; // '99's 79 $dynamic[ '/\'(\d)/' ] = $apos . '$1'; // '99 80 } 78 $spaces = wp_spaces_regexp(); 79 80 // '99s (apostrophe) 81 if ( "'" != $apos ) 82 $dynamic[ '/\'(?=\d)/' ] = $apos; 83 84 // Single quote at start, or preceded by (, {, <, [, ", or spaces. 81 85 if ( "'" != $opening_single_quote ) 82 $dynamic[ '/(\s|\A|[([{<]|")\'/' ] = '$1' . $opening_single_quote; // opening single quote, even after (, {, <, [ 86 $dynamic[ '/(?<=\A|[([{<"]|' . $spaces . ')\'/' ] = $opening_single_quote; 87 88 // 9" (double prime) 83 89 if ( '"' != $double_prime ) 84 $dynamic[ '/(\d)"/' ] = '$1' . $double_prime; // 9" (double prime) 90 $dynamic[ '/(?<=\d)"/' ] = $double_prime; 91 92 // 9' (prime) 85 93 if ( "'" != $prime ) 86 $dynamic[ '/(\d)\'/' ] = '$1' . $prime; // 9' (prime) 94 $dynamic[ '/(?<=\d)\'/' ] = $prime; 95 96 // Apostrophe in a word. No spaces or double primes. 87 97 if ( "'" != $apos ) 88 $dynamic[ '/(\S)\'([^\'\s])/' ] = '$1' . $apos . '$2'; // apostrophe in a word 98 $dynamic[ '/(?<!' . $spaces . ')\'(?!\'|' . $spaces . ')/' ] = $apos; 99 100 // Double quote at start, or preceded by (, {, <, [, or spaces, and not followed by spaces. 89 101 if ( '"' != $opening_quote ) 90 $dynamic[ '/(\s|\A|[([{<])"(?!\s)/' ] = '$1' . $opening_quote . '$2'; // opening double quote, even after (, {, <, [ 102 $dynamic[ '/(?<=\A|[([{<]|' . $spaces . ')"(?!' . $spaces . ')/' ] = $opening_quote; 103 104 // Any remaining double quotes. 91 105 if ( '"' != $closing_quote ) 92 $dynamic[ '/"(\s|\S|\Z)/' ] = $closing_quote . '$1'; // closing double quote 106 $dynamic[ '/"/' ] = $closing_quote; 107 108 // Single quotes followed by spaces. 93 109 if ( "'" != $closing_single_quote ) 94 $dynamic[ '/\'( [\s.]|\Z)/' ] = $closing_single_quote . '$1'; // closing single quote110 $dynamic[ '/\'(?=\Z|' . $spaces . ')/' ] = $closing_single_quote; 95 111 96 $dynamic[ '/\b(\d+)x(\d+)\b/' ] = '$1×$2'; // 9x9 (times) 112 // 9x9 (times) 113 $dynamic[ '/\b(\d+)x(\d+)\b/' ] = '$1×$2'; 97 114 98 115 $dynamic_characters = array_keys( $dynamic ); 99 116 $dynamic_replacements = array_values( $dynamic ); … … 318 335 } 319 336 320 337 $tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) ); 338 $spaces = wp_spaces_regexp(); 321 339 322 340 $pattern = 323 341 '/' 324 342 . '<p>' // Opening paragraph 325 . ' \\s*+'// Optional leading whitespace343 . '(?:' . $spaces . ')*+' // Optional leading whitespace 326 344 . '(' // 1: The shortcode 327 345 . '\\[' // Opening bracket 328 346 . "($tagregexp)" // 2: Shortcode name … … 347 365 . ')?' 348 366 . ')' 349 367 . ')' 350 . ' \\s*+'// optional trailing whitespace368 . '(?:' . $spaces . ')*+' // optional trailing whitespace 351 369 . '<\\/p>' // closing paragraph 352 370 . '/s'; 353 371 … … 1865 1883 */ 1866 1884 $src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() ); 1867 1885 1868 return sprintf( ' <img src="%s" alt="%s" class="wp-smiley" />', esc_url( $src_url ), esc_attr( $smiley ) );1886 return sprintf( '<img src="%s" alt="%s" class="wp-smiley" />', esc_url( $src_url ), esc_attr( $smiley ) ); 1869 1887 } 1870 1888 1871 1889 /** … … 3781 3799 3782 3800 return false; 3783 3801 } 3802 3803 /** 3804 * Returns the regexp for common whitespace characters. 3805 * 3806 * By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp. 3807 * This is designed to replace the PCRE \s sequence. In ticket #22692, that 3808 * sequence was found to be unreliable due to random inclusion of the A0 byte. 3809 * 3810 * @since 3.9.0 3811 * 3812 * @return string The spaces regexp. 3813 */ 3814 function wp_spaces_regexp() { 3815 static $spaces; 3816 3817 if (empty($spaces)) { 3818 $spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ' ); 3819 } 3820 3821 return $spaces; 3822 } -
wp-includes/functions.php
2560 2560 */ 2561 2561 krsort($wpsmiliestrans); 2562 2562 2563 $ wp_smiliessearch = '/((?:\s|^)';2563 $spaces = wp_spaces_regexp(); 2564 2564 2565 // Begin first "subpattern" 2566 $wp_smiliessearch = '/(?<=' . $spaces . '|^)'; 2567 2565 2568 $subchar = ''; 2566 2569 foreach ( (array) $wpsmiliestrans as $smiley => $img ) { 2567 2570 $firstchar = substr($smiley, 0, 1); … … 2570 2573 // new subpattern? 2571 2574 if ($firstchar != $subchar) { 2572 2575 if ($subchar != '') { 2573 $wp_smiliessearch .= ')(?=\s|$))|((?:\s|^)'; ; 2576 $wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern" 2577 $wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern" 2574 2578 } 2575 2579 $subchar = $firstchar; 2576 2580 $wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:'; … … 2580 2584 $wp_smiliessearch .= preg_quote($rest, '/'); 2581 2585 } 2582 2586 2583 $wp_smiliessearch .= ')(?= \s|$))/m';2587 $wp_smiliessearch .= ')(?=' . $spaces . '|$)/m'; 2584 2588 2585 2589 } 2586 2590
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)