aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-09-01 13:57:45 +0200
committerMario Vavti <mario@mariovavti.com>2016-09-01 13:57:45 +0200
commit24192ff1eff7df9a46f13349a043507f8fd9034e (patch)
tree72d38e68db0f46d4ffc7ab9cada8c918af128692 /include/bbcode.php
parent6adb18091124cd51e1bf8a2efae31cb83a0db075 (diff)
downloadvolse-hubzilla-24192ff1eff7df9a46f13349a043507f8fd9034e.tar.gz
volse-hubzilla-24192ff1eff7df9a46f13349a043507f8fd9034e.tar.bz2
volse-hubzilla-24192ff1eff7df9a46f13349a043507f8fd9034e.zip
introduce checklist BBcode for checklists
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 9c65afc59..bc543ca48 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -768,13 +768,14 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
}
// Check for list text
$Text = str_replace("[*]", "<li>", $Text);
- $Text = str_replace("[]", "<li><input class=\"listcheckbox\" type=\"checkbox\" disabled=\"disabled\">", $Text);
- $Text = str_replace("[x]", "<li><input class=\"listcheckbox\" type=\"checkbox\" checked=\"checked\" disabled=\"disabled\">", $Text);
+ $Text = str_replace("[]", "<li><input type=\"checkbox\" disabled=\"disabled\">", $Text);
+ $Text = str_replace("[x]", "<li><input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\">", $Text);
// handle nested lists
$endlessloop = 0;
while ((((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)) ||
+ ((strpos($Text, "[/checklist]") !== false) && (strpos($Text, "[checklist]") !== false)) ||
((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false)) ||
((strpos($Text, "[/dl]") !== false) && (strpos($Text, "[dl") !== false)) ||
@@ -786,6 +787,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '<ul class="listupperroman" style="list-style-type: upper-roman;">$2</ul>', $Text);
$Text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '<ul class="listloweralpha" style="list-style-type: lower-alpha;">$2</ul>', $Text);
$Text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '<ul class="listupperalpha" style="list-style-type: upper-alpha;">$2</ul>', $Text);
+ $Text = preg_replace("/\[checklist\](.*?)\[\/checklist\]/ism", '<ul class="checklist" style="list-style-type: none;">$1</ul>', $Text);
$Text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>', $Text);
$Text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>', $Text);
$Text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '<li>$1</li>', $Text);