From c895d2f41b0737f8a2799d36beca087e6b642f05 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 17 Dec 2008 21:00:03 -0500 Subject: Added an emoticon parsing system I decided that, because I use the :) emoticon so often, I might as well replace it with an actual image. I've added a Smiley parsing system to complement the BBCode parsing one. --- includes/bbcode.php | 2 +- includes/comments.php | 2 +- includes/functions.php | 2 +- includes/parsers.php | 36 ++++++++++++++++++++++++++++ includes/smilies.php | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 3 deletions(-) create mode 100755 includes/parsers.php create mode 100755 includes/smilies.php (limited to 'includes') diff --git a/includes/bbcode.php b/includes/bbcode.php index 42ff8d0..3cae84c 100755 --- a/includes/bbcode.php +++ b/includes/bbcode.php @@ -50,7 +50,7 @@ class BBCode $this->bbcodes['bquote'] = '

{CONTENT}
Anonymous
'; $this->bbcodes2['bquote'] = '

{CONTENT}
{PARAM}
'; $this->bbcodes2['abbr'] = '{CONTENT}'; - $this->bbcodes['hidden'] = '
{CONTENT}
'; + $this->bbcodes['hidden'] = '{CONTENT}'; $this->init = true; } diff --git a/includes/comments.php b/includes/comments.php index bf73318..15e9fc8 100755 --- a/includes/comments.php +++ b/includes/comments.php @@ -71,7 +71,7 @@ while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) 'USERNAME' => (($website != '') ? '' . $username . '' : $username), 'DATE' => date("F dS Y \a\\t g:i:s a",strtotime($getcomments3[$i]['posttime'])), 'ID' => $getcomments3[$i]['id'], - 'TEXT' => parseBBCode($getcomments3[$i]['comment']))); + 'TEXT' => parseText($getcomments3[$i]['comment']))); } $i++; } diff --git a/includes/functions.php b/includes/functions.php index 1caef59..881bfd1 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -124,7 +124,7 @@ function postBlogPost($title,$author,$tags,$content) $upconf = "UPDATE config SET value = \"" . date('md') . "\" WHERE name = \"lastUpdate\""; $upconf2 = mysql_query($upconf); - preg_match_all('|]*href="([^"]+)"|i', parseBBCode($content), $matches); + preg_match_all('|]*href="([^"]+)"|i', parseText($content), $matches); foreach ($matches[1] as $link) { diff --git a/includes/parsers.php b/includes/parsers.php new file mode 100755 index 0000000..5e984c2 --- /dev/null +++ b/includes/parsers.php @@ -0,0 +1,36 @@ + diff --git a/includes/smilies.php b/includes/smilies.php new file mode 100755 index 0000000..843af05 --- /dev/null +++ b/includes/smilies.php @@ -0,0 +1,64 @@ +smilies[':)'] = '001_smile.gif'; + + $this->init = true; + } + + function parseSmilies($text) + { + if (!$this->init) + { + $this->init(); + } + + foreach ($this->smilies as $name => $value) + { + $text = str_replace($name, '' . $name . '', $text); + } + + return $text; + } +} + +function parseSmilies($text) +{ + global $smilies; + if (!isset($smilies)) + { + $smilies = new Smilies(); + } + + return $smilies->parseSmilies($text); +} + +?> -- cgit 1.4.1