You are here

function globalredirect_url_is_external in Global Redirect 6

Same name and namespace in other branches
  1. 7 globalredirect.module \globalredirect_url_is_external()

Check if a path is external (e.g. http://example.com).

This is a simple copy of url_is_external() which if given an URL with an invalid protocal will return FALSE, an undesired value. This function will return TRUE given an URL with an invalid protocol.

1 call to globalredirect_url_is_external()
globalredirect_goto in ./globalredirect.module
A wrapper for drupal_goto() that does not pass through if $path is an external URL.

File

./globalredirect.module, line 249
The Global Redirect module redirects for all paths which have aliases but are not using the aliases which reduces the risk of duplicate content.

Code

function globalredirect_url_is_external($path) {
  $colonpos = strpos($path, ':');
  return $colonpos !== FALSE && !preg_match('![/?#]!', drupal_substr($path, 0, $colonpos));
}