/** * Class constructor * * @param string $p_uri * The full URI string */ public function __construct($p_uri = null) { parent::__construct($p_uri); try { $this->setURLType(URLTYPE_SHORT_NAMES); // HUGE TODO: rewrite this - remove globals controller usage! if (array_key_exists('controller', $GLOBALS)) { if (is_object($GLOBALS['controller'])) { $this->setURL($GLOBALS['controller']->getRequest()); } else { $this->setURLFromSymfony(Zend_Registry::get('container')->getService('request')); } } else { $this->setURL(new Zend_Controller_Request_Http()); } $this->m_validURI = true; $this->validateCache(false); } catch (Exception $e) { $this->m_validURI = false; $this->m_errorCode = $e->getCode(); if (!is_null($this->m_publication)) { $tplId = CampSystem::GetInvalidURLTemplate($this->m_publication->identifier, null, null, !$this->m_preview); $themePath = $this->getThemePath(); $tplId = substr($tplId, strlen($themePath)); $template = new MetaTemplate($tplId, $themePath); if ($template->defined()) { $this->m_template = $template; } CampTemplate::singleton()->config_dir = APPLICATION_PATH . '/../themes/' . $themePath . '_conf'; } CampTemplate::singleton()->trigger_error($e->getMessage()); } }
/** * Class constructor * * @param string $p_uri * The requested URI */ public function __construct($p_uri = null) { parent::__construct($p_uri); $this->setURLType(URLTYPE_TEMPLATE_PATH); $subdir = $this->m_config->getSetting('SUBDIR'); $this->m_templatesPrefix = empty($subdir) ? 'tpl' : substr($subdir, 1) . '/tpl'; $res = $this->setURL(); if (PEAR::isError($res)) { $this->m_validURI = false; $this->m_errorCode = $res->getCode(); if ($this->m_errorCode == self::INVALID_TEMPLATE && !is_null($this->m_publication)) { $tplId = CampSystem::GetInvalidURLTemplate($this->m_publication->identifier, null, null, !$this->m_preview); $template = new MetaTemplate($tplId); if ($template->defined()) { $this->m_template = $template; } } CampTemplate::singleton()->trigger_error($res->getMessage()); } else { foreach (CampURITemplatePath::$m_restrictedParameters as $parameter) { $this->setQueryVar($parameter); } $this->m_validURI = true; } $this->validateCache(false); }
/** * Class constructor * * @param string $p_uri * The full URI string */ public function __construct($p_uri = null) { parent::__construct($p_uri); $this->setURLType(URLTYPE_SHORT_NAMES); $res = $this->setURL(); if (PEAR::isError($res)) { $this->m_validURI = false; $this->m_errorCode = $res->getCode(); if (!is_null($this->m_publication)) { $tplId = CampSystem::GetInvalidURLTemplate($this->m_publication->identifier); $template = new MetaTemplate($tplId); if ($template->defined()) { $this->m_template = $template; } } CampTemplate::singleton()->trigger_error($res->getMessage()); } else { $this->m_validURI = true; } $this->validateCache(false); } // fn __construct
/** * Class constructor * * @param string $p_uri * The full URI string */ public function __construct($p_uri = null) { parent::__construct($p_uri); try { $this->setURLType(URLTYPE_SHORT_NAMES); $this->setURL($GLOBALS['controller']->getRequest()); $this->m_validURI = true; $this->validateCache(false); } catch (Exception $e) { $this->m_validURI = false; $this->m_errorCode = $e->getCode(); if (!is_null($this->m_publication)) { $tplId = CampSystem::GetInvalidURLTemplate($this->m_publication->identifier, null, null, !$this->m_preview); $themePath = $this->getThemePath(); $tplId = substr($tplId, strlen($themePath)); $template = new MetaTemplate($tplId, $themePath); if ($template->defined()) { $this->m_template = $template; } } CampTemplate::singleton()->trigger_error($e->getMessage()); } }
/** * */ public function getTemplate($p_templateIdOrName = null) { if (!is_null($this->m_template)) { return $this->m_template->name; } if (!empty($p_templateIdOrName)) { $tplObj = new MetaTemplate($p_templateIdOrName); if (!$tplObj->defined()) { $template = CampSystem::GetInvalidURLTemplate($this->publication->identifier, $this->issue->number, $this->language->number, !$this->m_preview); $template = substr($template, strlen($this->getThemePath())); } else { $template = $tplObj->name; } } elseif (is_null($this->m_errorCode)) { $template = CampSystem::GetTemplate($this->language->number, $this->publication->identifier, $this->issue->number, $this->section->number, $this->article->number); if (is_null($template)) { $template = CampSystem::GetInvalidURLTemplate($this->publication->identifier, $this->issue->number, $this->language->number, !$this->m_preview); } $template = substr($template, strlen($this->getThemePath())); } else { return null; } $filePath = CS_PATH_TEMPLATES . DIR_SEP . $this->getThemePath() . $template; if (!file_exists($filePath)) { return null; } return $template; }