vB_Library_BbCode_Table
in package
Uses
vB_Trait_NoSerialize
THIS CLASS IS A DUPLICATE OF vBForum_BBCodeHelper_Table IN CORE Implementation of table BB code parsing outside of the normal class hierarchy.
This is primarily to allow reuse in multiple places in the BB code parsing tree (eg, regular parsing and WYSIWYG parsing).
Table of Contents
Methods
- __construct() : mixed
- Constructor
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- appendClassList() : array<string|int, mixed>
- Appends an array of classes to a resolveNamedParams-formatted param list.
- convertParamsToHtml() : string
- Converts arrays of CSS and HTML attributes to the correct HTML format.
- getClassList() : array<string|int, mixed>
- Get the class list from a param list in the format returned by resolveNamedParams.
- isValidNamedParam() : bool
- General code to validate a particular parameter for a tag that takes named params.
- parseNamedParams() : array<string|int, mixed>
- Parses a string of "key: value, key: value" parameters.
- parseTableTag() : string
- Parses the [table] tag and returns the necessary HTML representation.
- resolveNamedParams() : array<string|int, mixed>
- Resolves a "param: value, param: value" formatted string of named parameters.
Methods
__construct()
Constructor
public
__construct(vB_Library_Bbcode $parser) : mixed
Parameters
- $parser : vB_Library_Bbcode
__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
appendClassList()
Appends an array of classes to a resolveNamedParams-formatted param list.
public
appendClassList(array<string|int, mixed> $params, array<string|int, mixed> $classes[, mixed $context = '' ]) : array<string|int, mixed>
Optitionally takes a context which will append "_$context" to the appended classes.
Parameters
- $params : array<string|int, mixed>
- $classes : array<string|int, mixed>
- $context : mixed = ''
Return values
array<string|int, mixed> —resolveNamedParams-formatted param list with extra classes appended
convertParamsToHtml()
Converts arrays of CSS and HTML attributes to the correct HTML format.
public
convertParamsToHtml(array<string|int, mixed> $css, array<string|int, mixed> $attributes) : string
Parameters
- $css : array<string|int, mixed>
- $attributes : array<string|int, mixed>
Return values
string —HTML attributes that can be applied to a tag.
getClassList()
Get the class list from a param list in the format returned by resolveNamedParams.
public
getClassList(array<string|int, mixed> $params[, mixed $context = '' ]) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
- $context : mixed = ''
Return values
array<string|int, mixed> —Array of classes
isValidNamedParam()
General code to validate a particular parameter for a tag that takes named params.
public
isValidNamedParam(mixed &$value, mixed $config[, mixed $context = '' ]) : bool
Parameters
- $value : mixed
- $config : mixed
- $context : mixed = ''
Return values
boolparseNamedParams()
Parses a string of "key: value, key: value" parameters.
public
parseNamedParams(mixed $params_raw) : array<string|int, mixed>
Parameters
- $params_raw : mixed
Return values
array<string|int, mixed> —Key-value formatted array
parseTableTag()
Parses the [table] tag and returns the necessary HTML representation.
public
parseTableTag(mixed $content[, mixed $params = '' ]) : string
TRs and TDs are parsed by this function (they are not real BB codes). Classes are pushed down to inner tags (TRs and TDs) and TRs are automatically valigned top.
Parameters
- $content : mixed
- $params : mixed = ''
Return values
string —HTML representation of the table and its contents.
resolveNamedParams()
Resolves a "param: value, param: value" formatted string of named parameters.
public
resolveNamedParams(mixed $param_string, array<string|int, mixed> $param_list[, mixed $context = '' ]) : array<string|int, mixed>
This validates against a list of allowed parameters; only valid params will be returned. Returns array with 2 keys (css, attributes) each with param => value arrays as values.
Parameters
- $param_string : mixed
- $param_list : array<string|int, mixed>
- $context : mixed = ''
Return values
array<string|int, mixed> —['css' => [ =>