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-07-13 10:37:56 +02:00
|
|
|
$types = array('abstract','param','example','syntax','result','description','discussion','author','copyright','package','access');
|
2001-07-13 10:19:41 +02:00
|
|
|
|
2001-11-12 22:24:52 +01:00
|
|
|
if($app)
|
|
|
|
{
|
|
|
|
if (!preg_match("/^[a-zA-Z0-9-_]+$/i",$app))
|
|
|
|
{
|
|
|
|
echo 'Invalid application<br>';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2001-11-12 19:01:42 +01:00
|
|
|
{
|
|
|
|
$app = 'phpgwapi';
|
|
|
|
}
|
|
|
|
|
2001-07-13 10:19:41 +02:00
|
|
|
if ($fn)
|
|
|
|
{
|
2001-11-29 23:12:28 +01:00
|
|
|
if (preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$fn) || preg_match("/^functions\.inc\.php+$/",$fn) || preg_match("/^xml_functions\.inc\.php+$/",$fn))
|
2001-11-12 22:24:52 +01:00
|
|
|
{
|
2001-11-12 20:16:57 +01:00
|
|
|
$files[] = $fn;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo 'No valid file selected';
|
|
|
|
exit;
|
|
|
|
}
|
2001-07-13 10:19:41 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-11-12 19:01:42 +01:00
|
|
|
$d = dir('../'.$app.'/inc/');
|
2001-07-13 10:19:41 +02:00
|
|
|
while ($x = $d->read())
|
|
|
|
{
|
2001-11-12 23:00:32 +01:00
|
|
|
if (preg_match("/^class\.([a-zA-Z0-9-_]*)\.inc\.php+$/",$x) || preg_match("/^functions\.inc\.php+$/",$x))
|
2001-07-13 10:19:41 +02:00
|
|
|
{
|
|
|
|
$files[] = $x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$d->close;
|
2001-11-12 20:16:57 +01:00
|
|
|
|
|
|
|
reset($files);
|
2001-11-12 23:00:32 +01:00
|
|
|
}
|
2001-07-13 10:19:41 +02:00
|
|
|
|
|
|
|
while (list($p,$fn) = each($files))
|
|
|
|
{
|
|
|
|
$matches = $elements = $data = array();
|
|
|
|
$string = $t = $out = $class = $xkey = $new = '';
|
2001-11-12 19:01:42 +01:00
|
|
|
$file = '../'.$app.'/inc/' . $fn;
|
2001-07-13 10:19:41 +02:00
|
|
|
echo '<br>Looking at: ' . $file . "\n";
|
|
|
|
|
|
|
|
$f = fopen($file,'r');
|
|
|
|
while (!feof($f))
|
|
|
|
{
|
|
|
|
$string .= fgets($f,8000);
|
|
|
|
}
|
|
|
|
fclose($f);
|
|
|
|
|
|
|
|
preg_match_all("#\*\!(.*)\*/#sUi",$string,$matches,PREG_SET_ORDER);
|
|
|
|
|
|
|
|
while (list($key,$val) = each($matches))
|
|
|
|
{
|
|
|
|
preg_match_all("#@(.*)$#sUi",$val[1],$data);
|
|
|
|
$new = explode("@",$data[1][0]);
|
2001-11-12 23:00:32 +01:00
|
|
|
while (list($x,$y) = each($new))
|
2001-07-13 10:19:41 +02:00
|
|
|
{
|
2001-11-12 23:00:32 +01:00
|
|
|
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-11-12 23:00:32 +01:00
|
|
|
reset($types);
|
|
|
|
while(list($z,$type) = each($types))
|
|
|
|
{
|
|
|
|
if(ereg($type,$y))
|
|
|
|
{
|
|
|
|
$xkey = $type;
|
|
|
|
$out = $y;
|
|
|
|
$out = ereg_replace($type,'',$out);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$xkey = 'unknown';
|
|
|
|
$out = $y;
|
|
|
|
}
|
|
|
|
}
|
2001-07-13 10:19:41 +02:00
|
|
|
|
2001-11-12 23:00:32 +01:00
|
|
|
if($out != $new[0])
|
|
|
|
{
|
|
|
|
$elements[$class][$t][$xkey][] = $out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-07-13 10:19:41 +02:00
|
|
|
}
|
|
|
|
echo '<br><pre>';
|
2001-07-13 10:37:56 +02:00
|
|
|
print_r($elements);
|
|
|
|
// var_dump($elements);
|
2001-07-13 10:19:41 +02:00
|
|
|
echo '</pre>' . "\n";
|
|
|
|
}
|
2001-09-25 09:19:16 +02:00
|
|
|
?>
|