jsAutoLoad.js.php File Reference

Go to the source code of this file.

Functions

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

Variables

 $strDir = __FILE__
 $arrDir = explode( "/" , $strDir )
 $intDeep = isset( $_REQUEST['deep'] ) ? $_REQUEST['deep'] : 0
 $intBack = isset( $_REQUEST['back'] ) ? $_REQUEST['back'] : 0
 print
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 28 of file jsAutoLoad.js.php.

References $arrFiles, $arrFolders, $strDir, and $strFileName.

Referenced by describe_folder().

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


Variable Documentation

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

Definition at line 6 of file jsAutoLoad.js.php.

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

Definition at line 26 of file jsAutoLoad.js.php.

Referenced by describe_folder().

$arrFolders = array()

Definition at line 25 of file jsAutoLoad.js.php.

Referenced by describe_folder().

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

Definition at line 10 of file jsAutoLoad.js.php.

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

Definition at line 9 of file jsAutoLoad.js.php.

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

Definition at line 22 of file jsAutoLoad.js.php.

while ($intDeep--) $strDir = __FILE__

__dir__ dont work in production server

Definition at line 5 of file jsAutoLoad.js.php.

Referenced by describe_folder().


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