vBulletin v6.1.0

vB_Library_Tags extends vB_Library
in package

vB_Library_Tags

Table of Contents

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
addTagIdsToContent()  : void
Add tags to content.
addTagsToNodeText()  : array<string|int, mixed>
Replace plain text that matches tags with hashtag bbcode.
clearCache()  : mixed
deleteUserTagAssociations()  : mixed
filterTagList()  : array<string|int, mixed>
Takes a list of tags and returns a list of valid tags
getContentInstance()  : mixed
getTagList()  : array<string|int, mixed>
Get tag info
instance()  : static
Returns singleton instance of self.
matchAllTagsForNodeText()  : array<string|int, mixed>
matchAllTagsForText()  : array<string|int, mixed>
matchTagsForNodeText()  : array<string|int, mixed>
matchTagsForText()  : array<string|int, mixed>
monitorWords()  : mixed
Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
splitTagList()  : array<string|int, mixed>
Splits the tag list based on an admin-specified set of delimiters (and comma).
splitTagListNormalized()  : array<string|int, mixed>
Splits the tag list based on the configured delimiters (including comma) and formats the tag values to be valid.

Methods

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

addTagIdsToContent()

Add tags to content.

public addTagIdsToContent(int $nodeid, array<string|int, mixed> $tagids) : void

This is a low level function that does not take into account any permissions or limits. The caller is expected to handle those details.

This also handles updating the denormalized tag information for the node

Parameters
$nodeid : int
$tagids : array<string|int, mixed>

addTagsToNodeText()

Replace plain text that matches tags with hashtag bbcode.

public addTagsToNodeText(string $text, bool $firstOnly[, array<string|int, mixed> $tags = [] ]) : array<string|int, mixed>

This function is bbcode aware and will not replace text in the bbcode "structure" and will exclude bbcode tags where replacements are awkward or harmful.

Tags will be match at word boundaries and will check for a literal match of the tag text including whitespace("A tag" will not match "A tag"), but is not case sensitive (case is preserved for the visible text). Matches will not occur over bbcode boundaries (the replacement would require altering the bbcode structure which would require complex handling if it is even possbile to preserve the original rendering).

If two or more matched tags overlap (tags "I am a tag", "I am", "a tag", matching "Really I am a tag in text" then we will match the tag that starts first and ignore the others (we can't have a hashtag within a hashgat).

Parameters
$text : string
$firstOnly : bool

-- Only replace a given tag once. Something other than first occurance of the tag string may be replaced in the case were the tag was skipped due to a conflict.

$tags : array<string|int, mixed> = []

-- Tags to replace. If empty all tags will be used.

Return values
array<string|int, mixed>

['text' => new text, 'tags' => the ids of the tags actually replaced]

clearCache()

public static clearCache() : mixed

deleteUserTagAssociations()

public deleteUserTagAssociations(mixed $userid) : mixed
Parameters
$userid : mixed

filterTagList()

Takes a list of tags and returns a list of valid tags

public filterTagList(string|array<string|int, mixed> $taglist, array<string|int, mixed> &$errors) : array<string|int, mixed>

Tags are transformed to removed tabs and newlines Tags may be lowercased based on options Tags matching synomyns will Duplicate will be eliminated (case insensitive) Invalid tags will be removed.

Fetch the valid tags from a list. Filters are length, censorship, perms (if desired).

Parameters
$taglist : string|array<string|int, mixed>
$errors : array<string|int, mixed>
Return values
array<string|int, mixed>

List of valid tags

getContentInstance()

public static getContentInstance(mixed $contenttypeid) : mixed
Parameters
$contenttypeid : mixed

getTagList()

Get tag info

public getTagList(array<string|int, mixed> $taglist) : array<string|int, mixed>

Gets the id and tag value, keyed by the original tag value. This is intended to do several things

  1. Get the case for a tagname that might have been given the wrong case
  2. Substitute the canonical tag for synonyms
  3. Get the tagid.
Parameters
$taglist : array<string|int, mixed>

-- string array of tag values

Return values
array<string|int, mixed>

-- array of [tagname => ['tagid' => tagid, 'tagtext' => correctedtagname]] If a value in the list isn't a valid tag, it will return [tagname => false]

instance()

Returns singleton instance of self.

public static instance(mixed $class) : static
Parameters
$class : mixed
Return values
static
  • Reference to singleton instance of the requested library class

matchAllTagsForNodeText()

public matchAllTagsForNodeText(string $text) : array<string|int, mixed>
Parameters
$text : string
Return values
array<string|int, mixed>

matchAllTagsForText()

public matchAllTagsForText(string $text) : array<string|int, mixed>
Parameters
$text : string
Return values
array<string|int, mixed>

matchTagsForNodeText()

public matchTagsForNodeText(string $text, array<string|int, mixed> $tags) : array<string|int, mixed>
Parameters
$text : string
$tags : array<string|int, mixed>
Return values
array<string|int, mixed>

matchTagsForText()

public matchTagsForText(string $text, array<string|int, mixed> $tags) : array<string|int, mixed>
Parameters
$text : string
$tags : array<string|int, mixed>
Return values
array<string|int, mixed>

monitorWords()

Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.

public monitorWords(mixed $text, mixed $type, mixed $nodeid[, mixed $userid = null ][, mixed $insertNotifications = true ][, mixed $currentuserid = 0 ]) : mixed

use the functions from the notification library directly.

Parameters
$text : mixed
$type : mixed
$nodeid : mixed
$userid : mixed = null
$insertNotifications : mixed = true
$currentuserid : mixed = 0

splitTagList()

Splits the tag list based on an admin-specified set of delimiters (and comma).

public splitTagList(string $taglist) : array<string|int, mixed>
Parameters
$taglist : string
Return values
array<string|int, mixed>

Tags in seperate array entries

splitTagListNormalized()

Splits the tag list based on the configured delimiters (including comma) and formats the tag values to be valid.

public splitTagListNormalized(string|array<string|int, mixed> $taglist) : array<string|int, mixed>

The function applies standard tag transforms including setting the case to lower if configured as well as collasping white space to a single space within the tag.

This will also take an array of tags and apply the case rules to it

Parameters
$taglist : string|array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results