diff options
author | nashe <thomas@chauchefoin.fr> | 2017-05-28 13:49:56 +0200 |
---|---|---|
committer | nashe <thomas@chauchefoin.fr> | 2017-05-28 13:49:56 +0200 |
commit | b3610f17ef53dd3b3455614263ffd809843b101c (patch) | |
tree | 98eae966c33b1abc3e1f606f9953a9a40ebfe35e /app/classes/PlanetConfig.php | |
parent | b3274cae04bc319c71d9d2037384480e8f8dc43c (diff) | |
download | planet-b3610f17ef53dd3b3455614263ffd809843b101c.tar planet-b3610f17ef53dd3b3455614263ffd809843b101c.tar.gz planet-b3610f17ef53dd3b3455614263ffd809843b101c.tar.bz2 planet-b3610f17ef53dd3b3455614263ffd809843b101c.tar.xz planet-b3610f17ef53dd3b3455614263ffd809843b101c.zip |
Move the debug directive to configuration file
Diffstat (limited to 'app/classes/PlanetConfig.php')
-rw-r--r-- | app/classes/PlanetConfig.php | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/app/classes/PlanetConfig.php b/app/classes/PlanetConfig.php index 709bc2e..18ffabd 100644 --- a/app/classes/PlanetConfig.php +++ b/app/classes/PlanetConfig.php @@ -8,27 +8,29 @@ class PlanetConfig public $conf; + protected static $defaultConfig = array( + 'url' => 'http://www.example.com/', + 'name' => '', + 'locale' => 'en', + 'items' => 10, + 'shuffle' => 0, + 'refresh' => 240, + 'cache' => 10, + 'nohtml' => 0, + 'postmaxlength' => 0, + 'categories' => '', + 'cachedir' => './cache', + 'debug' => false + ); + public function __construct($array) { - $defaultConfig = array( - 'url' => 'http://www.example.com/', - 'name' => '', - 'locale' => 'en', - 'items' => 10, - 'shuffle' => 0, - 'refresh' => 240, - 'cache' => 10, - 'nohtml' => 0, - 'postmaxlength' => 0, - 'cachedir' => './cache', - ); - // User config $this->conf = $array; // Complete config with default config - foreach ($defaultConfig as $key => $value) { - if (!isset($this->conf[$key])) { + foreach (self::$defaultConfig as $key => $value) { + if (!array_key_exists($key, $this->conf)) { $this->conf[$key] = $value; } } @@ -91,6 +93,11 @@ class PlanetConfig return Spyc::YAMLDump($this->conf,4); } + public function getDebug() + { + return $this->conf['debug']; + } + /** * Generic accessor for config. */ |