MediaWiki  1.23.1
CSSJanus_Tokenizer Class Reference

Utility class used by CSSJanus that tokenizes and untokenizes things we want to protect from being janused. More...

Public Member Functions

 __construct ( $regex, $token)
 Constructor. More...
 
 detokenize ( $str)
 Replace tokens with their originals. More...
 
 tokenize ( $str)
 Replace all occurrences of $regex in $str with a token and remember the original strings. More...
 

Public Attributes

 $token
 

Private Member Functions

 detokenizeCallback ( $matches)
 
 tokenizeCallback ( $matches)
 

Private Attributes

 $originals
 
 $regex
 

Detailed Description

Utility class used by CSSJanus that tokenizes and untokenizes things we want to protect from being janused.

Author
Roan Kattouw

Definition at line 362 of file CSSJanus.php.

Constructor & Destructor Documentation

◆ __construct()

CSSJanus_Tokenizer::__construct (   $regex,
  $token 
)

Constructor.

Parameters
string$regexRegular expression whose matches to replace by a token.
string$tokenToken

Definition at line 371 of file CSSJanus.php.

References $regex, $token, array(), and token.

Member Function Documentation

◆ detokenize()

CSSJanus_Tokenizer::detokenize (   $str)

Replace tokens with their originals.

If multiple strings were tokenized, it's important they be detokenized in exactly the SAME ORDER.

Parameters
string$strpreviously run through tokenize()
Returns
string Original string

Definition at line 402 of file CSSJanus.php.

References array(), and token.

◆ detokenizeCallback()

CSSJanus_Tokenizer::detokenizeCallback (   $matches)
private
Parameters
$matches
Returns
mixed

Definition at line 414 of file CSSJanus.php.

References $retval.

◆ tokenize()

CSSJanus_Tokenizer::tokenize (   $str)

Replace all occurrences of $regex in $str with a token and remember the original strings.

Parameters
string$strto tokenize
Returns
string Tokenized string

Definition at line 383 of file CSSJanus.php.

References array().

◆ tokenizeCallback()

CSSJanus_Tokenizer::tokenizeCallback (   $matches)
private
Parameters
$matchesarray
Returns
string

Definition at line 391 of file CSSJanus.php.

References $matches, and $token.

Member Data Documentation

◆ $originals

CSSJanus_Tokenizer::$originals
private

Definition at line 364 of file CSSJanus.php.

◆ $regex

CSSJanus_Tokenizer::$regex
private

Definition at line 363 of file CSSJanus.php.

Referenced by __construct().

◆ $token

CSSJanus_Tokenizer::$token

Definition at line 363 of file CSSJanus.php.

Referenced by __construct(), and tokenizeCallback().


The documentation for this class was generated from the following file: