summaryrefslogtreecommitdiffstats
path: root/common/app/classes/PlanetConfig.php
diff options
context:
space:
mode:
authorDamien Lallement <dams@mageia.org>2012-08-13 10:45:23 +0000
committerDamien Lallement <dams@mageia.org>2012-08-13 10:45:23 +0000
commitff32e499745367b816d10f25e63ff3328214c32f (patch)
tree238d19398f5951d69d32c8ed9a460f5193446981 /common/app/classes/PlanetConfig.php
parent5bed2fb79d7b554dd90d2eb58422cfa649aebe08 (diff)
downloadplanet-ff32e499745367b816d10f25e63ff3328214c32f.tar
planet-ff32e499745367b816d10f25e63ff3328214c32f.tar.gz
planet-ff32e499745367b816d10f25e63ff3328214c32f.tar.bz2
planet-ff32e499745367b816d10f25e63ff3328214c32f.tar.xz
planet-ff32e499745367b816d10f25e63ff3328214c32f.zip
- Import moonmoon
- Create repo per langs
Diffstat (limited to 'common/app/classes/PlanetConfig.php')
-rw-r--r--common/app/classes/PlanetConfig.php88
1 files changed, 88 insertions, 0 deletions
diff --git a/common/app/classes/PlanetConfig.php b/common/app/classes/PlanetConfig.php
new file mode 100644
index 0000000..a31938e
--- /dev/null
+++ b/common/app/classes/PlanetConfig.php
@@ -0,0 +1,88 @@
+<?php
+
+/**
+ * Planet configuration class
+ */
+class PlanetConfig
+{
+
+ public $conf;
+
+ 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])) {
+ $this->conf[$key] = $value;
+ }
+ }
+ }
+
+ public function getUrl()
+ {
+ return $this->conf['url'];
+ }
+
+ public function getName(){
+ return $this->conf['name'];
+ }
+
+ public function setName($name)
+ {
+ $this->conf['name'] = $name;
+ }
+
+ public function getCacheTimeout()
+ {
+ return $this->conf['refresh'];
+ }
+
+ public function getOutputTimeout()
+ {
+ return $this->conf['cache'];
+ }
+
+ //@TODO: drop this pref
+ public function getShuffle()
+ {
+ return $this->conf['shuffle'];
+ }
+
+ public function getMaxDisplay()
+ {
+ return $this->conf['items'];
+ }
+
+ //@TODO: drop this pref
+ public function getNoHTML()
+ {
+ return $this->conf['nohtml'];
+ }
+
+ //@TODO: drop this pref
+ public function getPostMaxLength()
+ {
+ return $this->conf['postmaxlength'];
+ }
+
+ public function toYaml()
+ {
+ return Spyc::YAMLDump($this->conf,4);
+ }
+}