<? PHP
/**
* Define the factroy class
*
* @ Author: Bear
* @ Package: Core
* @ Copyright: NULL
* @ Version: $ ID: factory. Class. php 09:50:00 $
*/
Class Factory
{
/**
* Load the specified object and return the object instance
*
* @ Author: Bear
* @ Param: String $ name
* @ Param: String $ method null
* @ Param: array $ Param null
* @ Return: Object
*/
Public static function GetObject ($ name, $ method = NULL, $ Param = array ())
{
$ Name = strval ($ name );
If (empty ($ name )){
Union: _ Throw ('the getobjcet method Param: $ name is not value! ');
Return false;
}
$ Incfile = libs_path. "{$ name}. Class. php ";
If (! File_exists ($ incfile )){
Union: _ Throw ('the GetObject method file ['. $ incfile.'] is not exists! ');
Return false;
}
Require_once ($ incfile );
$ OBJ = new $ name;
If (! Is_null ($ method )){
$ P = NULL;
If (! Empty ($ PARAM )){
$ P = "'". Split ("', '", $ PARAM )."'";
}
$ Obj-> $ method ($ P );
}
Return $ OBJ;
}
}
/**
* The application obtains the smarty object handle.
* In the folder, the TPL. Class. php file must exist.
*/
$ TPL = Factory: GetObject ('tpl ');
?>