aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-05-03 10:23:36 +0200
committerMario <mario@mariovavti.com>2024-05-03 10:23:36 +0200
commit3a50a0b71572d0f5cc5c5aed1df8592c3e9e4dce (patch)
tree2791fadba60123f01d93ec27f3a9ef162e850af6 /include
parentb25662e183fa800d13908e707e0a3f33131b9ea8 (diff)
downloadvolse-hubzilla-3a50a0b71572d0f5cc5c5aed1df8592c3e9e4dce.tar.gz
volse-hubzilla-3a50a0b71572d0f5cc5c5aed1df8592c3e9e4dce.tar.bz2
volse-hubzilla-3a50a0b71572d0f5cc5c5aed1df8592c3e9e4dce.zip
deal with li tags earlier seems to be more straight forward also add test for li without closing tag
Diffstat (limited to 'include')
-rw-r--r--include/html2bbcode.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index b7f3ea4e3..e95e498c9 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -26,8 +26,12 @@ function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
$xpath = new DomXPath($doc);
$list = $xpath->query("//".$oldnode);
+
foreach ($list as $oldNode) {
+ if ($oldnode == 'li')
+ hz_syslog(print_r($oldNode,true));
+
$attr = array();
if ($oldNode->attributes->length)
foreach ($oldNode->attributes as $attribute)
@@ -113,13 +117,6 @@ function html2bbcode($message)
$message = str_replace("\r", "", $message);
- $message = str_replace(array(
- "<li><p>",
- "</p></li>"),
- array(
- "<li>",
- "</li>"),
- $message);
// remove namespaces
$message = preg_replace('=<(\w+):(.+?)>=', '<removeme>', $message);
@@ -129,7 +126,8 @@ function html2bbcode($message)
//$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
$message = mb_encode_numericentity($message, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
-
+ $message = str_replace(['<li><p>', '<li>'], '[*]', $message);
+ $message = str_replace(['</p></li>', '</li>'], '', $message);
if(!$message)
return;
@@ -149,6 +147,9 @@ function html2bbcode($message)
node2bbcode($doc, 'html', array(), "", "");
node2bbcode($doc, 'body', array(), "", "");
+ node2bbcode($doc, 'li', array(), "[*]", "");
+
+
// Outlook-Quote - Variant 1
node2bbcode($doc, 'p', array('class'=>'MsoNormal', 'style'=>'margin-left:35.4pt'), '[quote]', '[/quote]');
@@ -205,7 +206,6 @@ function html2bbcode($message)
node2bbcode($doc, 'audio', array('src'=>'/(.+)/'), '[audio]$1', '[/audio]');
// node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]');
- node2bbcode($doc, 'li', array(), "[*]", "");
node2bbcode($doc, 'ul', array(), "[list]", "[/list]");
node2bbcode($doc, 'ol', array(), "[list=1]", "[/list]");