PHP code for parameter filtering
** @ Param string $ string the string to be converted * @ return string */static public function nl2br ($ string) {return nl2br ($ string);}/*** set
Convert to \ n ** @ param string $ string to be converted * @ return string */static public function br2nl ($ string) {$ array = array ('
','
'); Return str_replace ($ array, "\ n", $ string );} /*** multiple consecutive spaces are reserved for only one ** @ param string $ string to be converted * @ return unknown */static public function merge_spaces ($ string) {return preg_replace ("/\ s (? = \ S)/"," \ 1 ", $ string);}/*** multiple consecutive
Only one ** @ param string $ string to be converted * @ return string */static public function merge_brs ($ string) {return preg_replace ("/((
) +)/I ","
", $ String );} /*** filter the html tag in the string ** @ param string $ string the string to be converted * @ return string */static public function strip_tags ($ string) {return strip_tags ($ string );} /*** convert the string to all lowercase letters ** @ param string $ string the string to be converted * @ return string */static public function strtolower ($ string) {return strtolower ($ string );} /*** convert the string to uppercase ** @ param string $ string the string to be converted * @ return string */static public function strtoupper ($ string) {return strtoupper ($ string );} /*** filter specific characters starting and ending with a character string ** @ param string $ string to be converted * @ param string $ char_list list of specific characters to be converted * @ return string */static public function trim ($ string, $ char_list = '\\\\ s') {$ chars = preg_replace (array ('/[\ ^ \-\] \\\]/S ', '/\ {4}/S','/\/'), array (' \ 0 ','\\', '\/'), $ char_list); $ pattern = '^ ['. $ chars. '] * | ['. $ chars. '] *; return preg_replace ("/$ pattern/sSD", '', $ string );} /*** filter the carriage return and line feed in the string ** @ param string $ string the string to be converted * @ return string */static public function strip_new_lines ($ string) {return str_replace (array ("\ n", "\ r"), '', $ string );} /*** filter the script in the string ** @ param string $ string the string to be filtered * @ return string */static public function strip_script ($ string) {$ reg = "/
] *?>. *? <\/Script>/is "; return preg_replace ($ reg,'', $ string);}/*** filter strings