Smiley parsing fixes from Nazgul. fixes #2444 #1279

git-svn-id: https://develop.svn.wordpress.org/trunk@4283 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-10-04 02:21:27 +00:00
parent 520e4974cc
commit 076dd45bcf
2 changed files with 25 additions and 25 deletions

View File

@ -613,7 +613,7 @@ function convert_smilies($text) {
for ($i = 0; $i < $stop; $i++) {
$content = $textarr[$i];
if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag
$content = str_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
$content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
}
$output .= $content;
}

View File

@ -43,7 +43,7 @@ if (!isset($wpsmiliestrans)) {
':arrow:' => 'icon_arrow.gif',
':shock:' => 'icon_eek.gif',
':smile:' => 'icon_smile.gif',
' :???:' => 'icon_confused.gif',
':???:' => 'icon_confused.gif',
':cool:' => 'icon_cool.gif',
':evil:' => 'icon_evil.gif',
':grin:' => 'icon_biggrin.gif',
@ -57,28 +57,28 @@ if (!isset($wpsmiliestrans)) {
':lol:' => 'icon_lol.gif',
':mad:' => 'icon_mad.gif',
':sad:' => 'icon_sad.gif',
' 8-)' => 'icon_cool.gif',
' 8-O' => 'icon_eek.gif',
' :-(' => 'icon_sad.gif',
' :-)' => 'icon_smile.gif',
' :-?' => 'icon_confused.gif',
' :-D' => 'icon_biggrin.gif',
' :-P' => 'icon_razz.gif',
' :-o' => 'icon_surprised.gif',
' :-x' => 'icon_mad.gif',
' :-|' => 'icon_neutral.gif',
' ;-)' => 'icon_wink.gif',
' 8)' => 'icon_cool.gif',
' 8O' => 'icon_eek.gif',
' :(' => 'icon_sad.gif',
' :)' => 'icon_smile.gif',
' :?' => 'icon_confused.gif',
' :D' => 'icon_biggrin.gif',
' :P' => 'icon_razz.gif',
' :o' => 'icon_surprised.gif',
' :x' => 'icon_mad.gif',
' :|' => 'icon_neutral.gif',
' ;)' => 'icon_wink.gif',
'8-)' => 'icon_cool.gif',
'8-O' => 'icon_eek.gif',
':-(' => 'icon_sad.gif',
':-)' => 'icon_smile.gif',
':-?' => 'icon_confused.gif',
':-D' => 'icon_biggrin.gif',
':-P' => 'icon_razz.gif',
':-o' => 'icon_surprised.gif',
':-x' => 'icon_mad.gif',
':-|' => 'icon_neutral.gif',
';-)' => 'icon_wink.gif',
'8)' => 'icon_cool.gif',
'8O' => 'icon_eek.gif',
':(' => 'icon_sad.gif',
':)' => 'icon_smile.gif',
':?' => 'icon_confused.gif',
':D' => 'icon_biggrin.gif',
':P' => 'icon_razz.gif',
':o' => 'icon_surprised.gif',
':x' => 'icon_mad.gif',
':|' => 'icon_neutral.gif',
';)' => 'icon_wink.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
);
@ -87,7 +87,7 @@ if (!isset($wpsmiliestrans)) {
// generates smilies' search & replace arrays
foreach($wpsmiliestrans as $smiley => $img) {
$wp_smiliessearch[] = $smiley;
$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' /> ";
}