summaryrefslogtreecommitdiffstats
path: root/app/classes/PlanetConfig.php
diff options
context:
space:
mode:
authorPascal Chevrel <pascal@chevrel.org>2012-03-09 08:16:08 +0100
committerPascal Chevrel <pascal@chevrel.org>2012-03-09 08:16:08 +0100
commit4c3eb70d049e4376eec5fea393ad6529b98a5f10 (patch)
tree5c897dcf54be27bad6289df6241113dce78e97f2 /app/classes/PlanetConfig.php
parent781e77848b95e81c9865212385bab22f3013061e (diff)
downloadplanet-4c3eb70d049e4376eec5fea393ad6529b98a5f10.tar
planet-4c3eb70d049e4376eec5fea393ad6529b98a5f10.tar.gz
planet-4c3eb70d049e4376eec5fea393ad6529b98a5f10.tar.bz2
planet-4c3eb70d049e4376eec5fea393ad6529b98a5f10.tar.xz
planet-4c3eb70d049e4376eec5fea393ad6529b98a5f10.zip
Refactioring, this is a syntax change for all Planet* classes to use PHP5 syntax instead of PHP4
Diffstat (limited to 'app/classes/PlanetConfig.php')
-rw-r--r--app/classes/PlanetConfig.php66
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
+}