Class rcube_string_replacer

Description

Helper class for string replacements based on preg_replace_callback

Located in /lib/Roundcube/rcube_string_replacer.php (line 25)


	
			
Direct descendents
Class Description
 class rcmail_string_replacer Helper class for turning URLs and email addresses in plaintext content into clickable links.
Variable Summary
 static mixed $pattern
Method Summary
 static void parse_url_brackets ( &$url)
 rcube_string_replacer __construct ([ $options = array()])
 int add (string $str)
 void get_replacement ( $i)
 int link_callback (array $matches)
 int mailto_callback (array $matches)
 string replace (string $str)
 string replace_callback (array $matches)
 void resolve ( $str)
Variables
static mixed $pattern = '/##str_replacement\[([0-9]+)\]##/' (line 27)
  • access: public
mixed $link_pattern (line 29)
  • access: public
mixed $mailto_pattern (line 28)
  • access: public
Methods
static parse_url_brackets (line 160)

Fixes bracket characters in URL handling

  • access: public
void parse_url_brackets ( &$url)
  • &$url
Constructor __construct (line 34)
rcube_string_replacer __construct ([ $options = array()])
  • $options
add (line 58)

Add a string to the internal list

  • return: Index of value for retrieval
  • access: public
int add (string $str)
  • string $str: String value
get_replacement (line 68)

Build replacement string

  • access: public
void get_replacement ( $i)
  • $i
link_callback (line 79)

Callback function used to build HTML links around URL strings

  • return: Index of saved string value
  • access: public
int link_callback (array $matches)
  • array $matches: Matches result from preg_replace_callback
mailto_callback (line 112)

Callback function used to build mailto: links around e-mail strings

  • return: Index of saved string value
  • access: public
int mailto_callback (array $matches)
  • array $matches: Matches result from preg_replace_callback

Redefined in descendants as:
replace (line 140)

Replace all defined (link|mailto) patterns with replacement string

  • return: Text
  • access: public
string replace (string $str)
  • string $str: Text
replace_callback (line 128)

Look up the index from the preg_replace matches array and return the substitution value.

  • return: Value at index $matches[1]
  • access: public
string replace_callback (array $matches)
  • array $matches: Matches result from preg_replace_callback
resolve (line 152)

Replace substituted strings with original values

  • access: public
void resolve ( $str)
  • $str

Documentation generated on Fri, 03 May 2013 12:45:06 +0200 by phpDocumentor 1.4.4