/**
  * Overload the __getter so that it checks for data in the following order
  * 1) Pull From db/cache (Cii::getConfig now does caching of elements for improved performance)
  * 2) Check for __protected__ property, which we consider the default vlaue
  * 3) parent::__get()
  *
  * In order for this to work with __default__ values, the properties in classes that extend from this
  * MUST be protected. If they are public it will bypass this behavior.
  * 
  * @param  mixed $name The variable name we want to retrieve from the calling class
  * @return mixed
  */
 public function __get($name)
 {
     $data = Cii::getConfig($name);
     if ($data !== NULL && $data !== "" && !isset($this->attributes[$name])) {
         if ($name == 'openstack_apikey') {
             return Cii::decrypt($data);
         }
         return $data;
     }
     if (property_exists($this, $name)) {
         if ($name == 'openstack_apikey') {
             return Cii::decrypt($this->{$name});
         }
         return $this->{$name};
     }
     return parent::__get($name);
 }
Exemple #2
0
 /**
  * Overload the __getter so that it checks for data in the following order
  * 1) Pull From db/cache (Cii::getConfig now does caching of elements for improved performance) for global/user config
  * 2) Check for __protected__ property, which we consider the default vlaue
  * 3) parent::__get()
  *
  * In order for this to work with __default__ values, the properties in classes that extend from this
  * MUST be protected. If they are public it will bypass this behavior.
  * 
  * @param  mixed $name The variable name we want to retrieve from the calling class
  * @return mixed
  */
 public function __get($name)
 {
     if (strpos($name, 'global_') !== false) {
         $data = Cii::getConfig(get_class($this) . '_' . $name);
     } else {
         $data = Cii::getUserConfig($this->id . '_' . $name);
     }
     if ($data !== NULL && $data !== "" && !isset($this->attributes[$name])) {
         return $data;
     }
     if (property_exists($this, $name)) {
         return $this->{$name};
     }
     return parent::__get($name);
 }