class Parser extends ParserBase

Properties

protected array $config from  ParserBase
protected Parser $parser from  ParserBase

Methods

__construct(Parser $parser, array $config)

Constructor

void
setUp()

Plugin's setup

void
parse(string $text, array $matches)

No description

void
linkifyUrl(int $tagPos, string $url)

Linkify given URL at given position

string
trimUrl(string $url)

Remove trailing punctuation from given URL

Details

in ParserBase at line 30
final __construct(Parser $parser, array $config)

Constructor

Parameters

Parser $parser
array $config

in ParserBase at line 43
protected void setUp()

Plugin's setup

Return Value

void

at line 17
void parse(string $text, array $matches)

No description

Parameters

string $text
array $matches

If the config array has a "regexp" key, the corresponding matches are passed as second parameter. Otherwise, an empty array is passed

Return Value

void

at line 33
protected void linkifyUrl(int $tagPos, string $url)

Linkify given URL at given position

Parameters

int $tagPos

URL's position in the text

string $url URL

Return Value

void

at line 72
protected string trimUrl(string $url)

Remove trailing punctuation from given URL

We remove most ASCII non-letters and Unicode punctuation from the end of the string. Exceptions:

  • dashes and underscores, (base64 IDs could end with one)
  • equal signs, (because of "foo?bar=")
  • plus signs, (used by some file share services to force download)
  • trailing slashes,
  • closing parentheses. (they are balanced separately)

Parameters

string $url

Original URL

Return Value

string

Trimmed URL