$term Term object.
*/
public function __construct( $term ) {
foreach ( get_object_vars( $term ) as $key => $value ) {
$this->$key = $value;
}
}
/**
* Sanitizes term fields, according to the filter type provided.
*
* @since 4.4.0
*
* @param string $filter Filter context. Accepts 'edit', 'db', 'display', 'attribute', 'js', 'rss', or 'raw'.
*/
public function filter( $filter ) {
sanitize_term( $this, $this->taxonomy, $filter );
}
/**
* Converts an object to array.
*
* @since 4.4.0
*
* @return array Object as array.
*/
public function to_array() {
return get_object_vars( $this );
}
/**
* Getter.
*
* @since 4.4.0
*
* @param string $key Property to get.
* @return mixed Property value.
*/
public function __get( $key ) {
switch ( $key ) {
case 'data':
$data = new stdClass();
$columns = array( 'term_id', 'name', 'slug', 'term_group', 'term_taxonomy_id', 'taxonomy', 'description', 'parent', 'count' );
foreach ( $columns as $column ) {
$data->{$column} = isset( $this->{$column} ) ? $this->{$column} : null;
}
return sanitize_term( $data, $data->taxonomy, 'raw' );
}
}
}
compare – داروخانه دکتر سیده زهره حسینی