[摘要]", " ", join(" ", att_list));function html_highlight(str) color_1 ...
", " ", join(" ", $att_list));
}
function html_highlight($str) {
$color_1 = "red";
$color_2 = "blue";
$color_3 = "gray";
$str = str_replace("\\\"","\"",$str);
preg_match_all("/<script([^>]*)>(.*)<\/script>/isU", $str, $arr_tmp);
$arr_script = $arr_tmp[0];
for($i=0; $i<count($arr_script); $i++) {
$str = str_replace($arr_script[$i], "
::script_{$i}::
", $str);
$arr_script[$i] = preg_replace("/<script([^>]*)>(.*)<\/script>/iseU", "'<font color=\'{$color_2}\'><SCRIPT '.html_highlight_attr('\\1').'></font><br />'.script_highlight(str_replace('\\\"','\"','\\2'), false).'<font color=\'{$color_2}\'></SCRIPT></font>'", $arr_script[$i]);
}
$str = preg_replace("/(<textarea[^>]*>)(.*)(<\/textarea>)/ieU" ,"'\\1'.htmlspecialchars('\\2').'\\3'", $str);
$str = preg_replace("/<!\-\-(.*)\-\->/seU" ,"'<!--'.htmlspecialchars('\\1').'-->'", $str);
$str = preg_replace("/<style([^>]*)>(.*)<\/style>/isU" ,"<!style\\1>\\2</style!>", $str);
$str = preg_replace("/<([a-z:]+)\s*(.*?)( \/
关键词:PHP - Html Transfer Code