class vB_Api_Tags extends vB_Api

vB_Api_Tags

Traits

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected array $disableWhiteList Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected array $disableFalseReturnOnly Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api
protected $tagsObj
protected $errors

Methods

__sleep()

No description

__wakeup()

No description

static 
getApiClassName($controller)

No description

from vB_Api
static 
getApiClassNameInternal($controller)

No description

from vB_Api
static 
getApiClass($controller, $errorCheck = true)

No description

from vB_Api
static vB_Api
instanceInternal(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API

from vB_Api
static vB_Api
instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

from vB_Api
static 
clearCache()

Clears all previously loaded API objects.

from vB_Api
The
callNamed()

Call the given api function by name with a named arguments list.

from vB_Api
static string
map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

from vB_Api
static 
map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

from vB_Api
static 
map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

from vB_Api
__construct()

No description

from vB_Api
checkApiState($method)

This method checks whether the API method is enabled.

from vB_Api
bool
isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

from vB_Api
bool
isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

from vB_Api
toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

from vB_Api
none
checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
boolean
hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

from vB_Api
checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
setController(string $controller)

Set controller

from vB_Api
inDebugMode()

No description

from vB_Api
array
updateUserTags(int $nodeid, array $taglist = array())

Adds new tags and/or deletes tags (added by the current user) if they have removed them from the list

Comma-separated
addTags(NodeId $nodeid, Taglist $taglist)

Add tags to the current item implements vB_Tag::addTagsToContent

[array]
validTags([string|array] $taglist, integer $nodeid = 0)

Checks if the taglist contains invalid tags

insertTags($tagtext)

No description

array
updateTags(String, $tagtext)

Sets the tag matching tag text (case insensitive) to the exact text given Used to fix case when merging tags.

Mixed
createSynonyms(Array, $tagList, Integer, $targetid)

No description

True
promoteTags(int|array $taglist)

No description

array
getTagSynonyms(integer $tagid)

Get synonyms of a given tag

standard
removeTags(NodeId $nodeid, Tags $tags = '')

Remove tags from an item Implements vB_Tag::deleteTag

standard
killTags(Array $killTagList)

No description

The
getTagsList(NodeId $nodeid)

Gets the tag list from an specific node.

standard
mergeTags(int $nodeid, array $sourceids)

Merge tags from nodes.

standard
moveTags(TargetNodeId $nodeid, SourceNodeId $sourceid)

Move tags from one node to another one.

standard
copyTags(TargetNodeId $nodeid, SourceNodeId $sourceid)

Copy tags from a node to another one.

Tags
getNodeTags(NodeId $nodeid)

Get tags with full info (userid, tagid, tagtext) from node.

getAutocomplete($searchStr, $limitstart = 0, $limitnumber = 25)

No description

array
fetchTagsForCloud($taglevels = 5, $limit = 20, $type = 'nodes')

Get an array of tags for building tag cloud

array
fetchTagsForTagNavigation(int $channelId, int $limit = 25, bool $addCloudInfo = false, int $levels = 5)

Returns an array of tags for the tag navigation widget

int
sortTagsByTagText(array $a, array $b)

Sort function for fetchTagsForTagNavigation

array
fetchTagByText(string $tagtext)

Fetch tag by label

getTags($tagids)

Get the tags

logSearchTags(array $tagIds)

Saves the seached for tags so we can build a search tag cloud based on it

getExceptionFromErrors($errors)

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Api at line 63
static getApiClassName($controller)

Parameters

$controller

in vB_Api at line 69
static protected getApiClassNameInternal($controller)

Parameters

$controller

in vB_Api at line 97
static protected getApiClass($controller, $errorCheck = true)

Parameters

$controller
$errorCheck

in vB_Api at line 177
static vB_Api instanceInternal(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 203
static vB_Api instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 237
static clearCache()

Clears all previously loaded API objects.

Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.

in vB_Api at line 259
The callNamed()

Call the given api function by name with a named arguments list.

Used primarily to translate REST requests into API calls.

Return Value

The return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.

in vB_Api at line 313
static string map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

May alter request array.

Parameters

string $method -- vb4 method name
array $request -- $_REQUEST array for this api request

Return Value

string

in vB_Api at line 497
static map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- output array from vb5

in vB_Api at line 545
static map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- error array from vb5

in vB_Api at line 609
protected __construct()

in vB_Api at line 631
checkApiState($method)

This method checks whether the API method is enabled.

For extensions check make sure $controller property is already set.

Parameters

$method

in vB_Api at line 657
protected bool isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method is or is not a white list.

in vB_Api at line 685
protected bool isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method returns false response only.

in vB_Api at line 712
protected toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

Parameters

string $str The string to be converted

in vB_Api at line 734
protected none checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

Checks for: * A valid CP Session * The passed adminpermission.

Parameters

string $adminPermission The admin permission to check

Return Value

none

Exceptions

inlinemodauth_required -- The current session is not a mod/admin session
nopermission_loggedin -- The user does not have the given permission
no_permission -- The user is not logged in at all.

in vB_Api at line 753
protected boolean hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.

Parameters

string $adminPermission The admin permission to check

Return Value

boolean true if checks pass, false otherwise

in vB_Api at line 807
protected checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

in vB_Api at line 821
protected setController(string $controller)

Set controller

Parameters

string $controller Controller name

in vB_Api at line 831
protected inDebugMode()

at line 32
array updateUserTags(int $nodeid, array $taglist = array())

Adds new tags and/or deletes tags (added by the current user) if they have removed them from the list

Parameters

int $nodeid Node ID
array $taglist List of tags

Return Value

array List of all tags on the node

at line 84
Comma-separated addTags(NodeId $nodeid, Taglist $taglist)

Add tags to the current item implements vB_Tag::addTagsToContent

Parameters

NodeId $nodeid
Taglist $taglist to add

Return Value

Comma-separated list of all tags on the node

at line 108
[array] validTags([string|array] $taglist, integer $nodeid = 0)

Checks if the taglist contains invalid tags

Parameters

[string|array] $taglist [Comma separated string or an array with the tags]
integer $nodeid [The nodeid of the node the tags belong. If 0 this is done on node entry]

Return Value

[array] $errorArray [Array with the errors if any]

Exceptions

vB_Exception_Api

at line 130
insertTags($tagtext)

Parameters

$tagtext

at line 199
array updateTags(String, $tagtext)

Sets the tag matching tag text (case insensitive) to the exact text given Used to fix case when merging tags.

Parameters

String, $tagtext tag text

Return Value

array ('result', response

at line 236
Mixed createSynonyms(Array, $tagList, Integer, $targetid)

Parameters

Array, $tagList Array of tags to merge
Integer, $targetid Id of canonical tag

Return Value

Mixed response

at line 313
True promoteTags(int|array $taglist)

Parameters

int|array $taglist Tag id or array of tag ids

Return Value

True if success

at line 385
array getTagSynonyms(integer $tagid)

Get synonyms of a given tag

Parameters

integer $tagid

Return Value

array 'tags' => array of $tagid => $tagtext for the synonyms of $tagid

at line 424
standard removeTags(NodeId $nodeid, Tags $tags = '')

Remove tags from an item Implements vB_Tag::deleteTag

Parameters

NodeId $nodeid
Tags $tags to delete (if not specified it will delete all tags from node).

Return Value

standard success array

at line 450
standard killTags(Array $killTagList)

Parameters

Array $killTagList Tags Id to delete

Return Value

standard success array

at line 503
The getTagsList(NodeId $nodeid)

Gets the tag list from an specific node.

Implements vB_Tags::fetchExistingTagList

Parameters

NodeId $nodeid

Return Value

The taglist from node

at line 520
standard mergeTags(int $nodeid, array $sourceids)

Merge tags from nodes.

Implements vB_Tags::mergeTagAttachments

Parameters

int $nodeid
array $sourceids array of nodeids to merge tags from

Return Value

standard success array

at line 544
standard moveTags(TargetNodeId $nodeid, SourceNodeId $sourceid)

Move tags from one node to another one.

Implements vB_Tags::moveTagAttachments

Parameters

TargetNodeId $nodeid (Node to move tags in)
SourceNodeId $sourceid (Node to move tags from)

Return Value

standard success array

at line 584
standard copyTags(TargetNodeId $nodeid, SourceNodeId $sourceid)

Copy tags from a node to another one.

Implements vB_Tags::copyTagAttachments.

Parameters

TargetNodeId $nodeid (Node to copy tags in)
SourceNodeId $sourceid (Node to copy tags from)

Return Value

standard success array

at line 601
Tags getNodeTags(NodeId $nodeid)

Get tags with full info (userid, tagid, tagtext) from node.

Implements vB_Tags::getNodeTags

Parameters

NodeId $nodeid

Return Value

Tags from node

at line 621
getAutocomplete($searchStr, $limitstart = 0, $limitnumber = 25)

Parameters

$searchStr
$limitstart
$limitnumber

at line 653
array fetchTagsForCloud($taglevels = 5, $limit = 20, $type = 'nodes')

Get an array of tags for building tag cloud

Parameters

$taglevels
$limit
$type

Return Value

array

at line 700
array fetchTagsForTagNavigation(int $channelId, int $limit = 25, bool $addCloudInfo = false, int $levels = 5)

Returns an array of tags for the tag navigation widget

Parameters

int $channelId Channel ID for the root channel for this tag navigation module
int $limit Maximum number of tags to return
bool $addCloudInfo If true, it will add the information to display as a cloud (instead of a list)
int $levels The number of levels of tags (sizes for cloud)

Return Value

array Tag information

at line 744
protected int sortTagsByTagText(array $a, array $b)

Sort function for fetchTagsForTagNavigation

Parameters

array $a Tag info
array $b Tag info

Return Value

int

at line 754
array fetchTagByText(string $tagtext)

Fetch tag by label

Parameters

string $tagtext

Return Value

array -- tag record

at line 779
getTags($tagids)

Get the tags

Parameters

$tagids

at line 789
logSearchTags(array $tagIds)

Saves the seached for tags so we can build a search tag cloud based on it

Parameters

array $tagIds the ids of the tags that it was searched for

at line 809
protected getExceptionFromErrors($errors)

Parameters

$errors