Skip to content

Commit

Permalink
Fix roots#392 - Small tweak to root relative cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
retlehs committed Apr 11, 2012
1 parent c1ee571 commit 3a9077c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions inc/roots-cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ function roots_root_relative_url($input) {
'!(https?://[^/|"]+)([^"]+)?!',
create_function(
'$matches',
// if full URL is site_url, return a slash for relative root
'if (isset($matches[0]) && $matches[0] === site_url()) { return "/";' .
// if domain is equal to site_url, then make URL relative
'} elseif (isset($matches[0]) && strpos($matches[0], site_url()) !== false) { return $matches[2];' .
// if domain is not equal to site_url, do not make external link relative
// if full URL is home_url("/"), return a slash for relative root
'if (isset($matches[0]) && $matches[0] === home_url("/")) { return "/";' .
// if domain is equal to home_url("/"), then make URL relative
'} elseif (isset($matches[0]) && strpos($matches[0], home_url("/")) !== false) { return $matches[2];' .
// if domain is not equal to home_url("/"), do not make external link relative
'} else { return $matches[0]; };'
),
$input
Expand Down

0 comments on commit 3a9077c

Please sign in to comment.