Beispiel #1
0
 /**
  * Инициализация конфига
  * @param string $name имя шаблона, если указано - возвращается список всех
  * переменных
  * @param string $var необходимая переменная
  * @return string|array родительский шаблон или список всех переменных
  */
 public function init_cfg($name = null, $var = 'style_parent')
 {
     $f = 'main.conf';
     $var = $var ? $var : null;
     if ($name) {
         $tpldir = ROOT . THEMES_PATH . '/' . $name;
         if (!class_exists('Config_File', false)) {
             include_once SMARTY_DIR . 'Config_File.class.php';
         }
         $cfg = new Config_File($tpldir);
         $cfg->load_file($f);
         $vars = $cfg->get($f, null, $var);
         unset($cfg);
         // Destruct f*cking class
         return $vars;
     }
     if (!$this->conf_inited) {
         $this->config_load($f);
         $this->conf_inited = true;
     }
     return $this->get_config_vars($var);
 }
function getErrorMessage($key)
{
    global $smarty, $config;
    include_once $config['smartyBase'] . 'Config_File.class.php';
    $path = $config['skinBase'] . $config['skin'] . '/' . $config['language'];
    $file = 'edit_thesaurus.conf';
    $cf = new Config_File($path);
    $message = $cf->get($file, null, $key);
    if (!$message) {
        $message = "[[{$key}]]";
    }
    return $message;
}
Beispiel #3
0
$out = fopen($newFile, "wb");
if (!$out) {
    die("could not write into: {$newFile}");
}
$section = NULL;
foreach ($eng as $line) {
    if (preg_match('/"{3}/', $line)) {
        die('please do not use multiline (""")');
    } elseif (preg_match('/^([^=]+)=\\s*(.*)/', $line, $m)) {
        $key = trim($m[1]);
        $val = trim($m[2]);
        //print("$section: $key = $val\n");
        if ($langConf && $key) {
            //$transl = utf8_encode($langConf->get("$lang.conf", $section, $key));
            //print_r($transl);
            $transl = $langConf->get("{$lang}.conf", $section, $key);
        } else {
            $transl = NULL;
        }
        if (!empty($transl) && !is_array($transl)) {
            $newLine = "{$key} = {$transl}\n";
        } elseif (empty($val)) {
            $newLine = "{$key} = \n";
        } else {
            $newLine = "{$key} = {$val} (*)\n";
            print "Missing translation: [{$section}] {$key}\n";
        }
    } else {
        if (preg_match('/^\\[(.*?)\\]/', $line, $m)) {
            $section = $m[1];
        } else {