Permalink
Browse files

Remove absolute URL references to source host.

  • Loading branch information...
1 parent 50854d3 commit 03a4b8d9d8c7f6d6e354ffc2894d4ad0b83ef863 @dberstein committed May 6, 2011
Showing with 24 additions and 1 deletion.
  1. +24 −1 rewrite.php
View
@@ -38,10 +38,33 @@ function rwtCallback($string)
$string
);
+ $string = preg_replace(
+ '/[A-z]+' . preg_quote('://' . $host, '/') . '/',
+ '',
+ $string
+ );
+
+ return $string;
+}
+
+function mirrorCallback($string)
+{
+ $host = $_SERVER['HTTP_HOST'];
+ if (preg_match('/[A-z]:\/\/([^\/\"\']+)/i', $host)) {
+ $host = $matches[1];
+ }
+
+ $string = preg_replace(
+ '/[A-z]+' . preg_quote('://' . $host, '/') . '/',
+ '',
+ $string
+ );
+
return $string;
}
if (array_key_exists('rwt', $_GET)) {
ob_start('rwtCallback');
+} else {
+ ob_start('mirrorCallback');
}
-

0 comments on commit 03a4b8d

Please sign in to comment.