CLASSNAME: ' . $classname . '
' . endl;
if ($extends != '') $html .= 'EXTENDS: ' . $extends . '
' . endl;
$html .= '
' . endl;
////
// Get constants from source code
////
$html .= '' . endl;
$html .= '' . endl;
$html .= 'CONSTANTS' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
$regexp = '/define[(](.*?);/si';
preg_match_all($regexp,$buffer,$const);
$const = $const[0];
for($i=0; $i < count($const) ; $i++)
{
$html .= '' . endl;
$html .= '' . endl;
$html .= '' . $const[$i] . '' .endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
}
////
// Get imports from source code
////
$html .= '' . endl;
$html .= '' . endl;
$html .= 'IMPORTS' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
$regexp = '/((require|include)[(_].*?);/si';
preg_match_all($regexp,$buffer,$imports);
$imports = $imports[0];
for($i=0; $i < count($imports) ; $i++)
{
$html .= '' . endl;
$html .= '' . endl;
$html .= '' . $imports[$i] . '' .endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
}
////
// Get attributes from class
////
$html .= '' . endl;
$html .= '' . endl;
$html .= 'ATTRIBUTES' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
$regexp = '|var\\s(.+);\\s*(//!\\s*?(\\S+))?|mi';
preg_match_all($regexp,$buffer,$atr);
$vname = $atr[1];
$vtype = $atr[3];
if(!empty($vname))
{
$html .= '' . endl;
$html .= '' . endl;
$html .= 'TYPE' . endl;
$html .= ' | ' . endl;
$html .= '' . endl;
$html .= 'NAME' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
}
for($i=0; $i < count($vname) ; $i++)
{
$html .= '' . endl;
$html .= '' . endl;
if (empty($vtype[$i])) $html .= '(???)' . endl;
else $html .= '('. $vtype[$i] .')' . endl;
$html .= ' | ' . endl;
$html .= '' . endl;
$html .= 'var ' . $vname[$i] . ';' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
}
/////
// Get class' methods
/////
$html .= '' . endl;
$html .= '' . endl;
$html .= 'METHODS' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
$regexp = '|function\\s([^)]*)[)].*?(//!.*?)*;|si';
preg_match_all($regexp,$buffer,$func);
$funcname = $func[1];
$funccomment = $func[0];
for($i=0; $i < count($funcname) ; $i++)
{
$html .= '' . endl;
$html .= '' . endl;
$html .= 'function ' . $funcname[$i] . ')' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
$desc = '';
$ret = '';
$regexp = '|//!(.*)|mi';
preg_match_all($regexp,$funccomment[$i],$temp);
$temp = $temp[1];
if (empty($temp[0])) continue;
foreach($temp as $val)
{
if (strstr($val,'@desc'))
{
$regexp = '|.*?@desc(.*)|si';
preg_match($regexp,$val,$temp2);
$desc = $temp2[1];
}
elseif (strstr($val,'@return'))
{
$regexp = '|.*?@return(.*)|si';
preg_match($regexp,$val,$temp3);
$ret = $temp3[1];
}
}
if ($ret != '' or $desc != '')
{
$html .= '' . endl;
//@return column
$html .= '' . endl;
if ($ret == '') $html .= 'Return: ?void?' . endl;
else $html .= 'Return: ' . trim($ret) . '' . endl;
$html .= ' | ' . endl;
//@desc column
$html .= '' . endl;
if ($desc == '') $html .= 'OBS: ' . endl;
else $html .= 'OBS: ' . trim($desc) . '' . endl;
$html .= ' | ' . endl;
$html .= '
' . endl;
}
}
/////
$html .= '
';
return $html;
}
?>