Math Captcha - Version 1.0.1

Version Description

  • Fix: Math Captcha not available in Contact Form 7 if hide for logged in users selected
  • Tweak: Empty captcha title
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Math Captcha
Version 1.0.1
Comparing to
See all releases

Code changes from version 1.0.0.3 to 1.0.1

includes/math-captcha-cf7.php CHANGED
@@ -13,39 +13,45 @@ function wpcf7_add_shortcode_mathcaptcha()
13
 
14
  function wpcf7_mathcaptcha_shortcode_handler($tag)
15
  {
 
16
  global $mc_class;
17
-
18
- $tag = new WPCF7_Shortcode($tag);
19
-
20
- if(empty($tag->name))
21
- return '';
22
-
23
- $validation_error = wpcf7_get_validation_error($tag->name);
24
- $class = wpcf7_form_controls_class($tag->type);
25
-
26
- if($validation_error)
27
  {
28
- $class .= ' wpcf7-not-valid';
29
- }
30
 
31
- $atts = array();
32
- $atts['size'] = 2;
33
- $atts['maxlength'] = 2;
34
- $atts['class'] = $tag->get_class_option($class);
35
- $atts['id'] = $tag->get_option('id', 'id', true);
36
- $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
37
- $atts['aria-required'] = 'true';
38
- $atts['type'] = 'text';
39
- $atts['name'] = $tag->name;
40
- $atts['value'] = '';
41
- $atts = wpcf7_format_atts($atts);
42
-
43
- $mc_form = $mc_class->generate_captcha_phrase('cf7');
44
- $mc_form[$mc_form['input']] = '<input %2$s />';
45
 
46
- $math_captcha_title = apply_filters('math_captcha_title', $mc_class->get_attribute('title'));
47
-
48
- return sprintf(((empty($math_captcha_title)) ? '' : ''.$math_captcha_title.'').'<span class="wpcf7-form-control-wrap %1$s">'.$mc_form[1].$mc_form[2].$mc_form[3].'%3$s', $tag->name, $atts, $validation_error);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  }
51
 
13
 
14
  function wpcf7_mathcaptcha_shortcode_handler($tag)
15
  {
16
+
17
  global $mc_class;
18
+
19
+ if (!is_user_logged_in() || (is_user_logged_in() && $mc_class->options['hide_for_logged_users'] === FALSE))
 
 
 
 
 
 
 
 
20
  {
 
 
21
 
22
+ $tag = new WPCF7_Shortcode($tag);
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
+ if(empty($tag->name))
25
+ return '';
26
+
27
+ $validation_error = wpcf7_get_validation_error($tag->name);
28
+ $class = wpcf7_form_controls_class($tag->type);
29
+
30
+ if($validation_error)
31
+ {
32
+ $class .= ' wpcf7-not-valid';
33
+ }
34
+
35
+ $atts = array();
36
+ $atts['size'] = 2;
37
+ $atts['maxlength'] = 2;
38
+ $atts['class'] = $tag->get_class_option($class);
39
+ $atts['id'] = $tag->get_option('id', 'id', true);
40
+ $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
41
+ $atts['aria-required'] = 'true';
42
+ $atts['type'] = 'text';
43
+ $atts['name'] = $tag->name;
44
+ $atts['value'] = '';
45
+ $atts = wpcf7_format_atts($atts);
46
+
47
+ $mc_form = $mc_class->generate_captcha_phrase('cf7');
48
+ $mc_form[$mc_form['input']] = '<input %2$s />';
49
+
50
+ $math_captcha_title = apply_filters('math_captcha_title', $mc_class->get_attribute('title'));
51
+
52
+ return sprintf(((empty($math_captcha_title)) ? '' : ''.$math_captcha_title.'').'<span class="wpcf7-form-control-wrap %1$s">'.$mc_form[1].$mc_form[2].$mc_form[3].'%3$s', $tag->name, $atts, $validation_error);
53
+
54
+ }
55
 
56
  }
57
 
languages/math-captcha-pl_PL.mo CHANGED
Binary file
languages/math-captcha-pl_PL.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Math Captcha\n"
4
- "POT-Creation-Date: 2013-06-20 15:56+0100\n"
5
- "PO-Revision-Date: 2013-06-20 15:56+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@digitalfactory.pl>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: English\n"
@@ -128,15 +128,15 @@ msgstr "dziewięćdziesiąt"
128
  msgid "ERROR"
129
  msgstr "BŁĄD"
130
 
131
- #: ../wp-math-captcha.php:869 ../includes/math-captcha-cf7.php:104
132
  msgid "Please enter captcha value."
133
  msgstr "Proszę wpisać wartość."
134
 
135
- #: ../wp-math-captcha.php:870 ../includes/math-captcha-cf7.php:100
136
  msgid "Invalid captcha value."
137
  msgstr "Nieprawidłowa wartość."
138
 
139
- #: ../wp-math-captcha.php:871 ../includes/math-captcha-cf7.php:108
140
  msgid "Captcha time expired."
141
  msgstr "Upłynął czas."
142
 
@@ -269,7 +269,7 @@ msgstr ""
269
 
270
  #: ../wp-math-captcha.php:1115 ../wp-math-captcha.php:1116
271
  #: ../wp-math-captcha.php:1131 ../wp-math-captcha.php:1144
272
- #: ../includes/math-captcha-cf7.php:139
273
  msgid "Math Captcha"
274
  msgstr "Math Captcha"
275
 
@@ -322,19 +322,19 @@ msgstr "Forum pomocy"
322
  msgid "Settings"
323
  msgstr "Ustawienia"
324
 
325
- #: ../includes/math-captcha-cf7.php:151
326
  msgid "Name"
327
  msgstr "Nazwa"
328
 
329
- #: ../includes/math-captcha-cf7.php:157
330
  msgid "Input field settings"
331
  msgstr "Ustawienia pola"
332
 
333
- #: ../includes/math-captcha-cf7.php:160 ../includes/math-captcha-cf7.php:164
334
  msgid "optional"
335
  msgstr "opcjonalne"
336
 
337
- #: ../includes/math-captcha-cf7.php:170
338
  msgid "Copy this code and paste it into the form left."
339
  msgstr "Skopij i wkej ten kod do formularza po lewej."
340
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Math Captcha\n"
4
+ "POT-Creation-Date: 2013-06-20 21:03+0100\n"
5
+ "PO-Revision-Date: 2013-06-20 21:03+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@digitalfactory.pl>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: English\n"
128
  msgid "ERROR"
129
  msgstr "BŁĄD"
130
 
131
+ #: ../wp-math-captcha.php:869 ../includes/math-captcha-cf7.php:113
132
  msgid "Please enter captcha value."
133
  msgstr "Proszę wpisać wartość."
134
 
135
+ #: ../wp-math-captcha.php:870 ../includes/math-captcha-cf7.php:109
136
  msgid "Invalid captcha value."
137
  msgstr "Nieprawidłowa wartość."
138
 
139
+ #: ../wp-math-captcha.php:871 ../includes/math-captcha-cf7.php:117
140
  msgid "Captcha time expired."
141
  msgstr "Upłynął czas."
142
 
269
 
270
  #: ../wp-math-captcha.php:1115 ../wp-math-captcha.php:1116
271
  #: ../wp-math-captcha.php:1131 ../wp-math-captcha.php:1144
272
+ #: ../includes/math-captcha-cf7.php:148
273
  msgid "Math Captcha"
274
  msgstr "Math Captcha"
275
 
322
  msgid "Settings"
323
  msgstr "Ustawienia"
324
 
325
+ #: ../includes/math-captcha-cf7.php:160
326
  msgid "Name"
327
  msgstr "Nazwa"
328
 
329
+ #: ../includes/math-captcha-cf7.php:166
330
  msgid "Input field settings"
331
  msgstr "Ustawienia pola"
332
 
333
+ #: ../includes/math-captcha-cf7.php:169 ../includes/math-captcha-cf7.php:173
334
  msgid "optional"
335
  msgstr "opcjonalne"
336
 
337
+ #: ../includes/math-captcha-cf7.php:179
338
  msgid "Copy this code and paste it into the form left."
339
  msgstr "Skopij i wkej ten kod do formularza po lewej."
340
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 3.5.1
7
- Stable tag: 1.0.0.3
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -43,10 +43,15 @@ No questions yet.
43
 
44
  == Changelog ==
45
 
 
 
 
 
 
46
  = 1.0.0 =
47
  * Initial release
48
 
49
  == Upgrade Notice ==
50
 
51
- = 1.0.0.3 =
52
- Initial release
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: 3.5.1
7
+ Stable tag: 1.0.1
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
43
 
44
  == Changelog ==
45
 
46
+ = 1.0.1 =
47
+ * Fix: Math Captcha not available in Contact Form 7 if hide for logged in users selected
48
+ * Tweak: Empty captcha title
49
+
50
+
51
  = 1.0.0 =
52
  * Initial release
53
 
54
  == Upgrade Notice ==
55
 
56
+ = 1.0.1 =
57
+ Fix for a couple of bugfixes
wp-math-captcha.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Math Captcha
4
  Description: Math Captcha is a <strong>very effective CAPTCHA for WordPress</strong> that integrates into login, registration, comments, Contact Form 7 and bbPress.
5
- Version: 1.0.0.3
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/math-captcha/
@@ -45,7 +45,7 @@ class Math_Captcha
45
  ),
46
  'time' => 60
47
  );
48
- private $options = array();
49
  private $choice = array();
50
  private $enable_for = array();
51
  private $mathematical_operations = array();
@@ -54,7 +54,7 @@ class Math_Captcha
54
  private $errors;
55
  private $session_id = '';
56
  private $crypt_key = 'u.%ds)4;?D<gM#%fd!W2]9';
57
- public $err_msg = array();
58
 
59
 
60
  public function __construct()
@@ -148,7 +148,7 @@ class Math_Captcha
148
  //Contact Form 7
149
  if($this->options['enable_for']['contact_form_7'] === TRUE)
150
  {
151
- if(is_plugin_active('contact-form-7/wp-contact-form-7.php') && (!is_user_logged_in() || (is_user_logged_in() && $this->options['hide_for_logged_users'] === FALSE)))
152
  {
153
  global $mc_class;
154
  $mc_class = $this;
2
  /*
3
  Plugin Name: Math Captcha
4
  Description: Math Captcha is a <strong>very effective CAPTCHA for WordPress</strong> that integrates into login, registration, comments, Contact Form 7 and bbPress.
5
+ Version: 1.0.1
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/math-captcha/
45
  ),
46
  'time' => 60
47
  );
48
+ public static $options = array();
49
  private $choice = array();
50
  private $enable_for = array();
51
  private $mathematical_operations = array();
54
  private $errors;
55
  private $session_id = '';
56
  private $crypt_key = 'u.%ds)4;?D<gM#%fd!W2]9';
57
+ public static $err_msg = array();
58
 
59
 
60
  public function __construct()
148
  //Contact Form 7
149
  if($this->options['enable_for']['contact_form_7'] === TRUE)
150
  {
151
+ if(is_plugin_active('contact-form-7/wp-contact-form-7.php'))
152
  {
153
  global $mc_class;
154
  $mc_class = $this;