コード例 #1
0
 /**
  * Parse a json containing the lookup table.
  *
  * @return void
  */
 private function _fromJSON()
 {
     $uri = $this->_config->get('paths/lookup');
     try {
         $fileContent = $this->_vfs->file_get_contents($uri);
         $temp = json_decode($fileContent, true);
         self::$lookup = $temp['lookupTable'];
     } catch (Exception $e) {
         throw new KiTT_Exception($e->getMessage(), $e->getCode());
     }
 }
コード例 #2
0
 /**
  * Assemble all possible paths for the wanted template
  *
  * @param string $name template name
  *
  * @return array
  */
 private function _templatePaths($name)
 {
     $basepaths = array();
     try {
         $basepaths[] = $this->_config->get('paths/extra_templates');
     } catch (KiTT_MissingConfigurationException $e) {
     }
     $basepaths[] = $this->_vfs->join($this->_config->get('paths/kitt'), 'html');
     $paths = array();
     foreach ($basepaths as $index => $basepath) {
         $paths[] = $this->_vfs->join($basepath, strtolower($this->_locale->getCountryCode()), $name);
         $paths[] = $this->_vfs->join($basepath, $name);
     }
     return $paths;
 }
コード例 #3
0
 /**
  * Get the default country from the config.
  *
  * @return iso-3166-alpha-2 code or null if none is present
  */
 private function _getDefaultCountry()
 {
     try {
         return $this->_config->get('default');
     } catch (KiTT_MissingConfigurationException $e) {
         return null;
     }
 }
コード例 #4
0
 /**
  * Constructor
  *
  * @param KiTT_Config $config configuration
  */
 public function __construct(KiTT_Config $config)
 {
     $module = $config->get("module");
     $version = $config->get("version");
     $this->VERSION = "PHP:{$module}:{$version}";
 }
コード例 #5
0
 /**
  * Create language pack
  *
  * @param KiTT_Config $config configuration
  * @param KiTT_VFS    $vfs    vfs object
  */
 public function __construct(KiTT_Config $config, KiTT_VFS $vfs)
 {
     $this->_config = $config;
     $path = $this->_config->get('paths/lang');
     $this->_xml = simplexml_load_string(utf8_encode($vfs->file_get_contents($path)));
 }