Esempio n. 1
0
 /**
  * Loads a configuration in INI format from file.
  * @param string $file
  * @throws Exception
  */
 public function loadFromFile($file)
 {
     $this->settings = if_parse_ini_file($file);
     if ($this->settings === false) {
         throw new Exception("Can't load settings from file: {$file}");
     }
     $this->filepath = $file;
     return true;
 }
Esempio n. 2
0
 /**
  * Gets all existing(configured) locales.
  * @return array<IF_Locale> list with locales
  */
 public function getAvailableLocales()
 {
     // Open the index.cfg file and check which locales are available.
     $ret = array();
     $f = $this->trDirectory . $this->indexFile;
     if (file_exists($f)) {
         $data = if_parse_ini_file($f);
         $dataLen = count($data);
         foreach ($data as $section => &$kv) {
             $o = new IF_Locale();
             $o->locale = $section;
             $o->name = $kv["name"];
             $o->author = $kv["author"];
             array_push($ret, $o);
         }
     }
     return $ret;
 }