\Trean_Api

Trean external API interface.

This file defines Trean's external API interface. Other applications can interact with Trean through this API.

Copyright 2002-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (BSD). If you did not receive this file, see http://www.horde.org/licenses/bsdl.php.

Summary

Methods
Properties
Constants
deleteBookmark()
deleteBookmarks()
listTagInfo()
searchTags()
getAddUrl()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

deleteBookmark()

deleteBookmark(integer  $bookmarkId) 

Delete a given bookmark.

Parameters

integer $bookmarkId

The ID of the bookmark to delete

deleteBookmarks()

deleteBookmarks(array  $bookmarkIds) 

Delete multiple bookmarks.

Parameters

array $bookmarkIds

The IDs of the bookmarks to delete

listTagInfo()

listTagInfo(array  $tags = null, string  $user = null) : array

Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.

Parameters

array $tags

An optional array of tag_ids. If omitted, all tags will be included.

string $user

Restrict result to those tagged by $user.

Returns

array —

An array containing tag_name, and total

searchTags()

searchTags(array  $names, integer  $max = 10, integer  $from, string  $resource_type = '', string  $user = null, boolean  $raw = false) : array

SearchTags API: Returns an application-agnostic array (useful for when doing a tag search across multiple applications)

The 'raw' results array can be returned instead by setting $raw = true.

Parameters

array $names

An array of tag_names to search for.

integer $max

The maximum number of resources to return.

integer $from

The number of the resource to start with.

string $resource_type

The resource type [bookmark, '']

string $user

Restrict results to resources owned by $user.

boolean $raw

Return the raw data?

Returns

array —

An array of results:

 'title'    - The title for this resource.
 'desc'     - A terse description of this resource.
 'view_url' - The URL to view this resource.
 'app'      - The Horde application this resource belongs to.

getAddUrl()

getAddUrl(array  $params = array()) : string

Returns a URL that can be used in other applications to add the currently displayed page as a bookmark. If javascript and DOM is available, an overlay is used, if javascript and no DOM, then a pop-up is used and if no javascript is available a URL to Trean's add.php page is returned.

Parameters

array $params

A hash of 'url' and 'title' properties of the requested bookmark.

Returns

string —

The URL suitable for use in a tag.