/** * Initialise the config object * * Will check the file extension of your config filename and load up a specific parser * @param string $p_sConfigFile The config filename * @param array $p_aOptions The options * * @return void */ function __construct($p_sConfigFile, $p_aOptions = array()) { if (!file_exists(CONFIGPATH . $p_sConfigFile)) { die('Unable to find <b>' . CONFIGPATH . $p_sConfigFile . '</b> file, please check your application configuration'); } $ext = PPI_Helper::getFileExtension($p_sConfigFile); $block = isset($p_aOptions['block']) ? $p_aOptions['block'] : 'development'; switch ($ext) { case 'ini': $this->_oConfig = new PPI_Config_Ini(parse_ini_file(CONFIGPATH . $p_sConfigFile, true), $block); break; case 'xml': die('Trying to load a xml config file but no parser yet created.'); break; case 'php': die('Trying to load a php config file but no parser yet created.'); break; } }
/** * Read the config file, only ini type implemented * * @todo Implement XML and PHP config files * @return void */ function readConfig() { global $siteTypes; if (!file_exists(CONFIGPATH . $this->_configFile)) { die('Unable to find ' . $this->_configFile . ' file, please check your application configuration'); } $ext = PPI_Helper::getFileExtension($this->_configFile); $sHostname = getHTTPHostname(); $siteType = array_key_exists($sHostname, $siteTypes) ? $siteTypes[$sHostname] : 'development'; switch ($ext) { case 'ini': $this->_oConfig = new PPI_Config_Ini(parse_ini_file(CONFIGPATH . $this->_configFile, true), $siteType); break; case 'xml': die('Trying to load a xml config file but no parser yet created.'); break; case 'php': die('Trying to load a php config file but no parser yet created.'); break; } }