Source for file modifier.escape.php
Documentation is available at modifier.escape.php
* Smarty escape modifier plugin
* Purpose: Escape the string according to escapement type
* @link http://smarty.php.net/manual/en/language.modifier.escape.php
* escape (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param html|htmlall|url|quotes|hex|hexentity|javascript
// escape unescaped single quotes
// escape every character into hex
for ($x=
0; $x <
strlen($string); $x++
) {
$return .=
'%' .
bin2hex($string[$x]);
for ($x=
0; $x <
strlen($string); $x++
) {
$return .=
'&#x' .
bin2hex($string[$x]) .
';';
for ($x=
0; $x <
strlen($string); $x++
) {
$return .=
'&#' .
ord($string[$x]) .
';';
// escape quotes and backslashes, newlines, etc.
return strtr($string, array('\\'=>
'\\\\',"'"=>
"\\'",'"'=>
'\\"',"\r"=>
'\\r',"\n"=>
'\\n','</'=>
'<\/'));
// safe way to display e-mail address on a web page
return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string);
// escape non-standard chars, such as ms document quotes
for($_i =
0, $_len =
strlen($string); $_i <
$_len; $_i++
) {
// non-standard char, escape it
$_res .=
'&#' .
$_ord .
';';
$_res .=
substr($string, $_i, 1);
/* vim: set expandtab: */
Documentation generated on Sun, 09 Mar 2008 23:52:23 -0300 by phpDocumentor 1.4.0