]> git.donarmstrong.com Git - roundcube.git/blob - plugins/emoticons/emoticons.php
Merge commit 'upstream/0.3' into unstable-import
[roundcube.git] / plugins / emoticons / emoticons.php
1 <?php
2
3 /**
4  * Display Emoticons
5  *
6  * Sample plugin to replace emoticons in plain text message body with real icons
7  *
8  * @version 1.0.1
9  * @author Thomas Bruederli
10  * @website http://roundcube.net
11  */
12 class emoticons extends rcube_plugin
13 {
14   public $task = 'mail';
15   private $map;
16
17   function init()
18   {
19     $this->task = 'mail';
20     $this->add_hook('message_part_after', array($this, 'replace'));
21   
22     $this->map = array(
23       ':)'  => html::img(array('src' => './program/js/tiny_mce/plugins/emotions/img/smiley-smile.gif', 'alt' => ':)')),
24       ':-)' => html::img(array('src' => './program/js/tiny_mce/plugins/emotions/img/smiley-smile.gif', 'alt' => ':-)')),
25       ':('  => html::img(array('src' => './program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif', 'alt' => ':(')),
26       ':-(' => html::img(array('src' => './program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif', 'alt' => ':-(')),
27     );
28   }
29
30   function replace($args)
31   {
32     if ($args['type'] == 'plain')
33       return array('body' => strtr($args['body'], $this->map));
34   
35     return null;
36   }
37
38 }
39