diff options
| author | Tristan Zur <tzur@webserver.ccwn.org> | 2015-06-10 20:55:53 +0200 |
|---|---|---|
| committer | Tristan Zur <tzur@webserver.ccwn.org> | 2015-06-10 20:55:53 +0200 |
| commit | 406abd7c4df1ace2cd3e4e17159e8941a2e8c0c4 (patch) | |
| tree | a324be16021f44f2fd6d55e609f47024e945b1db /system/helpers/security.php | |
Initial import
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 |
