[development] Help with custom_url_rewrite_outboud(), url(), and l() because external URLs need rewriting too

Mlen-Too Wesley mlen.too.wesley at gmail.com
Mon Nov 9 22:25:30 UTC 2009


Hello,

I am currently developing a module to help libraries rewrite links to
external databases, such as ProQuest and LexisNexis, routing those links
through an EZProxy <http://en.wikipedia.org/wiki/EZproxy> or other proxy
referral server.

For example, consider a resource located at:
http://www.books24x7.com/marc.asp?bookid=30164

If accessed from an on-campus IP address, the resource will be available to
the student. However, if off-campus, the student would either have to use
VPN to route all their internet traffic through a university IP address or
use an proxy referral server, such as EZProxy.

EZProxy is easier, so from the library home page, the link is rewritten to
something such as:
http://ezproxy.example-library.edu/login?url=http://www.books24x7.com/marc.asp?bookid=30164

This way, the student is presented with a login screen for authentication
and then directed to the resource.

An easy module to make... or so I thought. Given the
custom_url_rewrite_outbound() function, this kind of stuff should be easy to
do in Drupal, but it is not. The url() function in common.inc returns the
$path variable without any attempts to call custom_url_rewrite_outbout().

All would be well, if line 1408 of common.inc added the same functionality
to external links in the url() function as it does for internal links. It
just needs 3 lines:

    if (function_exists('custom_url_rewrite_outbound')) {
      // Modules may alter outbound links by reference.
      custom_url_rewrite_outbound($path, $options, $original_path);
    }

Other than applying a patch, does anyone know another way around this issue?

I am not talking about Apache mod_rewrite or anything similar, Clean URLs,
or the Path module and URL aliases. I am looking for a way to rewrite
external URLs in anchor tags (links) without creating a wrapper function for
url() or l()... or using JavaScript or AJAX.

Thanks!

MT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20091109/096e6d00/attachment.html 


More information about the development mailing list