From 470499cbc73648636c375f3ed2315fe0f86ff20c Mon Sep 17 00:00:00 2001 From: e107steved Date: Mon, 8 Jan 2007 21:11:36 +0000 Subject: [PATCH] Simplify things a bit --- e107_files/bbcode/list.bb | 49 +++++++++++++---------------------- e107_files/bbcode/textarea.bb | 14 ++-------- 2 files changed, 20 insertions(+), 43 deletions(-) diff --git a/e107_files/bbcode/list.bb b/e107_files/bbcode/list.bb index 7e1aab84f..89d786339 100644 --- a/e107_files/bbcode/list.bb +++ b/e107_files/bbcode/list.bb @@ -1,5 +1,3 @@ - - /* Tag: unordered list [list]*line 1*line2*line 3*line 4*line5 etc[/list] */ /* Tag: ordered list [list=]*line 1*line2*line 3*line 4*line5 etc[/list] */ /* valid list types: @@ -14,35 +12,24 @@ */ +$listitems = explode("*", $code_text); -if(preg_match("#\[list\](.*?)\[/list\]#si", $full_text, $match)) -{ - /* unordered list */ - $listitems = explode("*", $match[1]); - $listtext = ""; - return $listtext; +if ($parm == '') +{ /* unordered list */ + $listtext = ""; } -else if(preg_match("#\[list=(.*?)\](.*?)\[/list\]#si", $full_text, $match)) +else { - $type = $tp -> toAttribute($match[1]); - $listitems = $match[2]; - $listitems = explode("*", $match[2]); - $listtext = "\n
    "; - foreach($listitems as $item) - { - if($item && $item != E_NL) - { - $listtext .= "
  1. $item
  2. "; - } - } - $listtext .= "
"; - return $listtext; -} \ No newline at end of file + $type = $tp -> toAttribute($parm); + $listtext = "\n
    "; + $trailer = "
"; +} +foreach($listitems as $item) +{ + if($item && $item != E_NL) + { + $listtext .= "
  • $item
  • "; + } +} +return $listtext.$trailer; diff --git a/e107_files/bbcode/textarea.bb b/e107_files/bbcode/textarea.bb index 50215f150..ca60fb847 100644 --- a/e107_files/bbcode/textarea.bb +++ b/e107_files/bbcode/textarea.bb @@ -1,20 +1,10 @@ - - /* Tag: [textarea name=name&style=style&row=rows&whatever=whatever]value[/textarea] */ - $tastr = ""; - parse_str($parm, $tmp); foreach($tmp as $key => $p) { - $tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' "; + $tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' "; } - - -preg_match ("#\](.*?)\[/textarea#", $full_text, $match); -$value = $match[1]; - -return ""; - +return "";