/** * Factory pattern to return the named controller * * @param string $controller - should be an underscored word * @param array $params - paramaters to pass to the controller factory * @return object */ static function &factory($controller, $params = null) { $ret = false; $file = NController::getIncludePath($controller); if (!$file) { NController::debug("Controller file not found for '{$controller}'", N_DEBUGTYPE_ASSET, PEAR_LOG_ERR); return $ret; } include_once $file; $class = NController::getClassName($controller); if (class_exists($class)) { $ret = new $class($params); } return $ret; }