1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5 * An open source application development framework for PHP 5.1.6 or newer
8 * @author ExpressionEngine Dev Team
9 * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
10 * @license http://codeigniter.com/user_guide/license.html
11 * @link http://codeigniter.com
16 // ------------------------------------------------------------------------
19 * CodeIgniter Security Helpers
21 * @package CodeIgniter
24 * @author ExpressionEngine Dev Team
25 * @link http://codeigniter.com/user_guide/helpers/security_helper.html
28 // ------------------------------------------------------------------------
35 * @param bool whether or not the content is an image file
38 if ( ! function_exists('xss_clean'))
40 function xss_clean($str, $is_image = FALSE)
42 $CI =& get_instance();
43 return $CI->security->xss_clean($str, $is_image);
47 // ------------------------------------------------------------------------
56 if ( ! function_exists('sanitize_filename'))
58 function sanitize_filename($filename)
60 $CI =& get_instance();
61 return $CI->security->sanitize_filename($filename);
65 // --------------------------------------------------------------------
68 * Hash encode a string
74 if ( ! function_exists('do_hash'))
76 function do_hash($str, $type = 'sha1')
89 // ------------------------------------------------------------------------
98 if ( ! function_exists('strip_image_tags'))
100 function strip_image_tags($str)
102 $str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str);
103 $str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str);
109 // ------------------------------------------------------------------------
112 * Convert PHP tags to entities
118 if ( ! function_exists('encode_php_tags'))
120 function encode_php_tags($str)
122 return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('<?php', '<?PHP', '<?', '?>'), $str);
127 /* End of file security_helper.php */
128 /* Location: ./system/helpers/security_helper.php */