Inheritance diagram for Vocabulary:
Collaboration diagram for Vocabulary:Public Member Functions | |
| __construct ($paramarray=array()) | |
| __get ($name) | |
| rename ($newname) | |
| insert () | |
| update () | |
| delete () | |
| add_term ($term, $target_term=null, $before=false) | |
| get_term ($term=null, $term_class= 'Term') | |
| get_object_terms ($object_type, $id) | |
| set_object_terms ($object_type, $id, $terms) | |
| delete_term ($term) | |
| is_empty () | |
| get_tree ($orderby= 'mptt_left ASC') | |
| get_options () | |
| get_root_terms () | |
| move_term ($term, $target_term=null, $before=false) | |
| count_total () | |
| max_count () | |
| merge ($master, $tags, $object_type= 'post') | |
| get_associations ($object_id, $object_type= 'post') | |
| post_count ($term, $object_type= 'post') | |
Static Public Member Functions | |
| static | default_fields () |
| static | create ($paramarray) |
| static | get ($name) |
| static | get_by_id ($id) |
| static | get_all () |
| static | names () |
| static | get_all_object_terms ($object_type, $id) |
| static | exists ($name) |
| static | add_object_type ($type) |
| static | object_type_id ($type) |
| static | prep_update ($terms) |
Static Public Attributes | |
| static | $features = array( 'hierarchical', 'required', 'multiple', 'free' ) |
Vocabulary Class
Vocabulary is part of the taxonomy system. A vocabulary holds terms and has features.
Definition at line 10 of file vocabulary.php.
| Vocabulary::__construct | ( | $ | paramarray = array() |
) |
Vocabulary constructor Creates a Vocabulary instance
| array | $paramarray an associative array of initial vocabulary values |
Reimplemented from QueryRecord.
Definition at line 43 of file vocabulary.php.
| Vocabulary::__get | ( | $ | name | ) |
function __get Overrides QueryRecord __get to implement custom object properties
| string | Name of property to return |
Reimplemented from QueryRecord.
Definition at line 78 of file vocabulary.php.
| static Vocabulary::add_object_type | ( | $ | type | ) | [static] |
inserts a new object type into the database, if it doesn't exist
| string | The name of the new post type | |
| bool | Whether the new post type is active or not |
Definition at line 600 of file vocabulary.php.
| Vocabulary::add_term | ( | $ | term, | |
| $ | target_term = null, |
|||
| $ | before = false | |||
| ) |
Adds a term to the vocabulary. Returns a Term object. null parameters append the term to the end of any hierarchies.
Definition at line 307 of file vocabulary.php.
Referenced by merge(), and set_object_terms().
| Vocabulary::count_total | ( | ) |
Returns the number of tags in the database.
Definition at line 744 of file vocabulary.php.
| static Vocabulary::create | ( | $ | paramarray | ) | [static] |
Create a vocabulary and save it.
| array | $paramarray An associative array of vocabulary fields |
Definition at line 65 of file vocabulary.php.
| static Vocabulary::default_fields | ( | ) | [static] |
Return the defined database columns for a Vocabulary.
Definition at line 27 of file vocabulary.php.
| Vocabulary::delete | ( | ) |
Delete an existing vocabulary
Reimplemented from QueryRecord.
Definition at line 272 of file vocabulary.php.
| Vocabulary::delete_term | ( | $ | term | ) |
Remove the term from the vocabulary. Convenience method to ->get_term('foo')->delete().
Definition at line 491 of file vocabulary.php.
Referenced by merge().
| static Vocabulary::exists | ( | $ | name | ) | [static] |
Determine whether a vocabulary exists
| string | $name a vocabulary name |
Definition at line 175 of file vocabulary.php.
| static Vocabulary::get | ( | $ | name | ) | [static] |
Return a Vocabulary by name.
Definition at line 98 of file vocabulary.php.
Referenced by Tags::vocabulary().
| static Vocabulary::get_all | ( | ) | [static] |
Return all vocabularies as Vocabulary objects
Definition at line 119 of file vocabulary.php.
| static Vocabulary::get_all_object_terms | ( | $ | object_type, | |
| $ | id | |||
| ) | [static] |
Return the Term objects associated to that type of object with that id in any vocabulary. For example, return all terms associated with a particular post, from all vocabularies.
Definition at line 156 of file vocabulary.php.
| Vocabulary::get_associations | ( | $ | object_id, | |
| $ | object_type = 'post' | |||
| ) |
Get the tags associated with this object
| Integer | $object_id. The id of the tagged object | |
| String | $object_type. The name of the type of the object being tagged. Defaults to post |
Definition at line 839 of file vocabulary.php.
| static Vocabulary::get_by_id | ( | $ | id | ) | [static] |
Return a Vocabulary by id
| integer | $id The id of the vocabulary |
Reimplemented in Tags.
Definition at line 109 of file vocabulary.php.
Referenced by Term::__get().
| Vocabulary::get_object_terms | ( | $ | object_type, | |
| $ | id | |||
| ) |
Gets the Term objects associated to that type of object with that id in this vocabulary For example, return all terms in this vocabulary that are associated with a particular post
| String | the name of the object type | |
| integer | The id of the object for which you want the terms |
Definition at line 417 of file vocabulary.php.
Referenced by get_associations(), and set_object_terms().
| Vocabulary::get_options | ( | ) |
Retrieve the vocabulary as an associative array suitable for FormUI select controls
Definition at line 543 of file vocabulary.php.
| Vocabulary::get_root_terms | ( | ) |
Get all root elements in this vocabulary
If we INNER JOIN the terms table with itself on ALL the descendants, then descendants one level down are listed once, two levels down are listed twice, etc. If we return only those terms which appear once, we get root elements. ORDER BY NULL to avoid the MySQL filesort.
Definition at line 567 of file vocabulary.php.
| Vocabulary::get_term | ( | $ | term = null, |
|
| $ | term_class = 'Term' | |||
| ) |
Gets the term object by id. No parameter returns the root Term object.
| mixed | $term A Term object, null (for the first node in the tree), a string (for a term slug or display), or an integer (for a Term ID). | |
| string | $term_class The class of the returned term object. |
Definition at line 385 of file vocabulary.php.
Referenced by delete_term(), merge(), post_count(), and set_object_terms().
| Vocabulary::get_tree | ( | $ | orderby = 'mptt_left ASC' |
) |
Retrieve the vocabulary
Definition at line 534 of file vocabulary.php.
Referenced by count_total(), and get_options().
| Vocabulary::insert | ( | ) |
function insert Saves a new vocabulary to the vocabularies table
Reimplemented from QueryRecord.
Definition at line 184 of file vocabulary.php.
Referenced by add_object_type().
| Vocabulary::is_empty | ( | ) |
Check if this vocabulary is empty.
Definition at line 524 of file vocabulary.php.
Referenced by add_term(), and move_term().
| Vocabulary::max_count | ( | ) |
Returns the number of times the most used tag is used.
Definition at line 754 of file vocabulary.php.
| Vocabulary::merge | ( | $ | master, | |
| $ | tags, | |||
| $ | object_type = 'post' | |||
| ) |
Renames terms. If the master term exists, the terms will be merged with it. If not, it will be created first.
| mixed | $master The Term to which they should be renamed, or the slug, text or id of it | |
| Array | $tags The tag text, slugs or ids to be renamed |
Definition at line 767 of file vocabulary.php.
| Vocabulary::move_term | ( | $ | term, | |
| $ | target_term = null, |
|||
| $ | before = false | |||
| ) |
Moves a term within the vocabulary. Returns a Term object. null parameters append the term to the end of any hierarchies.
Definition at line 625 of file vocabulary.php.
| static Vocabulary::names | ( | ) | [static] |
Return the names of all vocabularies
Definition at line 140 of file vocabulary.php.
| static Vocabulary::object_type_id | ( | $ | type | ) | [static] |
Return the object type id for a named object, such as a post
| string | $name The type of object |
Definition at line 614 of file vocabulary.php.
Referenced by Term::associate(), Term::dissociate(), Posts::get(), merge(), Term::object_count(), Term::objects(), and Charcoal::theme_show_tags().
| Vocabulary::post_count | ( | $ | term, | |
| $ | object_type = 'post' | |||
| ) |
Returns the count of times a tag is used.
| mixed | $term The tag to count usage. |
Definition at line 856 of file vocabulary.php.
| static Vocabulary::prep_update | ( | $ | terms | ) | [static] |
Moves all of the terms into a temporary area so that they can be moved
Definition at line 868 of file vocabulary.php.
Referenced by Terms::field_save().
| Vocabulary::rename | ( | $ | newname | ) |
Rename a Vocabulary.
Definition at line 128 of file vocabulary.php.
| Vocabulary::set_object_terms | ( | $ | object_type, | |
| $ | id, | |||
| $ | terms | |||
| ) |
Sets the Term objects associated to that type of object with that id in this vocabulary
| String | the name of the object type | |
| Integer | The id of the object for which you want the terms | |
| Array. | The names of the terms to associate |
Definition at line 441 of file vocabulary.php.
| Vocabulary::update | ( | ) |
function update Updates an existing vocabulary in the vocabularies table
Reimplemented from QueryRecord.
Definition at line 233 of file vocabulary.php.
Referenced by rename().
1.7.1