Merge pull request #941 from roots/rel_url_f

Port support for rel urls
This commit is contained in:
Foxaii
2013-12-13 12:09:27 -08:00

View File

@@ -13,7 +13,9 @@
function roots_root_relative_url($input) {
preg_match('|https?://([^/]+)(/.*)|i', $input, $matches);
if (isset($matches[1]) && isset($matches[2]) && $matches[1] === $_SERVER['SERVER_NAME']) {
if (!isset($matches[1]) || !isset($matches[2])) {
return $input;
} elseif (($matches[1] === $server_name) || $matches[1] === $server_name . ':' . $_SERVER['SERVER_PORT']) {
return wp_make_link_relative($input);
} else {
return $input;