zingming
Forum Replies Created
-
Forum: Plugins
In reply to: [HumansNotBots - Easy, Accessible Email Cloaker] Doesnt work properly anymoreIt works fine for me with the recent WordPress. Can you give an example?
Hi,
Thank you for pointing out the bug. It should be fixed in version 3.1, which I just released.
Have you tried going to the Settings and switching to the “Walk the DOM” method?
I’ve internationalized the development version my plugin so that it can be translated. You can download the development version here:
https://downloads.www.ads-software.com/plugin/humansnotbots.zip
Inside there is a ‘languages’ directory and a file named
humansnotbots-it-IT.po
. This is a partially-translated translation file that I made. I put in “PRESSO” and “PUNTO” for “AT” and “DOT”. I then compiled it to make thehumansnotbots-it-IT.mo
binary file that is used by WordPress to show the translations. I tested it and it works with “PRESSO” and “PUNTO” if the WordPress language is set to Italian.If you want to translate the other strings, you can edit the PO file to fill in the rest of the translations. After, you can compile the MO file if you are using Linux with:
msgfmt -o filename.mo filename.po
or you can send me the file so I can compile it for you if you aren’t using Linux.(It is probably good if you send me the PO file anyway so that I can include the Italian localization files when I release the next version of the HumansNotBots plugin.)
https://codex.www.ads-software.com/I18n_for_WordPress_Developers#PO_files
There is also an example Italian PO file here:
OK, that makes sense. I will try to work on adding internalization or customization.
Hi,
Can you give an example of what you would change the AT and DOT into?
No, it should work with any TLD that is two, three, or four characters: “DOT ca”, “DOT org”, and “DOT info” all work.
I am Canadian, and I have an email address that ends in .ca
It is case-sensitive, so the “AT” and “DOT” need to be uppercase.
2.0 is released, and there is the option to use the alternative method under admin Settings.
Here is a beta version of humansnotbots.js using a different method. I tested it in IE8. Let me know if it works for you.
[Code moderated as per the Forum Rules. Please use the pastebin]
I tested it in IE8 now, and it seems to work with Flash (embedded YouTube video) but not WP-Cumulus. I will have to investigate more.
1.3 is out.
humansnotbots.php:
class HumansNotBots { function add_to_footer () { $js_file_url = WP_PLUGIN_URL .'/'. plugin_basename(dirname(__FILE__)) . '/humansnotbots.js'; echo '<script type="text/javascript" src="' . $js_file_url .'"></script>' . "\n"; } } $humansnotbots = new HumansNotBots(); add_action('wp_footer', array($humansnotbots, 'add_to_footer'));
humansnotbots.js:
function HumansNotBots() { var htmlbody = document.getElementsByTagName('body')[0]; var rep = '<a href="mailto:$1@$2.$3">$1@$2.$3</a>'; var newInnerHTML = htmlbody.innerHTML.replace(/([a-zA-Z0-9._%+-]+)\sAT\s([a-zA-Z0-9.-]+)\sDOT\s([a-zA-Z]{2,4})/g, rep); htmlbody.innerHTML = newInnerHTML; } HumansNotBots();
Thanks. I should have thought to use getElementsByTagName instead!
For the next update, I have your version of humansnotbots.js. For humansnotbots.php, I now have this (inspired from your suggestions):
class HumansNotBots { function add_to_footer () { $js_url = WP_PLUGIN_URL .'/'. plugin_basename(dirname(__FILE__)) . '/humansnotbots.js'; echo '<script type="text/javascript" src="' . $js_url .'"></script>' . "\n"; echo '<script type="text/javascript">' . "\n\twindow.onload = HumansNotBots;\n</script>\n"; } } $humansnotbots = new HumansNotBots(); add_action('wp_footer', array($humansnotbots, 'add_to_footer')); ?>
I will let you inspect the code/test this time before I push the update. ??
Thanks again. I fixed that bug and added support for the Hybrid theme in version 1.2.
wp_enqueue_script is just a better way of including the script in the html head, but it doesn’t run it. However, your tip was helpful, because I used it in 1.2 to improve the way I added the script to the html head.
Thanks. It should be fixed now in version 1.1.