static function load()
 {
     global $Opt;
     if (!self::$loaded) {
         self::$loaded = true;
         foreach (expand_includes("src/sa/*.php") as $f) {
             include $f;
         }
         if (isset($Opt["searchaction_include"]) && $Opt["searchaction_include"]) {
             read_included_options($Opt["searchaction_include"]);
         }
     }
 }
 private static function load()
 {
     global $ConfSitePATH, $Opt;
     self::$messages = array();
     self::load_one("{$ConfSitePATH}/src/messages.csv");
     if ($lang = opt("lang")) {
         self::load_one("{$ConfSitePATH}/src/messages.{$lang}.csv");
     }
     self::load_one("{$ConfSitePATH}/conf/messages-local.csv");
     if ($lang) {
         self::load_one("{$ConfSitePATH}/conf/messages-local.{$lang}.csv");
     }
     if (opt("messages_include")) {
         foreach (expand_includes($Opt["messages_include"], ["lang" => $lang]) as $f) {
             self::load_one($f);
         }
     }
 }
Exemple #3
0
function psets_json_data($exclude_overrides)
{
    global $Conf, $ConfSitePATH, $Opt;
    $datamap = array();
    $fnames = expand_includes($ConfSitePATH, $Opt["psetsConfig"], ["CONFID" => @$Opt["confid"] ?: @$Opt["dbName"], "HOSTTYPE" => @$Opt["hostType"] ?: ""]);
    foreach ($fnames as $fname) {
        $datamap[$fname] = @file_get_contents($fname);
    }
    if (!$exclude_overrides && ($override_data = $Conf->setting_data("psets_override"))) {
        $datamap["<overrides>"] = $override_data;
    }
    return $datamap;
}
 static function option_json_list(Conf $c = null)
 {
     global $Conf, $Opt;
     if (self::$jlist === null) {
         self::$jlist = self::$jmap = [];
         $c = $c ?: $Conf;
         if ($optj = $c->setting_json("options")) {
             self::add_json($optj, false, "settings");
         }
         if (isset($Opt["optionsInclude"])) {
             $options_include = $Opt["optionsInclude"];
             if (!is_array($options_include)) {
                 $options_include = array($options_include);
             }
             foreach ($options_include as $k => $oi) {
                 if (preg_match(',\\A\\s*\\{\\s*\\",s', $oi)) {
                     self::add_json($oi, true, "include entry {$k}");
                 } else {
                     foreach (expand_includes($oi) as $f) {
                         if ($x = file_get_contents($f)) {
                             self::add_json($x, true, $f);
                         }
                     }
                 }
             }
         }
         uasort(self::$jlist, ["PaperOption", "compare"]);
     }
     return self::$jlist;
 }
 public static function initialize()
 {
     global $ConfSitePATH, $Opt;
     $fname = "{$ConfSitePATH}/src/settinginfo.json";
     $info = self::read([], file_get_contents($fname), $fname);
     if (isset($Opt["settinginfo_include"]) && ($settinginfo_include = $Opt["settinginfo_include"])) {
         if (!is_array($settinginfo_include)) {
             $settinginfo_include = array($settinginfo_include);
         }
         foreach ($settinginfo_include as $k => $si) {
             if (preg_match(',\\A\\s*\\{\\s*\\",s', $si)) {
                 $info = self::read($info, $si, "include entry {$k}");
             } else {
                 foreach (expand_includes($si) as $f) {
                     if ($x = file_get_contents($f)) {
                         $info = self::read($info, $x, $f);
                     }
                 }
             }
         }
     }
     foreach ($info as $k => $v) {
         if (isset($v["require"])) {
             foreach (expand_includes($v["require"]) as $f) {
                 require_once $f;
             }
         }
         $class = "Si";
         if (isset($v["info_class"])) {
             $class = $v["info_class"];
         }
         self::$all[$k] = new $class($k, (object) $v);
     }
 }
function read_included_options(&$files)
{
    global $Opt;
    if (is_string($files)) {
        $files = [$files];
    }
    for ($i = 0; $i != count($files); ++$i) {
        foreach (expand_includes($files[$i]) as $f) {
            if (!@(include $f)) {
                $Opt["missing"][] = $f;
            }
        }
    }
}
Exemple #7
0
function psets_json_data($exclude_overrides)
{
    global $Conf;
    $datamap = array();
    $fnames = expand_includes($Conf->opt("psetsConfig"), ["CONFID" => $Conf->opt("confid") ?: $Conf->dbname, "HOSTTYPE" => $Conf->opt("hostType", "")]);
    foreach ($fnames as $fname) {
        $datamap[$fname] = @file_get_contents($fname);
    }
    if (!$exclude_overrides && ($override_data = $Conf->setting_data("psets_override"))) {
        $datamap["<overrides>"] = $override_data;
    }
    return $datamap;
}