示例#1
0
 function &factory($name)
 {
     $name = empty($name) ? APPLICATION_DEFAULT_PAGE : $name;
     include_once $file = PAGE_FACTORY_SEARCH_DIR . $name . '.php';
     if (!class_exists($classname = 'Page_' . basename($file, '.php'))) {
         if ($name == APPLICATION_404_PAGE) {
             return PEAR::raiseError(null, PAGE_FACTORY_ERROR_NOT_FOUND, null, null, null, 'PageFactory_Error', true);
         } else {
             HTTP_Header::redirect(SAURL::url(APPLICATION_404_PAGE));
             exit;
         }
     }
     $obj =& new $classname();
     return $obj;
 }