1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-14 17:42:10 +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: ordered list [list=<list type>]*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 = "<ul>";
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
}
}
$listtext .= "</ul>";
return $listtext;
if ($parm == '')
{ /* unordered list */
$listtext = "<ul>";
$trailer = "</ul>";
}
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<ol style='list-style-type: $type'>";
foreach($listitems as $item)
{
if($item && $item != E_NL)
{
$listtext .= "<li>$item</li>";
}
}
$listtext .= "</ol>";
return $listtext;
}
$type = $tp -> toAttribute($parm);
$listtext = "\n<ol style='list-style-type: $type'>";
$trailer = "</ol>";
}
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] */
$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 "<textarea $tastr>$value</textarea>";
return "<textarea $tastr>$code_text</textarea>";