PHP Class Habari\Tags

Inheritance: extends Vocabulary
Show file Open project: habari/system Class Usage Examples

Protected Properties

Property Type Description
$object_type
$vocabulary

Public Methods

Method Description
get_by_frequency ( integer $limit = null, mixed $post_type = null, integer $min = 1, integer $max = null, mixed $search = null, $orderby = 'count', $inverse = false ) : Tags Returns a list of terms from this vocabulary ordered by frequency of use on the post type specified
get_by_id ( integer $tag ) : Tag Returns a Tag object based on a supplied ID
get_by_slug ( string $tag ) : Tag Return a tag based on a tag's text
get_by_text ( string $tag ) : Tag Return a tag based on a tag's text
get_one ( string | integer $tag ) : Tag Return a tag based on an id, tag text or slug
object_type ( ) : String Returns the default type Tags uses
parse_url_tags ( String $tags, $objectify = false ) : Array. Parse tag parameters from a URL string
save_associations ( $terms, $object_id, $object_type = 'post' ) : boolean. Save the tags associated to this object into the terms and object_terms tables
search ( string $q ) : Terms Return a terms that match a substring criteria
vocabulary ( ) : Vocabulary Returns the tags vocabulary

Method Details

get_by_frequency() public static method

Returns a list of terms from this vocabulary ordered by frequency of use on the post type specified
public static get_by_frequency ( integer $limit = null, mixed $post_type = null, integer $min = 1, integer $max = null, mixed $search = null, $orderby = 'count', $inverse = false ) : Tags
$limit integer If supplied, limits the results to the specified number
$post_type mixed If a name or id of a post type is supplied, limits the results to the terms applying to that type
$min integer If supplied, limits the results to tags associated with at least this number of posts
$max integer If supplied, limits the results to tags associated with at most this number of posts
$search mixed If supplied, limits the results to tags containing that value in their display string
return Tags A Tags instance containing the terms, each having an additional property of "count" that tells how many times the term was used

get_by_id() public static method

Returns a Tag object based on a supplied ID
public static get_by_id ( integer $tag ) : Tag
$tag integer The ID of the tag to retrieve
return Tag A Tag object

get_by_slug() public static method

Return a tag based on a tag's text
public static get_by_slug ( string $tag ) : Tag
$tag string The tag slug
return Tag A Tag object

get_by_text() public static method

Return a tag based on a tag's text
public static get_by_text ( string $tag ) : Tag
$tag string The tag's text (not slug)
return Tag A Tag object

get_one() public static method

Return a tag based on an id, tag text or slug
public static get_one ( string | integer $tag ) : Tag
$tag string | integer A tag's text, slug, or id
return Tag The tag object

object_type() public static method

Returns the default type Tags uses
public static object_type ( ) : String
return String The default type name

parse_url_tags() public static method

Parse tag parameters from a URL string
public static parse_url_tags ( String $tags, $objectify = false ) : Array.
$tags String The URL parameter string
return Array.

save_associations() public static method

Save the tags associated to this object into the terms and object_terms tables
public static save_associations ( $terms, $object_id, $object_type = 'post' ) : boolean.
return boolean.

vocabulary() public static method

Returns the tags vocabulary
public static vocabulary ( ) : Vocabulary
return Vocabulary The tags vocabulary

Property Details

$object_type protected static property

protected static $object_type

$vocabulary protected static property

protected static $vocabulary