public function serialize() { return b64_encode(serialize($this->data)); }
var_dump($url); var_dump($content); } $rewrite = !$image; /********************************************************* * Rewrite image & script urls *********************************************************/ if ($rewrite) { /* * src="http://.." format */ $content = preg_replace_callback('#(src|href|action)=("|\')?((http|ftp|//)s?([^"\'>]+))("|\')?#', function ($m) use($proxyserv) { return $m[1] . '="' . $proxyserv . b64_encode($m[3]) . '"'; }, $content); $content = preg_replace_callback('#url\\(("|\')?((http|ftp|//)s?([^"\']+))("|\')?\\)#', function ($m) use($proxyserv) { return 'url("' . $proxyserv . b64_encode($m[2]) . '")'; }, $content); /* * src="/..." or href="/..." or url('/...') format */ $content = preg_replace('#(src|href|action)=(["\'])/([^/]|["\'])#', '$1=$2' . $hostproxify . '/$3', $content); /*$content = preg_replace_callback('#(src|href|action)=(["\'])([^"\'>]+["\'])#', function($m) use ($hostproxify) { if (preg_match('#^(http|ftp|//)#', $m[3])) return $m[0]; return $m[1] . '=' . $m[2] . $hostproxify . '/' . $m[3]; }, $content);*/ $content = preg_replace('#url\\(("|\')?/([^/]|["\'])#', 'url($1' . $hostproxify . '/$2', $content); } /* * replace real host by proxify host