Documentation

Horde_Core_Tagger
in package

AbstractYes

Interface to the Horde_Content tagger.

Tags
author

Michael J Rubinsky mrubinsk@horde.org

category

Horde

copyright

2009-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

Properties

$_app  : string
Application this tagger is for.
$_tagger  : Content_Tagger
The tagger
$_type_ids  : array<string|int, mixed>
Cache of type name => ids from Content
$_types  : array<string|int, mixed>
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.

Methods

__construct()  : mixed
Constructor.
browseTags()  : array<string|int, mixed>
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()  : array<string|int, mixed>
Returns the data needed to build a tag cloud based on the passed in user's tag data set.
getTagCountsByObjects()  : array<string|int, mixed>
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()  : array<string|int, mixed>
Get tag ids for the specified tag names.
getTagInfo()  : array<string|int, mixed>
Returns cloud-like information, but only for a specified set of tags.
getTags()  : array<string|int, mixed>
Retrieves the tags on given object(s).
listTags()  : array<string|int, mixed>
Returns tags belonging to the current user beginning with $token.
replaceTags()  : mixed
Tags the given resource with *only* the tags provided, removing any tags that are already present but not in the list.
search()  : array<string|int, mixed>
Searches for resources that are tagged with all of the requested tags.
split()  : array<string|int, mixed>
Split a tag string into an array of tags.
tag()  : mixed
Tags an object with any number of tags.
untag()  : mixed
Removes a tag from an object.

Properties

$_app

Application this tagger is for.

protected string $_app

$_tagger

The tagger

protected Content_Tagger $_tagger

$_type_ids

Cache of type name => ids from Content

protected array<string|int, mixed> $_type_ids = array()

$_types

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<string|int, mixed> $_types

Methods

__construct()

Constructor.

public __construct() : mixed

browseTags()

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<string|int, mixed> $tags, string $user) : array<string|int, mixed>
Parameters
$tags : array<string|int, mixed>

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.

Tags
throws
Horde_Exception
Return values
array<string|int, mixed>

A tag_id => tag_name hash.

getCloud()

Returns the data needed to build a tag cloud based on the passed in user's tag data set.

public getCloud(string $user[, int $limit = 5 ][, bool $all = false ]) : array<string|int, mixed>
Parameters
$user : string

The user whose tags should be included.

$limit : int = 5

The maximum number of tags to include.

$all : bool = false

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

Tags
throws
Horde_Exception
Return values
array<string|int, mixed>

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

getTagCountsByObjects()

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<string|int, mixed> $ids[, int $type = null ]) : array<string|int, mixed>
Parameters
$ids : array<string|int, mixed>

An array of local object ids.

$type : int = null

The type identifier of of the objects.

Return values
array<string|int, mixed>

An array of tag_ids => counts.

getTagIds()

Get tag ids for the specified tag names.

public getTagIds(string|array<string|int, mixed> $tags) : array<string|int, mixed>
Parameters
$tags : string|array<string|int, mixed>

Either a tag_name or array of tag_names.

Tags
throws
Horde_Exception
Return values
array<string|int, mixed>

A tag_id => tag_name hash.

getTagInfo()

Returns cloud-like information, but only for a specified set of tags.

public getTagInfo([array<string|int, mixed> $tags = null ][, int $limit = 500 ][, string $type = null ][, string $user = null ]) : array<string|int, mixed>
Parameters
$tags : array<string|int, mixed> = null

An array of either tag names or ids.

$limit : int = 500

Limit results to this many.

$type : string = null

The type of resource.

$user : string = null

Restrict results to those tagged by $user.

Tags
throws
Horde_Exception
Return values
array<string|int, mixed>

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

getTags()

Retrieves the tags on given object(s).

public getTags(mixed $localId[, string $type = null ]) : array<string|int, mixed>
Parameters
$localId : mixed

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

$type : string = null

The type of object $localId represents.

Tags
throws
Horde_Exception
Return values
array<string|int, mixed>

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

listTags()

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

public listTags(string $token) : array<string|int, mixed>

Used for autocomplete code.

Parameters
$token : string

The token to match the start of the tag with.

Tags
throws
Horde_Exception
Return values
array<string|int, mixed>

A tag_id => tag_name hash

replaceTags()

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 ]) : mixed
Parameters
$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 = null

The type of object that $localId represents.

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

public abstract search(array<string|int, mixed> $tags[, array<string|int, mixed> $filter = array() ]) : array<string|int, mixed>
Parameters
$tags : array<string|int, mixed>

Either a tag_id, tag_name or an array.

$filter : array<string|int, mixed> = array()

Array of filter parameters.

Return values
array<string|int, mixed>

A hash of results.

split()

Split a tag string into an array of tags.

public split(string $tags) : array<string|int, mixed>

Overides Content_Tagger::split to only split on commas.

Parameters
$tags : string

A string of tags to be split.

Return values
array<string|int, mixed>

The split tags.

tag()

Tags an object with any number of tags.

public tag(string $localId, mixed $tags, string $owner[, string $content_type = null ]) : mixed
Parameters
$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 = null

The type of object we are tagging.

Tags
throws
Horde_Exception

untag()

Removes a tag from an object.

public untag(string $localId, mixed $tags[, string $content_type = null ]) : mixed

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

Parameters
$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 = null

The type of object that $localId represents.

Tags
throws
Horde_Exception

        
On this page

Search results