`smilies_init()`, treat ` ` like whitespace when converting smilies.
Adds unit tests. Props miqrogroove. Fixes #27587. Built from https://develop.svn.wordpress.org/trunk@28717 git-svn-id: http://core.svn.wordpress.org/trunk@28531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
66d2144e9a
commit
6cb51c9ceb
|
@ -1912,7 +1912,7 @@ function translate_smiley( $matches ) {
|
|||
*/
|
||||
$src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
|
||||
|
||||
return sprintf( ' <img src="%s" alt="%s" class="wp-smiley" /> ', esc_url( $src_url ), esc_attr( $smiley ) );
|
||||
return sprintf( '<img src="%s" alt="%s" class="wp-smiley" />', esc_url( $src_url ), esc_attr( $smiley ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2713,7 +2713,10 @@ function smilies_init() {
|
|||
*/
|
||||
krsort($wpsmiliestrans);
|
||||
|
||||
$wp_smiliessearch = '/((?:\s|^)';
|
||||
$spaces = wp_spaces_regexp();
|
||||
|
||||
// Begin first "subpattern"
|
||||
$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
|
||||
|
||||
$subchar = '';
|
||||
foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
|
||||
|
@ -2723,7 +2726,8 @@ function smilies_init() {
|
|||
// new subpattern?
|
||||
if ($firstchar != $subchar) {
|
||||
if ($subchar != '') {
|
||||
$wp_smiliessearch .= ')(?=\s|$))|((?:\s|^)'; ;
|
||||
$wp_smiliessearch .= ')(?=' . $spaces . '|$)'; // End previous "subpattern"
|
||||
$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern"
|
||||
}
|
||||
$subchar = $firstchar;
|
||||
$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
|
||||
|
@ -2733,7 +2737,7 @@ function smilies_init() {
|
|||
$wp_smiliessearch .= preg_quote($rest, '/');
|
||||
}
|
||||
|
||||
$wp_smiliessearch .= ')(?=\s|$))/m';
|
||||
$wp_smiliessearch .= ')(?=' . $spaces . '|$)/m';
|
||||
|
||||
}
|
||||
|
||||
|
@ -4419,4 +4423,4 @@ function wp_validate_boolean( $var ) {
|
|||
}
|
||||
|
||||
return (bool) $var;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue