';
$files = glob_recursive( $path );
echo 'Found ' . count( $files ) . ' files matching pattern. All files listed relative to path of this file.';
//echo '
' . print_r( $files, true ) . '
';
foreach( $files as $file ) {
echo '
';
echo 'File: ' . str_replace( dirname( __FILE__ ), '', $file ) . '
';
//if ( strstr(
$contents = file( $file );
$in_comment_block = false; // True when inside a comment block /* ... */ (can be multiple lines).
$in_class = ''; // Blank when not in a class; class name when in a class.
$comment_block_contents = '';
foreach( $contents as $content ) {
if ( false !== strpos( $content, '/*' ) ) {
$in_comment_block = true;
$comment_block_contents = '';
} // end checking for start of comment block.
// Parse things NOT in comment blocks:
if ( false === $in_comment_block ) {
if ( ( false !== strpos( $content, 'class ' ) ) && ( false !== strpos( $content, ' {' ) ) ) { // todo: needs more specificity to avoid false positives.
$in_class = substr( $content, strpos( $content, 'class ' ) + 6, -2 );
echo 'Class: ' . $in_class . '
';
}
}
if ( true === $in_comment_block ) {
$comment_block_contents .= $content;
} // end if in comment block.
if ( false !== strpos( $content, '*/' ) ) {
echo '';
$in_comment_block = false;
} // end checking for end of comment block.
}
}
?>