MediaWiki  REL1_24
CSSJanusTokenizer 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.

Private Member Functions

 detokenizeCallback ($matches)
 tokenizeCallback ($matches)

Private Attributes

 $originals
 $regex
 $token

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


Constructor & Destructor Documentation

CSSJanusTokenizer::__construct ( regex,
token 
)

Constructor.

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

Definition at line 406 of file CSSJanus.php.

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


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:
string$strpreviously run through tokenize()
Returns:
string Original string

Definition at line 437 of file CSSJanus.php.

References array().

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

Definition at line 452 of file CSSJanus.php.

References $retval.

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

References array().

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

Definition at line 426 of file CSSJanus.php.

References $matches.


Member Data Documentation

CSSJanusTokenizer::$originals [private]

Definition at line 399 of file CSSJanus.php.

CSSJanusTokenizer::$regex [private]

Definition at line 397 of file CSSJanus.php.

Referenced by __construct().

CSSJanusTokenizer::$token [private]

Definition at line 398 of file CSSJanus.php.

Referenced by __construct().


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