Drupal should provide a url_is_local() function to determine whether a given URL is local to the currently-running drupal instance. This could be done by re-factoring and re-using part of the conf_path() function.

Comments

pillarsdotnet’s picture

StatusFileSize
new2.8 KB

Here's a patch against D8. A backport to D7 or D6 would be trivial, as this code hasn't changed.

pillarsdotnet’s picture

StatusFileSize
new2.86 KB

Revised patch also works for relative URLs.

pillarsdotnet’s picture

StatusFileSize
new2.8 KB

Using drupal_parse_url instead of PHP's parse_url.

pillarsdotnet’s picture

Status: Active » Needs review
pillarsdotnet’s picture

Fixed typo, expanded doxygen comments, and provided both D7 and D8 versions.

pillarsdotnet’s picture

Version: 8.x-dev » 7.x-dev

Bah. D8 patches are being marked "postponed".

pillarsdotnet’s picture

Status: Needs review » Closed (duplicate)

Okay, this is too confusing. Gonna close and re-open a new issue.