fix logic for nested lists--should be OR, not AND

This commit is contained in:
Zach Prezkuta 2012-06-27 21:21:26 -06:00
parent 3968e71d4c
commit cd9ce0ecb3
2 changed files with 6 additions and 6 deletions

View File

@ -113,9 +113,9 @@ function bb2diaspora($Text,$preserve_nl = false) {
// to define the closing tag for the list elements. So nested lists // to define the closing tag for the list elements. So nested lists
// are going to be flattened out in Diaspora for now // are going to be flattened out in Diaspora for now
$endlessloop = 0; $endlessloop = 0;
while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) && while ((((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)) ||
(strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) && ((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
(strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) { ((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false))) && (++$endlessloop < 20)) {
$Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text); $Text = preg_replace_callback("/\[list\](.*?)\[\/list\]/is", 'diaspora_ul', $Text);
$Text = preg_replace_callback("/\[list=1\](.*?)\[\/list\]/is", 'diaspora_ol', $Text); $Text = preg_replace_callback("/\[list=1\](.*?)\[\/list\]/is", 'diaspora_ol', $Text);
$Text = preg_replace_callback("/\[list=i\](.*?)\[\/list\]/s",'diaspora_ol', $Text); $Text = preg_replace_callback("/\[list=i\](.*?)\[\/list\]/s",'diaspora_ol', $Text);

View File

@ -163,9 +163,9 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// handle nested lists // handle nested lists
$endlessloop = 0; $endlessloop = 0;
while ((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false) && while ((((strpos($Text, "[/list]") !== false) && (strpos($Text, "[list") !== false)) ||
(strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false) && ((strpos($Text, "[/ol]") !== false) && (strpos($Text, "[ol]") !== false)) ||
(strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false) && (++$endlessloop < 20)) { ((strpos($Text, "[/ul]") !== false) && (strpos($Text, "[ul]") !== false))) && (++$endlessloop < 20)) {
$Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text); $Text = preg_replace("/\[list\](.*?)\[\/list\]/ism", '<ul class="listbullet" style="list-style-type: circle;">$1</ul>' ,$Text);
$Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '<ul class="listnone" style="list-style-type: none;">$1</ul>' ,$Text); $Text = preg_replace("/\[list=\](.*?)\[\/list\]/ism", '<ul class="listnone" style="list-style-type: none;">$1</ul>' ,$Text);
$Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text); $Text = preg_replace("/\[list=1\](.*?)\[\/list\]/ism", '<ul class="listdecimal" style="list-style-type: decimal;">$1</ul>' ,$Text);