From 6b9922aa9e15b70a2b58a6bb6d2ec7ff09046d00 Mon Sep 17 00:00:00 2001 From: alec Date: Fri, 10 Dec 2010 12:49:24 +0000 Subject: - Support more emoticons (#1486885) git-svn-id: https://svn.roundcube.net/trunk@4337 208e9e7b-5314-0410-a742-e7e81cd9613c --- plugins/emoticons/emoticons.php | 63 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 33 deletions(-) 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