egroupware_official/doc/inlinedocparser.php

122 lines
2.9 KiB
PHP
Raw Normal View History

2001-07-13 10:19:41 +02:00
<?php
2001-09-25 09:19:16 +02:00
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* The file written by Miles Lott <milosch@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
2001-12-03 18:17:35 +01:00
$types = array('abstract','param','example','syntax','result','description','discussion','author','copyright','package','access');
2001-07-13 10:19:41 +02:00
2001-12-03 18:44:16 +01:00
$app = $GLOBALS['HTTP_GET_VARS']['app'];
2001-12-03 18:46:32 +01:00
$fn = $GLOBALS['HTTP_GET_VARS']['fn'];
2001-12-03 18:44:16 +01:00
2001-12-03 18:17:35 +01:00
if($app)
{
if (!preg_match("/^[a-zA-Z0-9-_]+$/i",$app))
2001-11-12 22:24:52 +01:00
{
2001-12-03 18:17:35 +01:00
echo 'Invalid application<br>';
exit;
}
}
else
{
$app = 'phpgwapi';
}
if ($fn)
{
if (preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$fn) || preg_match("/^functions\.inc\.php+$/",$fn) || preg_match("/^xml_functions\.inc\.php+$/",$fn))
{
$files[] = $fn;
2001-11-12 22:24:52 +01:00
}
else
2001-11-12 19:01:42 +01:00
{
2001-12-03 18:17:35 +01:00
echo 'No valid file selected';
exit;
2001-11-12 19:01:42 +01:00
}
2001-12-03 18:17:35 +01:00
}
else
{
$d = dir('../'.$app.'/inc/');
while ($x = $d->read())
{
if (preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$x) || preg_match("/^functions\.inc\.php+$/",$x))
{
$files[] = $x;
}
2001-11-12 23:00:32 +01:00
}
2001-12-03 18:17:35 +01:00
$d->close;
2001-07-13 10:19:41 +02:00
2001-12-03 18:17:35 +01:00
reset($files);
}
2001-07-13 10:19:41 +02:00
2001-12-03 18:17:35 +01:00
while (list($p,$fn) = each($files))
{
$matches = $elements = $data = array();
$string = $t = $out = $class = $xkey = $new = '';
$file = '../'.$app.'/inc/' . $fn;
echo '<br>Looking at: ' . $file . "\n";
2001-07-13 10:19:41 +02:00
2001-12-03 18:17:35 +01:00
$f = fopen($file,'r');
while (!feof($f))
{
$string .= fgets($f,8000);
}
fclose($f);
2001-07-13 10:19:41 +02:00
2001-12-03 18:17:35 +01:00
preg_match_all("#\*\!(.*)\*/#sUi",$string,$matches,PREG_SET_ORDER);
2001-07-13 10:19:41 +02:00
2001-12-03 18:17:35 +01:00
while (list($key,$val) = each($matches))
{
preg_match_all("#@(.*)$#sUi",$val[1],$data);
$new = explode("@",$data[1][0]);
while (list($x,$y) = each($new))
{
if (!isset($object) || trim($new[0]) == $object)
//if (trim($new[0]) == $object)
{
$t = trim($new[0]);
if(!$key)
{
$class = $t;
}
$t = trim(ereg_replace('function','',$t));
2001-07-13 10:19:41 +02:00
2001-12-03 18:17:35 +01:00
reset($types);
while(list($z,$type) = each($types))
{
if(ereg($type,$y))
{
$xkey = $type;
$out = $y;
$out = ereg_replace($type,'',$out);
break;
2001-11-12 23:00:32 +01:00
}
2001-12-03 18:17:35 +01:00
else
{
$xkey = 'unknown';
$out = $y;
}
}
if($out != $new[0])
{
$elements[$class][$t][$xkey][] = $out;
}
}
}
}
echo '<br><pre>';
print_r($elements);
// var_dump($elements);
echo '</pre>' . "\n";
}
2001-09-25 09:19:16 +02:00
?>