PHP Class Horde_Core_Tagger, horde

Author: Michael J Rubinsky ([email protected])
Datei anzeigen Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_app string Application this tagger is for.
$_tagger Content_Tagger The tagger
$_type_ids array Cache of type name => ids from Content
$_types array The types handled by this tagger. The first entry in the array is taken as the default type if the type parameter is not specified in tagging methods.

Public Methods

Method Description
__construct ( ) Constructor.
browseTags ( array $tags, string $user ) : array Retrieve a set of tags that are related to the specifed set. A tag is related if resources tagged with the specified set are also tagged with the tag being considered. Used to "browse" tagged resources.
getCloud ( string $user, integer $limit = 5, boolean $all = false ) : array Returns the data needed to build a tag cloud based on the passed in user's tag data set.
getTagCountsByObjects ( array $ids, integer $type = null ) : array Get the number of times tags are used within a specific set of objects basically a tag cloud, restricted to objects of a specific type.
getTagIds ( string | array $tags ) : array Get tag ids for the specified tag names.
getTagInfo ( array $tags = null, integer $limit = 500, string $type = null, string $user = null ) : array Returns cloud-like information, but only for a specified set of tags.
getTags ( mixed $localId, string $type = null ) : array Retrieves the tags on given object(s).
listTags ( string $token ) : array Returns tags belonging to the current user beginning with $token.
replaceTags ( string $localId, mixed $tags, string $owner, string $content_type = null ) Tags the given resource with *only* the tags provided, removing any tags that are already present but not in the list.
search ( array $tags, array $filter = [] ) : array Searches for resources that are tagged with all of the requested tags.
split ( string $tags ) : array Split a tag string into an array of tags.
tag ( string $localId, mixed $tags, string $owner, string $content_type = null ) Tags an object with any number of tags.
untag ( string $localId, mixed $tags, string $content_type = null ) Removes a tag from an object.

Method Details

__construct() public method

Constructor.
public __construct ( )

browseTags() public method

Retrieve a set of tags that are related to the specifed set. A tag is related if resources tagged with the specified set are also tagged with the tag being considered. Used to "browse" tagged resources.
public browseTags ( array $tags, string $user ) : array
$tags array An array of tags to check. This would represent the current "directory" of tags while browsing.
$user string The resource must be owned by this user.
return array A tag_id => tag_name hash.

getCloud() public method

Returns the data needed to build a tag cloud based on the passed in user's tag data set.
public getCloud ( string $user, integer $limit = 5, boolean $all = false ) : array
$user string The user whose tags should be included.
$limit integer The maximum number of tags to include.
$all boolean Return all tags, not just tags for the current types.
return array An array of hashes, each containing tag_id, tag_name, and count.

getTagCountsByObjects() public method

Get the number of times tags are used within a specific set of objects basically a tag cloud, restricted to objects of a specific type.
public getTagCountsByObjects ( array $ids, integer $type = null ) : array
$ids array An array of local object ids.
$type integer The type identifier of of the objects.
return array An array of tag_ids => counts.

getTagIds() public method

Get tag ids for the specified tag names.
public getTagIds ( string | array $tags ) : array
$tags string | array Either a tag_name or array of tag_names.
return array A tag_id => tag_name hash.

getTagInfo() public method

Returns cloud-like information, but only for a specified set of tags.
public getTagInfo ( array $tags = null, integer $limit = 500, string $type = null, string $user = null ) : array
$tags array An array of either tag names or ids.
$limit integer Limit results to this many.
$type string The type of resource.
$user string Restrict results to those tagged by $user.
return array An array of hashes, tag_id, tag_name, and count.

getTags() public method

Retrieves the tags on given object(s).
public getTags ( mixed $localId, string $type = null ) : array
$localId mixed Either the identifier of the object or an array of identifiers.
$type string The type of object $localId represents.
return array A tag_id => tag_name hash, possibly wrapped in a localid hash.

listTags() public method

Used for autocomplete code.
public listTags ( string $token ) : array
$token string The token to match the start of the tag with.
return array A tag_id => tag_name hash

replaceTags() public method

Tags the given resource with *only* the tags provided, removing any tags that are already present but not in the list.
public replaceTags ( string $localId, mixed $tags, string $owner, string $content_type = null )
$localId string The identifier for the object.
$tags mixed Either a tag_id, tag_name, or array of tag_ids.
$owner string The tag owner - should normally be the resource owner.
$content_type string The type of object that $localId represents.

split() public method

Overides Content_Tagger::split to only split on commas.
public split ( string $tags ) : array
$tags string A string of tags to be split.
return array The split tags.

tag() public method

Tags an object with any number of tags.
public tag ( string $localId, mixed $tags, string $owner, string $content_type = null )
$localId string The identifier of the object.
$tags mixed Either a single tag string or an array of tags.
$owner string The tag owner (should normally be the owner of the resource).
$content_type string The type of object we are tagging.

untag() public method

Removes *all* tags - regardless of the user that added the tag.
public untag ( string $localId, mixed $tags, string $content_type = null )
$localId string The object identifier.
$tags mixed Either a tag_id, tag_name or an array of ids or names to remove.
$content_type string The type of object that $localId represents.

Property Details

$_app protected_oe property

Application this tagger is for.
protected string $_app
return string

$_tagger protected_oe property

The tagger
protected Content_Tagger $_tagger
return Content_Tagger

$_type_ids protected_oe property

Cache of type name => ids from Content
protected array $_type_ids
return array

$_types protected_oe property

The types handled by this tagger. The first entry in the array is taken as the default type if the type parameter is not specified in tagging methods.
protected array $_types
return array