1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 05:07:27 +02:00

Simplify things a bit

This commit is contained in:
e107steved
2007-01-08 21:11:36 +00:00
parent fab4a3bc10
commit 470499cbc7
2 changed files with 20 additions and 43 deletions

View File

@@ -1,5 +1,3 @@
/* Tag: unordered list [list]*line 1*line2*line 3*line 4*line5 etc[/list] */ /* Tag: unordered list [list]*line 1*line2*line 3*line 4*line5 etc[/list] */
/* Tag: ordered list [list=<list type>]*line 1*line2*line 3*line 4*line5 etc[/list] */ /* Tag: ordered list [list=<list type>]*line 1*line2*line 3*line 4*line5 etc[/list] */
/* valid list types: /* valid list types:
@@ -14,28 +12,19 @@
*/ */
$listitems = explode("*", $code_text);
if(preg_match("#\[list\](.*?)\[/list\]#si", $full_text, $match)) if ($parm == '')
{ { /* unordered list */
/* unordered list */
$listitems = explode("*", $match[1]);
$listtext = "<ul>"; $listtext = "<ul>";
foreach($listitems as $item) $trailer = "</ul>";
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
} }
} else
$listtext .= "</ul>";
return $listtext;
}
else if(preg_match("#\[list=(.*?)\](.*?)\[/list\]#si", $full_text, $match))
{ {
$type = $tp -> toAttribute($match[1]); $type = $tp -> toAttribute($parm);
$listitems = $match[2];
$listitems = explode("*", $match[2]);
$listtext = "\n<ol style='list-style-type: $type'>"; $listtext = "\n<ol style='list-style-type: $type'>";
$trailer = "</ol>";
}
foreach($listitems as $item) foreach($listitems as $item)
{ {
if($item && $item != E_NL) if($item && $item != E_NL)
@@ -43,6 +32,4 @@ else if(preg_match("#\[list=(.*?)\](.*?)\[/list\]#si", $full_text, $match))
$listtext .= "<li>$item</li>"; $listtext .= "<li>$item</li>";
} }
} }
$listtext .= "</ol>"; return $listtext.$trailer;
return $listtext;
}

View File

@@ -1,20 +1,10 @@
/* Tag: [textarea name=name&style=style&row=rows&whatever=whatever]value[/textarea] */ /* Tag: [textarea name=name&style=style&row=rows&whatever=whatever]value[/textarea] */
$tastr = ""; $tastr = "";
parse_str($parm, $tmp); parse_str($parm, $tmp);
foreach($tmp as $key => $p) foreach($tmp as $key => $p)
{ {
$tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' "; $tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' ";
} }
return "<textarea $tastr>$code_text</textarea>";
preg_match ("#\](.*?)\[/textarea#", $full_text, $match);
$value = $match[1];
return "<textarea $tastr>$value</textarea>";