I need to test a series of links to see if any of them match the page that is being processed. I'm having trouble finding a solution that will match all possible pages (a node, a view page, a page created by a module, etc) and will consider path aliases.
(It would be convenient to start with all parameters of $test_url
stripped of the domain name and leading/following slashes.)
function _is_current_page($test_url){
$test = FALSE;
...
return $test;
}
Test case 1:
// current Url: domain.com/blog/year/month/article_name
// current Nid: 1234
// alias for above: domain.com/popular_article_name
_is_current_page("blog/year/month/article_name") -> true
_is_current_page("node/1234") -> true
_is_current_page("popular_article_name") -> true
Test case 2:
// current Url: domain.com/blog/calendar
// current Nid: _none_ (generated by view or module)
// alias for above: domain.com/blog-calendar
_is_current_page("blog/calendar") -> true
_is_current_page("blog-calendar") -> true
Help greatly appreciated : )