PHP Класс Horde_Core_Tagger, horde

Автор: Michael J Rubinsky ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_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.

Открытые методы

Метод Описание
__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.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( )

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 $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.
Результат array 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, 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.
Результат array 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 $ids, integer $type = null ) : array
$ids array An array of local object ids.
$type integer The type identifier of of the objects.
Результат array An array of tag_ids => counts.

getTagIds() публичный Метод

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.
Результат array A tag_id => tag_name hash.

getTagInfo() публичный Метод

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.
Результат array 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
$localId mixed Either the identifier of the object or an array of identifiers.
$type string The type of object $localId represents.
Результат array A tag_id => tag_name hash, possibly wrapped in a localid hash.

listTags() публичный Метод

Used for autocomplete code.
public listTags ( string $token ) : array
$token string The token to match the start of the tag with.
Результат array 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 )
$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() публичный Метод

Overides Content_Tagger::split to only split on commas.
public split ( string $tags ) : array
$tags string A string of tags to be split.
Результат array The split tags.

tag() публичный Метод

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() публичный Метод

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.

Описание свойств

$_app защищенное свойство

Application this tagger is for.
protected string $_app
Результат string

$_tagger защищенное свойство

The tagger
protected Content_Tagger $_tagger
Результат Content_Tagger

$_type_ids защищенное свойство

Cache of type name => ids from Content
protected array $_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 $_types
Результат array