32 lines
759 B
PHP
32 lines
759 B
PHP
<?php
|
|
# ########################################
|
|
# File: package.php
|
|
# Description:
|
|
# Namespace Package Loader
|
|
#
|
|
# Created on: 22 July 2014
|
|
# Last Modified: Tue 22 Jul 2014 02:37:14 PM HKT
|
|
# by: penguin
|
|
# ##################
|
|
|
|
IF( !function_exists( '___astropenguin_autoload' ) ):
|
|
|
|
define( "_APPATH_", dirname( __FILE__ ) . '/' );
|
|
|
|
function ___astropenguin_autoload( $classname )
|
|
{
|
|
if( strncmp( $classname, 'astropenguin\\', 12 ) === 0 )
|
|
{
|
|
$classfile = str_replace( '\\', '/', substr( $classname, 12 ) );
|
|
$result = @include_once _APPATH_ . $classfile . '.php';
|
|
if( !$result )
|
|
{
|
|
trigger_error( "Failed to include $classfile" );
|
|
}
|
|
}
|
|
}
|
|
|
|
spl_autoload_register( '___astropenguin_autoload' );
|
|
|
|
ENDIF;
|