aboutsummaryrefslogtreecommitdiffstats
path: root/include/html2bbcode.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-03-31 10:07:15 +0000
committerMario <mario@mariovavti.com>2022-03-31 10:07:15 +0000
commit3e38a24f0a28e9ad25dc322441ba45adf3bf2c02 (patch)
tree8766f4ed45ed5f15775d2e3df66abc84247e6343 /include/html2bbcode.php
parent0d0f73fb67bbfcc53058cefded85ac36f951c7a7 (diff)
downloadvolse-hubzilla-3e38a24f0a28e9ad25dc322441ba45adf3bf2c02.tar.gz
volse-hubzilla-3e38a24f0a28e9ad25dc322441ba45adf3bf2c02.tar.bz2
volse-hubzilla-3e38a24f0a28e9ad25dc322441ba45adf3bf2c02.zip
fix PHP error
Diffstat (limited to 'include/html2bbcode.php')
-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');