ObfuscateExternalLinks

Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.


To create a new cookbook entry, fill in or remove the sections below.

obfuscate.zip

Goal

The goal of this add-on is to replace external urls by an obfuscated form. This should avoid/limit spam on wiki pages: the url won't appear in the page

Solution

The FmtUrlLink function is replaced. Each link is replaced by a string made of the hexadecimal value of each characters of the urls. Then the url is replaced by a redirection script able to decode this string.

for example, on my wiki, the following link:

http://www.pmwiki.org/wiki/CookBook/HomePage

is replaced by:

[(approve links) edit diff]....

Discussion

  • Copy the hide_external_link.php file into yout local directory. Copy the redirect.php script to a place where it is accessible (your pmwiki directory).
  • Edit your local/config.php file, add the following lines:
  $UrlWhiteList[] = 'www.your.site.web';
  $UrlWhiteList[] = 'www.othersite';
  $UrlWhiteList[] = 'www.pmwiki.org';
  $UrlWhiteList[] = 'www.pmichaud.com';

  $RedirectionScriptUrl='[(approve links)
  edit
  diff]';
  include_once("local/hide_external_links.php");
  • the UrlWhiteList array contains names of website that should not be obfuscated.
  • $redirectionScriptUrl is the url of the redirection script

See Also

History

  • 18 June 2004: Creation
  • 18 June 2004: 2nd version, no more modification to pmwiki.php is needed
  • 21 June 2004: Compacter url coding used

Comments & Bugs

  • TODO: The white list could be loaded from a file or better, a wiki page.
  • BUG: ?? Some of the links being obfuscated are having their last letter changed.
I don't see why the huge random string is necessary, especially since a redirect is still a link to a target site and would most likely count as perfectly valid on search engines. -- Ari
I thought that url that do not appear clearly as plain text where not taken into account by web search engines? Bad news, I did this for nothing? :-(

Contributors

Copyright

pmwiki-2.3.32 -- Last modified by {{Gregory}}?

from IP: 85.171.160.186 ip should be disabled by default for security reasons