jsAutoLoad.php File Reference

Go to the source code of this file.

Functions

 describe_folder ($strDir, $strParentDir=null, &$arrFolders=null)

Variables

 $strDir = __DIR__
 $strFile = __FILE__
 print
 $arrDir = explode( "/" , $strDir )
 $intDeep = isset( $_REQUEST['deep'] ) ? $_REQUEST['deep'] : 0
 $intBack = isset( $_REQUEST['back'] ) ? $_REQUEST['back'] : 0
for($i=0;$i< $intBack;$i++) $strBack = implode( "/" , $arrDir )
 $arrFolders = array()
 $arrFiles = ( describe_folder( $strDir , $strBack , $arrFolders ) )


Function Documentation

describe_folder ( strDir,
strParentDir = null,
&$  arrFolders = null 
)

Definition at line 27 of file jsAutoLoad.php.

References $arrFiles, $arrFolders, $strDir, $strFileName, and describe_folder().

00028 {
00029     $arrFiles = array();
00030     if( $arrFolders == null )
00031     {
00032         $arrFolders = array();
00033     }
00034     
00035     if( $strParentDir == null )
00036     {
00037         $strParentDir = $strDir;
00038     }
00039     
00040     $arrDirFiles = scandir( $strDir );
00041     foreach( $arrDirFiles as $strFileName )
00042     {
00043         if( $strFileName[0] == "." )
00044         {
00045             continue;
00046         }
00047         $strDirFolder = $strDir . '/' . $strFileName;
00048         if( is_dir( $strDirFolder ) )
00049         {
00050             $strShortName = str_replace( array( "-" , '+' , ' ' , '.' ), "_" , $strFileName );
00051             $arrFolders[ $strShortName ] = $strDirFolder;
00052             $arrChildFiles = describe_folder( $strDirFolder , $strParentDir , $arrFolders );
00053             $arrFiles = array_merge( $arrFiles , $arrChildFiles );
00054         }
00055         else
00056         {
00057             $strType = ( substr( $strFileName , strpos( $strFileName , "." ) ) );
00058             if( $strType == ".js" )
00059             {
00060                 $strPath = $strDirFolder;
00061                 $strRelative = "." . str_replace( $strParentDir , "", $strPath );
00062                 $strShortName = substr( $strFileName , 0 , -3 );
00063                 $strShortName = str_replace( array( "-" , '+' , ' ' , '.' ), "_" , $strShortName );
00064                 
00065                 $arrFiles[ ucfirst( $strShortName ) ] = $strRelative;
00066             }
00067         }
00068     }
00069     return $arrFiles;
00070 }
00071 ?>
00072 window.autoload = function(){};
00073 
00074 <?php foreach( $arrFiles as $strShortNameFile => $strPathFile ): ?>
00075 window.autoload.<?php print "load" . $strShortNameFile ?> = function <?php print "load" . $strShortNameFile ?>()
00076 {
00077     require_once( "<?php print str_repeat( "../", $intBack ) . $strPathFile ?>" );
00078     return <? print $strShortNameFile ?>;
00079 }


Variable Documentation

$arrDir = explode( "/" , $strDir )

Definition at line 6 of file jsAutoLoad.php.

$arrFiles = ( describe_folder( $strDir , $strBack , $arrFolders ) )

Definition at line 25 of file jsAutoLoad.php.

$arrFolders = array()

Definition at line 24 of file jsAutoLoad.php.

$intBack = isset( $_REQUEST['back'] ) ? $_REQUEST['back'] : 0

Definition at line 9 of file jsAutoLoad.php.

$intDeep = isset( $_REQUEST['deep'] ) ? $_REQUEST['deep'] : 0

Definition at line 8 of file jsAutoLoad.php.

for ($i=0;$i< $intBack;$i++) $strBack = implode( "/" , $arrDir )

Definition at line 21 of file jsAutoLoad.php.

while ($intDeep--) $strDir = __DIR__

Definition at line 2 of file jsAutoLoad.php.

print $strFile = __FILE__

Definition at line 4 of file jsAutoLoad.php.


Generated on Sat Apr 7 14:19:11 2012 for CodeToDiagram by  doxygen 1.5.9