From 05fef4cd88030e04f233b332a8e32057fb57d5e4 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Fri, 15 Oct 2010 19:21:59 -0400 Subject: Backported [nosmilies] from Layout 8 --- includes/smilies.php | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'includes/smilies.php') diff --git a/includes/smilies.php b/includes/smilies.php index f9ffde8..e189ad6 100755 --- a/includes/smilies.php +++ b/includes/smilies.php @@ -37,7 +37,7 @@ class Smilies $this->init = true; } - function parseSmilies($text) + function parseSmiliesFirstPass($text) { if (!$this->init) { @@ -46,14 +46,29 @@ class Smilies foreach ($this->smilies as $name => $value) { - $text = str_replace($name, '' . $name . '', $text); + $text = str_replace($name, '[emoticon]' . $name . '[/emoticon]', $text); + } + + return $text; + } + + function parseSmiliesSecondPass($text) + { + if (!$this->init) + { + $this->init(); + } + + foreach ($this->smilies as $name => $value) + { + $text = str_replace('[emoticon]' . $name . '[/emoticon]', '' . $name . '', $text); } return $text; } } -function parseSmilies($text) +function parseSmiliesFirstPass($text) { global $smilies; if (!isset($smilies)) @@ -61,7 +76,19 @@ function parseSmilies($text) $smilies = new Smilies(); } - return $smilies->parseSmilies($text); + return $smilies->parseSmiliesFirstPass($text); } +function parseSmiliesSecondPass($text) +{ + global $smilies; + if (!isset($smilies)) + { + $smilies = new Smilies(); + } + + return $smilies->parseSmiliesSecondPass($text); +} + + ?> -- cgit 1.4.1