Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

Term Class Reference

Inheritance diagram for Term:
Collaboration diagram for Term:

List of all members.

Public Member Functions

 __construct ($paramarray=array())
 insert ()
 update ()
 delete ()
 ancestors ()
 not_ancestors ()
 descendants ()
 not_descendants ()
 is_descendant_of (Term $term)
 is_ancestor_of (Term $term)
 parent ()
 siblings ()
 children ()
 objects ($type)
 object_types ()
 object_count ($type)
 associate ($type, $id)
 dissociate ($type=null, $id=null)
 __tostring ()
 __get ($name)
 count ($object_type= 'post')
 __call ($name, $args)

Static Public Member Functions

static default_fields ()
static get ($term, $term_class= 'Term')

Public Attributes

 $unsetfields

Protected Member Functions

 setslug ()
 get_info ()
 is_valid ()

Protected Attributes

 $inforecords = null

Detailed Description

Definition at line 23 of file term.php.


Constructor & Destructor Documentation

Term::__construct ( paramarray = array()  ) 

Term constructor Creates a Term instance

Parameters:
array $paramarray an associative array of initial term values

Reimplemented from QueryRecord.

Reimplemented in Tag.

Definition at line 54 of file term.php.


Member Function Documentation

Term::__call ( name,
args 
)

Handle calls to this Term object that are implemented by plugins

Parameters:
string $name The name of the function called
array $args Arguments passed to the function call
Returns:
mixed The value returned from any plugin filters, null if no value is returned

Reimplemented in Tag.

Definition at line 518 of file term.php.

Term::__get ( name  ) 

function __get Overrides QueryRecord __get to implement custom object properties

Parameters:
$name string Name of property to return
Returns:
mixed The requested field value

Reimplemented from QueryRecord.

Definition at line 455 of file term.php.

Term::__tostring (  ) 

Allow output when the term is cast to a string

Returns:
string The terms display text

Definition at line 444 of file term.php.

Term::ancestors (  ) 

Find this Term's ancestors.

Returns:
Array Direct ancestors from the root to this Term in descendant order.

Definition at line 228 of file term.php.

Term::associate ( type,
id 
)

Associate this term to an object of a certain type via its id.

Parameters:
$type string. The name of the object type we want to set an association for
$id integer. The object's id

Definition at line 403 of file term.php.

Term::children (  ) 

Find this Term's children.

Returns:
Array of all direct children (compare to descendants()).

If we INNER JOIN the terms table with itself on ALL the descendants of our term, 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 immediate children. ORDER BY NULL to avoid the MySQL filesort.

Definition at line 328 of file term.php.

Term::count ( object_type = 'post'  ) 

Get a count of how many times the tag has been used in a post

Parameters:
string $object_type The type of object to count
Returns:
integer The number of times the tag has been used

Definition at line 507 of file term.php.

Referenced by __get(), and Tag::rewrite_tag_exists().

static Term::default_fields (  )  [static]

Return the defined database columns for a Term.

Returns:
array Array of columns in the Term table

Definition at line 36 of file term.php.

Term::delete (  ) 

Delete an existing term

Reimplemented from QueryRecord.

Definition at line 201 of file term.php.

Term::descendants (  ) 

Find this Term's descendants.

Returns:
Array of all descendants in MPTT left-to-right order.

Definition at line 250 of file term.php.

Term::dissociate ( type = null,
id = null 
)

Disassociate this term from an object of a certain type via its id.

Parameters:
$type string. The name of the object type we want to unset an association for
$id integer. The object's id

Definition at line 425 of file term.php.

static Term::get ( term,
term_class = 'Term' 
) [static]

Gets the term object by criteria.

Parameters:
mixed $term A Term object, 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.
Returns:
Term The Term object requested
Todo:
improve selective fetching by term slug vs term_display

Definition at line 531 of file term.php.

Referenced by Menus::action_admin_theme_get_menu_iframe(), Menus::action_admin_theme_get_menus(), and Menus::filter_menu_type_data().

Term::get_info (  )  [protected]

Gets the info object for this term, which contains data from the terminfo table related to this term.

Returns:
TermInfo object

Definition at line 489 of file term.php.

Referenced by __get().

Term::insert (  ) 

function insert Saves a new term to the terms table

Reimplemented from QueryRecord.

Definition at line 130 of file term.php.

Referenced by associate().

Term::is_ancestor_of ( Term term  ) 

Test a Term's ancestry

Returns:
boolean true if $term is a descendant of $this

Definition at line 287 of file term.php.

Term::is_descendant_of ( Term term  ) 

Test a Term's lineage.

Returns:
boolean true if $term is an ancestor of $this

Definition at line 272 of file term.php.

Term::is_valid (  )  [protected]

Make sure we have a valid term before inserting it in the database or updating it

Returns:
bool True if a valid term, false if not

Definition at line 555 of file term.php.

Referenced by insert(), and update().

Term::not_ancestors (  ) 

Find all Terms in this Term's Vocabulary that are not its ancestors, or it.

Returns:
Array of Terms in MPTT left-to-right order.

Definition at line 239 of file term.php.

Term::not_descendants (  ) 

Find all Terms in this Term's Vocabulary that are not its descendants, or it.

Returns:
Array of Terms in MPTT left-to-right order.

Definition at line 261 of file term.php.

Term::object_count ( type  ) 

Find the count of objects of a given type associated with this Term.

Parameters:
$type string. The name of the object type for which the associations are wanted.
Returns:
Array of object ids associated with this term for the given type.

Definition at line 390 of file term.php.

Referenced by count().

Term::object_types (  ) 

Find the types of objects associated with this Term.

Returns:
Array of objects, with each object containing an object id and an object type name

Definition at line 378 of file term.php.

Referenced by Menus::render_menu_item().

Term::objects ( type  ) 

Find objects of a given type associated with this Term.

Parameters:
$type string. The name of the object type for which the associations are wanted.
Returns:
Array of object ids associated with this term for the given type.

Definition at line 366 of file term.php.

Term::parent (  ) 

The Term that is this Term's parent in hierarchy.

Returns:
Term This Term's parent

Definition at line 302 of file term.php.

Referenced by children(), and siblings().

Term::setslug (  )  [protected]

Generate a new slug for the post.

Returns:
string The slug

Definition at line 87 of file term.php.

Referenced by insert(), and update().

Term::siblings (  ) 

Find this Term's siblings.

Returns:
Array of all siblings including self.

Definition at line 313 of file term.php.

Term::update (  ) 

function update Updates an existing term in the terms table

Reimplemented from QueryRecord.

Definition at line 169 of file term.php.


Member Data Documentation

Term::$unsetfields
Initial value:
 array(
    'object_id' => 'object_id',
    'type' => 'type',
  )

Reimplemented from QueryRecord.

Definition at line 27 of file term.php.


The documentation for this class was generated from the following file: