Smilies optimization from Nazgul. fixes #3201 #3216

git-svn-id: https://develop.svn.wordpress.org/trunk@4360 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-10-07 19:16:24 +00:00
parent fddb91d85c
commit 28a0e3786c
2 changed files with 2 additions and 9 deletions

View File

@ -618,14 +618,7 @@ function convert_smilies($text) {
if (get_option('use_smilies')) {
// HTML loop taken from texturize function, could possible be consolidated
$textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
$stop = count($textarr);// loop stuff
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
$content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
}
$output .= $content;
}
$output = implode('', preg_replace($wp_smiliessearch, $wp_smiliesreplace, $textarr));
} else {
// return default text.
$output = $text;

View File

@ -87,7 +87,7 @@ if (!isset($wpsmiliestrans)) {
// generates smilies' search & replace arrays
foreach($wpsmiliestrans as $smiley => $img) {
$wp_smiliessearch[] = '/(\s|^)?'.preg_quote($smiley, '/').'(\b|\s)/';
$wp_smiliessearch[] = '/(\s|^|[^<])?'.preg_quote($smiley, '/').'(\b|\s|$)/';
$smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES);
$wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
}