added lots of new stuff. Getting damn near useful HTMl output

This commit is contained in:
seek3r 2001-12-25 09:23:07 +00:00
parent 4d41699cdc
commit 24f4f79cdc
2 changed files with 110 additions and 28 deletions

View File

@ -282,14 +282,14 @@
$returndata = parseobject($data[1][0], $fn); $returndata = parseobject($data[1][0], $fn);
if ($startstop[$key] == 'some_lame_string_that_wont_be_used_by_a_function') if ($startstop[$key] == 'some_lame_string_that_wont_be_used_by_a_function')
{ {
if (!is_array($doc_array['file '.$fn][0]['files'])) if (!is_array($doc_array['file '.$fn][0]['file']))
{ {
$doc_array['file '.$fn][0]['files'] = Array(); $doc_array['file '.$fn][0]['file'] = Array();
} }
if (!in_array($fn,$doc_array['file '.$fn][0]['files'])) if (!in_array($fn,$doc_array['file '.$fn][0]['file']))
{ {
$doc_array['file '.$fn][0]['files'][] = $fn; $doc_array['file '.$fn][0]['file'][] = $fn;
} }
$doc_array['file '.$fn][$returndata['name']] = $returndata['value']; $doc_array['file '.$fn][$returndata['name']] = $returndata['value'];
} }
@ -300,26 +300,26 @@
$returndoc = parsesimpleobject($matches_starts[$startstop[$key]]); $returndoc = parsesimpleobject($matches_starts[$startstop[$key]]);
if ($returndoc != False) if ($returndoc != False)
{ {
if (!is_array($returndoc['value']['files'])) if (!is_array($returndoc['value']['file']))
{ {
$returndoc['value']['files'] = Array(); $returndoc['value']['file'] = Array();
} }
if (!in_array($fn, $returndoc['value']['files'])) if (!in_array($fn, $returndoc['value']['file']))
{ {
$returndoc['value']['files'][] = $fn; $returndoc['value']['file'][] = $fn;
} }
} }
$doc_array[$startstop[$key]][0] = $returndoc['value']; $doc_array[$startstop[$key]][0] = $returndoc['value'];
} }
else else
{ {
if (!is_array($doc_array[$startstop[$key]][0]['files'])) if (!is_array($doc_array[$startstop[$key]][0]['file']))
{ {
$doc_array[$startstop[$key]][0]['files'] = Array(); $doc_array[$startstop[$key]][0]['file'] = Array();
} }
if (!in_array($fn, $doc_array[$startstop[$key]][0]['files'])) if (!in_array($fn, $doc_array[$startstop[$key]][0]['file']))
{ {
$doc_array[$startstop[$key]][0]['files'][] = $fn; $doc_array[$startstop[$key]][0]['file'][] = $fn;
} }
} }
$doc_array[$startstop[$key]][$returndata['name']] = $returndata['value']; $doc_array[$startstop[$key]][$returndata['name']] = $returndata['value'];
@ -341,12 +341,85 @@
$GLOBALS['template']->set_block('tpl_file','border_top'); $GLOBALS['template']->set_block('tpl_file','border_top');
$GLOBALS['template']->set_block('tpl_file', 'group'); $GLOBALS['template']->set_block('tpl_file', 'group');
$GLOBALS['template']->set_block('tpl_file', 'object'); $GLOBALS['template']->set_block('tpl_file', 'object');
$GLOBALS['template']->set_block('tpl_file', 'object_name');
$GLOBALS['template']->set_block('tpl_file','border_bottom'); $GLOBALS['template']->set_block('tpl_file','border_bottom');
$GLOBALS['template']->set_block('tpl_file','generic'); $GLOBALS['template']->set_block('tpl_file','generic');
$GLOBALS['template']->set_block('tpl_file','generic_para');
$GLOBALS['template']->set_block('tpl_file','generic_pre');
$GLOBALS['template']->set_block('tpl_file','abstract'); $GLOBALS['template']->set_block('tpl_file','abstract');
$GLOBALS['template']->set_block('tpl_file','params'); $GLOBALS['template']->set_block('tpl_file','params');
$GLOBALS['template']->set_block('tpl_file','param_entry'); $GLOBALS['template']->set_block('tpl_file','param_entry');
$GLOBALS['template']->set_var('PHP_SELF',$PHP_SELF);
function parsedetails($array, $output_name = 'object_contents')
{
while(list($key, $value) = each($array))
{
switch ($key)
{
case 'author':
case 'file':
$num = count($value);
if ($num > 1)
{
$GLOBALS['template']->set_var('generic_name',ucwords($key.'s'));
for ($idx = 0; $idx < $num; ++$idx)
{
if($idx > 0)
{
$new_value .= ', '.$value[$idx];
}
else
{
$new_value = $value[$idx];
}
}
$GLOBALS['template']->set_var('generic_value',$new_value);
}
else
{
$GLOBALS['template']->set_var('generic_name',ucwords($key));
$GLOBALS['template']->set_var('generic_value',$value[0]);
}
$GLOBALS['template']->fp($output_name,'generic',True);
break;
case 'discussion':
$GLOBALS['template']->set_var('generic_name',ucwords($key));
$GLOBALS['template']->set_var('generic_value',$value[0]);
$GLOBALS['template']->fp($output_name,'generic_para',True);
break;
case 'syntax':
case 'example':
while(list($sub_key, $sub_value) = each($value))
{
$GLOBALS['template']->set_var('generic_name',ucwords($key));
$GLOBALS['template']->set_var('generic_value',$value[$sub_key]);
$GLOBALS['template']->fp($output_name,'generic_pre',True);
}
break;
case 'param':
while(list($sub_key, $sub_value) = each($value))
{
$GLOBALS['template']->set_var('generic_name',ucwords($key.($sub_key+1)));
$GLOBALS['template']->set_var('generic_value',$value[$sub_key]);
$GLOBALS['template']->fp($output_name,'generic',True);
}
break;
case 'abstract':
case 'description':
case 'result':
case 'package':
case 'copyright':
case 'access':
default:
$GLOBALS['template']->set_var('generic_name',ucwords($key));
$GLOBALS['template']->set_var('generic_value',$value[0]);
$GLOBALS['template']->fp($output_name,'generic',True);
}
}
}
$GLOBALS['template']->fp('doc','border_top',True); $GLOBALS['template']->fp('doc','border_top',True);
reset($doc_array); reset($doc_array);
while(list($group_key, $group_value) = each($doc_array)) while(list($group_key, $group_value) = each($doc_array))
@ -355,16 +428,19 @@
/* This is where most of the work in creating the output gets done */ /* This is where most of the work in creating the output gets done */
while(list($object_key, $object_value) = each($group_value)) while(list($object_key, $object_value) = each($group_value))
{ {
$GLOBALS['template']->set_var('object_name',$object_key); if ($object_key == '0')
{
$GLOBALS['template']->set_var('object_id','');
$GLOBALS['template']->set_var('object_name','');
}
else
{
$GLOBALS['template']->set_var('object_id',trim(ereg_replace ("function ", "", $object_key)));
$GLOBALS['template']->set_var('object_name',$object_key);
}
if(is_array($object_value)) if(is_array($object_value))
{ {
while(list($docline_key, $docline_value) = each($object_value)) parsedetails($object_value);
{
$GLOBALS['template']->set_var('generic_name',$docline_key);
$GLOBALS['template']->set_var('generic_value',$docline_value[0]);
$GLOBALS['template']->fp('object_contents','generic',True);
}
$GLOBALS['template']->set_var('generic_name',$docline_key); $GLOBALS['template']->set_var('generic_name',$docline_key);
$GLOBALS['template']->set_var('generic_value',$docline_value[0]); $GLOBALS['template']->set_var('generic_value',$docline_value[0]);
$GLOBALS['template']->fp('group_contents','object',True); $GLOBALS['template']->fp('group_contents','object',True);

View File

@ -23,23 +23,29 @@
<!-- END group --> <!-- END group -->
<!-- BEGIN object --> <!-- BEGIN object -->
<H2>{object_name}</H2> <H2><A href="{PHP_SELF}?object={object_id}">{object_name}</A></H2>
{object_contents} {object_contents}
<BR>
<!-- END object --> <!-- END object -->
<!-- BEGIN reference_list_of_types -->
'abstract','param','example','syntax','result','description','discussion','author','copyright','package','access'
<!-- END reference_list_of_types -->
<!-- BEGIN abstract --> <!-- BEGIN abstract -->
Abstract: {abstract}<br> <B>Abstract:</B> {abstract}<BR>
<!-- END abstract --> <!-- END abstract -->
<!-- BEGIN generic --> <!-- BEGIN generic -->
{generic_name}: {generic_value}<br> <B>{generic_name}:</B> {generic_value}<BR>
<!-- END generic --> <!-- END generic -->
<!-- BEGIN generic_para -->
<P><B>{generic_name}:</B> {generic_value}</P>
<!-- END generic_para -->
<!-- BEGIN generic_pre -->
<B>{generic_name}:</B>
<PRE>
{generic_value}
</PRE>
<!-- END generic_pre -->
<!-- BEGIN params --> <!-- BEGIN params -->
<TABLE border="1"> <TABLE border="1">
<TR> <TR>