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

Ken Rickard agentrickard at gmail.com
Mon Nov 9 22:56:26 UTC 2009


I think you may need a patch. We had something similar come up in
Drupal 5, and obviously missed this use-case when we had the call to
custom_url_rewrite_outbound() inserted in the url() function.

The D5 version of Domain Access shipped with a functional backport of
the patch, so best practice suggests fixing this against Drupal 8 (or
7 if we can call it an API bug) and then backport the patch to D6.

/me will vote that this is a bug in the API.

- Ken Rickard
agentrickard


On Mon, Nov 9, 2009 at 11:25 PM, Mlen-Too Wesley
<mlen.too.wesley at gmail.com> wrote:
> 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 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
>
>
>
>
>
>



-- 
Ken Rickard
agentrickard at gmail.com
http://ken.therickards.com


More information about the development mailing list