/** * Class constructor * * @param array $p_attributes */ private function __construct($p_attributes = array()) { $this->m_config = CampConfig::singleton(); if (isset($p_attributes['type'])) { $this->m_type = $p_attributes['type']; } else { $this->m_type = 'html'; } if (isset($p_attributes['charset'])) { $this->m_charset = $p_attributes['charset']; } else { $this->m_charset = 'utf-8'; } if (isset($p_attributes['language'])) { $this->m_language = $p_attributes['language']; } //set default document metadata $this->setMetaTag('Content-Type', $this->m_mime.'; charset='.$this->m_charset, true); $this->setMetaTag('robots', 'index, follow'); } // fn __construct
protected function getDefaultSiteName() { $defaultAlias = new Alias($this->m_dbObject->getDefaultAliasId()); if (!$defaultAlias->exists()) { return null; } $subdir = CampConfig::singleton()->getSetting('SUBDIR'); return $defaultAlias->getName() . $subdir; }
/** * Returns a CampConfig instance. * * @return object * A CampConfig instance */ public static function GetConfigInstance() { return CampConfig::singleton(); } // fn GetConfig
/** * Class constructor * * @param string $p_uri * The full URI string */ public function __construct($p_uri = 'SELF') { $this->m_config = CampConfig::singleton(); if (isset($p_uri) && $p_uri != 'SELF') { $uriString = $p_uri; } else { // ... otherwise we build the uri from the server itself. // // checks whether the site is being queried through SSL if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) { $scheme = 'https://'; } else { $scheme = 'http://'; } // this works at least for apache, some research is needed // in order to support other web servers. if (!empty($_SERVER['PHP_SELF'])) { $uriString = $scheme . $_SERVER['HTTP_HOST']; } if (isset($_SERVER['REQUEST_URI'])) { $uriString .= $_SERVER['REQUEST_URI']; } // some cleaning directives $uriString = urldecode($uriString); $uriString = str_replace('"', '"', $uriString); $uriString = str_replace('<', '<', $uriString); $uriString = str_replace('>', '>', $uriString); $uriString = preg_replace('/eval\((.*)\)/', '', $uriString); $uriString = preg_replace('/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', $uriString); } $this->parse($uriString); $this->m_queryArray = array_merge($this->m_queryArray, CampRequest::GetInput('POST')); $this->readUser(); } // fn __construct
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $this->m_configObj = CampConfig::singleton(); }
/** * Gets a setting var value from configuration. * * @param string * $p_varName The name of the setting variable * * @return mixed * null Var name passed is no valid * mixed The value of the setting variable */ public function getSetting($p_varName) { if (empty($p_varName)) { return null; } $settingVar = CampConfig::TranslateSettingName($p_varName); if (!$settingVar) { return array_key_exists($p_varName, $this->m_config) ? $this->m_config[$p_varName] : null; } $varname = $settingVar['varname']; $namespace = $settingVar['namespace']; if (!isset($this->m_config[$namespace]) || !is_array($this->m_config[$namespace]) || !array_key_exists($varname, $this->m_config[$namespace])) { return null; } return $this->m_config[$namespace][$varname]; }