Ticket #22692: miqro-22692.5.patch
| File miqro-22692.5.patch, 4.8 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 ); … … 1865 1882 */ 1866 1883 $src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() ); 1867 1884 1868 return sprintf( ' <img src="%s" alt="%s" class="wp-smiley" />', esc_url( $src_url ), esc_attr( $smiley ) );1885 return sprintf( '<img src="%s" alt="%s" class="wp-smiley" />', esc_url( $src_url ), esc_attr( $smiley ) ); 1869 1886 } 1870 1887 1871 1888 /** … … 3781 3798 3782 3799 return false; 3783 3800 } 3801 3802 /** 3803 * Returns the regexp for common whitespace characters. 3804 * 3805 * By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp. 3806 * This is designed to replace the PCRE \s sequence. In ticket #22692, that 3807 * sequence was found to be unreliable due to random inclusion of the A0 byte. 3808 * 3809 * @since 3.9.0 3810 * 3811 * @return string The spaces regexp. 3812 */ 3813 function wp_spaces_regexp() { 3814 static $spaces; 3815 3816 if (empty($spaces)) { 3817 $spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ' ); 3818 } 3819 3820 return $spaces; 3821 } -
wp-includes/functions.php
2559 2559 */ 2560 2560 krsort($wpsmiliestrans); 2561 2561 2562 $ wp_smiliessearch = '/((?:\s|^)';2562 $spaces = wp_spaces_regexp(); 2563 2563 2564 // Begin first "subpattern" 2565 $wp_smiliessearch = '/(?<=' . $spaces . '|^)'; 2566 2564 2567 $subchar = ''; 2565 2568 foreach ( (array) $wpsmiliestrans as $smiley => $img ) { 2566 2569 $firstchar = substr($smiley, 0, 1); … … 2569 2572 // new subpattern? 2570 2573 if ($firstchar != $subchar) { 2571 2574 if ($subchar != '') { 2572 $wp_smiliessearch .= ')(?=\s|$))|((?:\s|^)'; ; 2575 $wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern" 2576 $wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern" 2573 2577 } 2574 2578 $subchar = $firstchar; 2575 2579 $wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:'; … … 2579 2583 $wp_smiliessearch .= preg_quote($rest, '/'); 2580 2584 } 2581 2585 2582 $wp_smiliessearch .= ')(?= \s|$))/m';2586 $wp_smiliessearch .= ')(?=' . $spaces . '|$)/m'; 2583 2587 2584 2588 } 2585 2589
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)