/** * Overrides QueryRecord __get to implement custom object properties * * @param string Name of property to return * @return mixed The requested field value */ public function __get($name) { if (array_key_exists($name, $this->data_values)) { return $this->data_values[$name]; } else { return parent::__get($name); } }
public function __get($name) { switch ($name) { case 'ip': $out = long2ip(parent::__get($name)); break; default: $out = parent::__get($name); break; } return $out; }
/** * function __get * Overrides QueryRecord __get to implement custom object properties * @param string Name of property to return * @return mixed The requested field value **/ public function __get($name) { $out = parent::__get($name); switch ($name) { case 'features': if (!is_array($out)) { $out = unserialize($out); } break; } if (is_null($out)) { $out = in_array($name, $this->features); } return $out; }
/** * 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': parent::__set($name, $value); $this->unserialize_data(); return parent::__get($name); break; case 'type': return parent::__set($name, $value); break; default: $this->data_values[$name] = $value; return $this->data_values[$name]; break; } }
/** * Magic property getter to get the cronjob properties. * Unserializes the callback if called. * * @see QueryRecord::__get() * @param string $name The name of the property to get. * @return mixed The value of the property, or null if no property by that name. */ public function __get($name) { if ($name == 'callback') { if (false !== ($res = @unserialize(parent::__get($name)))) { return $res; } } return parent::__get($name); }
/** * function __get * Overrides QueryRecord __get to implement custom object properties * @param string Name of property to return * @return mixed The requested field value */ public function __get($name) { $fieldnames = array_merge(array_keys($this->fields), array('post', 'info', 'editlink')); $filter = false; if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) { $field_matches = implode('|', $fieldnames); if (preg_match('/^(' . $field_matches . ')_(.+)$/', $name, $matches)) { list($junk, $name, $filter) = $matches; } } if ($name == 'name' && parent::__get($name) == '') { return _t('Anonymous'); } switch ($name) { case 'post': $out = $this->get_post(); break; case 'info': $out = $this->get_info(); break; case 'statusname': $out = self::status_name($this->status); break; case 'typename': $out = self::type_name($this->type); break; case 'editlink': $out = $this->get_editlink(); break; default: $out = parent::__get($name); break; } //$out = parent::__get( $name ); $out = Plugins::filter("comment_{$name}", $out, $this); if ($filter) { $out = Plugins::filter("comment_{$name}_{$filter}", $out, $this); } return $out; }
/** * function __get * Overrides QueryRecord __get to implement custom object properties * @param $name string Name of property to return * @return mixed The requested field value */ public function __get( $name ) { switch ( $name ) { case 'vocabulary': $out = Vocabulary::get_by_id( $this->vocabulary_id ); break; case 'tag_text_searchable': // if it's got spaces, then quote it. if ( strpos( $this->term_display, ' ' ) !== false ) { $out = '\'' . str_replace( "'", "\'", $this->term_display ) . '\''; } else { $out = $this->term_display; } break; case 'count': $out = (int)$this->count(); break; case 'id': return (int)parent::__get( $name ); case 'info': return $this->get_info(); default: $out = parent::__get( $name ); break; } return $out; }
/** * A field accessor that doesn't filter, for use in plugins that filter field values * @param string $name Name of the field to get * @return mixed Value of the field, unfiltered */ public function get_raw_field($name) { return parent::__get($name); }
/** * function __get * Overrides QueryRecord __get to implement custom object properties * @param string Name of property to return * @return mixed The requested field value */ public function __get($name) { $fieldnames = array_merge(array_keys($this->fields), array('permalink', 'tags', 'comments', 'comment_count', 'approved_comment_count', 'comment_feed_link', 'author', 'editlink')); if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) { preg_match('/^(.*)_([^_]+)$/', $name, $matches); list($junk, $name, $filter) = $matches; } else { $filter = false; } switch ($name) { case 'statusname': $out = self::status_name($this->status); break; case 'typename': $out = self::type_name($this->content_type); break; case 'permalink': $out = $this->get_permalink(); break; case 'editlink': $out = $this->get_editlink(); break; case 'tags': $out = $this->get_tags(); break; case 'comments': $out = $this->get_comments(); break; case 'comment_count': $out = $this->get_comments()->count(); break; case 'approved_comment_count': $out = Comments::count_by_id($this->id); break; case 'comment_feed_link': $out = $this->get_comment_feed_link(); break; case 'author': $out = $this->get_author(); break; case 'info': $out = $this->get_info(); break; default: $out = parent::__get($name); break; } $out = Plugins::filter("post_get", $out, $name, $this); $out = Plugins::filter("post_{$name}", $out, $this); if ($filter) { $out = Plugins::filter("post_{$name}_{$filter}", $out, $this); } return $out; }
/** * function __get * Overrides QueryRecord __get to implement custom object properties * @param string Name of property to return * @return mixed The requested field value */ public function __get( $name ) { // some properties are considered special and accidentally filtering them would be bad, so we exclude those $fieldnames = array_merge( array_keys( $this->fields ), array( 'permalink', 'tags', 'comments', 'comment_count', 'approved_comment_count', 'comment_feed_link', 'author', 'editlink', 'info' ) ); $filter = false; if ( !in_array( $name, $fieldnames ) && strpos( $name, '_' ) !== false ) { $field_matches = implode('|', $fieldnames); if(preg_match( '/^(' . $field_matches . ')_(.+)$/', $name, $matches )) { list( $junk, $name, $filter )= $matches; } } switch ( $name ) { case 'statusname': $out = self::status_name( $this->status ); break; case 'typename': $out = self::type_name( $this->content_type ); break; case 'permalink': $out = $this->get_permalink(); break; case 'editlink': $out = $this->get_editlink(); break; case 'tags': $out = $this->get_tags(); break; case 'comments': $out = $this->get_comments(); break; case 'comment_count': $out = $this->get_comments()->count(); break; case 'approved_comment_count': $out = Comments::count_by_id( $this->id ); break; case 'comment_feed_link': $out = $this->get_comment_feed_link(); break; case 'author': $out = $this->get_author(); break; case 'info': $out = $this->get_info(); break; default: $out = parent::__get( $name ); break; } $out = Plugins::filter( "post_get", $out, $name, $this ); $out = Plugins::filter( "post_{$name}", $out, $this ); if ( $filter ) { $out = Plugins::filter( "post_{$name}_{$filter}", $out, $this ); } return $out; }
/** * Capture requests for the info object so that it can be initialized properly when * the constructor is bypassed (see PDO::FETCH_CLASS pecularities). Passes all other * requests to parent. * * @param string $name requested field name * @return mixed the requested field value */ public function __get($name) { $fieldnames = array_merge(array_keys($this->fields), array('groups', 'displayname', 'loggedin', 'info')); if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) { preg_match('/^(.*)_([^_]+)$/', $name, $matches); list($junk, $name, $filter) = $matches; } else { $filter = false; } switch ($name) { case 'info': $out = $this->get_info(); break; case 'groups': $out = $this->list_groups(); break; case 'displayname': $out = empty($this->info->displayname) ? $this->username : $this->info->displayname; break; case 'loggedin': $out = $this->id != 0; break; default: $out = parent::__get($name); break; } $out = Plugins::filter("user_get", $out, $name, $this); $out = Plugins::filter("user_{$name}", $out, $this); if ($filter) { $out = Plugins::filter("user_{$name}_{$filter}", $out, $this); } return $out; }
/** * Overrides QueryRecord __get to implement custom object properties * * @param string Name of property to return * @return mixed The requested field value */ public function __get( $name ) { $fieldnames = array_merge( array_keys( $this->fields ), array( 'module', 'type', 'severity' ) ); $filter = false; if ( !in_array( $name, $fieldnames ) && strpos( $name, '_' ) !== false ) { $field_matches = implode('|', $fieldnames); if(preg_match( '/^(' . $field_matches . ')_(.+)$/', $name, $matches )) { list( $junk, $name, $filter )= $matches; } } switch ( $name ) { case 'module': $out = $this->get_event_module(); break; case 'type': $out = $this->get_event_type(); break; case 'severity': $out = $this->get_event_severity(); break; default: $out = parent::__get( $name ); break; } $out = Plugins::filter( "logentry_{$name}", $out, $this ); if ( $filter ) { $out = Plugins::filter( "logentry_{$name}_{$filter}", $out, $this ); } return $out; }
/** * function __get * Overrides QueryRecord __get to implement custom object properties * @param $name string Name of property to return * @return mixed The requested field value **/ public function __get($name) { switch ($name) { case 'vocabulary': return Vocabulary::get_by_id($this->vocabulary_id); default: return parent::__get($name); } }
/** * function __get * Overrides QueryRecord __get to implement custom object properties * @param string Name of property to return * @return mixed The requested field value **/ public function __get($name) { $fieldnames = array_merge(array_keys($this->fields), array('post', 'info')); if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) { preg_match('/^(.*)_([^_]+)$/', $name, $matches); list($junk, $name, $filter) = $matches; } else { $filter = false; } switch ($name) { default: $out = parent::__get($name); break; } return $out; }
/** * Magic property getter for this class * @param string $name The name of the class property to return * @returns mixed The value of that field in this object */ public function __get($name) { switch ($name) { case 'named_args': if (empty($this->m_named_args)) { preg_match_all('/(?<!\\()\\{\\$(\\w+?)\\}(?!\\))/u', $this->build_str, $required); preg_match_all('/(?<=\\()[^\\(\\)]*\\{\\$(\\w+?)\\}[^\\(\\)]*(?=\\))/u', $this->build_str, $optional); $this->m_named_args['required'] = $required[1]; $this->m_named_args['optional'] = $optional[1]; } return $this->m_named_args; default: return parent::__get($name); } }
/** * Overrides QueryRecord __get to implement custom object properties * @param string $name Name of property to return * @return mixed The requested field value */ public function __get($name) { $fieldnames = array_merge(array_keys($this->fields), array('post', 'info', 'editlink')); $filter = false; if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) { $field_matches = implode('|', $fieldnames); if (preg_match('/^(' . $field_matches . ')_(.+)$/', $name, $matches)) { list($unused, $name, $filter) = $matches; } } switch ($name) { case 'name': if (parent::__get($name) == '') { $out = _t('Anonymous'); } else { $out = parent::__get($name); } break; case 'post': $out = $this->get_post(); break; case 'info': $out = $this->get_info(); break; case 'statusname': $out = self::status_name($this->status); break; case 'typename': $out = self::type_name($this->type); break; case 'editlink': $out = $this->get_editlink(); break; default: if (preg_match('#^is_(.+)$#i', $name, $matches)) { $ts_field = $matches[1]; if ($index = array_search($ts_field, Comment::list_comment_statuses())) { $out = $this->status == $index; } if ($index = array_search($ts_field, Comment::list_comment_types())) { $out = $this->type == $index; } // Dumb check for plurals $pluralize = function ($s) { return $s . 's'; }; if ($index = array_search($ts_field, array_map($pluralize, Comment::list_comment_statuses()))) { $out = $this->status == $index; } if ($index = array_search($ts_field, array_map($pluralize, Comment::list_comment_types()))) { $out = $this->type == $index; } } else { $out = parent::__get($name); } break; } //$out = parent::__get( $name ); $out = Plugins::filter("comment_{$name}", $out, $this); if ($filter) { $out = Plugins::filter("comment_{$name}_{$filter}", $out, $this); } return $out; }
/** * Capture requests for the info object so that it can be initialized properly when * the constructor is bypassed (see PDO::FETCH_CLASS pecularities). Passes all other * requests to parent. * * @param string $name requested field name * @return mixed the requested field value */ public function __get($name) { switch ($name) { case 'info': if (!isset($this->info)) { $this->info = new UserInfo($this->fields['id']); } else { $this->info->set_key($this->fields['id']); } return $this->info; case 'groups': return $this->list_groups(); case 'displayname': return empty($this->info->displayname) ? $this->username : $this->info->displayname; case 'loggedin': return $this->id != 0; default: return parent::__get($name); } }
/** * function __get * magic get function for returning virtual properties of the class * @param mixed the property to get * @return mixed the property */ public function __get( $param ) { switch ( $param ) { case 'members': $this->load_member_cache(); return (array) $this->member_ids; break; case 'users': $this->load_member_cache(); $results = DB::get_results( 'SELECT u.* FROM {users} u INNER JOIN {users_groups} ug ON ug.user_id = u.id WHERE ug.group_id= ?', array( $this->id ), 'User' ); if ( in_array( 0, $this->member_ids ) ) { $results[] = User::anonymous(); } return $results; case 'permissions': $this->load_permissions_cache(); return $this->permissions; break; default: return parent::__get( $param ); break; } }
/** * Overrides QueryRecord __get to implement custom object properties * @param string $name Name of property to return * @return mixed The requested field value */ public function __get($name) { // some properties are considered special and accidentally filtering them would be bad, so we exclude those $fieldnames = array_merge(array_keys($this->fields), array('permalink', 'tags', 'comments', 'comment_count', 'approved_comment_count', 'comment_feed_link', 'author', 'editlink', 'info')); $filter = false; if (!in_array($name, $fieldnames) && strpos($name, '_') !== false) { $field_matches = implode('|', $fieldnames); if (preg_match('/^(' . $field_matches . ')_(.+)$/', $name, $matches)) { list($junk, $name, $filter) = $matches; } } switch ($name) { case 'content': if ($filter == 'internal') { $out = parent::__get('content'); } else { $out = parent::__get('cached_content'); // Didn't bother to store a cached version? Run the prerender filter on the raw version. if (empty($out)) { $out = Plugins::filter("post_prerender_content", parent::__get('content'), $this); // Queue rendered content for writing to cached_content field? } } break; case 'statusname': $out = self::status_name($this->status); break; case 'typename': $out = self::type_name($this->content_type); break; case 'permalink': $out = $this->get_permalink(); break; case 'editlink': $out = $this->get_editlink(); break; case 'tags': $out = $this->get_tags(); break; case 'comments': $out = $this->get_comments(); break; case 'comment_count': $out = $this->get_comments()->count(); break; case 'approved_comment_count': $out = Comments::count_by_id($this->id); break; case 'comment_feed_link': $out = $this->get_comment_feed_link(); break; case 'author': $out = $this->get_author(); break; case 'info': $out = $this->get_info(); break; case 'excerpt': $field = 'content' . ($filter ? '_' . $filter : '_out'); $out = $this->__get($field); if (!Plugins::implemented('post_excerpt', 'filter')) { $out = Format::more($out, $this, Options::get('excerpt_settings', array('max_paragraphs' => 2))); } break; default: $out = parent::__get($name); break; } if ($filter != 'internal') { $out = Plugins::filter("post_get", $out, $name, $this); $out = Plugins::filter("post_{$name}", $out, $this); } if ($filter) { $out = Plugins::filter("post_{$name}_{$filter}", $out, $this); } return $out; }