Ticket #3201: 3201.diff

File 3201.diff, 1.5 KB (added by Nazgul, 6 years ago)
  • wp-includes/formatting.php

     
    609609        if (get_option('use_smilies')) { 
    610610                // HTML loop taken from texturize function, could possible be consolidated 
    611611                $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between 
    612                 $stop = count($textarr);// loop stuff 
    613                 for ($i = 0; $i < $stop; $i++) { 
    614                         $content = $textarr[$i]; 
    615                         if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag 
    616                                 $content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content); 
    617                         } 
    618                         $output .= $content; 
    619                 } 
     612                $output = implode('', preg_replace($wp_smiliessearch, $wp_smiliesreplace, $textarr)); 
    620613        } else { 
    621614                // return default text. 
    622615                $output = $text; 
  • wp-includes/vars.php

     
    8787 
    8888// generates smilies' search & replace arrays 
    8989foreach($wpsmiliestrans as $smiley => $img) { 
    90         $wp_smiliessearch[] = '/(\s|^)?'.preg_quote($smiley, '/').'(\b|\s)/'; 
     90        $wp_smiliessearch[] = '/(\s|^|[^<])?'.preg_quote($smiley, '/').'(\b|\s|$)/'; 
    9191        $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES); 
    9292        $wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> "; 
    9393}