Advertisement
H4nk

Script Filter Parameter

Sep 22nd, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. function filter_param($text,$html=true){
  2.         $e_s=array('\\','\'','"');
  3.         $d_s=array('','','');
  4.         $text = preg_replace( "'<script[^>]*>.*?</script>'si", '', $text );
  5.         $text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text );
  6.         $text = preg_replace( '/<!--.+?-->/', '', $text );
  7.         $text = preg_replace( '/{.+?}/', '', $text );
  8.         $text = preg_replace( '/&nbsp;/', ' ', $text );
  9.         $text = preg_replace( '/&amp;/', '', $text );
  10.         $text = str_replace( $e_s, $d_s, $text );
  11.         $text = strip_tags( $text );
  12.         $text = preg_replace("/\r\n\r\n\r\n+/", " ", $text);
  13.         $text = $html ? htmlspecialchars( $text ) : $text;
  14.         return $text;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement