public function __set($name, $value) { switch ($name) { case 'ip': $this->ip = sprintf('%u', ip2long($value)); break; } return parent::__set($name, $value); }
/** * Overrides QueryRecord __set to implement custom object properties * * @param string Name of property to return * @return mixed The requested field value */ public function __set($name, $value) { switch ($name) { case 'id': case 'title': case 'data': case 'type': return parent::__set($name, $value); break; default: $this->data_values[$name] = $value; return $this->data_values[$name]; break; } }
/** * function __set * Overrides QueryRecord __set to implement custom object properties * @param string Name of property to return * @return mixed The requested field value */ public function __set( $name, $value ) { switch ( $name ) { case 'pubdate': case 'updated': case 'modified': if ( !( $value instanceOf HabariDateTime ) ) { $value = HabariDateTime::date_create( $value ); } break; case 'tags': if ( $value instanceof Terms ) { return $this->tags_object = $value; } elseif ( is_array( $value ) ) { return $this->tags_object = new Terms($value); } else { return $this->tags_object = Terms::parse( $value, 'Term', Tags::vocabulary() ); } case 'status': return $this->setstatus( $value ); } return parent::__set( $name, $value ); }
/** * Overrides QueryRecord __set to implement custom object properties * @param string $name Name of property to set * @param mixed $value Value of the property * @return mixed The set field value */ public function __set($name, $value) { switch ($name) { case 'status': $value = self::status($value); break; case 'date': if (!$value instanceof DateTime) { $value = DateTime::create($value); } break; case 'post': if (is_int($value)) { // a post ID was passed $p = Post::get(array('id' => $value)); $this->post_id = $p->id; $this->post_object = $p; } elseif (is_string($value)) { // a post Slug was passed $p = Post::get(array('slug' => $value)); $this->post_id = $p->id; $this->post_object = $p; } elseif (is_object($value)) { // a Post object was passed, so just use it directly $this->post_id = $value->id; $this->post_object = $value; } return $value; } return parent::__set($name, $value); }
/** * Magic property setter to set the cronjob properties. * Serializes the callback if needed. * * @see QueryRecord::__set() * @param string $name The name of the property to set. * @param mixed $value The value of the property to set. * @return mixed The new value of the property. */ public function __set($name, $value) { switch ($name) { case 'callback': if (is_array($value) || is_object($value)) { $value = serialize($value); } break; case 'next_run': case 'last_run': case 'start_time': case 'end_time': if (!$value instanceof HabariDateTime && !is_null($value)) { $value = HabariDateTime::date_create($value); } break; } return parent::__set($name, $value); }
/** * Overrides QueryRecord __set to implement custom object properties * * @param string Name of property to return * @return mixed The requested field value */ public function __set( $name, $value ) { switch ( $name ) { case 'timestamp': if ( !( $value instanceOf HabariDateTime ) ) { $value = HabariDateTime::date_create( $value ); } break; } return parent::__set( $name, $value ); }
/** * function __set * Overrides QueryRecord __set to implement custom object properties * @param string Name of property to return * @return mixed The requested field value **/ public function __set($name, $value) { return parent::__set($name, $value); }
/** * function __set * Overrides QueryRecord __set to implement custom object properties * @param string Name of property to return * @return mixed The requested field value */ public function __set($name, $value) { switch ($name) { case 'pubdate': case 'updated': case 'modified': if (!$value instanceof HabariDateTime) { $value = HabariDateTime::date_create($value); } break; case 'tags': if (is_array($value)) { return $this->tags = $value; } else { return $this->tags = $this->parsetags($value); } case 'status': return $this->setstatus($value); } return parent::__set($name, $value); }
/** * Overrides QueryRecord __set to implement custom object properties * * @param string $name name of property to return * @param mixed $value The requested field value * @return mixed The requested field value */ public function __set($name, $value) { switch ($name) { case 'timestamp': if (!$value instanceof DateTime) { $value = DateTime::create($value); } break; } return parent::__set($name, $value); }