\Horde_Core_Tagger_Null

Null driver for the Horde_Content tagger.

Summary

Methods
Properties
Constants
__construct()
split()
tag()
getTags()
untag()
replaceTags()
listTags()
getCloud()
getTagCountsByObjects()
browseTags()
getTagIds()
getTagInfo()
search()
No public properties found
No constants found
No protected methods found
$_type_ids
$_app
$_types
$_tagger
N/A
No private methods found
No private properties found
N/A

Properties

$_type_ids

$_type_ids : array

Cache of type name => ids from Content

Type

array

$_app

$_app : string

Application this tagger is for.

Type

string

$_types

$_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.

Type

array

$_tagger

$_tagger : \Content_Tagger

The tagger

Type

\Content_Tagger

Methods

__construct()

__construct() 

Constructor.

split()

split(string  $tags) : array

Split a tag string into an array of tags.

Overides Content_Tagger::split to only split on commas.

Parameters

string $tags

A string of tags to be split.

Returns

array —

The split tags.

tag()

tag(string  $localId, mixed  $tags, string  $owner, string  $content_type = null) 

Tags an object with any number of tags.

Parameters

string $localId

The identifier of the object.

mixed $tags

Either a single tag string or an array of tags.

string $owner

The tag owner (should normally be the owner of the resource).

string $content_type

The type of object we are tagging.

getTags()

getTags(mixed  $localId, string  $type = null) : array

Retrieves the tags on given object(s).

Parameters

mixed $localId

Either the identifier of the object or an array of identifiers.

string $type

The type of object $localId represents.

Returns

array —

A tag_id => tag_name hash, possibly wrapped in a localid hash.

untag()

untag(string  $localId, mixed  $tags, string  $content_type = null) 

Removes a tag from an object.

Removes all tags - regardless of the user that added the tag.

Parameters

string $localId

The object identifier.

mixed $tags

Either a tag_id, tag_name or an array of ids or names to remove.

string $content_type

The type of object that $localId represents.

replaceTags()

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.

Parameters

string $localId

The identifier for the object.

mixed $tags

Either a tag_id, tag_name, or array of tag_ids.

string $owner

The tag owner - should normally be the resource owner.

string $content_type

The type of object that $localId represents.

listTags()

listTags(string  $token) : array

Returns tags belonging to the current user beginning with $token.

Used for autocomplete code.

Parameters

string $token

The token to match the start of the tag with.

Returns

array —

A tag_id => tag_name hash

getCloud()

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.

Parameters

string $user

The user whose tags should be included.

integer $limit

The maximum number of tags to include.

boolean $all

Return all tags, not just tags for the current types.

Returns

array —

An array of hashes, each containing tag_id, tag_name, and count.

getTagCountsByObjects()

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.

Parameters

array $ids

An array of local object ids.

integer $type

The type identifier of of the objects.

Returns

array —

An array of tag_ids => counts.

browseTags()

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.

Parameters

array $tags

An array of tags to check. This would represent the current "directory" of tags while browsing.

string $user

The resource must be owned by this user.

Returns

array —

A tag_id => tag_name hash.

getTagIds()

getTagIds(string|array  $tags) : array

Get tag ids for the specified tag names.

Parameters

string|array $tags

Either a tag_name or array of tag_names.

Returns

array —

A tag_id => tag_name hash.

getTagInfo()

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.

Parameters

array $tags

An array of either tag names or ids.

integer $limit

Limit results to this many.

string $type

The type of resource.

string $user

Restrict results to those tagged by $user.

Returns

array —

An array of hashes, tag_id, tag_name, and count.

search()

search(array  $tags, array  $filter = array()) : array

Searches for resources that are tagged with all of the requested tags.

Parameters

array $tags

Either a tag_id, tag_name or an array.

array $filter

Array of filter parameters.

Returns

array —

A hash of results.