diff options
Diffstat (limited to 'app/classes/PlanetConfig.php')
-rw-r--r-- | app/classes/PlanetConfig.php | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/app/classes/PlanetConfig.php b/app/classes/PlanetConfig.php index 2509e00..13e1cc6 100644 --- a/app/classes/PlanetConfig.php +++ b/app/classes/PlanetConfig.php @@ -3,73 +3,85 @@ /** * Planet configuration class */ -class PlanetConfig{ - var $conf; +class PlanetConfig +{ - function __construct($array){ - $defaultConfig = Array( - 'url' => 'http://www.example.com/', - 'name' => '', - 'items' => 10, - 'shuffle' => 0, - 'refresh' => 240, - 'cache' => 10, - 'nohtml' => 0, + public $conf; + + public function __construct($array) + { + $defaultConfig = array( + 'url' => 'http://www.example.com/', + 'name' => '', + 'items' => 10, + 'shuffle' => 0, + 'refresh' => 240, + 'cache' => 10, + 'nohtml' => 0, 'postmaxlength' => 0, - 'cachedir' => './cache' + 'cachedir' => './cache', ); - //User config + // User config $this->conf = $array; - //Complete config with default config - foreach ($defaultConfig as $key => $value){ - if (!isset($this->conf[$key])){ + // Complete config with default config + foreach ($defaultConfig as $key => $value) { + if (!isset($this->conf[$key])) { $this->conf[$key] = $value; } } } - function getUrl(){ + public function getUrl() + { return $this->conf['url']; } - function getName(){ + public function getName(){ return $this->conf['name']; } - function setName($name){ + public function setName($name) + { $this->conf['name'] = $name; } - function getCacheTimeout(){ + public function getCacheTimeout() + { return $this->conf['refresh']; } - function getOutputTimeout(){ + public function getOutputTimeout() + { return $this->conf['cache']; } //@TODO: drop this pref - function getShuffle(){ + public function getShuffle() + { return $this->conf['shuffle']; } - function getMaxDisplay(){ + public function getMaxDisplay() + { return $this->conf['items']; } //@TODO: drop this pref - function getNoHTML(){ + public function getNoHTML() + { return $this->conf['nohtml']; } //@TODO: drop this pref - function getPostMaxLength(){ + public function getPostMaxLength() + { return $this->conf['postmaxlength']; } - function toYaml(){ + public function toYaml() + { return Spyc::YAMLDump($this->conf,4); } -}
\ No newline at end of file +} |