PHP Class Habari\Term

Inheritance: extends QueryRecord
Datei anzeigen Open project: habari/system

Public Properties

Property Type Description
$unsetfields

Protected Properties

Property Type Description
$inforecords

Public Methods

Method Description
__call ( string $name, array $args ) : mixed Handle calls to this Term object that are implemented by plugins
__construct ( array $paramarray = [] ) Term constructor Creates a Term instance
__get ( $name ) : mixed function __get Overrides QueryRecord __get to implement custom object properties
__tostring ( ) : string Allow output when the term is cast to a string
ancestors ( ) : Array Find this Term's ancestors.
associate ( $type, $id ) Associate this term to an object of a certain type via its id.
children ( ) : Array Find this Term's children.
count ( string $object_type = 'post' ) : integer Get a count of how many times the tag has been used in a post
default_fields ( ) : array Return the defined database columns for a Term.
delete ( ) Delete an existing term
descendants ( ) : Array Find this Term's descendants.
dissociate ( $type = null, $id = null ) Disassociate this term from an object of a certain type via its id.
get ( mixed $term, string $term_class = 'Term' ) : Term Gets the term object by criteria.
insert ( ) function insert Saves a new term to the terms table
is_ancestor_of ( Term $term ) : boolean Test a Term's ancestry
is_descendant_of ( Term $term ) : boolean Test a Term's lineage.
not_ancestors ( ) : Array Find all Terms in this Term's Vocabulary that are not its ancestors, or it.
not_descendants ( ) : Array Find all Terms in this Term's Vocabulary that are not its descendants, or it.
object_count ( $type ) : Array Find the count of objects of a given type associated with this Term.
object_types ( ) : Array Find the types of objects associated with this Term.
objects ( $type ) : Array Find objects of a given type associated with this Term.
parent ( ) : Term The Term that is this Term's parent in hierarchy.
siblings ( ) : Array Find this Term's siblings.
update ( ) function update Updates an existing term in the terms table

Protected Methods

Method Description
get_info ( ) : TermInfo Gets the info object for this term, which contains data from the terminfo table related to this term.
is_valid ( ) : boolean Make sure we have a valid term before inserting it in the database or updating it
setslug ( ) : string Generate a new slug for the post.

Method Details

__call() public method

Handle calls to this Term object that are implemented by plugins
public __call ( string $name, array $args ) : mixed
$name string The name of the function called
$args array Arguments passed to the function call
return mixed The value returned from any plugin filters, null if no value is returned

__construct() public method

Term constructor Creates a Term instance
public __construct ( array $paramarray = [] )
$paramarray array an associative array of initial term values

__get() public method

function __get Overrides QueryRecord __get to implement custom object properties
public __get ( $name ) : mixed
$name string Name of property to return
return mixed The requested field value

__tostring() public method

Allow output when the term is cast to a string
public __tostring ( ) : string
return string The terms display text

ancestors() public method

Find this Term's ancestors.
public ancestors ( ) : Array
return Array Direct ancestors from the root to this Term in descendant order.

associate() public method

Associate this term to an object of a certain type via its id.
public associate ( $type, $id )
$type string. The name of the object type we want to set an association for
$id integer. The object's id

children() public method

Find this Term's children.
public children ( ) : Array
return Array of all direct children (compare to descendants()).

count() public method

Get a count of how many times the tag has been used in a post
public count ( string $object_type = 'post' ) : integer
$object_type string The type of object to count
return integer The number of times the tag has been used

default_fields() public static method

Return the defined database columns for a Term.
public static default_fields ( ) : array
return array Array of columns in the Term table

delete() public method

Delete an existing term
public delete ( )

descendants() public method

Find this Term's descendants.
public descendants ( ) : Array
return Array of all descendants in MPTT left-to-right order.

dissociate() public method

Disassociate this term from an object of a certain type via its id.
public dissociate ( $type = null, $id = null )
$type string. The name of the object type we want to unset an association for
$id integer. The object's id

get() public static method

Gets the term object by criteria.
public static get ( mixed $term, string $term_class = 'Term' ) : Term
$term mixed A Term object, a string (for a term slug or display), or an integer (for a Term ID).
$term_class string The class of the returned term object.
return Term The Term object requested

get_info() protected method

Gets the info object for this term, which contains data from the terminfo table related to this term.
protected get_info ( ) : TermInfo
return TermInfo object

insert() public method

function insert Saves a new term to the terms table
public insert ( )

is_ancestor_of() public method

Test a Term's ancestry
public is_ancestor_of ( Term $term ) : boolean
$term Term
return boolean true if $term is a descendant of $this

is_descendant_of() public method

Test a Term's lineage.
public is_descendant_of ( Term $term ) : boolean
$term Term
return boolean true if $term is an ancestor of $this

is_valid() protected method

Make sure we have a valid term before inserting it in the database or updating it
protected is_valid ( ) : boolean
return boolean True if a valid term, false if not

not_ancestors() public method

Find all Terms in this Term's Vocabulary that are not its ancestors, or it.
public not_ancestors ( ) : Array
return Array of Terms in MPTT left-to-right order.

not_descendants() public method

Find all Terms in this Term's Vocabulary that are not its descendants, or it.
public not_descendants ( ) : Array
return Array of Terms in MPTT left-to-right order.

object_count() public method

Find the count of objects of a given type associated with this Term.
public object_count ( $type ) : Array
$type string. The name of the object type for which the associations are wanted.
return Array of object ids associated with this term for the given type.

object_types() public method

Find the types of objects associated with this Term.
public object_types ( ) : Array
return Array of objects, with each object containing an object id and an object type name

objects() public method

Find objects of a given type associated with this Term.
public objects ( $type ) : Array
$type string. The name of the object type for which the associations are wanted.
return Array of object ids associated with this term for the given type.

parent() public method

The Term that is this Term's parent in hierarchy.
public parent ( ) : Term
return Term This Term's parent

setslug() protected method

Generate a new slug for the post.
protected setslug ( ) : string
return string The slug

siblings() public method

Find this Term's siblings.
public siblings ( ) : Array
return Array of all siblings including self.

update() public method

function update Updates an existing term in the terms table
public update ( )

Property Details

$inforecords protected_oe property

protected $inforecords

$unsetfields public_oe property

public $unsetfields