test abitrary url against current page 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") -&gt; true
_is_current_page("node/1234") -&gt; true
_is_current_page("popular_article_name") -&gt; 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") -&gt; true
_is_current_page("blog-calendar") -&gt; true


Help greatly appreciated : )
Excluding edge cases (querystring, hash tags, etc), this seems to work for all my test cases:

/**
 * Determine whether a given url matches the current page.
 * 
 * @param string $test_path     A file path (no domain, no querystring, etc)
 * @return boolean 
 */
function _nwr1_is_current_url($test_path){
    $test_path = trim($test_path, '/');
    $test_norm_path = drupal_lookup_path('source', $test_path);
    $this_nid = (arg(0) == 'node' &amp;&amp; is_numeric(arg(1))) ? arg(1) : FALSE;
    $this_norm_path = ($this_nid) ? "node/$this_nid" : FALSE;
    $success = FALSE;   

    // test by source (eg node/XXXX - preferred)
    if($test_norm_path &amp;&amp; $this_norm_path &amp;&amp; ($test_norm_path==$this_norm_path) ){
        $success = TRUE;

    // test by path 
    }else if($test_path &amp;&amp; current_path() &amp;&amp; ($test_path==current_path()) ){
        $success = TRUE;
    }
    return $success;
}