7 private static $config = array();
11 $dbPrefix = $this->getDbPrefix();
12 $result = self::$dbo->exec(
"CREATE TABLE IF NOT EXISTS `{$dbPrefix}config` (
13 `lang` VARCHAR(8) NULL,
14 `key` VARCHAR(64) NOT NULL,
18 if ($result ===
false)
19 throw new \Exception(get_class().
": ".self::$dbo->errorInfo()[2]);
20 self::setConfig(null,
"theme",
"default");
24 public static function setConfig($lang, $key, $value)
26 $fetcher =
new self();
27 $data = $fetcher->selects(array(
"lang" => $lang,
"key" => $key));
33 $data->value = $value;
39 $data->value = $value;
44 public static function getConfig($lang =null, $key =null, $defaultValue =null)
46 $fetcher =
new self();
50 if (isset(self::$config[$_lang]))
51 return isset(self::$config[$_lang][$key]) ? self::$config[$_lang][$key] : $defaultValue;
52 $values = $fetcher->selects(array(
"lang" => $lang));
53 foreach ($values as $i)
54 self::$config[$_lang][$i->key] = $i->value;
56 return (isset(self::$config[$_lang][$key]) ? self::$config[$_lang][$key] : $defaultValue);
static getConfig($lang=null, $key=null, $defaultValue=null)
static setConfig($lang, $key, $value)