class vB_Library_BbCode_Table

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).

Traits

Properties

protected array $table_param_list Defines the list of paramaters that can be used in a table BB code.
protected array $tr_param_list Defines a list of params that can be used in a tr BB code.
protected array $td_param_list Defines a list of params that can be used in a td BB code.
protected string $table_class_prefix Prefix to apply to all classes used by the table/tr/td tags.
protected bool $add_formatting_whitespace Whether the output should include non-significant whitespace to aid in formatting the HTML output. This will have no difference on the displayed output.
protected $wrap_table Whether to wrap the output table with a div for markup purposes
protected vB_BBCodeParser $parser The BB code parser invoking this object.

Methods

__sleep()

No description

__wakeup()

No description

__construct(vB_Library_Bbcode $parser)

Constructor

string
parseTableTag(string $content, string $params = '')

Parses the [table] tag and returns the necessary HTML representation.

array
modifyTableParams(array $table_params)

Helper method to allow modification of the paramaters for a table tag before they are used in child tags or outputted.

string
parseTableRows(string $content, array $table_classes)

Parses the rows of a table

string
parseTableCells(string $content, array $row_classes)

Parses the cells of a table row

string
modifyCellContent(string $content)

Helper method to modify the cell content before it is placed in the HTML.

array
getClassList(array $params, string $context = '')

Get the class list from a param list in the format returned by resolveNamedParams.

array
appendClassList(array $params, array $classes, string $context = '')

Appends an array of classes to a resolveNamedParams-formatted param list.

array
resolveNamedParams(string $param_string, array $param_list, string $context = '')

Resolves a "param: value, param: value" formatted string of named parameters.

string
convertParamsToHtml(array $css, array $attributes)

Converts arrays of CSS and HTML attributes to the correct HTML format.

bool
isValidNamedParam(string $value, array $config, string $context = '')

General code to validate a particular parameter for a tag that takes named params.

array
parseNamedParams(string $params_raw)

Parses a string of "key: value, key: value" parameters.

bool
validateTableClass(string $class_string, string $context = '')

Validates the class parameter for a table/tr/td tag. The classes passed in will be modified to be prefixed by $table_class_prefix.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 127
__construct(vB_Library_Bbcode $parser)

Constructor

Parameters

vB_Library_Bbcode $parser Invoking BB code parser

at line 143
string parseTableTag(string $content, string $params = '')

Parses the [table] tag and returns the necessary HTML representation.

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

string $content Content within the table tag
string $params Optional set of parameters in an unparsed format. Parses "param: value, param: value" form.

Return Value

string HTML representation of the table and its contents.

at line 178
protected array modifyTableParams(array $table_params)

Helper method to allow modification of the paramaters for a table tag before they are used in child tags or outputted.

Parameters

array $table_params Table parameters (in format of resolveNamedParams)

Return Value

array Table parameters modified if necessary

at line 191
protected string parseTableRows(string $content, array $table_classes)

Parses the rows of a table

Parameters

string $content Content within the table BB code
array $table_classes List of classes applied to the table BB code (from getClassList)

Return Value

string HTML output of the rows

at line 230
protected string parseTableCells(string $content, array $row_classes)

Parses the cells of a table row

Parameters

string $content Content within the tr BB code
array $row_classes List of classes applied to the table and tr BB codes (from getClassList)

Return Value

string HTML output of the cells

at line 266
protected string modifyCellContent(string $content)

Helper method to modify the cell content before it is placed in the HTML.

Parameters

string $content Cell content

Return Value

string Modified cell content

at line 280
array getClassList(array $params, string $context = '')

Get the class list from a param list in the format returned by resolveNamedParams.

Parameters

array $params Param set as returned by resolveNamedParams
string $context Optional context info (primarily used in child classes)

Return Value

array Array of classes

at line 302
array appendClassList(array $params, array $classes, string $context = '')

Appends an array of classes to a resolveNamedParams-formatted param list.

Optitionally takes a context which will append "_$context" to the appended classes.

Parameters

array $params resolveNamedParams-formatted param list
array $classes Array of classes to append
string $context Optional context, will be appended to class names that are added

Return Value

array resolveNamedParams-formatted param list with extra classes appended

at line 340
array resolveNamedParams(string $param_string, array $param_list, string $context = '')

Resolves a "param: value, param: value" formatted string of named parameters.

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

string $param_string Unparsed string of named params
array $param_list A list of valid params. See $table_param_list for format.
string $context Optional context that can be used to help validation methods.

Return Value

array array('css' => array( => ...), 'attributes' => array( => ...))

at line 386
string convertParamsToHtml(array $css, array $attributes)

Converts arrays of CSS and HTML attributes to the correct HTML format.

Parameters

array $css Key-value array of CSS attributes
array $attributes Key-value array of HTML attributes

Return Value

string HTML attributes that can be applied to a tag.

at line 422
bool isValidNamedParam(string $value, array $config, string $context = '')

General code to validate a particular parameter for a tag that takes named params.

Parameters

string $value Value for the parameter
array $config Configuration for the validation of the param
string $context Context value (for a validation callback)

Return Value

bool

at line 462
array parseNamedParams(string $params_raw)

Parses a string of "key: value, key: value" parameters.

Parameters

string $params_raw Parameters to parse

Return Value

array Key-value formatted array

at line 493
protected bool validateTableClass(string $class_string, string $context = '')

Validates the class parameter for a table/tr/td tag. The classes passed in will be modified to be prefixed by $table_class_prefix.

Parameters

string $class_string List of classes. Modified to be prefixed by $table_class_prefix
string $context Optional context. Unused at this time.

Return Value

bool