1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +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,35 +12,24 @@
*/ */
$listitems = explode("*", $code_text);
if(preg_match("#\[list\](.*?)\[/list\]#si", $full_text, $match)) if ($parm == '')
{ { /* unordered list */
/* unordered list */ $listtext = "<ul>";
$listitems = explode("*", $match[1]); $trailer = "</ul>";
$listtext = "<ul>";
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
}
}
$listtext .= "</ul>";
return $listtext;
} }
else if(preg_match("#\[list=(.*?)\](.*?)\[/list\]#si", $full_text, $match)) else
{ {
$type = $tp -> toAttribute($match[1]); $type = $tp -> toAttribute($parm);
$listitems = $match[2]; $listtext = "\n<ol style='list-style-type: $type'>";
$listitems = explode("*", $match[2]); $trailer = "</ol>";
$listtext = "\n<ol style='list-style-type: $type'>";
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
}
}
$listtext .= "</ol>";
return $listtext;
} }
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
}
}
return $listtext.$trailer;

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>";