} if ($_flags['remove_scripts']) { $_response_body = preg_replace('#<\\s*script[^>]*?>.*?<\\s*/\\s*script\\s*>#si', '', $_response_body); $_response_body = preg_replace("#(\\bon[a-z]+)\\s*=\\s*(?:\"([^\"]*)\"?|'([^']*)'?|([^'\"\\s>]*))?#i", '', $_response_body); $_response_body = preg_replace('#<noscript>(.*?)</noscript>#si', "\$1", $_response_body); } if (!$_flags['show_images']) { $_response_body = preg_replace('#<(img|image)[^>]*?>#si', '', $_response_body); } // // PROXIFY HTML RESOURCE // $tags = array('a' => array('href'), 'img' => array('src', 'longdesc'), 'image' => array('src', 'longdesc'), 'body' => array('background'), 'base' => array('href'), 'frame' => array('src', 'longdesc'), 'iframe' => array('src', 'longdesc'), 'head' => array('profile'), 'layer' => array('src'), 'input' => array('src', 'usemap'), 'form' => array('action'), 'area' => array('href'), 'link' => array('href', 'src', 'urn'), 'meta' => array('content'), 'param' => array('value'), 'applet' => array('codebase', 'code', 'object', 'archive'), 'object' => array('usermap', 'codebase', 'classid', 'archive', 'data'), 'script' => array('src'), 'select' => array('src'), 'hr' => array('src'), 'table' => array('background'), 'tr' => array('background'), 'th' => array('background'), 'td' => array('background'), 'bgsound' => array('src'), 'blockquote' => array('cite'), 'del' => array('cite'), 'embed' => array('src'), 'fig' => array('src', 'imagemap'), 'ilayer' => array('src'), 'ins' => array('cite'), 'note' => array('src'), 'overlay' => array('src', 'imagemap'), 'q' => array('cite'), 'ul' => array('src')); preg_match_all('#(<\\s*style[^>]*>)(.*?)(<\\s*/\\s*style[^>]*>)#is', $_response_body, $matches, PREG_SET_ORDER); for ($i = 0, $count_i = count($matches); $i < $count_i; ++$i) { $_response_body = str_replace($matches[$i][0], $matches[$i][1] . proxify_css($matches[$i][2]) . $matches[$i][3], $_response_body); } preg_match_all("#<\\s*([a-zA-Z\\?-]+)([^>]+)>#S", $_response_body, $matches); for ($i = 0, $count_i = count($matches[0]); $i < $count_i; ++$i) { if (!preg_match_all("#([a-zA-Z\\-\\/]+)\\s*(?:=\\s*(?:\"([^\">]*)\"?|'([^'>]*)'?|([^'\"\\s]*)))?#S", $matches[2][$i], $m, PREG_SET_ORDER)) { continue; } $rebuild = false; $extra_html = $temp = ''; $attrs = array(); for ($j = 0, $count_j = count($m); $j < $count_j; $attrs[strtolower($m[$j][1])] = isset($m[$j][4]) ? $m[$j][4] : (isset($m[$j][3]) ? $m[$j][3] : (isset($m[$j][2]) ? $m[$j][2] : false)), ++$j) { } if (isset($attrs['style'])) { $rebuild = true; $attrs['style'] = proxify_inline_css($attrs['style']); }
} if ($GLOBALS['_flags']['remove_scripts']) { $GLOBALS['_response_body'] = preg_replace('#<\\s*script[^>]*?>.*?<\\s*/\\s*script\\s*>#si', '', $GLOBALS['_response_body']); $GLOBALS['_response_body'] = preg_replace("#(\\bon[a-z]+)\\s*=\\s*(?:\"([^\"]*)\"?|'([^']*)'?|([^'\"\\s>]*))?#i", '', $GLOBALS['_response_body']); $GLOBALS['_response_body'] = preg_replace('#<noscript>(.*?)</noscript>#si', "\$1", $GLOBALS['_response_body']); } if (!$GLOBALS['_flags']['show_images']) { $GLOBALS['_response_body'] = preg_replace('#<(img|image)[^>]*?>#si', '', $GLOBALS['_response_body']); } // // PROXIFY HTML RESOURCE // $tags = array('a' => array('href'), 'img' => array('src', 'longdesc'), 'image' => array('src', 'longdesc'), 'body' => array('background', 'onload'), 'base' => array('href'), 'frame' => array('src', 'longdesc'), 'iframe' => array('src', 'longdesc'), 'head' => array('profile'), 'layer' => array('src'), 'input' => array('src', 'usemap'), 'form' => array('action'), 'area' => array('href'), 'link' => array('href', 'src', 'urn'), 'meta' => array('content'), 'param' => array('value'), 'applet' => array('codebase', 'code', 'object', 'archive'), 'object' => array('usermap', 'codebase', 'classid', 'archive', 'data'), 'script' => array('src'), 'select' => array('src'), 'hr' => array('src'), 'table' => array('background'), 'tr' => array('background'), 'th' => array('background'), 'td' => array('background'), 'bgsound' => array('src'), 'blockquote' => array('cite'), 'del' => array('cite'), 'embed' => array('src'), 'fig' => array('src', 'imagemap'), 'ilayer' => array('src'), 'ins' => array('cite'), 'note' => array('src'), 'overlay' => array('src', 'imagemap'), 'q' => array('cite'), 'ul' => array('src')); preg_match_all('#(<\\s*style[^>]*>)(.*?)(<\\s*/\\s*style[^>]*>)#is', $GLOBALS['_response_body'], $matches, PREG_SET_ORDER); for ($i = 0, $count_i = count($matches); $i < $count_i; ++$i) { $GLOBALS['_response_body'] = str_replace($matches[$i][0], $matches[$i][1] . proxify_css($matches[$i][2]) . $matches[$i][3], $GLOBALS['_response_body']); } preg_match_all("#<\\s*([a-zA-Z\\?-]+)([^>]+)>#S", $GLOBALS['_response_body'], $matches); for ($i = 0, $count_i = count($matches[0]); $i < $count_i; ++$i) { if (!preg_match_all("#([a-zA-Z\\-\\/]+)\\s*(?:=\\s*(?:\"([^\">]*)\"?|'([^'>]*)'?|([^'\"\\s]*)))?#S", $matches[2][$i], $m, PREG_SET_ORDER)) { continue; } $body = false; // oneye $rebuild = false; $extra_html = $temp = ''; $attrs = array(); for ($j = 0, $count_j = count($m); $j < $count_j; $attrs[strtolower($m[$j][1])] = isset($m[$j][4]) ? $m[$j][4] : (isset($m[$j][3]) ? $m[$j][3] : (isset($m[$j][2]) ? $m[$j][2] : false)), ++$j) { } if (isset($attrs['style'])) { $rebuild = true;