private static function initCache() { Settings::$cache = array(); $settings = Setting::model()->findAll(); foreach ($settings as $setting) { Settings::$cache[$setting->key] = $setting->value; } }
public static function get() { if (!self::$cache) { $json = file_get_contents(ROOTDIR . "/src/server/settings.json"); $json = str_replace("%DROOT%", ROOTDIR, $json); self::$cache = (array) json_decode($json, true); } return self::$cache; }
public static function get() { if (!self::$cache) { $json = file_get_contents(ROOTDIR . "/src/server/settings.json"); $root = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? str_replace('\\', '/', ROOTDIR) : ROOTDIR; $json = str_replace("%DROOT%", $root, $json); self::$cache = (array) json_decode($json, true); } return self::$cache; }
public static function get() { if (!self::$cache) { $json = <<<EOJSON %JSON% EOJSON; self::$cache = (array) json_decode($json, true); } return self::$cache; }
public static function get() { if (!self::$cache) { $json = <<<EOJSON %JSON% EOJSON; $root = dirname(dirname(__DIR__)); $json = str_replace("%DROOT%", $root, $json); self::$cache = (array) json_decode($json, true); } return self::$cache; }