vB_Api_Bbcode
extends vB_Api
in package
vB_Api_Bbcode
Table of Contents
Constants
- ALLOW_BBCODE_ALIGN = 16
- ALLOW_BBCODE_BASIC = 1
- ALLOW_BBCODE_CODE = 128
- ALLOW_BBCODE_COLOR = 2
- ALLOW_BBCODE_CUSTOM = 4096
- ALLOW_BBCODE_FONT = 8
- ALLOW_BBCODE_HASHTAG = 32768
- ALLOW_BBCODE_HTML = 512
- ALLOW_BBCODE_IMG = 1024
- ALLOW_BBCODE_LIST = 32
- ALLOW_BBCODE_PHP = 256
- ALLOW_BBCODE_QUOTE = 2048
- ALLOW_BBCODE_SIZE = 4
- ALLOW_BBCODE_URL = 64
- ALLOW_BBCODE_USER = 16384
- ALLOW_BBCODE_VIDEO = 8192
- EDITOR_INDENT = 40
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- callNamed() : The
- Call the given api function by name with a named arguments list.
- checkApiState() : mixed
- This method checks whether the API method is enabled.
- clearCache() : mixed
- Clears all previously loaded API objects.
- convertUrlToBbcode() : string
- Converts URLs into bbcode with [URL]
- convertWysiwygTextToBbcode() : string
- Converts text from an editor into text ready to be saved with bbcode converted
- extractVideo() : mixed
- Extracts the video and photo content from text.
- fetchSmilies() : array<string|int, mixed>
- Returns an array of smilie information.
- fetchTagList() : array<string|int, mixed>
- Returns the list of default BB code tags
- getApiClassName() : mixed
- getSignatureInfo() : array<string|int, mixed>
- Fetches and parses to html a user's signature
- hasBbcode() : bool
- Determines if the text contains bbcode.
- initInfo() : array<string|int, mixed>
- Returns an array of bbcode parsing information. {@see vB_Api_Bbcode::fetchTagList}
- instance() : vB_Api
- Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
- instanceInternal() : vB_Api
- 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
- map_vb4_input_to_vb5() : string
- Returns vb5 api method name.
- map_vb5_errors_to_vb4() : mixed
- Alters the error array in any way necessary to interface correctly with vb4.
- map_vb5_output_to_vb4() : mixed
- Alters the output array in any way necessary to interface correctly with vb4.
- parseSignature() : string
- Fetches and parses to html a user's signature
- parseSignatures() : array<string|int, mixed>
- Fetches and parses to html signatures
- parseWysiwygHtmlToBbcode() : string
- Parses HTML produced by a WYSIWYG editor and produces the corresponding BBCode formatted text
Constants
ALLOW_BBCODE_ALIGN
public
mixed
ALLOW_BBCODE_ALIGN
= 16
ALLOW_BBCODE_BASIC
public
mixed
ALLOW_BBCODE_BASIC
= 1
ALLOW_BBCODE_CODE
public
mixed
ALLOW_BBCODE_CODE
= 128
ALLOW_BBCODE_COLOR
public
mixed
ALLOW_BBCODE_COLOR
= 2
ALLOW_BBCODE_CUSTOM
public
mixed
ALLOW_BBCODE_CUSTOM
= 4096
ALLOW_BBCODE_FONT
public
mixed
ALLOW_BBCODE_FONT
= 8
ALLOW_BBCODE_HASHTAG
public
mixed
ALLOW_BBCODE_HASHTAG
= 32768
ALLOW_BBCODE_HTML
public
mixed
ALLOW_BBCODE_HTML
= 512
ALLOW_BBCODE_IMG
public
mixed
ALLOW_BBCODE_IMG
= 1024
ALLOW_BBCODE_LIST
public
mixed
ALLOW_BBCODE_LIST
= 32
ALLOW_BBCODE_PHP
public
mixed
ALLOW_BBCODE_PHP
= 256
ALLOW_BBCODE_QUOTE
public
mixed
ALLOW_BBCODE_QUOTE
= 2048
ALLOW_BBCODE_SIZE
public
mixed
ALLOW_BBCODE_SIZE
= 4
ALLOW_BBCODE_URL
public
mixed
ALLOW_BBCODE_URL
= 64
ALLOW_BBCODE_USER
public
mixed
ALLOW_BBCODE_USER
= 16384
ALLOW_BBCODE_VIDEO
public
mixed
ALLOW_BBCODE_VIDEO
= 8192
EDITOR_INDENT
public
int
EDITOR_INDENT
= 40
EDITOR_INDENT Used in parsing the [INDENT] bbcode tag
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>
__wakeup()
public
__wakeup() : void
callNamed()
Call the given api function by name with a named arguments list.
public
callNamed() : The
Used primarily to translate REST requests into API calls.
Return values
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.
checkApiState()
This method checks whether the API method is enabled.
public
checkApiState(mixed $method) : mixed
For extensions check make sure $controller property is already set.
Parameters
- $method : mixed
clearCache()
Clears all previously loaded API objects.
public
static clearCache() : mixed
Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.
convertUrlToBbcode()
Converts URLs into bbcode with [URL]
public
convertUrlToBbcode(mixed $messagetext) : string
Parameters
- $messagetext : mixed
Return values
string —Converted text
convertWysiwygTextToBbcode()
Converts text from an editor into text ready to be saved with bbcode converted
public
convertWysiwygTextToBbcode(mixed $text, mixed $options) : string
Parameters
- $text : mixed
- $options : mixed
Return values
string —Converted Text
extractVideo()
Extracts the video and photo content from text.
public
extractVideo(mixed $rawtext) : mixed
Parameters
- $rawtext : mixed
Return values
mixed —Array of 'url', 'provider', 'code'
fetchSmilies()
Returns an array of smilie information.
public
fetchSmilies() : array<string|int, mixed>
Return values
array<string|int, mixed> —Smilie information corresponding to the data in the "smilie" field, with one extra column "smilielen".
fetchTagList()
Returns the list of default BB code tags
public
fetchTagList([mixed $prepend_path = '' ][, mixed $force_all = false ]) : array<string|int, mixed>
Parameters
- $prepend_path : mixed = ''
- $force_all : mixed = false
Return values
array<string|int, mixed> —Array of BB code tags. Format:
array(
defaultTags => array vB_Api_Bbcode::fetchTagList
customTags => array @see vB_Api_Bbcode::fetchCustomTags
defaultOptions => array vB_Api_Bbcode::fetchBbcodeOptions()
)
getApiClassName()
public
static getApiClassName(mixed $controller) : mixed
Parameters
- $controller : mixed
getSignatureInfo()
Fetches and parses to html a user's signature
public
getSignatureInfo(int $userid[, string $signature = false ][, bool $skipdupcheck = false ]) : array<string|int, mixed>
Parameters
- $userid : int
- $signature : string = false
-
optionally pass the signature to avoid fetching it again
- $skipdupcheck : bool = false
-
-- skips the check for multiple sigpic usages in the signature.
Return values
array<string|int, mixed> —Array containing the parsed signature: (same as doParseSignature)
array( signature => parsed HTML signature allowed => array of bbcode tags the user is allowed to use in their signature disabled => array of bbcode tags the user is NOT allowed to use in their signature )
hasBbcode()
Determines if the text contains bbcode.
public
hasBbcode(mixed $text) : bool
Parameters
- $text : mixed
Return values
bool —True if the text contains valid bbcode, false if not.
initInfo()
Returns an array of bbcode parsing information. {@see vB_Api_Bbcode::fetchTagList}
public
initInfo() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —Bbcode parsing information. Format:
array( defaultTags => array vB_Api_Bbcode::fetchTagList customTags => array @see vB_Api_Bbcode::fetchCustomTags defaultOptions => array vB_Api_Bbcode::fetchBbcodeOptions() )
instance()
Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
public
static instance(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_ApiinstanceInternal()
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
public
static instanceInternal(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_Apimap_vb4_input_to_vb5()
Returns vb5 api method name.
public
static map_vb4_input_to_vb5(string $method, array<string|int, mixed> &$request) : string
May alter request array.
Parameters
- $method : string
-
-- vb4 method name
- $request : array<string|int, mixed>
-
-- $_REQUEST array for this api request
Return values
stringmap_vb5_errors_to_vb4()
Alters the error array in any way necessary to interface correctly with vb4.
public
static map_vb5_errors_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- error array from vb5
map_vb5_output_to_vb4()
Alters the output array in any way necessary to interface correctly with vb4.
public
static map_vb5_output_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- output array from vb5
parseSignature()
Fetches and parses to html a user's signature
public
parseSignature(int $userid[, string $signature = false ][, bool $skipdupcheck = false ]) : string
Parameters
- $userid : int
- $signature : string = false
-
optionally pass the signature to avoid fetching it again
- $skipdupcheck : bool = false
-
-- skips the check for multiple sigpic usages in the signature.
Tags
Return values
string —the parsed (html) signature
parseSignatures()
Fetches and parses to html signatures
public
parseSignatures(array<string|int, mixed> $userIds[, array<string|int, mixed> $rawSignatures = array() ]) : array<string|int, mixed>
Parameters
- $userIds : array<string|int, mixed>
- $rawSignatures : array<string|int, mixed> = array()
-
(Optional) Raw signatures to avoid fetching them again
Return values
array<string|int, mixed> —the parsed (html) signatures keyed by the userid.
parseWysiwygHtmlToBbcode()
Parses HTML produced by a WYSIWYG editor and produces the corresponding BBCode formatted text
public
parseWysiwygHtmlToBbcode(mixed $text) : string
Parameters
- $text : mixed
Return values
string —BBCode text