aboutsummaryrefslogtreecommitdiffstats
path: root/include/html2bbcode.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-05-03 12:04:19 +0200
committerMario <mario@mariovavti.com>2024-05-03 12:04:19 +0200
commit219f0dfeca0cccc1870ca9da608d5004d43e67fb (patch)
treebd0b58c822f323d74c446add788aa1e6b4483890 /include/html2bbcode.php
parent3a50a0b71572d0f5cc5c5aed1df8592c3e9e4dce (diff)
downloadvolse-hubzilla-219f0dfeca0cccc1870ca9da608d5004d43e67fb.tar.gz
volse-hubzilla-219f0dfeca0cccc1870ca9da608d5004d43e67fb.tar.bz2
volse-hubzilla-219f0dfeca0cccc1870ca9da608d5004d43e67fb.zip
also deal with ol and ul tags earlier and add test for double nested lists
Diffstat (limited to 'include/html2bbcode.php')
-rw-r--r--include/html2bbcode.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index e95e498c9..e1c0572f5 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -126,6 +126,9 @@ function html2bbcode($message)
//$message = mb_convert_encoding($message, 'HTML-ENTITIES', "UTF-8");
$message = mb_encode_numericentity($message, [0x80, 0x10FFFF, 0, ~0], 'UTF-8');
+ $message = preg_replace('/\<ul(.*?)\>/', '[list]', $message);
+ $message = preg_replace('/\<ol(.*?)\>/', '[list=1]', $message);
+ $message = str_replace(['</ul>', '</ol>'], '[/list]', $message);
$message = str_replace(['<li><p>', '<li>'], '[*]', $message);
$message = str_replace(['</p></li>', '</li>'], '', $message);
@@ -147,9 +150,6 @@ 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]');
@@ -206,9 +206,6 @@ function html2bbcode($message)
node2bbcode($doc, 'audio', array('src'=>'/(.+)/'), '[audio]$1', '[/audio]');
// node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]');
- node2bbcode($doc, 'ul', array(), "[list]", "[/list]");
- node2bbcode($doc, 'ol', array(), "[list=1]", "[/list]");
-
node2bbcode($doc, 'hr', array(), "[hr]", "");
// node2bbcode($doc, 'table', array(), "", "");