Skip to content
Permalink
Browse files

added OC smileys to watchlist mails; fixes #935

  • Loading branch information...
following5 committed Mar 15, 2016
1 parent 2523288 commit f45a6a219170b0a2146ba2faa116cd3c89b4327e
Showing with 13 additions and 17 deletions.
  1. +13 −17 htdocs/lib2/edithelper.inc.php
@@ -28,7 +28,7 @@
function processEditorInput($oldDescMode, $descMode, $text)
{
global $opt, $smiley;
global $opt;
if ($descMode != 1)
{
@@ -58,22 +58,7 @@ function processEditorInput($oldDescMode, $descMode, $text)
else
{
// mode switch from HTML editor to plain text, or decode HTML-encoded plain text
// convert smilies ...
for ($n=0; $n < count($smiley['image']); $n++)
{
do
{
$logtext0 = $text;
$text = mb_ereg_replace("<img [^>]*?src=[^>]+?".str_replace('.','\.',$smiley['file'][$n])."[^>]+?>", "[s![".$smiley['text'][$n]."]!s]", $text);
// the [s[ ]s] is needed to protect the spaces around the smileys
} while ($text != $logtext0);
}
// ... and HTML to plain text
$text = html2plaintext($text, $oldDescMode = 0, 0);
$text = str_replace(array('[s![',']!s]'), '', $text);
}
}
@@ -88,7 +73,7 @@ function processEditorInput($oldDescMode, $descMode, $text)
function html2plaintext($text, $texthtml0, $wrap)
{
global $opt;
global $opt, $smiley;
if ($texthtml0)
{
@@ -98,11 +83,22 @@ function html2plaintext($text, $texthtml0, $wrap)
}
else
{
// convert smilies ...
for ($n=0; $n < count($smiley['image']); $n++) {
$text = mb_ereg_replace(
"<img [^>]*?src=[^>]+?".str_replace('.','\.', $smiley['file'][$n])."[^>]+?>",
"[s![".$smiley['text'][$n]."]!s]",
$text);
// the [s[ ]s] is needed to protect the spaces around the smileys
}
$h2t = new html2text($text);
$h2t->set_base_url($opt['page']['default_absolute_url']);
$h2t->width = $wrap;
$text = $h2t->get_text();
$text = str_replace(array('[s![',']!s]'), '', $text);
// remove e.g. trailing \n created from </p> by html2text
while (substr($text,-2) == "\n\n")
$text = substr($text, 0, strlen($text) - 1);

0 comments on commit f45a6a2

Please sign in to comment.
You can’t perform that action at this time.