Security Helper

The security helper offers various methods that assist with input filtering.

Methods

xss_clean()

'xss_clean' behaves the same as xss_clean in the Input library.

  • [string] String to be cleansed

strip_image_tags()

'strip_image_tags()' strips the image tags out of a string and returns the string trimmed without the image tags.

  • [string] String to be stripped
$string = '<b>Check this image:</b> <img src="http://www.example.com/example.jpg" />';
print Kohana::debug(security::strip_image_tags($string));

It will result in HTML as:

<b>Check this image:</b> http://www.example.com/example.jpg

encode_php_tags()

'encode_php_tags' replaces PHP tags in a string with their corresponding HTML entities.

  • [string] String to santize
$string = '<?php echo "<b>Hello World!</b>" ?>';
print Kohana::debug(security::encode_php_tags($string));

It will result in HTML as:

&lt;?php echo "<b>Hello World!</b>" ?&gt;
helpers/security.txt · Dernière modification: 15/03/2011 21:18 par alban
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0