Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

dox_filter.php

Go to the documentation of this file.
00001 
00002 /** @file dox_filter.php
00003 * PHP sources converter for Doxygen.
00004 * @todo Do something with PHP`s 'Content-type:'
00005 * @note For succesful work of dox_filter.php it is
00006 *   required that 'register_argc_argv' is not 'off' 
00007 *   in PHP`s configuration file.
00008 */
00009 function process_php( pth )
00010 {
00011   path = pathinfo( pth );
00012   name = path[ 'basename' ];
00013   dir = path[ 'dirname' ];
00014   ext = path[ 'extension' ];
00015   f = fopen( pth, 'rb' );
00016   fin = fread( f, filesize( pth ) );
00017   fclose( f );
00018   fout =
00019     str_replace( '', '',
00020     str_replace( '', '',
00021     preg_replace( '/(\bclass\b)([^\{]*\{)/', "\\0\npublic:",
00022     preg_replace( '/\bextends\b/', ': public ',
00023     str_replace( '', '',
00024     preg_replace( '/\brequire(_once)?\s*\(\s*[\'"](\S+)[\'"]\s*\)\s*;/', '#include "2"',
00025     preg_replace( '/\bdefine\s*\(\s*[\'"](\S+)[\'"]\s*,(.*)\)\s*;/', '#define 1 2',
00026       fin
00027     )
00028     )
00029     )
00030     )
00031     )
00032     )
00033     );
00034   return fout;
00035 }
00036 // Process file
00037 function process_file( pth )
00038 {
00039   path = pathinfo( pth );
00040   name = path[ 'basename' ];
00041   dir = path[ 'dirname' ];
00042   ext = path[ 'extension' ];
00043   switch( ext )
00044   {
00045     case 'php':
00046       res = process_php( pth );
00047       break;
00048     default:
00049       // Just read and output
00050       f = fopen( pth, 'rb' );
00051       res = fread( f, filesize( pth ) );
00052       fclose( f );
00053   }
00054   return res;
00055 }
00056 res = process_file( _SERVER[ 'argv' ][ 1 ] );
00057 // Output directly to stdout rather use of echo 
00058 // to prevent PHP`s 'Content-type:' at begining of output
00059 f = fopen( 'php://stdout', 'w' );
00060 fwrite( f, res );
00061 fclose( f );
00062 X-Powered-By: PHP/4.0.8-dev
00063 Content-type: text/html
00064 
00065 

Generated on Tue Mar 11 08:35:12 2003 for SES by doxygen1.2.16