NAME
App::ZofCMS::Plugin::AntiSpamMailTo - "smart" HTML escapes to protect mailto:foo@bar.com links from not-so-smart spam bots
SYNOPSIS
In your Main Config file or ZofCMS template:
# include the plugin
plugins => [ qw/AntiSpamMailTo/ ],
# then this:
plug_anti_spam_mailto => 'bar',
# or this:
plug_anti_spam_mailto => [ qw/foo bar baz/ ],
# or this:
plug_anti_spam_mailto => {
foo => 'bar',
baz => 'beer',
},
In your HTML::Template template:
<tmpl_var name="mailto">
# or this:
<tmpl_var name="mailto_0"> <tmpl_var name="mailto_1"> <tmpl_var name="mailto_2">
# or this:
<tmpl_var name="foo"> <tmpl_var name="baz">
DESCRIPTION
The module is an App::ZofCMS plugin which provides means to deploy a technique that many claim to be effective in protecting your <a href="mailto:foo@bar.com"></a> links from dumb spam bots.
The technique is quite simple (and simple to circumvent, but we are talking about dumb spam bots) - the entire contents of href="" attribute are encoded as HTML entities. Dumb spam bots miss the mailto: and go their way. As of the day of this writing, I have about 14 sites that have been using this plugin for 3+ years and I might have received one spam email to the email address shown by the plugin. Anyway, on to the business.
This documentation assumes you have read App::ZofCMS, App::ZofCMS::Config and App::ZofCMS::Template
MAIN CONFIG/ZofCMS TEMPLATE FIRST-LEVEL KEYS
plug_anti_spam_mailto
plug_anti_spam_mailto => 'bar',
plug_anti_spam_mailto => [ qw/foo bar baz/ ],
plug_anti_spam_mailto => {
foo => 'bar',
baz => 'beer',
},
The plugin takes it's data from plug_anti_spam_mailto first-level key that is in either ZofCMS template or config file. The key takes either a string, arrayref or a hashref as its value. If the key is specified in both main config file and ZofCMS template and the value is of the same type (string, arrayref or hashref) then both values will be interpreted by the plugin; in case of the hashref, any duplicate keys will obtain the value assigned to them in ZofCMS template. Note: if the value is of "type" string specified in both main config file and ZofCMS template it will interpreted as an arrayref with two elements. Now I'll tell you why this all matters:
value is a string
plug_anti_spam_mailto => 'bar',
When the value is a string then in HTML::Template template you'd access the converted data via variable mailto, i.e. <tmpl_var name="mailto">
value is an arrayref or a string in both ZofCMS template and main config file
plug_anti_spam_mailto => [ qw/foo bar baz/ ],
To access converted data when the value is an arrayref you'd use mailto_NUM where NUM is the index of the element in the arrayref. In other words, to access value bar in the example above you'd use <tmpl_var name="mailto_1">
value is a hashref
plug_anti_spam_mailto => {
foo => 'bar',
baz => 'beer',
},
You do not have to keep typing mailto to access your converted data. When value is a hashref the values of that hashref are the data to be converted and the keys are the names of <tmpl_var name"">s into which to stick that data. In the example above, to access converted data for beer you'd use <tmpl_var name="baz">
EXAMPLE
ZofCMS template:
plugins => [ qw/AntiSpamMailTo/ ],
plug_anti_spam_mailto => 'mailto:john.foo@example.com',
HTML::Template template:
<a href="<tmpl_var name="mailto">">email to John Foo</a>
AUTHOR
'Zoffix, <'zoffix at cpan.org'> (http://zoffix.com/, http://haslayout.net/, http://zofdesign.com/)
BUGS
Please report any bugs or feature requests to bug-app-zofcms-plugin-antispammailto at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-ZofCMS-Plugin-AntiSpamMailTo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc App::ZofCMS::Plugin::AntiSpamMailTo
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-ZofCMS-Plugin-AntiSpamMailTo
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
http://cpanratings.perl.org/d/App-ZofCMS-Plugin-AntiSpamMailTo
Search CPAN
http://search.cpan.org/dist/App-ZofCMS-Plugin-AntiSpamMailTo
COPYRIGHT & LICENSE
Copyright 2008 'Zoffix, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.