MediaWiki  REL1_19
CSSJanus_Tokenizer Class Reference

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

List of all members.

Public Member Functions

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

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 291 of file CSSJanus.php.


Constructor & Destructor Documentation

CSSJanus_Tokenizer::__construct ( regex,
token 
)

Constructor.

Parameters:
$regexstring Regular expression whose matches to replace by a token.
$tokenstring Token

Definition at line 300 of file CSSJanus.php.

References $regex, and $token.


Member Function Documentation

Replace tokens with their originals.

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

Parameters:
$strString: previously run through tokenize()
Returns:
string Original string

Definition at line 331 of file CSSJanus.php.

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

Definition at line 343 of file CSSJanus.php.

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

Parameters:
$strString to tokenize
Returns:
string Tokenized string

Definition at line 312 of file CSSJanus.php.

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

Definition at line 320 of file CSSJanus.php.

References $matches.


Member Data Documentation

CSSJanus_Tokenizer::$originals [private]

Definition at line 293 of file CSSJanus.php.

CSSJanus_Tokenizer::$regex [private]

Definition at line 292 of file CSSJanus.php.

Referenced by __construct().

CSSJanus_Tokenizer::$token

Definition at line 292 of file CSSJanus.php.

Referenced by __construct().


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