diff options
Diffstat (limited to 'system/helpers/security.php')
| -rw-r--r-- | system/helpers/security.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/system/helpers/security.php b/system/helpers/security.php new file mode 100644 index 0000000..7103bd1 --- /dev/null +++ b/system/helpers/security.php @@ -0,0 +1,35 @@ +<?php defined('SYSPATH') OR die('No direct access allowed.'); +/** + * Security helper class. + * + * @package Kohana + * @author Kohana Team + * @copyright (c) 2007-2009 Kohana Team + * @license http://kohanaphp.com/license + */ +class security_Core { + + /** + * Sanitize a string with the xss_clean method. + * + * @param string string to sanitize + * @param string xss_clean method to use ('htmlpurifier' or defaults to built-in method) + * @return string + */ + public static function xss_clean($str, $tool = NULL) + { + return Input::instance()->xss_clean($str, $tool); + } + + /** + * Remove image tags from a string. + * + * @param string string to sanitize + * @return string + */ + public static function strip_image_tags($str) + { + return preg_replace('#<img\s.*?(?:src\s*=\s*["\']?([^"\'<>\s]*)["\']?[^>]*)?>#is', '$1', $str); + } + +} // End security
\ No newline at end of file |
