class parser implements parser_interface

s9e\TextFormatter\Parser adapter

Properties

protected dispatcher_interface $dispatcher
protected Parser $parser

Methods

__construct(driver_interface $cache, string $key, factory $factory, dispatcher_interface $dispatcher)

Constructor

string
parse(string $text)

Parse given text

null
disable_bbcode(string $name)

Disable a specific BBCode

disable_bbcodes()

Disable BBCodes in general

disable_censor()

Disable the censor

disable_magic_url()

Disable magic URLs

disable_smilies()

Disable smilies

null
enable_bbcode(string $name)

Enable a specific BBCode

enable_bbcodes()

Enable BBCodes in general

enable_censor()

Enable the censor

enable_magic_url()

Enable magic URLs

enable_smilies()

Enable smilies

array[]
get_errors()

Get the list of errors that were generated during last parsing

Parser
get_parser()

Return the instance of s9e\TextFormatter\Parser used by this object

null
set_var(string $name, mixed $value)

Set a variable to be used by the parser

null
set_vars(array $vars)

Set multiple variables to be used by the parser

static mixed
filter_font_size(string $size, int $max_size, Logger $logger)

Filter the value used in a [size] BBCode

static string|bool
filter_img_url(string $url, array $url_config, Logger $logger)

Filter an image's URL to enforce restrictions on its dimensions

bool
is_a_bbcode(Tag $tag)

Test whether given tag consumes text that looks like BBCode-styled markup

Details

at line 43
__construct(driver_interface $cache, string $key, factory $factory, dispatcher_interface $dispatcher)

Constructor

Parameters

driver_interface $cache
string $key

Cache key

factory $factory
dispatcher_interface $dispatcher

at line 77
string parse(string $text)

Parse given text

Parameters

string $text

Return Value

string

at line 111
null disable_bbcode(string $name)

Disable a specific BBCode

Parameters

string $name

BBCode name

Return Value

null

at line 119
disable_bbcodes()

Disable BBCodes in general

at line 127
disable_censor()

Disable the censor

at line 135
disable_magic_url()

Disable magic URLs

at line 144
disable_smilies()

Disable smilies

at line 153
null enable_bbcode(string $name)

Enable a specific BBCode

Parameters

string $name

BBCode name

Return Value

null

at line 161
enable_bbcodes()

Enable BBCodes in general

at line 169
enable_censor()

Enable the censor

at line 177
enable_magic_url()

Enable magic URLs

at line 186
enable_smilies()

Enable smilies

at line 198
array[] get_errors()

Get the list of errors that were generated during last parsing

Return Value

array[]

Array of arrays. Each array contains a lang string at index 0 plus any number of optional parameters

at line 270
Parser get_parser()

Return the instance of s9e\TextFormatter\Parser used by this object

Return Value

Parser

at line 278
null set_var(string $name, mixed $value)

Set a variable to be used by the parser

  • max_font_size
  • max_img_height
  • max_img_width
  • max_smilies
  • max_urls

Parameters

string $name
mixed $value

Return Value

null

at line 297
null set_vars(array $vars)

Set multiple variables to be used by the parser

Parameters

array $vars

Associative array of [name => value]

Return Value

null

at line 315
static mixed filter_font_size(string $size, int $max_size, Logger $logger)

Filter the value used in a [size] BBCode

Parameters

string $size

Original size

int $max_size

Maximum allowed size

Logger $logger

Return Value

mixed

Original value if valid, FALSE otherwise

See also

\phpbb\textformatter\s9e\bbcode_firstpass::bbcode_size()

at line 343
static string|bool filter_img_url(string $url, array $url_config, Logger $logger)

Filter an image's URL to enforce restrictions on its dimensions

Parameters

string $url

Original URL

array $url_config

Config used by the URL filter

Logger $logger

Return Value

string|bool

Original value if valid, FALSE otherwise

See also

\phpbb\textformatter\s9e\bbcode_firstpass::bbcode_img()

at line 361
protected bool is_a_bbcode(Tag $tag)

Test whether given tag consumes text that looks like BBCode-styled markup

Parameters

Tag $tag

Original tag

Return Value

bool