
<?php
/*------------------------------------------------------------------*/
if (strtoupper(substr(PHP_OS, 0, 3)) === ’WIN’) {
if(!defined(’NEWLINE’)){
define(’NEWLINE’, " ");
}
} else {
if(!defined(’NEWLINE’)){
define(’NEWLINE’, " ");
}
}
/*------------------------------------------------------------------*/
if(!defined(’HTMLNEWLINE’)){
define(’HTMLNEWLINE’, ’<br/>’);
}
/*------------------------------------------------------------------*/
if(!defined(’CURRENT_TIMESTAMP’)){
define(’CURRENT_TIMESTAMP’, time());
}
if(!defined(’FORMAT_DATE’)){
define(’FORMAT_DATE’, ’Y-m-d’);
}
if(!defined(’TIMESTAMP’)){
define(’TIMESTAMP’, ’Y-m-d H:i:s’);
}
/*------------------------------------------------------------------*/
if(!defined(’SECONDS_HOUR’)){
define(’SECONDS_HOUR’, 3600);
}
if(!defined(’SECONDS_DAY’)){
define(’SECONDS_DAY’, 3600 * 24);
}
if(!defined(’SECONDS_WEEK’)){
define(’SECONDS_WEEK’, 3600 * 24 * 7);
}
?>
<?php
require_once ’Constants.php’;
class Autoload {
/**
* 注册容器,包括路径,类名和文件扩展名容器,可以赋默认值
*/
public $containers = array (
’includePaths’,
’classNames’,
’extensionNames’
);
/*--------- 类搜索路径列表 ------------*/
public $includePaths = array ();
/*--------- 类名称列表 ------------*/
public $classNames = array ();
/*--------- 类文件扩展名列表 ------------*/
public $extensionNames = array ();
public function __construct() { /* 默认搜索路径 */
array_push( $this->includePaths, ’.’, ’lib’, ’classes’);
/* 默认扩展名列表 */
array_push( $this->extensionNames, ’.php’,’.class.php’);
/* 自动加载函数注册 */
if (method_exists( $this, ’__autoload’)) {
spl_autoload_register(array( $this, ’__autoload’));
}
} /**