Commit 08867d98 authored by lechuck's avatar lechuck Committed by lechuck
Browse files

Upgrade recaptcha to 3.1.6

parent 8eeb6fdf
=== Plugin Name ===
Contributors: BlaenkDenum
Donate link: http://www.blaenkdenum.com
Tags: comments, registration, recaptcha, antispam, mailhide, captcha, wpmu
Tags: comments, registration, recaptcha, antispam, mailhide, captcha
Requires at least: 2.7
Tested up to: 2.9.1
Stable tag: 3.1.3
Stable tag: 3.1.6
Integrates reCAPTCHA anti-spam methods with WordPress including comment, registration, and email spam protection. WPMU Compatible.
Integrates reCAPTCHA anti-spam methods with WordPress including comment, registration, and email spam protection.
== Description ==
= Notice =
If anyone is interested in taking up development of this plugin, please contact me at blaenk@gmail.com. I would be glad to provide access to the plugin repository. Preferably someone who has experience with the WP and WP multisite APIs (primarily their authorization and options APIs).
If you would like to simply contribute patches, you are welcome to do so at the [github repository](https://github.com/blaenk/wp-recaptcha).
Otherwise, if anyone encounters issues with this plugin, you might want to give [this one](http://wordpress.org/extend/plugins/bwp-recaptcha/) a try.
= What is reCAPTCHA? =
[reCAPTCHA](http://recaptcha.net/ "reCAPTCHA") is an anti-spam method originating from [Carnegie Mellon University](http://www.cmu.edu/index.shtml "Carnegie Mellon University"), then acquired by [Google](http://www.google.com/recaptcha) which uses [CAPTCHAs](http://recaptcha.net/captcha.html "CAPTCHA") in a [genius way](http://recaptcha.net/learnmore.html "How Does it Work? - reCAPTCHA"). Instead of randomly generating useless characters which users grow tired of continuosly typing in, risking the possibility that spammers will eventually write sophisticated spam bots which use [OCR](http://en.wikipedia.org/wiki/Optical_character_recognition "Optical Character Recognition - Wikipedia") libraries to read the characters, reCAPTCHA uses a different approach.
......@@ -20,10 +27,6 @@ reCAPTCHA is probably the most popular and widely accepted CAPTCHA systems by bo
It is accessible by everyone. If the user has trouble reading the CAPTCHA challenge, he or she has the option of requesting a new one. If this does not help, there is also an audio challenge which users may use.
This plugin is [WordPress MU](http://mu.wordpress.org/) compatible.
For more information please view the [plugin page](http://www.blaenkdenum.com/wp-recaptcha/ "WP-reCAPTCHA - Blaenk Denum").
== Installation ==
To install in regular WordPress and [WordPress MultiSite](http://codex.wordpress.org/Create_A_Network):
......@@ -32,14 +35,6 @@ To install in regular WordPress and [WordPress MultiSite](http://codex.wordpress
1. Activate the plugin through the `Plugins` menu in WordPress
1. Get the reCAPTCHA keys [here](http://recaptcha.net/api/getkey?domain=www.blaenkdenum.com&app=wordpress "reCAPTCHA API keys") and/or the MailHide keys [here](http://mailhide.recaptcha.net/apikey "MailHide keys")
To install in WordPress MU (Forced Activation/Site-Wide):
1. Upload the `wp-recaptcha` folder to the `/wp-content/mu-plugins` directory
1. **Move** the `wp-recaptcha.php` file out of the `wp-recaptcha` folder so that it is in `/wp-content/mu-plugins`
1. Now you should have `/wp-content/mu-plugins/wp-recaptcha.php` and `/wp-content/mu-plugins/wp-recaptcha/`
1. Go to the administrator menu and then go to **Site Admin > reCAPTCHA**
1. Get the reCAPTCHA keys [here](http://recaptcha.net/api/getkey?domain=www.blaenkdenum.com&app=wordpress "reCAPTCHA API keys") and/or the MailHide keys [here](http://mailhide.recaptcha.net/apikey "MailHide keys")
== Requirements ==
* You need the reCAPTCHA keys [here](http://recaptcha.net/api/getkey?domain=www.blaenkdenum.com&app=wordpress "reCAPTCHA API keys") and/or the MailHide keys [here](http://mailhide.recaptcha.net/apikey "MailHide keys")
......@@ -49,6 +44,16 @@ To install in WordPress MU (Forced Activation/Site-Wide):
== ChangeLog ==
= Version 3.1.6 =
* WordPress MS fixes. Should now work out of the box at the individual blog level. Thanks to [huyz](http://huyz.us/)
* NOTICE: If anyone is interested in taking up development of this plugin, please contact me at blaenk@gmail.com.
= Version 3.1.5 =
* Thanks to [Ken Newman](https://github.com/WraithKenny) for these changes
* Update author website
* Stop generating javascript errors on unnecessary pages
* Better SSL support
= Version 3.1.4 =
* Fixed an XSS vulnerability
= Version 3.1.3 =
* Added a collision aversion prefix to the Plugin class. bbouton from github alerted me to a collision between WP-reCAPTCHA's plugin class and the JW Player Plugin's Plugin class.
= Version 3.1.2 =
......
......@@ -54,7 +54,6 @@ if (!class_exists('reCAPTCHA')) {
// only register the hooks if the user wants recaptcha on the comments page
if ($this->options['show_in_comments']) {
add_action('comment_form', array(&$this, 'show_recaptcha_in_comments'));
add_action('wp_footer', array(&$this, 'save_comment_script')); // preserve the comment that was entered
// recaptcha comment processing (look into doing all of this with AJAX, optionally)
add_action('wp_head', array(&$this, 'saved_comment'), 0);
......@@ -276,17 +275,19 @@ COMMENT_FORM;
else
$use_ssl = false;
$escaped_error = htmlentities($_GET['rerror'], ENT_QUOTES);
// if it's for wordpress mu, show the errors
if ($this->is_multi_blog()) {
$error = $errors->get_error_message('captcha');
echo '<label for="verification">Verification:</label>';
echo ($error ? '<p class="error">'.$error.'</p>' : '');
echo $format . $this->get_recaptcha_html($_GET['rerror'], $use_ssl);
echo $format . $this->get_recaptcha_html($escaped_error, $use_ssl);
}
// for regular wordpress
else {
echo $format . $this->get_recaptcha_html($_GET['rerror'], $use_ssl);
echo $format . $this->get_recaptcha_html($escaped_error, $use_ssl);
}
}
......@@ -375,6 +376,8 @@ COMMENT_FORM;
</script>
OPTS;
add_action('wp_footer', array(&$this, 'save_comment_script')); // preserve the comment that was entered
// todo: replace this with jquery: http://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/
// todo: use math to increment+1 the submit button based on what the tab_index option is
if ($this->options['xhtml_compliance']) {
......@@ -395,7 +398,9 @@ COMMENT_FORM;
$use_ssl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on");
echo $recaptcha_js_opts . $this->get_recaptcha_html(isset($_GET['rerror']) ? $_GET['rerror'] : null, $use_ssl) . $comment_string;
$escaped_error = htmlentities($_GET['rerror'], ENT_QUOTES);
echo $recaptcha_js_opts . $this->get_recaptcha_html(isset($escaped_error) ? $escaped_error : null, $use_ssl) . $comment_string;
}
}
......@@ -523,8 +528,10 @@ JS;
if ($this->environment == Environment::WordPressMU && $this->is_authority())
add_submenu_page('wpmu-admin.php', 'WP-reCAPTCHA', 'WP-reCAPTCHA', 'manage_options', __FILE__, array(&$this, 'show_settings_page'));
/* re-add when we figure out a way to add network-wide settings in ms
if ($this->environment == Environment::WordPressMS && $this->is_authority())
add_submenu_page('ms-admin.php', 'WP-reCAPTCHA', 'WP-reCAPTCHA', 'manage_options', __FILE__, array(&$this, 'show_settings_page'));
*/
add_options_page('WP-reCAPTCHA', 'WP-reCAPTCHA', 'manage_options', __FILE__, array(&$this, 'show_settings_page'));
}
......
......@@ -60,9 +60,9 @@ if (!class_exists('WPPlugin')) {
static function plugins_url() {
if (WPPlugin::determine_environment() == Environment::WordPressMU)
return get_option('siteurl') . '/wp-content/mu-plugins';
return site_url() . '/wp-content/mu-plugins';
else
return get_option('siteurl') . '/wp-content/plugins';
return site_url() . '/wp-content/plugins';
}
static function path_to_plugin_directory() {
......@@ -91,21 +91,21 @@ if (!class_exists('WPPlugin')) {
// option retrieval
static function retrieve_options($options_name) {
if (WPPlugin::determine_environment() == Environment::WordPressMU || WPPlugin::determine_environment() == Environment::WordPressMS)
if (WPPlugin::determine_environment() == Environment::WordPressMU)
return get_site_option($options_name);
else
return get_option($options_name);
}
static function remove_options($options_name) {
if (WPPlugin::determine_environment() == Environment::WordPressMU || WPPlugin::determine_environment() == Environment::WordPressMS)
if (WPPlugin::determine_environment() == Environment::WordPressMU)
return delete_site_option($options_name);
else
return delete_option($options_name);
}
static function add_options($options_name, $options) {
if (WPPlugin::determine_environment() == Environment::WordPressMU || WPPlugin::determine_environment() == Environment::WordPressMS)
if (WPPlugin::determine_environment() == Environment::WordPressMU)
return add_site_option($options_name, $options);
else
return add_option($options_name, $options);
......@@ -129,4 +129,4 @@ if (!class_exists('WPPlugin')) {
}
}
?>
\ No newline at end of file
?>
<?php
/*
Plugin Name: WP-reCAPTCHA
Plugin URI: http://www.blaenkdenum.com/wp-recaptcha/
Plugin URI: https://github.com/blaenk/wp-recaptcha
Description: Integrates reCAPTCHA anti-spam solutions with wordpress
Version: 3.1.3
Version: 3.1.6
Author: Jorge Peña
Email: support@recaptcha.net
Author URI: http://www.blaenkdenum.com
Author URI: https://github.com/blaenk
*/
// this is the 'driver' file that instantiates the objects and registers every hook
......@@ -19,4 +19,4 @@ require_once('mailhide.php');
$recaptcha = new reCAPTCHA('recaptcha_options');
$mailhide = new MailHide('mailhide_options');
?>
\ No newline at end of file
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment