aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/html2bbcode.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index cc67a5666..0aa067371 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -87,7 +87,7 @@ function deletenode(&$doc, $node)
function html2bbcode($message)
{
- if(!is_string($message) && !$message)
+ if(!is_string($message))
return;
$message = str_replace("\r", "", $message);
@@ -104,11 +104,14 @@ function html2bbcode($message)
$message = preg_replace('=<(\w+):(.+?)>=', '<removeme>', $message);
$message = preg_replace('=</(\w+):(.+?)>=', '</removeme>', $message);
+ $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
+
+ if(!$message)
+ return;
+
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
- $message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
-
@$doc->loadHTML($message);
deletenode($doc, 'style');