first commit

This commit is contained in:
2014-03-26 14:18:20 +08:00
commit 41681f1f18
31 changed files with 4496 additions and 0 deletions

26
engine/Autoloader.class.php Executable file
View File

@ -0,0 +1,26 @@
<?php
class Autoloader {
private static $autoloaderData = array();
public static function addLoadPath( $dir ) {
array_unshift( self::$autoloaderData, $dir);
}
public static function getPathByClassName($className) {
$className = str_replace( array('/','\\') , array('','') , $className );
$file = NULL;
if( self::$autoloaderData ){
foreach (self::$autoloaderData as $path ) {
if( is_file( $path.'/'.$className.'.class.php' ) ){
return $path.'/'.$className.'.class.php';
}
}
}
}
}
function engine_autoload($class_name) {
$path = Autoloader::getPathByClassName($class_name);
if( $path ){
require($path);
}
}
spl_autoload_register("engine_autoload");