context == null) { } return $this->context; } /** * Returns a URL Writer used to parse/generate URLs * @return UrlWriter */ function GetRouter() { if ($this->router == null) { require_once("verysimple/Phreeze/GenericRouter.php"); $this->router = new GenericRouter(self::$ROOT_URL, self::GetDefaultAction(), self::$ROUTE_MAP); } return $this->router; } /** * Returns the requested action requested by the user * @return string */ function GetAction() { list($controller,$method) = $this->GetRouter()->GetRoute(); return $controller . '.' . $method; } /** * Returns the default action if none is specified by the user * @return string */ function GetDefaultAction() { return self::$DEFAULT_ACTION; } /** * Returns the Phreezer persistence layer * @return Phreezer */ function GetPhreezer() { if ($this->phreezer == null) { if (!self::$CONVERT_NULL_TO_EMPTYSTRING) { require_once("verysimple/DB/DatabaseConfig.php"); DatabaseConfig::$CONVERT_NULL_TO_EMPTYSTRING = false; } if (self::$DEBUG_MODE) { require_once("verysimple/Phreeze/ObserveToSmarty.php"); $observer = new ObserveToSmarty($this->GetRenderEngine()); $this->phreezer = new Phreezer(self::$CONNECTION_SETTING, $observer); } else { $this->phreezer = new Phreezer(self::$CONNECTION_SETTING); } if (self::$LEVEL_2_CACHE) { $this->phreezer->SetLevel2CacheProvider(self::$LEVEL_2_CACHE, self::$LEVEL_2_CACHE_TEMP_PATH); $this->phreezer->ValueCacheTimeout = self::$LEVEL_2_CACHE_TIMEOUT; } } return $this->phreezer; } /** * @return IRenderEngine */ function GetRenderEngine() { if ($this->render_engine == null) { $engine_class = self::$TEMPLATE_ENGINE; if (!class_exists($engine_class)) { require_once 'verysimple/Phreeze/' . $engine_class . '.php'; } $this->render_engine = new $engine_class(self::$TEMPLATE_PATH, self::$TEMPLATE_CACHE_PATH); $this->render_engine->assign("ROOT_URL", self::$ROOT_URL); $this->render_engine->assign("PHREEZE_VERSION", Phreezer::$Version); $this->render_engine->assign("PHREEZE_PHAR", Phreezer::PharPath()); } return $this->render_engine; } }