From db1a87cd6c506f2afbd1a37c64cb56ae11120b49 Mon Sep 17 00:00:00 2001 From: thomascube Date: Fri, 17 Dec 2010 15:07:04 +0000 Subject: Update branch for 0.5-rc release --- plugins/emoticons/emoticons.php | 63 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 33 deletions(-) (limited to 'plugins/emoticons/emoticons.php') diff --git a/plugins/emoticons/emoticons.php b/plugins/emoticons/emoticons.php index e929c9f9d..95f5ecf39 100644 --- a/plugins/emoticons/emoticons.php +++ b/plugins/emoticons/emoticons.php @@ -5,7 +5,7 @@ * * Sample plugin to replace emoticons in plain text message body with real icons * - * @version 1.2.0 + * @version 1.3 * @author Thomas Bruederli * @author Aleksander Machniak * @website http://roundcube.net @@ -35,38 +35,30 @@ class emoticons extends rcube_plugin // map of emoticon replacements $map = array( - '/:\)/' => html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-smile.gif', - 'title' => ':)' - )), - '/:-\)/' => html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-smile.gif', - 'title' => ':-)' - )), - '/(? html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-laughing.gif', - 'title' => ':D' - )), - '/:-D/' => html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-laughing.gif', - 'title' => ':-D' - )), - '/:\(/' => html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-frown.gif', - 'title' => ':(' - )), - '/:-\(/' => html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-frown.gif', - 'title' => ':-(' - )), - '/'.$entity.';\)/' => html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-wink.gif', - 'title' => ';)' - )), - '/'.$entity.';-\)/' => html::img(array( - 'src' => './program/js/tiny_mce/plugins/emotions/img/smiley-wink.gif', - 'title' => ';-)' - )), + '/:\)/' => $this->img_tag('smiley-smile.gif', ':)' ), + '/:-\)/' => $this->img_tag('smiley-smile.gif', ':-)' ), + '/(? $this->img_tag('smiley-laughing.gif', ':D' ), + '/:-D/' => $this->img_tag('smiley-laughing.gif', ':-D' ), + '/:\(/' => $this->img_tag('smiley-frown.gif', ':(' ), + '/:-\(/' => $this->img_tag('smiley-frown.gif', ':-(' ), + '/'.$entity.';\)/' => $this->img_tag('smiley-wink.gif', ';)' ), + '/'.$entity.';-\)/' => $this->img_tag('smiley-wink.gif', ';-)' ), + '/8\)/' => $this->img_tag('smiley-cool.gif', '8)' ), + '/8-\)/' => $this->img_tag('smiley-cool.gif', '8-)' ), + '/(? $this->img_tag('smiley-surprised.gif', ':O' ), + '/(? $this->img_tag('smiley-surprised.gif', ':-O' ), + '/(? $this->img_tag('smiley-tongue-out.gif', ':P' ), + '/(? $this->img_tag('smiley-tongue-out.gif', ':-P' ), + '/(? $this->img_tag('smiley-yell.gif', ':@' ), + '/(? $this->img_tag('smiley-yell.gif', ':-@' ), + '/O:\)/i' => $this->img_tag('smiley-innocent.gif', 'O:)' ), + '/O:-\)/i' => $this->img_tag('smiley-innocent.gif', 'O:-)' ), + '/(? $this->img_tag('smiley-embarassed.gif', ':$' ), + '/(? $this->img_tag('smiley-embarassed.gif', ':-$' ), + '/(? $this->img_tag('smiley-kiss.gif', ':*' ), + '/(? $this->img_tag('smiley-kiss.gif', ':-*' ), + '/(? $this->img_tag('smiley-undecided.gif', ':S' ), + '/(? $this->img_tag('smiley-undecided.gif', ':-S' ), ); if ($args['type'] == 'plain') { @@ -77,4 +69,9 @@ class emoticons extends rcube_plugin return $args; } + private function img_tag($ico, $title) + { + $path = './program/js/tiny_mce/plugins/emotions/img/'; + return html::img(array('src' => $path.$ico, 'title' => $title)); + } } -- cgit v1.2.3