public function getController2() { $route = pathinfo(Request::getVar("route9sd3jdk3", "GET") . "/1.1"); unset($_GET["route9sd3jdk3"]); $route = $route["dirname"]; $route = preg_replace("/index\\.php\$/i", "", $route); $route = preg_replace("/\\/\$/", "", $route); if (($rm = RoadMap::get()) != NULL) { $found = false; $i = 0; $matches = array(); for (; !$found && $i < count($rm); $i++) { $found = preg_match_all("/^" . addcslashes($rm[$i]["url"], "/") . "\$/", $route, $matches); } if ($found && $rm[$i - 1]["hasPage"] != 0) { $name = ucfirst($rm[$i - 1]["ctrl"]); $ctrl = Class_routines::loadClass(__ROOT_PATH . DS . "controller" . DS . "ctrl" . $name . ".class.php"); Registry::set("controllerParams", array("route" => $route, "XHROnly" => $rm[$i - 1]["XHROnly"])); Registry::set("viewName", $name); Registry::set("controller", new $ctrl()); Registry::set("route:params", $matches); return Registry::get("controller"); } else { self::raiseException(!$found ? ERR_ROUTER_NO_ROUTE_FOUND : ERR_ROUTE_IS_NOT_LEAF, $route); return NULL; } } }
protected function _turnPluginsOn() { if (strlen(trim(Config::PLUGINS)) < 1) { return; } /* else */ $plugins = explode(",", Config::PLUGINS); for ($i = 0; $i < count($plugins); $i++) { $pluginName = Class_routines::loadClass(__ROOT_PATH . DS . "plugin" . DS . "plg" . $plugins[$i] . ".class.php"); $plugin = new $pluginName(); //print_r( $plugin ); foreach ($plugin->whatEventWannaListen() as $eventType) { $this->addObserver($plugin, $eventType); } } }
protected function _getView($viewName) { if (is_string($viewName)) { if (!in_array($viewName, $this->_views)) { $viewPath = __ROOT_PATH . DS . "view" . DS . $viewName . DS . "view" . $viewName . ".class.php"; if (($viewName = Class_routines::loadClass($viewPath)) !== NULL) { $this->_views[$viewName] = new $viewName(); } else { return NULL; } } return $this->_views[$viewName]; } else { $this->raiseException(ERR_PLUGIN_BASE_BAD_VIEW_NAME, $viewName); return NULL; } }
protected function _compileComponent($name, $attr = NULL) { $compPath = __ROOT_PATH . DS . "component" . DS . "comp" . ucfirst($name) . ".class.php"; $className = Class_routines::loadClass($compPath); if ($className != NULL) { $comp = new $className($this->_params === NULL ? NULL : $this->_params[$name]); //if ( $name == "siteCatalogRightPanel" ) die( "1" ); $t = $comp->getTree($attr); return $t; } else { $this->raiseException(ERR_VIEW_COMPONENT_NOTFOUND, $name); return false; } }