class Config
{
public $source;
+ public $date;
public $daysBefore;
public $daysAfter;
public $locale;
protected function loadFile($filename)
{
include $filename;
- $this->source = $source;
- $this->daysBefore = $daysBefore;
- $this->daysAfter = $daysAfter;
- if (isset($locale)) {
- $this->locale = $locale;
+ $vars = get_defined_vars();
+ foreach ($vars as $k => $value) {
+ $this->$k = $value;
}
}
return new $class($settings[0]);
}
+
+ public function get($varname, $default = '')
+ {
+ if (!isset($this->$varname) || $this->$varname == '') {
+ return $default;
+ }
+ return $this->$varname;
+ }
}
?>