Ejemplo n.º 1
0
 /**
  * Overloads the default __get() magic method. Used to return a possible
  * meta key value.
  *
  * @param  string $name
  *   A meta_key name.
  *
  * @return mixed
  */
 public function __get($name)
 {
     // Check to see if the meta key exists.
     if ($meta = $this->meta()->where('meta_key', $name)->first()) {
         // Use WP's default maybe_unserialize function to handle possible
         // serialized data.
         return maybe_unserialize($meta->meta_value);
     }
     // No, the key doesn't exist, so return the parent's action.
     return parent::__get($name);
 }