Source for file escape.php
Documentation is available at escape.php
* Applies various escaping schemes on the given string
* * value : the string to process
* * format : escaping format to use, valid formats are : html, htmlall, url, urlpathinfo, quotes, hex, hexentity, javascript and mail
* * charset : character set to use for the conversion (applies to some formats only), defaults to the current Dwoo charset
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://dwoo.org/LICENSE Modified BSD License
$charset =
$dwoo->getCharset();
return preg_replace("#(?<!\\\\)'#", "\\'", (string)
$value);
$cnt =
strlen((string)
$value);
for ($i=
0; $i <
$cnt; $i++
) {
$out .=
'%' .
bin2hex((string)
$value[$i]);
$cnt =
strlen((string)
$value);
for ($i=
0; $i <
$cnt; $i++
)
$out .=
'&#x' .
bin2hex((string)
$value[$i]) .
';';
return strtr((string)
$value, array('\\'=>
'\\\\',"'"=>
"\\'",'"'=>
'\\"',"\r"=>
'\\r',"\n"=>
'\\n','</'=>
'<\/'));
return str_replace(array('@', '.'), array(' (AT) ', ' (DOT) '), (string)
$value);
return $dwoo->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript or mail, "'.
$format.
'" given.', E_USER_WARNING);
Documentation generated on Sat, 18 Jul 2009 21:04:58 +0200 by phpDocumentor 1.4.0