summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-12-06 11:13:55 +0000
committeralecpl <alec@alec.pl>2010-12-06 11:13:55 +0000
commit74728935122fe35ed97c40092080cc7dfd4b7052 (patch)
tree8a523405d4411c74a583be07555c8d49cbf380ef /program/include
parent9e81b55616ea64e1a754174a7008efac26a2f285 (diff)
- Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/main.inc38
1 files changed, 38 insertions, 0 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 6d4e19c36..ad0bccd48 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1647,6 +1647,43 @@ function rcube_html_editor($mode='')
/**
+ * Replaces TinyMCE's emoticon images with plain-text representation
+ *
+ * @param string HTML content
+ * @return string HTML content
+ */
+function rcmail_replace_emoticons($html)
+{
+ $emoticons = array(
+ '8-)' => 'smiley-cool',
+ ':-#' => 'smiley-foot-in-mouth',
+ ':-*' => 'smiley-kiss',
+ ':-X' => 'smiley-sealed',
+ ':-P' => 'smiley-tongue-out',
+ ':-@' => 'smiley-yell',
+ ":'(" => 'smiley-cry',
+ ':-(' => 'smiley-frown',
+ ':-D' => 'smiley-laughing',
+ ':-)' => 'smiley-smile',
+ ':-/' => 'smiley-undecided',
+ ':-X' => 'smiley-embarassed',
+ '0:-)' => 'smiley-innocent',
+ ':-|' => 'smiley-money-mouth',
+ ':-0' => 'smiley-surprised',
+ ';-)' => 'smiley-wink',
+ );
+
+ foreach ($emoticons as $idx => $file) {
+ // <img title="Cry" src="http://.../program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif" border="0" alt="Cry" />
+ $search[] = '/<img title="[a-z ]+" src="https?:\/\/[a-z0-9_.\/-]+\/tiny_mce\/plugins\/emotions\/img\/'.$file.'.gif"[^>]+\/>/i';
+ $replace[] = $idx;
+ }
+
+ return preg_replace($search, $replace, $html);
+}
+
+
+/**
* Check if working in SSL mode
*
* @param integer HTTPS port number
@@ -1881,3 +1918,4 @@ function log_bug($arg_arr)
flush();
}
}
+