Пример #1
0
	public static function KillTags($str)
	{
		$str = CSearch::RemovePHP($str);

		static $search = array (
			"'<!--.*?-->'si",  // Strip out javascript
			"'<script[^>]*?>.*?</script>'si",  // Strip out javascript
			"'<style[^>]*?>.*?</style>'si",  // Strip out styles
			"'<select[^>]*?>.*?</select>'si",  // Strip out <select></select>
			"'<head[^>]*?>.*?</head>'si",  // Strip out <head></head>
			"'<tr[^>]*?>'",
			"'<[^>]*?>'",
			"'([\\r\\n])[\\s]+'",  // Strip out white space
			"'&(quot|#34);'i",  // Replace html entities
			"'&(amp|#38);'i",
			"'&(lt|#60);'i",
			"'&(gt|#62);'i",
			"'&(nbsp|#160);'i",
			"'[ ]+ '",
		);

		static $replace = array (
			"",
			"",
			"",
			"",
			"",
			"\r\n",
			"\r\n",
			"\\1",
			"\"",
			"&",
			"<",
			">",
			" ",
			" ",
		);

		$str = preg_replace ($search, $replace, $str);

		return $str;
	}
Пример #2
0
 function KillTags($str)
 {
     $str = CSearch::RemovePHP($str);
     static $search = array("'<!--.*?-->'si", "'<script[^>]*?>.*?</script>'si", "'<style[^>]*?>.*?</style>'si", "'<select[^>]*?>.*?</select>'si", "'<head[^>]*?>.*?</head>'si", "'<tr[^>]*?>'", "'<[^>]*?>'", "'([\\r\\n])[\\s]+'", "'&(quot|#34);'i", "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'[ ]+ '");
     static $replace = array("", "", "", "", "", "\r\n", "\r\n", "\\1", "\"", "&", "<", ">", " ", " ");
     $str = preg_replace($search, $replace, $str);
     return $str;
 }