From 74728935122fe35ed97c40092080cc7dfd4b7052 Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 6 Dec 2010 11:13:55 +0000 Subject: - Fix plaintext versions of HTML messages don't contain placeholders for emotions (#1485206) --- program/include/main.inc | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'program/include') 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 @@ -1646,6 +1646,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) { + // Cry + $search[] = '/]+\/>/i'; + $replace[] = $idx; + } + + return preg_replace($search, $replace, $html); +} + + /** * Check if working in SSL mode * @@ -1881,3 +1918,4 @@ function log_bug($arg_arr) flush(); } } + -- cgit v1.2.3