Version Description
- Fix: Contact Form 7 validation issue, due to recent CF7 changes
Download this release
Release Info
| Developer | dfactory |
| Plugin | |
| Version | 1.2.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.4 to 1.2.5
includes/class-cookie-session.php
CHANGED
|
@@ -37,12 +37,12 @@ class Math_Captcha_Cookie_Session
|
|
| 37 |
case 'multi':
|
| 38 |
for($i = 0; $i < 5; $i++)
|
| 39 |
{
|
| 40 |
-
$this->session_ids[$place][$i] = sha1($this->generate_password(
|
| 41 |
}
|
| 42 |
break;
|
| 43 |
|
| 44 |
case 'default':
|
| 45 |
-
$this->session_ids[$place] = sha1($this->generate_password(
|
| 46 |
break;
|
| 47 |
}
|
| 48 |
}
|
|
@@ -59,21 +59,16 @@ class Math_Captcha_Cookie_Session
|
|
| 59 |
}
|
| 60 |
}
|
| 61 |
|
| 62 |
-
|
| 63 |
/**
|
| 64 |
* Generate password helper, without wp_rand() call
|
| 65 |
*/
|
| 66 |
-
private function generate_password($length =
|
| 67 |
{
|
| 68 |
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
| 69 |
-
if ($special_chars)
|
| 70 |
-
$chars .= '!@#$%^&*()';
|
| 71 |
-
if ($extra_special_chars)
|
| 72 |
-
$chars .= '-_ []{}<>~`+=,.;:/?|';
|
| 73 |
-
|
| 74 |
$password = '';
|
| 75 |
-
|
| 76 |
-
for
|
| 77 |
{
|
| 78 |
$password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
| 79 |
}
|
| 37 |
case 'multi':
|
| 38 |
for($i = 0; $i < 5; $i++)
|
| 39 |
{
|
| 40 |
+
$this->session_ids[$place][$i] = sha1($this->generate_password());
|
| 41 |
}
|
| 42 |
break;
|
| 43 |
|
| 44 |
case 'default':
|
| 45 |
+
$this->session_ids[$place] = sha1($this->generate_password());
|
| 46 |
break;
|
| 47 |
}
|
| 48 |
}
|
| 59 |
}
|
| 60 |
}
|
| 61 |
|
| 62 |
+
|
| 63 |
/**
|
| 64 |
* Generate password helper, without wp_rand() call
|
| 65 |
*/
|
| 66 |
+
private function generate_password($length = 64)
|
| 67 |
{
|
| 68 |
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
$password = '';
|
| 70 |
+
|
| 71 |
+
for($i = 0; $i < $length; $i++)
|
| 72 |
{
|
| 73 |
$password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
| 74 |
}
|
includes/class-core.php
CHANGED
|
@@ -50,7 +50,7 @@ class Math_Captcha_Core
|
|
| 50 |
{
|
| 51 |
// Contact Form 7
|
| 52 |
if(Math_Captcha()->options['general']['enable_for']['contact_form_7'] && class_exists('WPCF7_ContactForm'))
|
| 53 |
-
include_once(MATH_CAPTCHA_PATH.'includes/
|
| 54 |
|
| 55 |
if(is_admin())
|
| 56 |
return;
|
| 50 |
{
|
| 51 |
// Contact Form 7
|
| 52 |
if(Math_Captcha()->options['general']['enable_for']['contact_form_7'] && class_exists('WPCF7_ContactForm'))
|
| 53 |
+
include_once(MATH_CAPTCHA_PATH.'includes/integrations/contact-form-7.php');
|
| 54 |
|
| 55 |
if(is_admin())
|
| 56 |
return;
|
includes/class-settings.php
CHANGED
|
@@ -84,16 +84,16 @@ class Math_Captcha_Settings
|
|
| 84 |
<p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'math-captcha').' <a href="http://www.dfactory.eu/support/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum','math-captcha').'">'.__('Support forum', 'math-captcha').'</a></p>
|
| 85 |
<hr/>
|
| 86 |
<h4 class="inner">'.__('Do you like this plugin?', 'math-captcha').'</h4>
|
| 87 |
-
<p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/wp-math-captcha" target="_blank" title="'.__('Rate it 5', 'math-captcha').'">'.__('Rate it 5', 'math-captcha').'</a> '.__('on WordPress.org', 'math-captcha').'<br/>'.
|
| 88 |
-
__('Blog about it & link to the', 'math-captcha').' <a href="http://www.dfactory.eu/plugins/math-captcha/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'math-captcha').'">'.__('plugin page', 'math-captcha').'</a><br/>'.
|
| 89 |
-
__('Check out our other', 'math-captcha').' <a href="http://www.dfactory.eu/plugins/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'math-captcha').'">'.__('WordPress plugins', 'math-captcha').'</a>
|
| 90 |
-
</p>
|
| 91 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" class="inner">
|
| 92 |
<input type="hidden" name="cmd" value="_s-xclick">
|
| 93 |
<input type="hidden" name="hosted_button_id" value="BJSHR9GS5QJTC">
|
| 94 |
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
| 95 |
<img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
|
| 96 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
<hr/>
|
| 98 |
<p class="df-link inner">Created by <a href="http://www.dfactory.eu/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.MATH_CAPTCHA_URL.'/images/logo-dfactory.png" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress"/></a></p>
|
| 99 |
</div>
|
| 84 |
<p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'math-captcha').' <a href="http://www.dfactory.eu/support/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum','math-captcha').'">'.__('Support forum', 'math-captcha').'</a></p>
|
| 85 |
<hr/>
|
| 86 |
<h4 class="inner">'.__('Do you like this plugin?', 'math-captcha').'</h4>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" class="inner">
|
| 88 |
<input type="hidden" name="cmd" value="_s-xclick">
|
| 89 |
<input type="hidden" name="hosted_button_id" value="BJSHR9GS5QJTC">
|
| 90 |
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
| 91 |
<img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">
|
| 92 |
</form>
|
| 93 |
+
<p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/wp-math-captcha" target="_blank" title="'.__('Rate it 5', 'math-captcha').'">'.__('Rate it 5', 'math-captcha').'</a> '.__('on WordPress.org', 'math-captcha').'<br/>'.
|
| 94 |
+
__('Blog about it & link to the', 'math-captcha').' <a href="http://www.dfactory.eu/plugins/math-captcha/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'math-captcha').'">'.__('plugin page', 'math-captcha').'</a><br/>'.
|
| 95 |
+
__('Check out our other', 'math-captcha').' <a href="http://www.dfactory.eu/plugins/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'math-captcha').'">'.__('WordPress plugins', 'math-captcha').'</a>
|
| 96 |
+
</p>
|
| 97 |
<hr/>
|
| 98 |
<p class="df-link inner">Created by <a href="http://www.dfactory.eu/?utm_source=math-captcha-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.MATH_CAPTCHA_URL.'/images/logo-dfactory.png" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress"/></a></p>
|
| 99 |
</div>
|
includes/{integration-cf7.php → integrations/contact-form-7.php}
RENAMED
|
@@ -59,6 +59,8 @@ function wpcf7_mathcaptcha_validation_filter($result, $tag)
|
|
| 59 |
|
| 60 |
if(!is_admin() && isset($_POST[$name]))
|
| 61 |
{
|
|
|
|
|
|
|
| 62 |
if($_POST[$name] !== '')
|
| 63 |
{
|
| 64 |
$session_id = (isset($_POST[$name.'-sn']) && $_POST[$name.'-sn'] !== '' ? Math_Captcha()->cookie_session->session_ids['multi'][$_POST[$name.'-sn']] : '');
|
|
@@ -67,20 +69,35 @@ function wpcf7_mathcaptcha_validation_filter($result, $tag)
|
|
| 67 |
{
|
| 68 |
if(strcmp(get_transient('cf7_'.$session_id), sha1(AUTH_KEY.$_POST[$name].$session_id, false)) !== 0)
|
| 69 |
{
|
| 70 |
-
$
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
}
|
| 74 |
else
|
| 75 |
{
|
| 76 |
-
$
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
}
|
| 79 |
}
|
| 80 |
else
|
| 81 |
{
|
| 82 |
-
$
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
}
|
| 86 |
|
| 59 |
|
| 60 |
if(!is_admin() && isset($_POST[$name]))
|
| 61 |
{
|
| 62 |
+
$cf7_version = get_option('wpcf7', '1.0.0');
|
| 63 |
+
|
| 64 |
if($_POST[$name] !== '')
|
| 65 |
{
|
| 66 |
$session_id = (isset($_POST[$name.'-sn']) && $_POST[$name.'-sn'] !== '' ? Math_Captcha()->cookie_session->session_ids['multi'][$_POST[$name.'-sn']] : '');
|
| 69 |
{
|
| 70 |
if(strcmp(get_transient('cf7_'.$session_id), sha1(AUTH_KEY.$_POST[$name].$session_id, false)) !== 0)
|
| 71 |
{
|
| 72 |
+
if(version_compare($cf7_version, '4.1.0', '>='))
|
| 73 |
+
$result['reason'][$name] = wpcf7_get_message('wrong_mathcaptcha');
|
| 74 |
+
else
|
| 75 |
+
{
|
| 76 |
+
$result['valid'] = false;
|
| 77 |
+
$result->invalidate($tag, wpcf7_get_message('wrong_mathcaptcha'));
|
| 78 |
+
}
|
| 79 |
}
|
| 80 |
}
|
| 81 |
else
|
| 82 |
{
|
| 83 |
+
if(version_compare($cf7_version, '4.1.0', '>='))
|
| 84 |
+
$result->invalidate($tag, wpcf7_get_message('time_mathcaptcha'));
|
| 85 |
+
else
|
| 86 |
+
{
|
| 87 |
+
$result['valid'] = false;
|
| 88 |
+
$result['reason'][$name] = wpcf7_get_message('time_mathcaptcha');
|
| 89 |
+
}
|
| 90 |
}
|
| 91 |
}
|
| 92 |
else
|
| 93 |
{
|
| 94 |
+
if(version_compare($cf7_version, '4.1.0', '>='))
|
| 95 |
+
$result->invalidate($tag, wpcf7_get_message('fill_mathcaptcha'));
|
| 96 |
+
else
|
| 97 |
+
{
|
| 98 |
+
$result['valid'] = false;
|
| 99 |
+
$result['reason'][$name] = wpcf7_get_message('fill_mathcaptcha');
|
| 100 |
+
}
|
| 101 |
}
|
| 102 |
}
|
| 103 |
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: dfactory
|
|
| 3 |
Donate link: http://www.dfactory.eu/
|
| 4 |
Tags: antispam, capcha, captcha, captha, catcha, comment, comments, spam, security, login, lost password, math captcha, registration, cf7, contact, contact forms, form, contact form 7, bbpress
|
| 5 |
Requires at least: 3.3
|
| 6 |
-
Tested up to: 4.1
|
| 7 |
-
Stable tag: 1.2.
|
| 8 |
License: MIT License
|
| 9 |
License URI: http://opensource.org/licenses/MIT
|
| 10 |
|
|
@@ -61,6 +61,9 @@ A. Chances are, someone else has asked it. Check out the support forum at: http:
|
|
| 61 |
|
| 62 |
== Changelog ==
|
| 63 |
|
|
|
|
|
|
|
|
|
|
| 64 |
= 1.2.4 =
|
| 65 |
* Tweak: Switch from wp_generate_password() to custom function due to Jetpack statistics DB calls issue
|
| 66 |
* Fix: Undefined contant notice in plugin settings
|
|
@@ -127,6 +130,5 @@ A. Chances are, someone else has asked it. Check out the support forum at: http:
|
|
| 127 |
|
| 128 |
== Upgrade Notice ==
|
| 129 |
|
| 130 |
-
= 1.2.
|
| 131 |
-
*
|
| 132 |
-
* Fix: Undefined contant notice in plugin settings
|
| 3 |
Donate link: http://www.dfactory.eu/
|
| 4 |
Tags: antispam, capcha, captcha, captha, catcha, comment, comments, spam, security, login, lost password, math captcha, registration, cf7, contact, contact forms, form, contact form 7, bbpress
|
| 5 |
Requires at least: 3.3
|
| 6 |
+
Tested up to: 4.1.1
|
| 7 |
+
Stable tag: 1.2.5
|
| 8 |
License: MIT License
|
| 9 |
License URI: http://opensource.org/licenses/MIT
|
| 10 |
|
| 61 |
|
| 62 |
== Changelog ==
|
| 63 |
|
| 64 |
+
= 1.2.5 =
|
| 65 |
+
* Fix: Contact Form 7 validation issue, due to recent CF7 changes
|
| 66 |
+
|
| 67 |
= 1.2.4 =
|
| 68 |
* Tweak: Switch from wp_generate_password() to custom function due to Jetpack statistics DB calls issue
|
| 69 |
* Fix: Undefined contant notice in plugin settings
|
| 130 |
|
| 131 |
== Upgrade Notice ==
|
| 132 |
|
| 133 |
+
= 1.2.5 =
|
| 134 |
+
* Fix: Contact Form 7 validation issue, due to recent CF7 changes
|
|
|
wp-math-captcha.php
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
/*
|
| 3 |
Plugin Name: Math Captcha
|
| 4 |
Description: Math Captcha is a <strong>100% effective CAPTCHA for WordPress</strong> that integrates into login, registration, comments, Contact Form 7 and bbPress.
|
| 5 |
-
Version: 1.2.
|
| 6 |
Author: dFactory
|
| 7 |
Author URI: http://www.dfactory.eu/
|
| 8 |
Plugin URI: http://www.dfactory.eu/plugins/math-captcha/
|
|
@@ -67,7 +67,7 @@ class Math_Captcha
|
|
| 67 |
'deactivation_delete' => false,
|
| 68 |
'flush_rules' => false
|
| 69 |
),
|
| 70 |
-
'version' => '1.2.
|
| 71 |
);
|
| 72 |
|
| 73 |
|
| 2 |
/*
|
| 3 |
Plugin Name: Math Captcha
|
| 4 |
Description: Math Captcha is a <strong>100% effective CAPTCHA for WordPress</strong> that integrates into login, registration, comments, Contact Form 7 and bbPress.
|
| 5 |
+
Version: 1.2.5
|
| 6 |
Author: dFactory
|
| 7 |
Author URI: http://www.dfactory.eu/
|
| 8 |
Plugin URI: http://www.dfactory.eu/plugins/math-captcha/
|
| 67 |
'deactivation_delete' => false,
|
| 68 |
'flush_rules' => false
|
| 69 |
),
|
| 70 |
+
'version' => '1.2.5'
|
| 71 |
);
|
| 72 |
|
| 73 |
|
