Version Description
- Tweak: Added option to reset settings to defaults
- Tweak: Code rewritten to singleton design pattern
- Fix: Contact Form 7 compatibility issues
- New: Option to donate this plugin :)
Download this release
Release Info
Developer | dfactory |
Plugin | Math Captcha |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.2.0
- css/admin.css +2 -0
- css/{front.css → frontend.css} +0 -0
- includes/class-cookie-session.php +62 -0
- includes/class-core.php +763 -0
- includes/class-settings.php +387 -0
- includes/class-update.php +43 -0
- includes/integration-cf7.php +176 -0
- includes/math-captcha-cf7.php +30 -35
- js/admin-settings.js +7 -0
- js/admin.js +0 -4
- languages/math-captcha-pl_PL.mo +0 -0
- languages/math-captcha-pl_PL.po +698 -691
- languages/math-captcha.pot +154 -140
- readme.txt +12 -4
- wp-math-captcha.php +104 -1222
css/admin.css
CHANGED
@@ -4,6 +4,8 @@
|
|
4 |
.df-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
|
5 |
.df-credits .df-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
|
6 |
.df-credits .df-link a { vertical-align: middle; padding: 5px 0 0 4px; }
|
|
|
|
|
7 |
.math-captcha-settings { margin-right: 300px; }
|
8 |
.math-captcha-settings hr, .df-credits hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
|
9 |
.math-captcha-settings form { float: left; min-width: 463px; width: auto; }
|
4 |
.df-credits h3 { font-size: 14px; line-height: 1.4; margin: 0; padding: 8px 12px; border-bottom: 1px solid #eee; }
|
5 |
.df-credits .df-link { font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; font-style:italic; padding-bottom: 10px; margin: 0; }
|
6 |
.df-credits .df-link a { vertical-align: middle; padding: 5px 0 0 4px; }
|
7 |
+
.math-captcha-settings .df-credits form { min-width: 260px; margin-bottom: 1em; }
|
8 |
+
.math-captcha-settings .df-credits form input { margin: 0; padding: 0; }
|
9 |
.math-captcha-settings { margin-right: 300px; }
|
10 |
.math-captcha-settings hr, .df-credits hr { border: solid #eee; border-width: 1px 0 0; clear: both; height: 0; }
|
11 |
.math-captcha-settings form { float: left; min-width: 463px; width: auto; }
|
css/{front.css → frontend.css}
RENAMED
File without changes
|
includes/class-cookie-session.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(!defined('ABSPATH')) exit;
|
3 |
+
|
4 |
+
new Math_Captcha_Cookie_Session();
|
5 |
+
|
6 |
+
class Math_Captcha_Cookie_Session
|
7 |
+
{
|
8 |
+
public $session_ids;
|
9 |
+
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
// sets instance
|
14 |
+
Math_Captcha()->cookie_session = $this;
|
15 |
+
|
16 |
+
// actions
|
17 |
+
add_action('plugins_loaded', array(&$this, 'init_session'), 1);
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Initializes cookie-session
|
23 |
+
*/
|
24 |
+
public function init_session()
|
25 |
+
{
|
26 |
+
if(is_admin())
|
27 |
+
return;
|
28 |
+
|
29 |
+
if(isset($_COOKIE['mc_session_ids']))
|
30 |
+
$this->session_ids = $_COOKIE['mc_session_ids'];
|
31 |
+
else
|
32 |
+
{
|
33 |
+
foreach(array('default', 'multi') as $place)
|
34 |
+
{
|
35 |
+
switch($place)
|
36 |
+
{
|
37 |
+
case 'multi':
|
38 |
+
for($i = 0; $i < 5; $i++)
|
39 |
+
{
|
40 |
+
$this->session_ids[$place][$i] = sha1(wp_generate_password(64, false, false));
|
41 |
+
}
|
42 |
+
break;
|
43 |
+
|
44 |
+
case 'default':
|
45 |
+
$this->session_ids[$place] = sha1(wp_generate_password(64, false, false));
|
46 |
+
break;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
if(!isset($_COOKIE['mc_session_ids']))
|
52 |
+
{
|
53 |
+
setcookie('mc_session_ids[default]', $this->session_ids['default'], current_time('timestamp', true) + apply_filters('math_captcha_time', Math_Captcha()->options['general']['time']), COOKIEPATH, COOKIE_DOMAIN, (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? true : false), true);
|
54 |
+
|
55 |
+
for($i = 0; $i < 5; $i++)
|
56 |
+
{
|
57 |
+
setcookie('mc_session_ids[multi]['.$i.']', $this->session_ids['multi'][$i], current_time('timestamp', true) + apply_filters('math_captcha_time', Math_Captcha()->options['general']['time']), COOKIEPATH, COOKIE_DOMAIN);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
?>
|
includes/class-core.php
ADDED
@@ -0,0 +1,763 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(!defined('ABSPATH')) exit;
|
3 |
+
|
4 |
+
new Math_Captcha_Core();
|
5 |
+
|
6 |
+
class Math_Captcha_Core
|
7 |
+
{
|
8 |
+
public $session_number = 0;
|
9 |
+
public $login_failed = false;
|
10 |
+
public $error_messages;
|
11 |
+
public $errors;
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
*
|
16 |
+
*/
|
17 |
+
public function __construct()
|
18 |
+
{
|
19 |
+
// sets instance
|
20 |
+
Math_Captcha()->core = $this;
|
21 |
+
|
22 |
+
// actions
|
23 |
+
add_action('init', array(&$this, 'load_actions_filters'), 1);
|
24 |
+
add_action('plugins_loaded', array(&$this, 'load_defaults'));
|
25 |
+
add_action('admin_init', array(&$this, 'flush_rewrites'));
|
26 |
+
|
27 |
+
// filters
|
28 |
+
add_filter('shake_error_codes', array(&$this, 'add_shake_error_codes'), 1);
|
29 |
+
add_filter('mod_rewrite_rules', array(&$this, 'block_direct_comments'));
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Load defaults
|
35 |
+
*/
|
36 |
+
public function load_defaults()
|
37 |
+
{
|
38 |
+
$this->error_messages = array(
|
39 |
+
'fill' => '<strong>'. __('ERROR', 'math-captcha').'</strong>: '.__('Please enter captcha value.', 'math-captcha'),
|
40 |
+
'wrong' => '<strong>'. __('ERROR', 'math-captcha').'</strong>: '.__('Invalid captcha value.', 'math-captcha'),
|
41 |
+
'time' => '<strong>'. __('ERROR', 'math-captcha').'</strong>: '.__('Captcha time expired.', 'math-captcha')
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Loads required filters
|
48 |
+
*/
|
49 |
+
public function load_actions_filters()
|
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/integration-cf7.php');
|
54 |
+
|
55 |
+
if(is_admin())
|
56 |
+
return;
|
57 |
+
|
58 |
+
$action = (isset($_GET['action']) && $_GET['action'] !== '' ? $_GET['action'] : null);
|
59 |
+
|
60 |
+
// comments
|
61 |
+
if(Math_Captcha()->options['general']['enable_for']['comment_form'])
|
62 |
+
{
|
63 |
+
if(!is_user_logged_in())
|
64 |
+
add_action('comment_form_after_fields', array(&$this, 'add_captcha_form'));
|
65 |
+
elseif(!Math_Captcha()->options['general']['hide_for_logged_users'])
|
66 |
+
add_action('comment_form_logged_in_after', array(&$this, 'add_captcha_form'));
|
67 |
+
|
68 |
+
add_filter('preprocess_comment', array(&$this, 'add_comment_with_captcha'));
|
69 |
+
}
|
70 |
+
|
71 |
+
// registration
|
72 |
+
if(Math_Captcha()->options['general']['enable_for']['registration_form'] && (!is_user_logged_in() || (is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users'])) && $action === 'register')
|
73 |
+
{
|
74 |
+
add_action('register_form', array(&$this, 'add_captcha_form'));
|
75 |
+
add_action('register_post', array(&$this, 'add_user_with_captcha'), 10, 3);
|
76 |
+
add_action('signup_extra_fields', array(&$this, 'add_captcha_form'));
|
77 |
+
add_filter('wpmu_validate_user_signup', array(&$this, 'validate_user_with_captcha'));
|
78 |
+
}
|
79 |
+
|
80 |
+
// lost password
|
81 |
+
if(Math_Captcha()->options['general']['enable_for']['reset_password_form'] && (!is_user_logged_in() || (is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users'])) && $action === 'lostpassword')
|
82 |
+
{
|
83 |
+
add_action('lostpassword_form', array(&$this, 'add_captcha_form'));
|
84 |
+
add_action('lostpassword_post', array(&$this, 'check_lost_password_with_captcha'));
|
85 |
+
}
|
86 |
+
|
87 |
+
// login
|
88 |
+
if(Math_Captcha()->options['general']['enable_for']['login_form'] && (!is_user_logged_in() || (is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users'])) && $action === null)
|
89 |
+
{
|
90 |
+
add_action('login_form', array(&$this, 'add_captcha_form'));
|
91 |
+
add_filter('login_redirect', array(&$this, 'redirect_login_with_captcha'), 10, 3);
|
92 |
+
add_filter('authenticate', array(&$this, 'authenticate_user'), 1000, 3);
|
93 |
+
}
|
94 |
+
|
95 |
+
// bbPress
|
96 |
+
if(Math_Captcha()->options['general']['enable_for']['bbpress'] && class_exists('bbPress') && (!is_user_logged_in() || (is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users'])))
|
97 |
+
{
|
98 |
+
add_action('bbp_theme_after_reply_form_content', array(&$this, 'add_bbp_captcha_form'));
|
99 |
+
add_action('bbp_theme_after_topic_form_content', array(&$this, 'add_bbp_captcha_form'));
|
100 |
+
add_action('bbp_new_reply_pre_extras', array(&$this, 'check_bbpress_captcha'));
|
101 |
+
add_action('bbp_new_topic_pre_extras', array(&$this, 'check_bbpress_captcha'));
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Adds lost password errors
|
108 |
+
*/
|
109 |
+
public function add_lostpassword_captcha_message($errors)
|
110 |
+
{
|
111 |
+
return $errors.$this->errors->errors['math-captcha-error'][0];
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Adds lost password errors (special way)
|
117 |
+
*/
|
118 |
+
public function add_lostpassword_wp_message()
|
119 |
+
{
|
120 |
+
return $this->errors;
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Validates lost password form
|
126 |
+
*/
|
127 |
+
public function check_lost_password_with_captcha()
|
128 |
+
{
|
129 |
+
$this->errors = new WP_Error();
|
130 |
+
$user_error = false;
|
131 |
+
$user_data = null;
|
132 |
+
|
133 |
+
// checks captcha
|
134 |
+
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
135 |
+
{
|
136 |
+
if(Math_Captcha()->cookie_session->session_ids['default'] !== '' && get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']) !== false)
|
137 |
+
{
|
138 |
+
if(strcmp(get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].Math_Captcha()->cookie_session->session_ids['default'], false)) !== 0)
|
139 |
+
$this->errors->add('math-captcha-error', $this->error_messages['wrong']);
|
140 |
+
}
|
141 |
+
else
|
142 |
+
$this->errors->add('math-captcha-error', $this->error_messages['time']);
|
143 |
+
}
|
144 |
+
else
|
145 |
+
$this->errors->add('math-captcha-error', $this->error_messages['fill']);
|
146 |
+
|
147 |
+
// checks user_login (from wp-login.php)
|
148 |
+
if(empty($_POST['user_login']))
|
149 |
+
$user_error = true;
|
150 |
+
elseif(strpos($_POST['user_login'], '@'))
|
151 |
+
{
|
152 |
+
$user_data = get_user_by('email', trim($_POST['user_login']));
|
153 |
+
|
154 |
+
if(empty($user_data))
|
155 |
+
$user_error = true;
|
156 |
+
}
|
157 |
+
else
|
158 |
+
$user_data = get_user_by('login', trim($_POST['user_login']));
|
159 |
+
|
160 |
+
if(!$user_data)
|
161 |
+
$user_error = true;
|
162 |
+
|
163 |
+
// something went wrong?
|
164 |
+
if(!empty($this->errors->errors))
|
165 |
+
{
|
166 |
+
// nasty hack (captcha is wrong but user_login is fine)
|
167 |
+
if($user_error === false)
|
168 |
+
add_filter('allow_password_reset', array(&$this, 'add_lostpassword_wp_message'));
|
169 |
+
else
|
170 |
+
add_filter('login_errors', array(&$this, 'add_lostpassword_captcha_message'));
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Validates register form
|
177 |
+
*/
|
178 |
+
public function add_user_with_captcha($login, $email, $errors)
|
179 |
+
{
|
180 |
+
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
181 |
+
{
|
182 |
+
if(Math_Captcha()->cookie_session->session_ids['default'] !== '' && get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']) !== false)
|
183 |
+
{
|
184 |
+
if(strcmp(get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].Math_Captcha()->cookie_session->session_ids['default'], false)) !== 0)
|
185 |
+
$errors->add('math-captcha-error', $this->error_messages['wrong']);
|
186 |
+
}
|
187 |
+
else
|
188 |
+
$errors->add('math-captcha-error', $this->error_messages['time']);
|
189 |
+
}
|
190 |
+
else
|
191 |
+
$errors->add('math-captcha-error', $this->error_messages['fill']);
|
192 |
+
|
193 |
+
return $errors;
|
194 |
+
}
|
195 |
+
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Validates register form
|
199 |
+
*/
|
200 |
+
public function validate_user_with_captcha($result)
|
201 |
+
{
|
202 |
+
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
203 |
+
{
|
204 |
+
if(Math_Captcha()->cookie_session->session_ids['default'] !== '' && get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']) !== false)
|
205 |
+
{
|
206 |
+
if(strcmp(get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].Math_Captcha()->cookie_session->session_ids['default'], false)) !== 0)
|
207 |
+
$results['errors']->add('math-captcha-error', $this->error_messages['wrong']);
|
208 |
+
}
|
209 |
+
else
|
210 |
+
$results['errors']->add('math-captcha-error', $this->error_messages['time']);
|
211 |
+
}
|
212 |
+
else
|
213 |
+
$results['errors']->add('math-captcha-error', $this->error_messages['fill']);
|
214 |
+
|
215 |
+
return $results;
|
216 |
+
}
|
217 |
+
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Posts login form
|
221 |
+
*/
|
222 |
+
public function redirect_login_with_captcha($redirect, $bool, $errors)
|
223 |
+
{
|
224 |
+
if($this->login_failed === false && !empty($_POST))
|
225 |
+
{
|
226 |
+
$error = '';
|
227 |
+
|
228 |
+
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
229 |
+
{
|
230 |
+
if(Math_Captcha()->cookie_session->session_ids['default'] !== '' && get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']) !== false)
|
231 |
+
{
|
232 |
+
if(strcmp(get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].Math_Captcha()->cookie_session->session_ids['default'], false)) !== 0)
|
233 |
+
$error = 'wrong';
|
234 |
+
}
|
235 |
+
else
|
236 |
+
$error = 'time';
|
237 |
+
}
|
238 |
+
else
|
239 |
+
$error = 'fill';
|
240 |
+
|
241 |
+
if(is_wp_error($errors) && !empty($error))
|
242 |
+
$errors->add('math-captcha-error', $this->error_messages[$error]);
|
243 |
+
}
|
244 |
+
|
245 |
+
return $redirect;
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Authenticate user
|
251 |
+
*/
|
252 |
+
public function authenticate_user($user, $username, $password)
|
253 |
+
{
|
254 |
+
// user gave us valid login and password
|
255 |
+
if(!is_wp_error($user))
|
256 |
+
{
|
257 |
+
if(!empty($_POST))
|
258 |
+
{
|
259 |
+
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
260 |
+
{
|
261 |
+
if(Math_Captcha()->cookie_session->session_ids['default'] !== '' && get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']) !== false)
|
262 |
+
{
|
263 |
+
if(strcmp(get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].Math_Captcha()->cookie_session->session_ids['default'], false)) !== 0)
|
264 |
+
$error = 'wrong';
|
265 |
+
}
|
266 |
+
else
|
267 |
+
$error = 'time';
|
268 |
+
}
|
269 |
+
else
|
270 |
+
$error = 'fill';
|
271 |
+
}
|
272 |
+
|
273 |
+
if(!empty($error))
|
274 |
+
{
|
275 |
+
// destroy cookie
|
276 |
+
wp_clear_auth_cookie();
|
277 |
+
|
278 |
+
$user = new WP_Error();
|
279 |
+
$user->add('math-captcha-error', $this->error_messages[$error]);
|
280 |
+
|
281 |
+
// inform redirect function that we failed to login
|
282 |
+
$this->login_failed = true;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
return $user;
|
287 |
+
}
|
288 |
+
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Adds shake
|
292 |
+
*/
|
293 |
+
public function add_shake_error_codes($codes)
|
294 |
+
{
|
295 |
+
$codes[] = 'math-captcha-error';
|
296 |
+
|
297 |
+
return $codes;
|
298 |
+
}
|
299 |
+
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Adds captcha to comment form
|
303 |
+
*/
|
304 |
+
public function add_comment_with_captcha($comment)
|
305 |
+
{
|
306 |
+
if(isset($_POST['mc-value']) && (!is_admin() || DOING_AJAX) && ($comment['comment_type'] === '' || $comment['comment_type'] === 'comment'))
|
307 |
+
{
|
308 |
+
if($_POST['mc-value'] !== '')
|
309 |
+
{
|
310 |
+
if(Math_Captcha()->cookie_session->session_ids['default'] !== '' && get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']) !== false)
|
311 |
+
{
|
312 |
+
if(strcmp(get_transient('mc_'.Math_Captcha()->cookie_session->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].Math_Captcha()->cookie_session->session_ids['default'], false)) === 0)
|
313 |
+
return $comment;
|
314 |
+
else
|
315 |
+
wp_die($this->error_messages['wrong']);
|
316 |
+
}
|
317 |
+
else
|
318 |
+
wp_die($this->error_messages['time']);
|
319 |
+
}
|
320 |
+
else
|
321 |
+
wp_die($this->error_messages['fill']);
|
322 |
+
}
|
323 |
+
else
|
324 |
+
return $comment;
|
325 |
+
}
|
326 |
+
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Shows and generates captcha
|
330 |
+
*/
|
331 |
+
public function add_captcha_form()
|
332 |
+
{
|
333 |
+
if(is_admin())
|
334 |
+
return;
|
335 |
+
|
336 |
+
$captcha_title = apply_filters('math_captcha_title', Math_Captcha()->options['general']['title']);
|
337 |
+
|
338 |
+
echo '
|
339 |
+
<p class="math-captcha-form">';
|
340 |
+
|
341 |
+
if(!empty($captcha_title))
|
342 |
+
echo '
|
343 |
+
<label>'.$captcha_title.'<br/></label>';
|
344 |
+
|
345 |
+
echo '
|
346 |
+
<span>'.$this->generate_captcha_phrase('default').'</span>
|
347 |
+
</p>';
|
348 |
+
}
|
349 |
+
|
350 |
+
|
351 |
+
/**
|
352 |
+
* Shows and generates captcha for bbPress
|
353 |
+
*/
|
354 |
+
public function add_bbp_captcha_form()
|
355 |
+
{
|
356 |
+
if(is_admin())
|
357 |
+
return;
|
358 |
+
|
359 |
+
$captcha_title = apply_filters('math_captcha_title', Math_Captcha()->options['general']['title']);
|
360 |
+
|
361 |
+
echo '
|
362 |
+
<p class="math-captcha-form">';
|
363 |
+
|
364 |
+
if(!empty($captcha_title))
|
365 |
+
echo '
|
366 |
+
<label>'.$captcha_title.'<br/></label>';
|
367 |
+
|
368 |
+
echo '
|
369 |
+
<span>'.$this->generate_captcha_phrase('bbpress').'</span>
|
370 |
+
</p>';
|
371 |
+
}
|
372 |
+
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Validates bbpress topics and replies
|
376 |
+
*/
|
377 |
+
public function check_bbpress_captcha()
|
378 |
+
{
|
379 |
+
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
380 |
+
{
|
381 |
+
if(Math_Captcha()->cookie_session->session_ids['default'] !== '' && get_transient('bbp_'.Math_Captcha()->cookie_session->session_ids['default']) !== false)
|
382 |
+
{
|
383 |
+
if(strcmp(get_transient('bbp_'.Math_Captcha()->cookie_session->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].Math_Captcha()->cookie_session->session_ids['default'], false)) !== 0)
|
384 |
+
bbp_add_error('math-captcha-wrong', $this->error_messages['wrong']);
|
385 |
+
}
|
386 |
+
else
|
387 |
+
bbp_add_error('math-captcha-wrong', $this->error_messages['time']);
|
388 |
+
}
|
389 |
+
else
|
390 |
+
bbp_add_error('math-captcha-wrong', $this->error_messages['fill']);
|
391 |
+
}
|
392 |
+
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Encodes chars
|
396 |
+
*/
|
397 |
+
private function encode_operation($string)
|
398 |
+
{
|
399 |
+
$chars = str_split($string);
|
400 |
+
$seed = mt_rand(0, (int)abs(crc32($string) / strlen($string)));
|
401 |
+
|
402 |
+
foreach($chars as $key => $char)
|
403 |
+
{
|
404 |
+
$ord = ord($char);
|
405 |
+
|
406 |
+
// ignore non-ascii chars
|
407 |
+
if($ord < 128)
|
408 |
+
{
|
409 |
+
// pseudo "random function"
|
410 |
+
$r = ($seed * (1 + $key)) % 100;
|
411 |
+
|
412 |
+
if($r > 60 && $char !== '@') {} // plain character (not encoded), if not @-sign
|
413 |
+
elseif($r < 45) $chars[$key] = '&#x'.dechex($ord).';'; // hexadecimal
|
414 |
+
else $chars[$key] = '&#'.$ord.';'; // decimal (ascii)
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
return implode('', $chars);
|
419 |
+
}
|
420 |
+
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Converts numbers to words
|
424 |
+
*/
|
425 |
+
private function numberToWords($number)
|
426 |
+
{
|
427 |
+
$words = array(
|
428 |
+
1 => __('one', 'math-captcha'),
|
429 |
+
2 => __('two', 'math-captcha'),
|
430 |
+
3 => __('three', 'math-captcha'),
|
431 |
+
4 => __('four', 'math-captcha'),
|
432 |
+
5 => __('five', 'math-captcha'),
|
433 |
+
6 => __('six', 'math-captcha'),
|
434 |
+
7 => __('seven', 'math-captcha'),
|
435 |
+
8 => __('eight', 'math-captcha'),
|
436 |
+
9 => __('nine', 'math-captcha'),
|
437 |
+
10 => __('ten', 'math-captcha'),
|
438 |
+
11 => __('eleven', 'math-captcha'),
|
439 |
+
12 => __('twelve', 'math-captcha'),
|
440 |
+
13 => __('thirteen', 'math-captcha'),
|
441 |
+
14 => __('fourteen', 'math-captcha'),
|
442 |
+
15 => __('fifteen', 'math-captcha'),
|
443 |
+
16 => __('sixteen', 'math-captcha'),
|
444 |
+
17 => __('seventeen', 'math-captcha'),
|
445 |
+
18 => __('eighteen', 'math-captcha'),
|
446 |
+
19 => __('nineteen', 'math-captcha'),
|
447 |
+
20 => __('twenty', 'math-captcha'),
|
448 |
+
30 => __('thirty', 'math-captcha'),
|
449 |
+
40 => __('forty', 'math-captcha'),
|
450 |
+
50 => __('fifty', 'math-captcha'),
|
451 |
+
60 => __('sixty', 'math-captcha'),
|
452 |
+
70 => __('seventy', 'math-captcha'),
|
453 |
+
80 => __('eighty', 'math-captcha'),
|
454 |
+
90 => __('ninety', 'math-captcha')
|
455 |
+
);
|
456 |
+
|
457 |
+
if(isset($words[$number]))
|
458 |
+
return $words[$number];
|
459 |
+
else
|
460 |
+
{
|
461 |
+
$reverse = false;
|
462 |
+
|
463 |
+
switch(get_bloginfo('language'))
|
464 |
+
{
|
465 |
+
case 'de-DE':
|
466 |
+
$spacer = 'und';
|
467 |
+
$reverse = true;
|
468 |
+
break;
|
469 |
+
|
470 |
+
case 'nl-NL':
|
471 |
+
$spacer = 'en';
|
472 |
+
$reverse = true;
|
473 |
+
break;
|
474 |
+
|
475 |
+
case 'ru-RU':
|
476 |
+
case 'pl-PL':
|
477 |
+
case 'en-EN':
|
478 |
+
default:
|
479 |
+
$spacer = ' ';
|
480 |
+
}
|
481 |
+
|
482 |
+
$first = (int)(substr($number, 0, 1) * 10);
|
483 |
+
$second = (int)substr($number, -1);
|
484 |
+
|
485 |
+
return ($reverse === false ? $words[$first].$spacer.$words[$second] : $words[$second].$spacer.$words[$first]);
|
486 |
+
}
|
487 |
+
}
|
488 |
+
|
489 |
+
|
490 |
+
/**
|
491 |
+
* Generates captcha
|
492 |
+
*/
|
493 |
+
public function generate_captcha_phrase($form = '')
|
494 |
+
{
|
495 |
+
$ops = array(
|
496 |
+
'addition' => '+',
|
497 |
+
'subtraction' => '−',
|
498 |
+
'multiplication' => '×',
|
499 |
+
'division' => '÷',
|
500 |
+
);
|
501 |
+
|
502 |
+
$operations = $groups = array();
|
503 |
+
$input = '<input type="text" size="2" length="2" id="mc-input" class="mc-input" name="mc-value" value="" aria-required="true"/>';
|
504 |
+
|
505 |
+
// available operations
|
506 |
+
foreach(Math_Captcha()->options['general']['mathematical_operations'] as $operation => $enable)
|
507 |
+
{
|
508 |
+
if($enable === true)
|
509 |
+
$operations[] = $operation;
|
510 |
+
}
|
511 |
+
|
512 |
+
// available groups
|
513 |
+
foreach(Math_Captcha()->options['general']['groups'] as $group => $enable)
|
514 |
+
{
|
515 |
+
if($enable === true)
|
516 |
+
$groups[] = $group;
|
517 |
+
}
|
518 |
+
|
519 |
+
// number of groups
|
520 |
+
$ao = count($groups);
|
521 |
+
|
522 |
+
// operation
|
523 |
+
$rnd_op = $operations[mt_rand(0, count($operations) - 1)];
|
524 |
+
$number[3] = $ops[$rnd_op];
|
525 |
+
|
526 |
+
// place where to put empty input
|
527 |
+
$rnd_input = mt_rand(0, 2);
|
528 |
+
|
529 |
+
// which random operation
|
530 |
+
switch($rnd_op)
|
531 |
+
{
|
532 |
+
case 'addition':
|
533 |
+
if($rnd_input === 0)
|
534 |
+
{
|
535 |
+
$number[0] = mt_rand(1, 10);
|
536 |
+
$number[1] = mt_rand(1, 89);
|
537 |
+
}
|
538 |
+
elseif($rnd_input === 1)
|
539 |
+
{
|
540 |
+
$number[0] = mt_rand(1, 89);
|
541 |
+
$number[1] = mt_rand(1, 10);
|
542 |
+
}
|
543 |
+
elseif($rnd_input === 2)
|
544 |
+
{
|
545 |
+
$number[0] = mt_rand(1, 9);
|
546 |
+
$number[1] = mt_rand(1, 10 - $number[0]);
|
547 |
+
}
|
548 |
+
|
549 |
+
$number[2] = $number[0] + $number[1];
|
550 |
+
break;
|
551 |
+
|
552 |
+
case 'subtraction':
|
553 |
+
if($rnd_input === 0)
|
554 |
+
{
|
555 |
+
$number[0] = mt_rand(2, 10);
|
556 |
+
$number[1] = mt_rand(1, $number[0] - 1);
|
557 |
+
}
|
558 |
+
elseif($rnd_input === 1)
|
559 |
+
{
|
560 |
+
$number[0] = mt_rand(11, 99);
|
561 |
+
$number[1] = mt_rand(1, 10);
|
562 |
+
}
|
563 |
+
elseif($rnd_input === 2)
|
564 |
+
{
|
565 |
+
$number[0] = mt_rand(11, 99);
|
566 |
+
$number[1] = mt_rand($number[0] - 10, $number[0] - 1);
|
567 |
+
}
|
568 |
+
|
569 |
+
$number[2] = $number[0] - $number[1];
|
570 |
+
break;
|
571 |
+
|
572 |
+
case 'multiplication':
|
573 |
+
if($rnd_input === 0)
|
574 |
+
{
|
575 |
+
$number[0] = mt_rand(1, 10);
|
576 |
+
$number[1] = mt_rand(1, 9);
|
577 |
+
}
|
578 |
+
elseif($rnd_input === 1)
|
579 |
+
{
|
580 |
+
$number[0] = mt_rand(1, 9);
|
581 |
+
$number[1] = mt_rand(1, 10);
|
582 |
+
}
|
583 |
+
elseif($rnd_input === 2)
|
584 |
+
{
|
585 |
+
$number[0] = mt_rand(1, 10);
|
586 |
+
$number[1] = ($number[0] > 5 ? 1 : ($number[0] === 4 && $number[0] === 5 ? mt_rand(1, 2) : ($number[0] === 3 ? mt_rand(1, 3) : ($number[0] === 2 ? mt_rand(1, 5) : mt_rand(1, 10)))));
|
587 |
+
}
|
588 |
+
|
589 |
+
$number[2] = $number[0] * $number[1];
|
590 |
+
break;
|
591 |
+
|
592 |
+
case 'division':
|
593 |
+
$divide = array(1 => 99, 2 => 49, 3 => 33, 4 => 24, 5 => 19, 6 => 16, 7 => 14, 8 => 12, 9 => 11, 10 => 9);
|
594 |
+
|
595 |
+
if($rnd_input === 0)
|
596 |
+
{
|
597 |
+
$divide = array(2 => array(1, 2), 3 => array(1, 3), 4 => array(1, 2, 4), 5 => array(1, 5), 6 => array(1, 2, 3, 6), 7 => array(1, 7), 8 => array(1, 2, 4, 8), 9 => array(1, 3, 9), 10 => array(1, 2, 5, 10));
|
598 |
+
$number[0] = mt_rand(2, 10);
|
599 |
+
$number[1] = $divide[$number[0]][mt_rand(0, count($divide[$number[0]]) - 1)];
|
600 |
+
}
|
601 |
+
elseif($rnd_input === 1)
|
602 |
+
{
|
603 |
+
$number[1] = mt_rand(1, 10);
|
604 |
+
$number[0] = $number[1] * mt_rand(1, $divide[$number[1]]);
|
605 |
+
}
|
606 |
+
elseif($rnd_input === 2)
|
607 |
+
{
|
608 |
+
$number[2] = mt_rand(1, 10);
|
609 |
+
$number[0] = $number[2] * mt_rand(1, $divide[$number[2]]);
|
610 |
+
$number[1] = (int)($number[0] / $number[2]);
|
611 |
+
}
|
612 |
+
|
613 |
+
if(!isset($number[2]))
|
614 |
+
$number[2] = (int)($number[0] / $number[1]);
|
615 |
+
|
616 |
+
break;
|
617 |
+
}
|
618 |
+
|
619 |
+
// words
|
620 |
+
if($ao === 1 && $groups[0] === 'words')
|
621 |
+
{
|
622 |
+
if($rnd_input === 0)
|
623 |
+
{
|
624 |
+
$number[1] = $this->numberToWords($number[1]);
|
625 |
+
$number[2] = $this->numberToWords($number[2]);
|
626 |
+
}
|
627 |
+
elseif($rnd_input === 1)
|
628 |
+
{
|
629 |
+
$number[0] = $this->numberToWords($number[0]);
|
630 |
+
$number[2] = $this->numberToWords($number[2]);
|
631 |
+
}
|
632 |
+
elseif($rnd_input === 2)
|
633 |
+
{
|
634 |
+
$number[0] = $this->numberToWords($number[0]);
|
635 |
+
$number[1] = $this->numberToWords($number[1]);
|
636 |
+
}
|
637 |
+
}
|
638 |
+
// numbers and words
|
639 |
+
elseif($ao === 2)
|
640 |
+
{
|
641 |
+
if($rnd_input === 0)
|
642 |
+
{
|
643 |
+
if(mt_rand(1, 2) === 2)
|
644 |
+
{
|
645 |
+
$number[1] = $this->numberToWords($number[1]);
|
646 |
+
$number[2] = $this->numberToWords($number[2]);
|
647 |
+
}
|
648 |
+
else
|
649 |
+
$number[$tmp = mt_rand(1, 2)] = $this->numberToWords($number[$tmp]);
|
650 |
+
}
|
651 |
+
elseif($rnd_input === 1)
|
652 |
+
{
|
653 |
+
if(mt_rand(1, 2) === 2)
|
654 |
+
{
|
655 |
+
$number[0] = $this->numberToWords($number[0]);
|
656 |
+
$number[2] = $this->numberToWords($number[2]);
|
657 |
+
}
|
658 |
+
else
|
659 |
+
$number[$tmp = array_rand(array(0 => 0, 2 => 2), 1)] = $this->numberToWords($number[$tmp]);
|
660 |
+
}
|
661 |
+
elseif($rnd_input === 2)
|
662 |
+
{
|
663 |
+
if(mt_rand(1, 2) === 2)
|
664 |
+
{
|
665 |
+
$number[0] = $this->numberToWords($number[0]);
|
666 |
+
$number[1] = $this->numberToWords($number[1]);
|
667 |
+
}
|
668 |
+
else
|
669 |
+
$number[$tmp = mt_rand(0, 1)] = $this->numberToWords($number[$tmp]);
|
670 |
+
}
|
671 |
+
}
|
672 |
+
|
673 |
+
if(in_array($form, array('default', 'bbpress'), true))
|
674 |
+
{
|
675 |
+
// position of empty input
|
676 |
+
if($rnd_input === 0)
|
677 |
+
$return = $input.' '.$number[3].' '.$this->encode_operation($number[1]).' = '.$this->encode_operation($number[2]);
|
678 |
+
elseif($rnd_input === 1)
|
679 |
+
$return = $this->encode_operation($number[0]).' '.$number[3].' '.$input.' = '.$this->encode_operation($number[2]);
|
680 |
+
elseif($rnd_input === 2)
|
681 |
+
$return = $this->encode_operation($number[0]).' '.$number[3].' '.$this->encode_operation($number[1]).' = '.$input;
|
682 |
+
|
683 |
+
$transient_name = ($form === 'bbpress' ? 'bbp' : 'mc');
|
684 |
+
$session_id = Math_Captcha()->cookie_session->session_ids['default'];
|
685 |
+
}
|
686 |
+
elseif($form === 'cf7')
|
687 |
+
{
|
688 |
+
$return = array();
|
689 |
+
|
690 |
+
if($rnd_input === 0)
|
691 |
+
{
|
692 |
+
$return['input'] = 1;
|
693 |
+
$return[2] = ' '.$number[3].' '.$this->encode_operation($number[1]).' = ';
|
694 |
+
$return[3] = $this->encode_operation($number[2]);
|
695 |
+
}
|
696 |
+
elseif($rnd_input === 1)
|
697 |
+
{
|
698 |
+
$return[1] = $this->encode_operation($number[0]).' '.$number[3].' ';
|
699 |
+
$return['input'] = 2;
|
700 |
+
$return[3] = ' = '.$this->encode_operation($number[2]);
|
701 |
+
}
|
702 |
+
elseif($rnd_input === 2)
|
703 |
+
{
|
704 |
+
$return[1] = $this->encode_operation($number[0]).' '.$number[3].' ';
|
705 |
+
$return[2] = $this->encode_operation($number[1]).' = ';
|
706 |
+
$return['input'] = 3;
|
707 |
+
}
|
708 |
+
|
709 |
+
$transient_name = 'cf7';
|
710 |
+
$session_id = Math_Captcha()->cookie_session->session_ids['multi'][$this->session_number++];
|
711 |
+
}
|
712 |
+
|
713 |
+
set_transient($transient_name.'_'.$session_id, sha1(AUTH_KEY.$number[$rnd_input].$session_id, false), apply_filters('math_captcha_time', Math_Captcha()->options['general']['time']));
|
714 |
+
|
715 |
+
return $return;
|
716 |
+
}
|
717 |
+
|
718 |
+
|
719 |
+
/**
|
720 |
+
*
|
721 |
+
*/
|
722 |
+
public function flush_rewrites()
|
723 |
+
{
|
724 |
+
if(Math_Captcha()->options['general']['flush_rules'])
|
725 |
+
{
|
726 |
+
global $wp_rewrite;
|
727 |
+
|
728 |
+
$wp_rewrite->flush_rules();
|
729 |
+
|
730 |
+
Math_Captcha()->options['general']['flush_rules'] = false;
|
731 |
+
update_option('math_captcha_options', Math_Captcha()->options['general']);
|
732 |
+
}
|
733 |
+
}
|
734 |
+
|
735 |
+
|
736 |
+
/**
|
737 |
+
*
|
738 |
+
*/
|
739 |
+
public function block_direct_comments($rules)
|
740 |
+
{
|
741 |
+
if(Math_Captcha()->options['general']['block_direct_comments'])
|
742 |
+
{
|
743 |
+
$new_rules =
|
744 |
+
<<<EOT
|
745 |
+
\n# BEGIN Math Captcha
|
746 |
+
<IfModule mod_rewrite.c>
|
747 |
+
RewriteEngine On
|
748 |
+
RewriteCond %{REQUEST_METHOD} POST
|
749 |
+
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
|
750 |
+
RewriteCond %{HTTP_REFERER} !.*{$_SERVER['HTTP_HOST']}.* [OR]
|
751 |
+
RewriteCond %{HTTP_USER_AGENT} ^$
|
752 |
+
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
|
753 |
+
</IfModule>
|
754 |
+
# END Math Captcha\n\n
|
755 |
+
EOT;
|
756 |
+
|
757 |
+
return $new_rules.$rules;
|
758 |
+
}
|
759 |
+
|
760 |
+
return $rules;
|
761 |
+
}
|
762 |
+
}
|
763 |
+
?>
|
includes/class-settings.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(!defined('ABSPATH')) exit;
|
3 |
+
|
4 |
+
new Math_Captcha_Settings();
|
5 |
+
|
6 |
+
class Math_Captcha_Settings
|
7 |
+
{
|
8 |
+
public $mathematical_operations;
|
9 |
+
public $groups;
|
10 |
+
public $forms;
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
// actions
|
19 |
+
add_action('init', array(&$this, 'load_defaults'));
|
20 |
+
add_action('admin_init', array(&$this, 'register_settings'));
|
21 |
+
add_action('admin_menu', array(&$this, 'admin_menu_options'));
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
public function load_defaults()
|
29 |
+
{
|
30 |
+
if(!is_admin())
|
31 |
+
return;
|
32 |
+
|
33 |
+
$this->forms = array(
|
34 |
+
'login_form' => __('login form', 'math-captcha'),
|
35 |
+
'registration_form' => __('registration form', 'math-captcha'),
|
36 |
+
'reset_password_form' => __('reset password form', 'math-captcha'),
|
37 |
+
'comment_form' => __('comment form', 'math-captcha'),
|
38 |
+
'bbpress' => __('bbpress', 'math-captcha'),
|
39 |
+
'contact_form_7' => __('contact form 7', 'math-captcha')
|
40 |
+
);
|
41 |
+
|
42 |
+
$this->mathematical_operations = array(
|
43 |
+
'addition' => __('addition (+)', 'math-captcha'),
|
44 |
+
'subtraction' => __('subtraction (-)', 'math-captcha'),
|
45 |
+
'multiplication' => __('multiplication (×)', 'math-captcha'),
|
46 |
+
'division' => __('division (÷)', 'math-captcha')
|
47 |
+
);
|
48 |
+
|
49 |
+
$this->groups = array(
|
50 |
+
'numbers' => __('numbers', 'math-captcha'),
|
51 |
+
'words' => __('words', 'math-captcha')
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Adds options menu
|
58 |
+
*/
|
59 |
+
public function admin_menu_options()
|
60 |
+
{
|
61 |
+
add_options_page(
|
62 |
+
__('Math Captcha', 'math-captcha'),
|
63 |
+
__('Math Captcha', 'math-captcha'),
|
64 |
+
'manage_options',
|
65 |
+
'math-captcha',
|
66 |
+
array(&$this, 'options_page')
|
67 |
+
);
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Shows options page
|
73 |
+
*/
|
74 |
+
public function options_page()
|
75 |
+
{
|
76 |
+
echo '
|
77 |
+
<div class="wrap">
|
78 |
+
<h2>'.__('Math Captcha', 'math-captcha').'</h2>
|
79 |
+
<div class="math-captcha-settings">
|
80 |
+
<div class="df-credits">
|
81 |
+
<h3 class="hndle">'.__('Math Captcha', 'math-captcha').' '.Math_Captcha()->defaults['version'].'</h3>
|
82 |
+
<div class="inside">
|
83 |
+
<h4 class="inner">'.__('Need support?', 'math-captcha').'</h4>
|
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="'.DOWNLOAD_ATTACHMENTS_URL.'/images/logo-dfactory.png" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress"/></a></p>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
<form action="options.php" method="post">';
|
102 |
+
|
103 |
+
wp_nonce_field('update-options');
|
104 |
+
settings_fields('math_captcha_options');
|
105 |
+
do_settings_sections('math_captcha_options');
|
106 |
+
|
107 |
+
echo '
|
108 |
+
<p class="submit">';
|
109 |
+
|
110 |
+
submit_button('', 'primary', 'save_mc_general', false);
|
111 |
+
|
112 |
+
echo ' ';
|
113 |
+
|
114 |
+
submit_button(__('Reset to defaults', 'math-captcha'), 'secondary reset_mc_settings', 'reset_mc_general', false);
|
115 |
+
|
116 |
+
echo '
|
117 |
+
</p>
|
118 |
+
</form>
|
119 |
+
</div>
|
120 |
+
<div class="clear"></div>
|
121 |
+
</div>';
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
/**
|
126 |
+
*
|
127 |
+
*/
|
128 |
+
public function register_settings()
|
129 |
+
{
|
130 |
+
// general settings
|
131 |
+
register_setting('math_captcha_options', 'math_captcha_options', array(&$this, 'validate_settings'));
|
132 |
+
add_settings_section('math_captcha_settings', __('Math Captcha settings', 'math-captcha'), '', 'math_captcha_options');
|
133 |
+
add_settings_field('mc_general_enable_captcha_for', __('Enable Math Captcha for', 'math-captcha'), array(&$this, 'mc_general_enable_captcha_for'), 'math_captcha_options', 'math_captcha_settings');
|
134 |
+
add_settings_field('mc_general_hide_for_logged_users', __('Hide for logged in users', 'math-captcha'), array(&$this, 'mc_general_hide_for_logged_users'), 'math_captcha_options', 'math_captcha_settings');
|
135 |
+
add_settings_field('mc_general_mathematical_operations', __('Mathematical operations', 'math-captcha'), array(&$this, 'mc_general_mathematical_operations'), 'math_captcha_options', 'math_captcha_settings');
|
136 |
+
add_settings_field('mc_general_groups', __('Display captcha as', 'math-captcha'), array(&$this, 'mc_general_groups'), 'math_captcha_options', 'math_captcha_settings');
|
137 |
+
add_settings_field('mc_general_title', __('Captcha field title', 'math-captcha'), array(&$this, 'mc_general_title'), 'math_captcha_options', 'math_captcha_settings');
|
138 |
+
add_settings_field('mc_general_time', __('Captcha time', 'math-captcha'), array(&$this, 'mc_general_time'), 'math_captcha_options', 'math_captcha_settings');
|
139 |
+
add_settings_field('mc_general_block_direct_comments', __('Block Direct Comments', 'math-captcha'), array(&$this, 'mc_general_block_direct_comments'), 'math_captcha_options', 'math_captcha_settings');
|
140 |
+
add_settings_field('mc_general_deactivation_delete', __('Deactivation', 'math-captcha'), array(&$this, 'mc_general_deactivation_delete'), 'math_captcha_options', 'math_captcha_settings');
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
/**
|
145 |
+
*
|
146 |
+
*/
|
147 |
+
public function mc_general_enable_captcha_for()
|
148 |
+
{
|
149 |
+
echo '
|
150 |
+
<div id="mc_general_enable_captcha_for">
|
151 |
+
<fieldset>';
|
152 |
+
|
153 |
+
foreach($this->forms as $val => $trans)
|
154 |
+
{
|
155 |
+
echo '
|
156 |
+
<input id="mc-general-enable-captcha-for-'.$val.'" type="checkbox" name="math_captcha_options[enable_for][]" value="'.$val.'" '.checked(true, Math_Captcha()->options['general']['enable_for'][$val], false).' '.disabled((($val === 'contact_form_7' && !class_exists('WPCF7_ContactForm')) || ($val === 'bbpress' && !class_exists('bbPress'))), true, false).'/><label for="mc-general-enable-captcha-for-'.$val.'">'.esc_html($trans).'</label>';
|
157 |
+
}
|
158 |
+
|
159 |
+
echo '
|
160 |
+
<br/>
|
161 |
+
<span class="description">'.__('Select where you\'d like to use Math Captcha.', 'math-captcha').'</span>
|
162 |
+
</fieldset>
|
163 |
+
</div>';
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
/**
|
168 |
+
*
|
169 |
+
*/
|
170 |
+
public function mc_general_hide_for_logged_users()
|
171 |
+
{
|
172 |
+
echo '
|
173 |
+
<div id="mc_general_hide_for_logged_users">
|
174 |
+
<fieldset>
|
175 |
+
<input id="mc-general-hide-for-logged" type="checkbox" name="math_captcha_options[hide_for_logged_users]" '.checked(true, Math_Captcha()->options['general']['hide_for_logged_users'], false).'/><label for="mc-general-hide-for-logged">'.__('Enable to hide captcha for logged in users.', 'math-captcha').'</label>
|
176 |
+
</fieldset>
|
177 |
+
</div>';
|
178 |
+
}
|
179 |
+
|
180 |
+
|
181 |
+
/**
|
182 |
+
*
|
183 |
+
*/
|
184 |
+
public function mc_general_mathematical_operations()
|
185 |
+
{
|
186 |
+
echo '
|
187 |
+
<div id="mc_general_mathematical_operations">
|
188 |
+
<fieldset>';
|
189 |
+
|
190 |
+
foreach($this->mathematical_operations as $val => $trans)
|
191 |
+
{
|
192 |
+
echo '
|
193 |
+
<input id="mc-general-mathematical-operations-'.$val.'" type="checkbox" name="math_captcha_options[mathematical_operations][]" value="'.$val.'" '.checked(true, Math_Captcha()->options['general']['mathematical_operations'][$val], false).'/><label for="mc-general-mathematical-operations-'.$val.'">'.esc_html($trans).'</label>';
|
194 |
+
}
|
195 |
+
|
196 |
+
echo '
|
197 |
+
<br/>
|
198 |
+
<span class="description">'.__('Select which mathematical operations to use in your captcha.', 'math-captcha').'</span>
|
199 |
+
</fieldset>
|
200 |
+
</div>';
|
201 |
+
}
|
202 |
+
|
203 |
+
|
204 |
+
/**
|
205 |
+
*
|
206 |
+
*/
|
207 |
+
public function mc_general_groups()
|
208 |
+
{
|
209 |
+
echo '
|
210 |
+
<div id="mc_general_groups">
|
211 |
+
<fieldset>';
|
212 |
+
|
213 |
+
foreach($this->groups as $val => $trans)
|
214 |
+
{
|
215 |
+
echo '
|
216 |
+
<input id="mc-general-groups-'.$val.'" type="checkbox" name="math_captcha_options[groups][]" value="'.$val.'" '.checked(true, Math_Captcha()->options['general']['groups'][$val], false).'/><label for="mc-general-groups-'.$val.'">'.esc_html($trans).'</label>';
|
217 |
+
}
|
218 |
+
|
219 |
+
echo '
|
220 |
+
<br/>
|
221 |
+
<span class="description">'.__('Select how you\'d like to display you captcha.', 'math-captcha').'</span>
|
222 |
+
</fieldset>
|
223 |
+
</div>';
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
/**
|
228 |
+
*
|
229 |
+
*/
|
230 |
+
public function mc_general_title()
|
231 |
+
{
|
232 |
+
echo '
|
233 |
+
<div id="mc_general_title">
|
234 |
+
<fieldset>
|
235 |
+
<input type="text" name="math_captcha_options[title]" value="'.Math_Captcha()->options['general']['title'].'"/>
|
236 |
+
<br/>
|
237 |
+
<span class="description">'.__('How to entitle field with captcha?', 'math-captcha').'</span>
|
238 |
+
</fieldset>
|
239 |
+
</div>';
|
240 |
+
}
|
241 |
+
|
242 |
+
|
243 |
+
/**
|
244 |
+
*
|
245 |
+
*/
|
246 |
+
public function mc_general_time()
|
247 |
+
{
|
248 |
+
echo '
|
249 |
+
<div id="mc_general_time">
|
250 |
+
<fieldset>
|
251 |
+
<input type="text" name="math_captcha_options[time]" value="'.Math_Captcha()->options['general']['time'].'"/>
|
252 |
+
<br/>
|
253 |
+
<span class="description">'.__('Enter the time (in seconds) a user has to enter captcha value.', 'math-captcha').'</span>
|
254 |
+
</fieldset>
|
255 |
+
</div>';
|
256 |
+
}
|
257 |
+
|
258 |
+
|
259 |
+
/**
|
260 |
+
*
|
261 |
+
*/
|
262 |
+
public function mc_general_block_direct_comments()
|
263 |
+
{
|
264 |
+
echo '
|
265 |
+
<div id="mc_general_block_direct_comments">
|
266 |
+
<fieldset>
|
267 |
+
<input id="mc-general-block-direct-comments" type="checkbox" name="math_captcha_options[block_direct_comments]" '.checked(true, Math_Captcha()->options['general']['block_direct_comments'], false).'/><label for="mc-general-block-direct-comments">'.__('Blocks direct access to wp-comments-post.php. Enable this to prevent spambots from posting to Wordpress via a URL.', 'math-captcha').'</label>
|
268 |
+
</fieldset>
|
269 |
+
</div>';
|
270 |
+
}
|
271 |
+
|
272 |
+
|
273 |
+
/**
|
274 |
+
*
|
275 |
+
*/
|
276 |
+
public function mc_general_deactivation_delete()
|
277 |
+
{
|
278 |
+
echo '
|
279 |
+
<div id="mc_general_deactivation_delete">
|
280 |
+
<fieldset>
|
281 |
+
<input id="mc-general-deactivation-delete" type="checkbox" name="math_captcha_options[deactivation_delete]" '.checked(true, Math_Captcha()->options['general']['deactivation_delete'], false).'/><label for="mc-general-deactivation-delete">'.__('Delete settings on plugin deactivation.', 'math-captcha').'</label>
|
282 |
+
</fieldset>
|
283 |
+
</div>';
|
284 |
+
}
|
285 |
+
|
286 |
+
|
287 |
+
/**
|
288 |
+
* Validates settings
|
289 |
+
*/
|
290 |
+
public function validate_settings($input)
|
291 |
+
{
|
292 |
+
if(isset($_POST['save_mc_general']))
|
293 |
+
{
|
294 |
+
// enable captcha forms
|
295 |
+
$enable_for = array();
|
296 |
+
|
297 |
+
if(empty($input['enable_for']))
|
298 |
+
{
|
299 |
+
foreach(Math_Captcha()->defaults['general']['enable_for'] as $enable => $bool)
|
300 |
+
{
|
301 |
+
$input['enable_for'][$enable] = false;
|
302 |
+
}
|
303 |
+
}
|
304 |
+
else
|
305 |
+
{
|
306 |
+
foreach($this->forms as $enable => $trans)
|
307 |
+
{
|
308 |
+
$enable_for[$enable] = (in_array($enable, $input['enable_for']) ? true : false);
|
309 |
+
}
|
310 |
+
|
311 |
+
$input['enable_for'] = $enable_for;
|
312 |
+
}
|
313 |
+
|
314 |
+
if(!class_exists('WPCF7_ContactForm') && Math_Captcha()->options['general']['enable_for']['contact_form_7'])
|
315 |
+
$input['enable_for']['contact_form_7'] = true;
|
316 |
+
|
317 |
+
if(!class_exists('bbPress') && Math_Captcha()->options['general']['enable_for']['bbpress'])
|
318 |
+
$input['enable_for']['bbpress'] = true;
|
319 |
+
|
320 |
+
// enable mathematical operations
|
321 |
+
$mathematical_operations = array();
|
322 |
+
|
323 |
+
if(empty($input['mathematical_operations']))
|
324 |
+
{
|
325 |
+
add_settings_error('empty-operations', 'settings_updated', __('You need to check at least one mathematical operation. Defaults settings of this option restored.', 'math-captcha'), 'error');
|
326 |
+
|
327 |
+
$input['mathematical_operations'] = Math_Captcha()->defaults['general']['mathematical_operations'];
|
328 |
+
}
|
329 |
+
else
|
330 |
+
{
|
331 |
+
foreach($this->mathematical_operations as $operation => $trans)
|
332 |
+
{
|
333 |
+
$mathematical_operations[$operation] = (in_array($operation, $input['mathematical_operations']) ? true : false);
|
334 |
+
}
|
335 |
+
|
336 |
+
$input['mathematical_operations'] = $mathematical_operations;
|
337 |
+
}
|
338 |
+
|
339 |
+
// enable groups
|
340 |
+
$groups = array();
|
341 |
+
|
342 |
+
if(empty($input['groups']))
|
343 |
+
{
|
344 |
+
add_settings_error('empty-groups', 'settings_updated', __('You need to check at least one group. Defaults settings of this option restored.', 'math-captcha'), 'error');
|
345 |
+
|
346 |
+
$input['groups'] = Math_Captcha()->defaults['general']['groups'];
|
347 |
+
}
|
348 |
+
else
|
349 |
+
{
|
350 |
+
foreach($this->groups as $group => $trans)
|
351 |
+
{
|
352 |
+
$groups[$group] = (in_array($group, $input['groups']) ? true : false);
|
353 |
+
}
|
354 |
+
|
355 |
+
$input['groups'] = $groups;
|
356 |
+
}
|
357 |
+
|
358 |
+
// hide for logged in users
|
359 |
+
$input['hide_for_logged_users'] = isset($input['hide_for_logged_users']);
|
360 |
+
|
361 |
+
// block direct comments access
|
362 |
+
$input['block_direct_comments'] = isset($input['block_direct_comments']);
|
363 |
+
|
364 |
+
// deactivation delete
|
365 |
+
$input['deactivation_delete'] = isset($input['deactivation_delete']);
|
366 |
+
|
367 |
+
// captcha title
|
368 |
+
$input['title'] = trim($input['title']);
|
369 |
+
|
370 |
+
// captcha time
|
371 |
+
$time = (int)$input['time'];
|
372 |
+
$input['time'] = ($time < 0 ? Math_Captcha()->defaults['general']['time'] : $time);
|
373 |
+
|
374 |
+
// flush rules
|
375 |
+
$input['flush_rules'] = true;
|
376 |
+
}
|
377 |
+
elseif(isset($_POST['reset_mc_general']))
|
378 |
+
{
|
379 |
+
$input = Math_Captcha()->defaults['general'];
|
380 |
+
|
381 |
+
add_settings_error('settings', 'settings_reset', __('Settings restored to defaults.', 'math-captcha'), 'updated');
|
382 |
+
}
|
383 |
+
|
384 |
+
return $input;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
?>
|
includes/class-update.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(!defined('ABSPATH')) exit;
|
3 |
+
|
4 |
+
new Math_Captcha_Update();
|
5 |
+
|
6 |
+
class Math_Captcha_Update
|
7 |
+
{
|
8 |
+
/**
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
// actions
|
14 |
+
add_action('init', array(&$this, 'check_update'));
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
*
|
20 |
+
*/
|
21 |
+
public function check_update()
|
22 |
+
{
|
23 |
+
if(!is_admin() || !current_user_can('manage_options'))
|
24 |
+
return;
|
25 |
+
|
26 |
+
// gets current database version
|
27 |
+
$current_db_version = get_option('math_captcha_version', '1.0.0');
|
28 |
+
|
29 |
+
// new version?
|
30 |
+
if(version_compare($current_db_version, Math_Captcha()->defaults['version'], '<'))
|
31 |
+
{
|
32 |
+
if(version_compare($current_db_version, '1.0.9', '<'))
|
33 |
+
{
|
34 |
+
update_option('math_captcha_options', Math_Captcha()->options['general']);
|
35 |
+
delete_option('mc_options');
|
36 |
+
}
|
37 |
+
|
38 |
+
// updates plugin version
|
39 |
+
update_option('math_captcha_version', Math_Captcha()->defaults['version']);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
?>
|
includes/integration-cf7.php
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
A module for [mathcaptcha]
|
4 |
+
**/
|
5 |
+
|
6 |
+
// shortcode handler
|
7 |
+
add_action('init', 'wpcf7_add_shortcode_mathcaptcha', 5);
|
8 |
+
|
9 |
+
function wpcf7_add_shortcode_mathcaptcha()
|
10 |
+
{
|
11 |
+
wpcf7_add_shortcode('mathcaptcha', 'wpcf7_mathcaptcha_shortcode_handler', true);
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
function wpcf7_mathcaptcha_shortcode_handler($tag)
|
16 |
+
{
|
17 |
+
if(!is_user_logged_in() || (is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users']))
|
18 |
+
{
|
19 |
+
$tag = new WPCF7_Shortcode($tag);
|
20 |
+
|
21 |
+
if(empty($tag->name))
|
22 |
+
return '';
|
23 |
+
|
24 |
+
$validation_error = wpcf7_get_validation_error($tag->name);
|
25 |
+
$class = wpcf7_form_controls_class($tag->type);
|
26 |
+
|
27 |
+
if($validation_error)
|
28 |
+
$class .= ' wpcf7-not-valid';
|
29 |
+
|
30 |
+
$atts = array();
|
31 |
+
$atts['size'] = 2;
|
32 |
+
$atts['maxlength'] = 2;
|
33 |
+
$atts['class'] = $tag->get_class_option($class);
|
34 |
+
$atts['id'] = $tag->get_option('id', 'id', true);
|
35 |
+
$atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
|
36 |
+
$atts['aria-required'] = 'true';
|
37 |
+
$atts['type'] = 'text';
|
38 |
+
$atts['name'] = $tag->name;
|
39 |
+
$atts['value'] = '';
|
40 |
+
$atts = wpcf7_format_atts($atts);
|
41 |
+
|
42 |
+
$mc_form = Math_Captcha()->core->generate_captcha_phrase('cf7');
|
43 |
+
$mc_form[$mc_form['input']] = '<input %2$s />';
|
44 |
+
|
45 |
+
$math_captcha_title = apply_filters('math_captcha_title', Math_Captcha()->options['general']['title']);
|
46 |
+
|
47 |
+
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</span><input type="hidden" value="'.(Math_Captcha()->core->session_number - 1).'" name="'.$tag->name.'-sn" />', $tag->name, $atts, $validation_error);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
// validation
|
53 |
+
add_filter('wpcf7_validate_mathcaptcha', 'wpcf7_mathcaptcha_validation_filter', 10, 2);
|
54 |
+
|
55 |
+
function wpcf7_mathcaptcha_validation_filter($result, $tag)
|
56 |
+
{
|
57 |
+
$tag = new WPCF7_Shortcode($tag);
|
58 |
+
$name = $tag->name;
|
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']] : '');
|
65 |
+
|
66 |
+
if($session_id !== '' && get_transient('cf7_'.$session_id) !== false)
|
67 |
+
{
|
68 |
+
if(strcmp(get_transient('cf7_'.$session_id), sha1(AUTH_KEY.$_POST[$name].$session_id, false)) !== 0)
|
69 |
+
{
|
70 |
+
$result['valid'] = false;
|
71 |
+
$result['reason'][$name] = wpcf7_get_message('wrong_mathcaptcha');
|
72 |
+
}
|
73 |
+
}
|
74 |
+
else
|
75 |
+
{
|
76 |
+
$result['valid'] = false;
|
77 |
+
$result['reason'][$name] = wpcf7_get_message('time_mathcaptcha');
|
78 |
+
}
|
79 |
+
}
|
80 |
+
else
|
81 |
+
{
|
82 |
+
$result['valid'] = false;
|
83 |
+
$result['reason'][$name] = wpcf7_get_message('fill_mathcaptcha');
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
return $result;
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
// messages
|
92 |
+
add_filter('wpcf7_messages', 'wpcf7_mathcaptcha_messages');
|
93 |
+
|
94 |
+
function wpcf7_mathcaptcha_messages($messages)
|
95 |
+
{
|
96 |
+
return array_merge(
|
97 |
+
$messages,
|
98 |
+
array(
|
99 |
+
'wrong_mathcaptcha' => array(
|
100 |
+
'description' => __('Invalid captcha value.', 'math-captcha'),
|
101 |
+
'default' => Math_Captcha()->core->error_messages['wrong']
|
102 |
+
),
|
103 |
+
'fill_mathcaptcha' => array(
|
104 |
+
'description' => __('Please enter captcha value.', 'math-captcha'),
|
105 |
+
'default' => Math_Captcha()->core->error_messages['fill']
|
106 |
+
),
|
107 |
+
'time_mathcaptcha' => array(
|
108 |
+
'description' => __('Captcha time expired.', 'math-captcha'),
|
109 |
+
'default' => Math_Captcha()->core->error_messages['time']
|
110 |
+
)
|
111 |
+
)
|
112 |
+
);
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
// warning message
|
117 |
+
add_action('wpcf7_admin_notices', 'wpcf7_mathcaptcha_display_warning_message');
|
118 |
+
|
119 |
+
function wpcf7_mathcaptcha_display_warning_message()
|
120 |
+
{
|
121 |
+
if(empty($_GET['post']) || !($contact_form = wpcf7_contact_form( $_GET['post'])))
|
122 |
+
return;
|
123 |
+
|
124 |
+
$has_tags = (bool)$contact_form->form_scan_shortcode(array('type' => array('mathcaptcha')));
|
125 |
+
|
126 |
+
if(!$has_tags)
|
127 |
+
return;
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
// tag generator
|
132 |
+
add_action('admin_init', 'wpcf7_add_tag_generator_mathcaptcha', 45);
|
133 |
+
|
134 |
+
function wpcf7_add_tag_generator_mathcaptcha()
|
135 |
+
{
|
136 |
+
if(!function_exists('wpcf7_add_tag_generator'))
|
137 |
+
return;
|
138 |
+
|
139 |
+
wpcf7_add_tag_generator('mathcaptcha', __('Math Captcha', 'math-captcha'), 'wpcf7-mathcaptcha', 'wpcf7_tg_pane_mathcaptcha');
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
function wpcf7_tg_pane_mathcaptcha($contact_form)
|
144 |
+
{
|
145 |
+
echo '
|
146 |
+
<div id="wpcf7-mathcaptcha" class="hidden">
|
147 |
+
<form action="">
|
148 |
+
<table>
|
149 |
+
<tr>
|
150 |
+
<td>
|
151 |
+
'.esc_html(__('Name', 'math-captcha')).'<br />
|
152 |
+
<input type="text" name="name" class="tg-name oneline" />
|
153 |
+
</td>
|
154 |
+
</tr>
|
155 |
+
</table>
|
156 |
+
<table class="scope mathcaptcha">
|
157 |
+
<caption>'.esc_html(__('Input field settings', 'math-captcha')).'</caption>
|
158 |
+
<tr>
|
159 |
+
<td>
|
160 |
+
<code>id</code> ('.esc_html(__('optional', 'math-captcha')).')<br />
|
161 |
+
<input type="text" name="id" class="idvalue oneline option" />
|
162 |
+
</td>
|
163 |
+
<td>
|
164 |
+
<code>class</code> ('.esc_html(__('optional', 'math-captcha')).')<br />
|
165 |
+
<input type="text" name="class" class="classvalue oneline option" />
|
166 |
+
</td>
|
167 |
+
</tr>
|
168 |
+
</table>
|
169 |
+
<div class="tg-tag">
|
170 |
+
'.esc_html(__('Copy this code and paste it into the form left.', 'math-captcha')).'<br />
|
171 |
+
<input type="text" name="mathcaptcha" class="tag" readonly="readonly" onfocus="this.select()" />
|
172 |
+
</div>
|
173 |
+
</form>
|
174 |
+
</div>';
|
175 |
+
}
|
176 |
+
?>
|
includes/math-captcha-cf7.php
CHANGED
@@ -14,39 +14,36 @@ function wpcf7_add_shortcode_mathcaptcha()
|
|
14 |
function wpcf7_mathcaptcha_shortcode_handler($tag)
|
15 |
{
|
16 |
global $mc_class;
|
17 |
-
|
18 |
-
if(!is_user_logged_in() || (is_user_logged_in() && $mc_class->get_options('hide_for_logged_users') === FALSE))
|
19 |
-
{
|
20 |
-
$tag = new WPCF7_Shortcode($tag);
|
21 |
-
|
22 |
-
if(empty($tag->name))
|
23 |
-
return '';
|
24 |
-
|
25 |
-
$validation_error = wpcf7_get_validation_error($tag->name);
|
26 |
-
$class = wpcf7_form_controls_class($tag->type);
|
27 |
-
|
28 |
-
if($validation_error)
|
29 |
-
$class .= ' wpcf7-not-valid';
|
30 |
|
31 |
-
|
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 |
-
|
44 |
-
|
45 |
|
46 |
-
|
|
|
47 |
|
48 |
-
|
|
|
|
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
|
52 |
|
@@ -64,11 +61,9 @@ function wpcf7_mathcaptcha_validation_filter($result, $tag)
|
|
64 |
{
|
65 |
if($_POST[$name] !== '')
|
66 |
{
|
67 |
-
$
|
68 |
-
|
69 |
-
if($session_id !== '' && get_transient('cf7_'.$session_id) !== FALSE)
|
70 |
{
|
71 |
-
if(strcmp(get_transient('cf7_'.$session_id), sha1(
|
72 |
{
|
73 |
$result['valid'] = FALSE;
|
74 |
$result['reason'][$name] = wpcf7_get_message('wrong_mathcaptcha');
|
@@ -103,15 +98,15 @@ function wpcf7_mathcaptcha_messages($messages)
|
|
103 |
array(
|
104 |
'wrong_mathcaptcha' => array(
|
105 |
'description' => __('Invalid captcha value.', 'math-captcha'),
|
106 |
-
'default' => $mc_class->
|
107 |
),
|
108 |
'fill_mathcaptcha' => array(
|
109 |
'description' => __('Please enter captcha value.', 'math-captcha'),
|
110 |
-
'default' => $mc_class->
|
111 |
),
|
112 |
'time_mathcaptcha' => array(
|
113 |
'description' => __('Captcha time expired.', 'math-captcha'),
|
114 |
-
'default' => $mc_class->
|
115 |
)
|
116 |
)
|
117 |
);
|
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 |
+
return sprintf('<label>'.apply_filters('math_captcha_title', $mc_class->get_attribute('title')).'</label><br /><span class="wpcf7-form-control-wrap %1$s">'.$mc_form[1].$mc_form[2].$mc_form[3].'%3$s</span>', $tag->name, $atts, $validation_error);
|
47 |
}
|
48 |
|
49 |
|
61 |
{
|
62 |
if($_POST[$name] !== '')
|
63 |
{
|
64 |
+
if($mc_class->get_attribute('session_id') !== '' && get_transient('cf7_'.$mc_class->get_attribute('session_id')) !== FALSE)
|
|
|
|
|
65 |
{
|
66 |
+
if(strcmp(get_transient('cf7_'.$mc_class->get_attribute('session_id')), sha1($mc_class->get_attribute('crypt_key').$_POST[$name].$mc_class->get_attribute('session_id'), FALSE)) !== 0)
|
67 |
{
|
68 |
$result['valid'] = FALSE;
|
69 |
$result['reason'][$name] = wpcf7_get_message('wrong_mathcaptcha');
|
98 |
array(
|
99 |
'wrong_mathcaptcha' => array(
|
100 |
'description' => __('Invalid captcha value.', 'math-captcha'),
|
101 |
+
'default' => $mc_class->err_msg['wrong']
|
102 |
),
|
103 |
'fill_mathcaptcha' => array(
|
104 |
'description' => __('Please enter captcha value.', 'math-captcha'),
|
105 |
+
'default' => $mc_class->err_msg['fill']
|
106 |
),
|
107 |
'time_mathcaptcha' => array(
|
108 |
'description' => __('Captcha time expired.', 'math-captcha'),
|
109 |
+
'default' => $mc_class->err_msg['time']
|
110 |
)
|
111 |
)
|
112 |
);
|
js/admin-settings.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
// resets options to defaults if needed
|
4 |
+
$(document).on('click', '.reset_mc_settings', function() {
|
5 |
+
return confirm(mcArgsSettings.resetToDefaults);
|
6 |
+
});
|
7 |
+
});
|
js/admin.js
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($) {
|
2 |
-
|
3 |
-
$('.wplikebtns').buttonset();
|
4 |
-
});
|
|
|
|
|
|
|
|
languages/math-captcha-pl_PL.mo
CHANGED
Binary file
|
languages/math-captcha-pl_PL.po
CHANGED
@@ -1,691 +1,698 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Math Captcha\n"
|
4 |
-
"POT-Creation-Date: 2014-
|
5 |
-
"PO-Revision-Date: 2014-
|
6 |
-
"Last-Translator: Bartosz Arendt <info@
|
7 |
-
"Language-Team: dFactory <info@dfactory.eu>\n"
|
8 |
-
"Language: en\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.6.
|
13 |
-
"X-Poedit-KeywordsList: gettext;gettext_noop;__;_e\n"
|
14 |
-
"X-Poedit-Basepath: .\n"
|
15 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
-
"X-Poedit-SearchPath-0: ..\n"
|
17 |
-
|
18 |
-
#: ../
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
#: ../
|
128 |
-
msgid "
|
129 |
-
msgstr "
|
130 |
-
|
131 |
-
#: ../
|
132 |
-
msgid "
|
133 |
-
msgstr "
|
134 |
-
|
135 |
-
#: ../
|
136 |
-
msgid "
|
137 |
-
msgstr "
|
138 |
-
|
139 |
-
#: ../
|
140 |
-
msgid "
|
141 |
-
msgstr "
|
142 |
-
|
143 |
-
#: ../
|
144 |
-
msgid "login form"
|
145 |
-
msgstr "formularz logowania"
|
146 |
-
|
147 |
-
#: ../
|
148 |
-
msgid "registration form"
|
149 |
-
msgstr "formularz rejestracji"
|
150 |
-
|
151 |
-
#: ../
|
152 |
-
msgid "reset password form"
|
153 |
-
msgstr "resetowanie hasła"
|
154 |
-
|
155 |
-
#: ../
|
156 |
-
msgid "comment form"
|
157 |
-
msgstr "komentarze"
|
158 |
-
|
159 |
-
#: ../
|
160 |
-
msgid "bbpress"
|
161 |
-
msgstr "bbpress"
|
162 |
-
|
163 |
-
#: ../
|
164 |
-
msgid "contact form 7"
|
165 |
-
msgstr "contact form 7"
|
166 |
-
|
167 |
-
#: ../
|
168 |
-
msgid "
|
169 |
-
msgstr "
|
170 |
-
|
171 |
-
#: ../
|
172 |
-
msgid "
|
173 |
-
msgstr "
|
174 |
-
|
175 |
-
#: ../
|
176 |
-
msgid "
|
177 |
-
msgstr "
|
178 |
-
|
179 |
-
#: ../
|
180 |
-
msgid "
|
181 |
-
msgstr "
|
182 |
-
|
183 |
-
#: ../
|
184 |
-
msgid "
|
185 |
-
msgstr "
|
186 |
-
|
187 |
-
#: ../
|
188 |
-
msgid "
|
189 |
-
msgstr "
|
190 |
-
|
191 |
-
#: ../
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
"
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
"
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
"
|
277 |
-
|
278 |
-
|
279 |
-
"
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
"
|
284 |
-
"
|
285 |
-
|
286 |
-
|
287 |
-
"
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
#: ../includes/
|
292 |
-
msgid "
|
293 |
-
msgstr "
|
294 |
-
|
295 |
-
#: ../
|
296 |
-
msgid "
|
297 |
-
msgstr "
|
298 |
-
|
299 |
-
#: ../
|
300 |
-
msgid ""
|
301 |
-
"
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
#: ../
|
313 |
-
msgid "
|
314 |
-
msgstr "
|
315 |
-
|
316 |
-
#: ../
|
317 |
-
msgid "
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
#: ../
|
325 |
-
msgid "
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
#: ../
|
333 |
-
msgid "
|
334 |
-
msgstr "
|
335 |
-
|
336 |
-
#: ../
|
337 |
-
msgid "
|
338 |
-
msgstr "
|
339 |
-
|
340 |
-
#: ../
|
341 |
-
msgid "
|
342 |
-
msgstr "Ustawienia"
|
343 |
-
|
344 |
-
#: ../includes/
|
345 |
-
msgid "
|
346 |
-
msgstr "
|
347 |
-
|
348 |
-
#: ../includes/
|
349 |
-
msgid "
|
350 |
-
msgstr "
|
351 |
-
|
352 |
-
#: ../
|
353 |
-
msgid "
|
354 |
-
msgstr "
|
355 |
-
|
356 |
-
#: ../
|
357 |
-
msgid "
|
358 |
-
msgstr "
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
#~
|
365 |
-
|
366 |
-
|
367 |
-
#~
|
368 |
-
|
369 |
-
|
370 |
-
#~
|
371 |
-
|
372 |
-
#~
|
373 |
-
#~ msgstr "
|
374 |
-
|
375 |
-
|
376 |
-
#~
|
377 |
-
|
378 |
-
|
379 |
-
#~
|
380 |
-
|
381 |
-
|
382 |
-
#~
|
383 |
-
|
384 |
-
|
385 |
-
#~
|
386 |
-
|
387 |
-
|
388 |
-
#~
|
389 |
-
|
390 |
-
|
391 |
-
#~
|
392 |
-
|
393 |
-
|
394 |
-
#~
|
395 |
-
|
396 |
-
|
397 |
-
#~
|
398 |
-
|
399 |
-
|
400 |
-
#~
|
401 |
-
|
402 |
-
|
403 |
-
#~
|
404 |
-
|
405 |
-
|
406 |
-
#~
|
407 |
-
|
408 |
-
|
409 |
-
#~
|
410 |
-
|
411 |
-
|
412 |
-
#~
|
413 |
-
|
414 |
-
|
415 |
-
#~
|
416 |
-
|
417 |
-
|
418 |
-
#~
|
419 |
-
|
420 |
-
|
421 |
-
#~
|
422 |
-
|
423 |
-
|
424 |
-
#~
|
425 |
-
|
426 |
-
|
427 |
-
#~
|
428 |
-
|
429 |
-
|
430 |
-
#~
|
431 |
-
|
432 |
-
|
433 |
-
#~
|
434 |
-
|
435 |
-
|
436 |
-
#~
|
437 |
-
|
438 |
-
|
439 |
-
#~
|
440 |
-
|
441 |
-
|
442 |
-
#~
|
443 |
-
|
444 |
-
|
445 |
-
#~
|
446 |
-
|
447 |
-
|
448 |
-
#~
|
449 |
-
|
450 |
-
|
451 |
-
#~
|
452 |
-
|
453 |
-
|
454 |
-
#~
|
455 |
-
|
456 |
-
|
457 |
-
#~
|
458 |
-
|
459 |
-
|
460 |
-
#~
|
461 |
-
|
462 |
-
|
463 |
-
#~
|
464 |
-
|
465 |
-
|
466 |
-
#~
|
467 |
-
|
468 |
-
|
469 |
-
#~
|
470 |
-
|
471 |
-
|
472 |
-
#~
|
473 |
-
|
474 |
-
|
475 |
-
#~
|
476 |
-
|
477 |
-
|
478 |
-
#~
|
479 |
-
|
480 |
-
|
481 |
-
#~
|
482 |
-
|
483 |
-
|
484 |
-
#~
|
485 |
-
|
486 |
-
|
487 |
-
#~
|
488 |
-
|
489 |
-
|
490 |
-
#~
|
491 |
-
|
492 |
-
|
493 |
-
#~
|
494 |
-
|
495 |
-
|
496 |
-
#~
|
497 |
-
|
498 |
-
|
499 |
-
#~
|
500 |
-
|
501 |
-
|
502 |
-
#~
|
503 |
-
|
504 |
-
|
505 |
-
#~
|
506 |
-
|
507 |
-
|
508 |
-
#~ "
|
509 |
-
#~ msgstr ""
|
510 |
-
|
511 |
-
#~ "
|
512 |
-
|
513 |
-
|
514 |
-
#~
|
515 |
-
#~ "
|
516 |
-
|
517 |
-
#~ msgid "
|
518 |
-
#~
|
519 |
-
|
520 |
-
#~
|
521 |
-
#~
|
522 |
-
|
523 |
-
#~ msgid "
|
524 |
-
#~ msgstr "
|
525 |
-
|
526 |
-
|
527 |
-
#~ "
|
528 |
-
#~ "
|
529 |
-
|
530 |
-
#~ "
|
531 |
-
|
532 |
-
|
533 |
-
#~ "
|
534 |
-
#~ "
|
535 |
-
|
536 |
-
#~
|
537 |
-
#~ "
|
538 |
-
|
539 |
-
#~
|
540 |
-
#~
|
541 |
-
|
542 |
-
#~ msgid "
|
543 |
-
#~
|
544 |
-
|
545 |
-
#~
|
546 |
-
#~
|
547 |
-
|
548 |
-
|
549 |
-
#~
|
550 |
-
|
551 |
-
|
552 |
-
#~
|
553 |
-
|
554 |
-
|
555 |
-
#~
|
556 |
-
|
557 |
-
|
558 |
-
#~
|
559 |
-
|
560 |
-
|
561 |
-
#~
|
562 |
-
#~ "Wybierz
|
563 |
-
|
564 |
-
#~ msgid "
|
565 |
-
#~ msgstr "
|
566 |
-
|
567 |
-
#~ msgid "
|
568 |
-
#~ msgstr "
|
569 |
-
|
570 |
-
#~ msgid "
|
571 |
-
#~ msgstr ""
|
572 |
-
#~ "
|
573 |
-
|
574 |
-
#~ msgid "
|
575 |
-
#~ msgstr "
|
576 |
-
|
577 |
-
#~ msgid "
|
578 |
-
#~ msgstr "
|
579 |
-
|
580 |
-
#~ msgid "
|
581 |
-
#~ msgstr "
|
582 |
-
|
583 |
-
|
584 |
-
#~
|
585 |
-
|
586 |
-
|
587 |
-
#~
|
588 |
-
|
589 |
-
|
590 |
-
#~
|
591 |
-
|
592 |
-
|
593 |
-
#~
|
594 |
-
|
595 |
-
|
596 |
-
#~
|
597 |
-
|
598 |
-
|
599 |
-
#~
|
600 |
-
|
601 |
-
|
602 |
-
#~
|
603 |
-
|
604 |
-
|
605 |
-
#~
|
606 |
-
|
607 |
-
|
608 |
-
#~
|
609 |
-
|
610 |
-
|
611 |
-
#~
|
612 |
-
|
613 |
-
|
614 |
-
#~
|
615 |
-
|
616 |
-
|
617 |
-
#~
|
618 |
-
|
619 |
-
|
620 |
-
#~
|
621 |
-
|
622 |
-
|
623 |
-
#~
|
624 |
-
|
625 |
-
|
626 |
-
#~
|
627 |
-
|
628 |
-
|
629 |
-
#~
|
630 |
-
|
631 |
-
|
632 |
-
#~
|
633 |
-
|
634 |
-
|
635 |
-
#~
|
636 |
-
|
637 |
-
|
638 |
-
#~ "
|
639 |
-
#~ "
|
640 |
-
|
641 |
-
#~
|
642 |
-
#~ "
|
643 |
-
|
644 |
-
#~
|
645 |
-
|
646 |
-
#~
|
647 |
-
#~
|
648 |
-
|
649 |
-
#~
|
650 |
-
#~
|
651 |
-
|
652 |
-
|
653 |
-
#~
|
654 |
-
|
655 |
-
|
656 |
-
#~
|
657 |
-
#~ "Wybierz
|
658 |
-
|
659 |
-
#~ msgid "Restrict
|
660 |
-
#~ msgstr "Ograniczenia
|
661 |
-
|
662 |
-
#~ msgid "Select which
|
663 |
-
#~ msgstr "
|
664 |
-
|
665 |
-
|
666 |
-
#~
|
667 |
-
|
668 |
-
|
669 |
-
#~
|
670 |
-
#~ "Wybierz
|
671 |
-
|
672 |
-
#~ msgid "Restrict
|
673 |
-
#~ msgstr "Ograniczenia
|
674 |
-
|
675 |
-
#~ msgid "
|
676 |
-
#~ msgstr "
|
677 |
-
|
678 |
-
|
679 |
-
#~
|
680 |
-
|
681 |
-
|
682 |
-
#~
|
683 |
-
|
684 |
-
|
685 |
-
#~
|
686 |
-
|
687 |
-
|
688 |
-
#~
|
689 |
-
|
690 |
-
|
691 |
-
#~
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Math Captcha\n"
|
4 |
+
"POT-Creation-Date: 2014-09-05 17:19+0100\n"
|
5 |
+
"PO-Revision-Date: 2014-09-05 17:20+0100\n"
|
6 |
+
"Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
|
7 |
+
"Language-Team: dFactory <info@dfactory.eu>\n"
|
8 |
+
"Language: en\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.6.9\n"
|
13 |
+
"X-Poedit-KeywordsList: gettext;gettext_noop;__;_e\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
+
"X-Poedit-SearchPath-0: ..\n"
|
17 |
+
|
18 |
+
#: ../includes/class-core.php:39 ../includes/class-core.php:40
|
19 |
+
#: ../includes/class-core.php:41
|
20 |
+
msgid "ERROR"
|
21 |
+
msgstr "BŁĄD"
|
22 |
+
|
23 |
+
#: ../includes/class-core.php:39 ../includes/integration-cf7.php:104
|
24 |
+
msgid "Please enter captcha value."
|
25 |
+
msgstr "Proszę wpisać wartość."
|
26 |
+
|
27 |
+
#: ../includes/class-core.php:40 ../includes/integration-cf7.php:100
|
28 |
+
msgid "Invalid captcha value."
|
29 |
+
msgstr "Nieprawidłowa wartość."
|
30 |
+
|
31 |
+
#: ../includes/class-core.php:41 ../includes/integration-cf7.php:108
|
32 |
+
msgid "Captcha time expired."
|
33 |
+
msgstr "Upłynął czas."
|
34 |
+
|
35 |
+
#: ../includes/class-core.php:428
|
36 |
+
msgid "one"
|
37 |
+
msgstr "jeden"
|
38 |
+
|
39 |
+
#: ../includes/class-core.php:429
|
40 |
+
msgid "two"
|
41 |
+
msgstr "dwa"
|
42 |
+
|
43 |
+
#: ../includes/class-core.php:430
|
44 |
+
msgid "three"
|
45 |
+
msgstr "trzy"
|
46 |
+
|
47 |
+
#: ../includes/class-core.php:431
|
48 |
+
msgid "four"
|
49 |
+
msgstr "cztery"
|
50 |
+
|
51 |
+
#: ../includes/class-core.php:432
|
52 |
+
msgid "five"
|
53 |
+
msgstr "pięć"
|
54 |
+
|
55 |
+
#: ../includes/class-core.php:433
|
56 |
+
msgid "six"
|
57 |
+
msgstr "sześć"
|
58 |
+
|
59 |
+
#: ../includes/class-core.php:434
|
60 |
+
msgid "seven"
|
61 |
+
msgstr "siedem"
|
62 |
+
|
63 |
+
#: ../includes/class-core.php:435
|
64 |
+
msgid "eight"
|
65 |
+
msgstr "osiem"
|
66 |
+
|
67 |
+
#: ../includes/class-core.php:436
|
68 |
+
msgid "nine"
|
69 |
+
msgstr "dziewięć"
|
70 |
+
|
71 |
+
#: ../includes/class-core.php:437
|
72 |
+
msgid "ten"
|
73 |
+
msgstr "dziesięć"
|
74 |
+
|
75 |
+
#: ../includes/class-core.php:438
|
76 |
+
msgid "eleven"
|
77 |
+
msgstr "jedenaście"
|
78 |
+
|
79 |
+
#: ../includes/class-core.php:439
|
80 |
+
msgid "twelve"
|
81 |
+
msgstr "dwanaście"
|
82 |
+
|
83 |
+
#: ../includes/class-core.php:440
|
84 |
+
msgid "thirteen"
|
85 |
+
msgstr "trzynaście"
|
86 |
+
|
87 |
+
#: ../includes/class-core.php:441
|
88 |
+
msgid "fourteen"
|
89 |
+
msgstr "czternaście"
|
90 |
+
|
91 |
+
#: ../includes/class-core.php:442
|
92 |
+
msgid "fifteen"
|
93 |
+
msgstr "piętnaście"
|
94 |
+
|
95 |
+
#: ../includes/class-core.php:443
|
96 |
+
msgid "sixteen"
|
97 |
+
msgstr "szesnaście"
|
98 |
+
|
99 |
+
#: ../includes/class-core.php:444
|
100 |
+
msgid "seventeen"
|
101 |
+
msgstr "siedemnaście"
|
102 |
+
|
103 |
+
#: ../includes/class-core.php:445
|
104 |
+
msgid "eighteen"
|
105 |
+
msgstr "osiemnaście"
|
106 |
+
|
107 |
+
#: ../includes/class-core.php:446
|
108 |
+
msgid "nineteen"
|
109 |
+
msgstr "dziewiętnaście"
|
110 |
+
|
111 |
+
#: ../includes/class-core.php:447
|
112 |
+
msgid "twenty"
|
113 |
+
msgstr "dwadzieścia"
|
114 |
+
|
115 |
+
#: ../includes/class-core.php:448
|
116 |
+
msgid "thirty"
|
117 |
+
msgstr "trzydzieści"
|
118 |
+
|
119 |
+
#: ../includes/class-core.php:449
|
120 |
+
msgid "forty"
|
121 |
+
msgstr "czterdzieści"
|
122 |
+
|
123 |
+
#: ../includes/class-core.php:450
|
124 |
+
msgid "fifty"
|
125 |
+
msgstr "pięćdziesiąt"
|
126 |
+
|
127 |
+
#: ../includes/class-core.php:451
|
128 |
+
msgid "sixty"
|
129 |
+
msgstr "sześćdziesiąt"
|
130 |
+
|
131 |
+
#: ../includes/class-core.php:452
|
132 |
+
msgid "seventy"
|
133 |
+
msgstr "siedemdziesiąt"
|
134 |
+
|
135 |
+
#: ../includes/class-core.php:453
|
136 |
+
msgid "eighty"
|
137 |
+
msgstr "osiemdziesiąt"
|
138 |
+
|
139 |
+
#: ../includes/class-core.php:454
|
140 |
+
msgid "ninety"
|
141 |
+
msgstr "dziewięćdziesiąt"
|
142 |
+
|
143 |
+
#: ../includes/class-settings.php:34
|
144 |
+
msgid "login form"
|
145 |
+
msgstr "formularz logowania"
|
146 |
+
|
147 |
+
#: ../includes/class-settings.php:35
|
148 |
+
msgid "registration form"
|
149 |
+
msgstr "formularz rejestracji"
|
150 |
+
|
151 |
+
#: ../includes/class-settings.php:36
|
152 |
+
msgid "reset password form"
|
153 |
+
msgstr "resetowanie hasła"
|
154 |
+
|
155 |
+
#: ../includes/class-settings.php:37
|
156 |
+
msgid "comment form"
|
157 |
+
msgstr "komentarze"
|
158 |
+
|
159 |
+
#: ../includes/class-settings.php:38
|
160 |
+
msgid "bbpress"
|
161 |
+
msgstr "bbpress"
|
162 |
+
|
163 |
+
#: ../includes/class-settings.php:39
|
164 |
+
msgid "contact form 7"
|
165 |
+
msgstr "contact form 7"
|
166 |
+
|
167 |
+
#: ../includes/class-settings.php:43
|
168 |
+
msgid "addition (+)"
|
169 |
+
msgstr "dodawanie (+)"
|
170 |
+
|
171 |
+
#: ../includes/class-settings.php:44
|
172 |
+
msgid "subtraction (-)"
|
173 |
+
msgstr "odejmowanie (-)"
|
174 |
+
|
175 |
+
#: ../includes/class-settings.php:45
|
176 |
+
msgid "multiplication (×)"
|
177 |
+
msgstr "mnożenie (×)"
|
178 |
+
|
179 |
+
#: ../includes/class-settings.php:46
|
180 |
+
msgid "division (÷)"
|
181 |
+
msgstr "dzielenie (÷)"
|
182 |
+
|
183 |
+
#: ../includes/class-settings.php:50
|
184 |
+
msgid "numbers"
|
185 |
+
msgstr "liczby"
|
186 |
+
|
187 |
+
#: ../includes/class-settings.php:51
|
188 |
+
msgid "words"
|
189 |
+
msgstr "słowa"
|
190 |
+
|
191 |
+
#: ../includes/class-settings.php:62 ../includes/class-settings.php:63
|
192 |
+
#: ../includes/class-settings.php:78 ../includes/class-settings.php:81
|
193 |
+
#: ../includes/integration-cf7.php:139
|
194 |
+
msgid "Math Captcha"
|
195 |
+
msgstr "Math Captcha"
|
196 |
+
|
197 |
+
#: ../includes/class-settings.php:83
|
198 |
+
msgid "Need support?"
|
199 |
+
msgstr "Potrzebujesz pomocy?"
|
200 |
+
|
201 |
+
#: ../includes/class-settings.php:84
|
202 |
+
msgid ""
|
203 |
+
"If you are having problems with this plugin, please talk about them in the"
|
204 |
+
msgstr "Jeśli masz jakiekolwiek problemy z tą wtyczką, powiedz o tym na"
|
205 |
+
|
206 |
+
#: ../includes/class-settings.php:84
|
207 |
+
msgid "Support forum"
|
208 |
+
msgstr "Forum pomocy"
|
209 |
+
|
210 |
+
#: ../includes/class-settings.php:86
|
211 |
+
msgid "Do you like this plugin?"
|
212 |
+
msgstr "Lubisz tę wtyczkę?"
|
213 |
+
|
214 |
+
#: ../includes/class-settings.php:87
|
215 |
+
msgid "Rate it 5"
|
216 |
+
msgstr "Oceń ją na 5"
|
217 |
+
|
218 |
+
#: ../includes/class-settings.php:87
|
219 |
+
msgid "on WordPress.org"
|
220 |
+
msgstr "na WordPress.org"
|
221 |
+
|
222 |
+
#: ../includes/class-settings.php:88
|
223 |
+
msgid "Blog about it & link to the"
|
224 |
+
msgstr "Napisz o niej i dodaj link do"
|
225 |
+
|
226 |
+
#: ../includes/class-settings.php:88
|
227 |
+
msgid "plugin page"
|
228 |
+
msgstr "strony wtyczki"
|
229 |
+
|
230 |
+
#: ../includes/class-settings.php:89
|
231 |
+
msgid "Check out our other"
|
232 |
+
msgstr "Sprawdź nasze inne"
|
233 |
+
|
234 |
+
#: ../includes/class-settings.php:89
|
235 |
+
msgid "WordPress plugins"
|
236 |
+
msgstr "wtyczki do WordPressa"
|
237 |
+
|
238 |
+
#: ../includes/class-settings.php:114
|
239 |
+
msgid "Reset to defaults"
|
240 |
+
msgstr "Resetuj do domyślnych"
|
241 |
+
|
242 |
+
#: ../includes/class-settings.php:132
|
243 |
+
msgid "Math Captcha settings"
|
244 |
+
msgstr "Ustawienia Math Captcha"
|
245 |
+
|
246 |
+
#: ../includes/class-settings.php:133
|
247 |
+
msgid "Enable Math Captcha for"
|
248 |
+
msgstr "Włącz captcha dla"
|
249 |
+
|
250 |
+
#: ../includes/class-settings.php:134
|
251 |
+
msgid "Hide for logged in users"
|
252 |
+
msgstr "Ukryj dla zalogowanych"
|
253 |
+
|
254 |
+
#: ../includes/class-settings.php:135
|
255 |
+
msgid "Mathematical operations"
|
256 |
+
msgstr "Operacje matematyczne"
|
257 |
+
|
258 |
+
#: ../includes/class-settings.php:136
|
259 |
+
msgid "Display captcha as"
|
260 |
+
msgstr "Wyświetlaj captcha jako"
|
261 |
+
|
262 |
+
#: ../includes/class-settings.php:137
|
263 |
+
msgid "Captcha field title"
|
264 |
+
msgstr "Tytuł pola captcha"
|
265 |
+
|
266 |
+
#: ../includes/class-settings.php:138
|
267 |
+
msgid "Captcha time"
|
268 |
+
msgstr "Czas captcha"
|
269 |
+
|
270 |
+
#: ../includes/class-settings.php:139
|
271 |
+
msgid "Block Direct Comments"
|
272 |
+
msgstr "Blokowanie bezpośrednich komentarzy"
|
273 |
+
|
274 |
+
#: ../includes/class-settings.php:140
|
275 |
+
msgid "Deactivation"
|
276 |
+
msgstr "Deaktywacja wtyczki"
|
277 |
+
|
278 |
+
#: ../includes/class-settings.php:161
|
279 |
+
msgid "Select where you'd like to use Math Captcha."
|
280 |
+
msgstr "Wybierz w których miejscach chcesz używać Math Captcha."
|
281 |
+
|
282 |
+
#: ../includes/class-settings.php:175
|
283 |
+
msgid "Enable to hide captcha for logged in users."
|
284 |
+
msgstr "Włącz aby ukryć captcha dla zalogowanych użytkowników."
|
285 |
+
|
286 |
+
#: ../includes/class-settings.php:198
|
287 |
+
msgid "Select which mathematical operations to use in your captcha."
|
288 |
+
msgstr ""
|
289 |
+
"Wybierz jakie rodzaje operacji matematycznych będą stosowane w captcha."
|
290 |
+
|
291 |
+
#: ../includes/class-settings.php:221
|
292 |
+
msgid "Select how you'd like to display you captcha."
|
293 |
+
msgstr "Wybierz w jaki sposób chcesz wyświetlać captcha."
|
294 |
+
|
295 |
+
#: ../includes/class-settings.php:237
|
296 |
+
msgid "How to entitle field with captcha?"
|
297 |
+
msgstr "Jaki tytuł będzie miało pole z captcha?"
|
298 |
+
|
299 |
+
#: ../includes/class-settings.php:253
|
300 |
+
msgid "Enter the time (in seconds) a user has to enter captcha value."
|
301 |
+
msgstr "Podaj czas (w sekundach) w jakim należy uzupełnić pole captcha."
|
302 |
+
|
303 |
+
#: ../includes/class-settings.php:267
|
304 |
+
msgid ""
|
305 |
+
"Blocks direct access to wp-comments-post.php. Enable this to prevent "
|
306 |
+
"spambots from posting to Wordpress via a URL."
|
307 |
+
msgstr ""
|
308 |
+
"To ustawienie blokuje bezpośredni dostęp do pliku wp-comments-post.php. "
|
309 |
+
"Włącz to jeśli chcesz uniemożliwiść spambotom dodawanie komentarzy poprzez "
|
310 |
+
"URL."
|
311 |
+
|
312 |
+
#: ../includes/class-settings.php:281
|
313 |
+
msgid "Delete settings on plugin deactivation."
|
314 |
+
msgstr "Usuń wszystkie dane wtyczki podczas deaktywacji."
|
315 |
+
|
316 |
+
#: ../includes/class-settings.php:325
|
317 |
+
msgid ""
|
318 |
+
"You need to check at least one mathematical operation. Defaults settings of "
|
319 |
+
"this option restored."
|
320 |
+
msgstr ""
|
321 |
+
"Musisz wybrać przynajmniej jedną operację. Przywrócono domyślne ustawienie "
|
322 |
+
"tej opcji."
|
323 |
+
|
324 |
+
#: ../includes/class-settings.php:344
|
325 |
+
msgid ""
|
326 |
+
"You need to check at least one group. Defaults settings of this option "
|
327 |
+
"restored."
|
328 |
+
msgstr ""
|
329 |
+
"Musisz wybrać przynajmniej jedną grupę. Przywrócono domyślne ustawienie tej "
|
330 |
+
"opcji."
|
331 |
+
|
332 |
+
#: ../includes/class-settings.php:381
|
333 |
+
msgid "Settings restored to defaults."
|
334 |
+
msgstr "Ustawienia zostały przywrócone do domyślnych."
|
335 |
+
|
336 |
+
#: ../includes/integration-cf7.php:151
|
337 |
+
msgid "Name"
|
338 |
+
msgstr "Nazwa"
|
339 |
+
|
340 |
+
#: ../includes/integration-cf7.php:157
|
341 |
+
msgid "Input field settings"
|
342 |
+
msgstr "Ustawienia pola"
|
343 |
+
|
344 |
+
#: ../includes/integration-cf7.php:160 ../includes/integration-cf7.php:164
|
345 |
+
msgid "optional"
|
346 |
+
msgstr "opcjonalne"
|
347 |
+
|
348 |
+
#: ../includes/integration-cf7.php:170
|
349 |
+
msgid "Copy this code and paste it into the form left."
|
350 |
+
msgstr "Skopij i wkej ten kod do formularza po lewej."
|
351 |
+
|
352 |
+
#: ../wp-math-captcha.php:167
|
353 |
+
msgid "Are you sure you want to reset these settings to defaults?"
|
354 |
+
msgstr "Jesteś pewny, że chcesz przywrócić te ustawienia do domyślnych?"
|
355 |
+
|
356 |
+
#: ../wp-math-captcha.php:202
|
357 |
+
msgid "Support"
|
358 |
+
msgstr "Forum pomocy"
|
359 |
+
|
360 |
+
#: ../wp-math-captcha.php:224
|
361 |
+
msgid "Settings"
|
362 |
+
msgstr "Ustawienia"
|
363 |
+
|
364 |
+
#~ msgid "yes"
|
365 |
+
#~ msgstr "tak"
|
366 |
+
|
367 |
+
#~ msgid "no"
|
368 |
+
#~ msgstr "nie"
|
369 |
+
|
370 |
+
#~ msgid ""
|
371 |
+
#~ "Select what kind of mathematical operations will be used to generate "
|
372 |
+
#~ "captcha."
|
373 |
+
#~ msgstr ""
|
374 |
+
#~ "Wybierz jakie rodzaje operacji matematycznych będą stosowane w captcha."
|
375 |
+
|
376 |
+
#~ msgid "Created by"
|
377 |
+
#~ msgstr "Stworzone przez"
|
378 |
+
|
379 |
+
#~ msgid "form top"
|
380 |
+
#~ msgstr "na górze formularza"
|
381 |
+
|
382 |
+
#~ msgid "before form fields"
|
383 |
+
#~ msgstr "przed polami formularza"
|
384 |
+
|
385 |
+
#~ msgid "form bottom"
|
386 |
+
#~ msgstr "na dole formularza"
|
387 |
+
|
388 |
+
#~ msgid "after form"
|
389 |
+
#~ msgstr "po formularzu"
|
390 |
+
|
391 |
+
#~ msgid "WordPress default"
|
392 |
+
#~ msgstr "Domyślny WordPressa"
|
393 |
+
|
394 |
+
#~ msgid "Bootstrap"
|
395 |
+
#~ msgstr "Bootstrap"
|
396 |
+
|
397 |
+
#~ msgid "do not hide"
|
398 |
+
#~ msgstr "nie ukrywaj"
|
399 |
+
|
400 |
+
#~ msgid "1 second"
|
401 |
+
#~ msgstr "1 sekunda"
|
402 |
+
|
403 |
+
#~ msgid "2 seconds"
|
404 |
+
#~ msgstr "2 sekundy"
|
405 |
+
|
406 |
+
#~ msgid "3 seconds"
|
407 |
+
#~ msgstr "3 sekundy"
|
408 |
+
|
409 |
+
#~ msgid "5 seconds"
|
410 |
+
#~ msgstr "5 sekund"
|
411 |
+
|
412 |
+
#~ msgid "10 seconds"
|
413 |
+
#~ msgstr "10 sekund"
|
414 |
+
|
415 |
+
#~ msgid "fade"
|
416 |
+
#~ msgstr "zanikanie"
|
417 |
+
|
418 |
+
#~ msgid "slide"
|
419 |
+
#~ msgstr "zjeżdżanie"
|
420 |
+
|
421 |
+
#~ msgid "approved"
|
422 |
+
#~ msgstr "zatwierdzone"
|
423 |
+
|
424 |
+
#~ msgid "unapproved"
|
425 |
+
#~ msgstr "niezatwierdzone"
|
426 |
+
|
427 |
+
#~ msgid "trash"
|
428 |
+
#~ msgstr "w koszu"
|
429 |
+
|
430 |
+
#~ msgid "spam"
|
431 |
+
#~ msgstr "spam"
|
432 |
+
|
433 |
+
#~ msgid "Inline Edit"
|
434 |
+
#~ msgstr "Edycja"
|
435 |
+
|
436 |
+
#~ msgid "Messages"
|
437 |
+
#~ msgstr "Komunikaty"
|
438 |
+
|
439 |
+
#~ msgid "Edit"
|
440 |
+
#~ msgstr "Edytuj"
|
441 |
+
|
442 |
+
#~ msgid "Save"
|
443 |
+
#~ msgstr "Zapisz"
|
444 |
+
|
445 |
+
#~ msgid "Cancel"
|
446 |
+
#~ msgstr "Anuluj"
|
447 |
+
|
448 |
+
#~ msgid "Time remaining"
|
449 |
+
#~ msgstr "Pozostały czas"
|
450 |
+
|
451 |
+
#~ msgid "Delete"
|
452 |
+
#~ msgstr "Usuń"
|
453 |
+
|
454 |
+
#~ msgid "Unapprove"
|
455 |
+
#~ msgstr "Odrzuć"
|
456 |
+
|
457 |
+
#~ msgid "Spam"
|
458 |
+
#~ msgstr "Oznacz jako spam"
|
459 |
+
|
460 |
+
#~ msgid "Trash"
|
461 |
+
#~ msgstr "Kosz"
|
462 |
+
|
463 |
+
#~ msgid "Approve"
|
464 |
+
#~ msgstr "Zatwierdź"
|
465 |
+
|
466 |
+
#~ msgid "Restore"
|
467 |
+
#~ msgstr "Przywróć"
|
468 |
+
|
469 |
+
#~ msgid "Unspam"
|
470 |
+
#~ msgstr "Odznacz spam"
|
471 |
+
|
472 |
+
#~ msgid "Comments statuses"
|
473 |
+
#~ msgstr "Statusy komentarzy"
|
474 |
+
|
475 |
+
#~ msgid "Comment Edit Timer"
|
476 |
+
#~ msgstr "Edycja komentarza"
|
477 |
+
|
478 |
+
#~ msgid "Editing time"
|
479 |
+
#~ msgstr "Czas edycji"
|
480 |
+
|
481 |
+
#~ msgid "Delete permanently button"
|
482 |
+
#~ msgstr "Przycisk Usuń"
|
483 |
+
|
484 |
+
#~ msgid "Edit comment effect"
|
485 |
+
#~ msgstr "Efekt przy edycji komentarza"
|
486 |
+
|
487 |
+
#~ msgid "CSS style"
|
488 |
+
#~ msgstr "Styl CSS"
|
489 |
+
|
490 |
+
#~ msgid "Show on hover"
|
491 |
+
#~ msgstr "Pokaż po najechaniu"
|
492 |
+
|
493 |
+
#~ msgid "Highlight comments"
|
494 |
+
#~ msgstr "Podświetlanie komentarzy"
|
495 |
+
|
496 |
+
#~ msgid "Highlight colors"
|
497 |
+
#~ msgstr "Kolory podświetlenia"
|
498 |
+
|
499 |
+
#~ msgid "Messages Settings"
|
500 |
+
#~ msgstr "Ustawienia komunikatów"
|
501 |
+
|
502 |
+
#~ msgid "Message box position for logged in users"
|
503 |
+
#~ msgstr "Pozycja pola z komunikatami dla zalogowanych użytkowników"
|
504 |
+
|
505 |
+
#~ msgid "Message box position for logged out users"
|
506 |
+
#~ msgstr "Pozycja pola z komunikatami dla niezalogowanych użytkowników"
|
507 |
+
|
508 |
+
#~ msgid "Show message effect"
|
509 |
+
#~ msgstr "Efekt wyświetlania komunikatów"
|
510 |
+
|
511 |
+
#~ msgid "Hide message effect"
|
512 |
+
#~ msgstr "Efekt ukrywania komunikatów"
|
513 |
+
|
514 |
+
#~ msgid "Hide message after"
|
515 |
+
#~ msgstr "Ukrywanie komunikatów po"
|
516 |
+
|
517 |
+
#~ msgid ""
|
518 |
+
#~ "Comment timer allows users to edit their comments for specified time."
|
519 |
+
#~ msgstr ""
|
520 |
+
#~ "Stoper komentarza pozwala użytkownikom na edycję ich komentarzy przez "
|
521 |
+
#~ "określony czas."
|
522 |
+
|
523 |
+
#~ msgid "How much time (in minutes) a user has to edit a published comment"
|
524 |
+
#~ msgstr ""
|
525 |
+
#~ "Jak długo (w minutach) użtkownik może edytować opublikowany komentarz"
|
526 |
+
|
527 |
+
#~ msgid "Pick highlight colors for specific comment statuses"
|
528 |
+
#~ msgstr "Wybierz kolory podświetlenia określonych statusów komentarzy"
|
529 |
+
|
530 |
+
#~ msgid "Highlight comments with specific colors"
|
531 |
+
#~ msgstr "Podświetl komentarze określonym kolorem"
|
532 |
+
|
533 |
+
#~ msgid "Show inline edit actions only on hovering over a comment"
|
534 |
+
#~ msgstr "Wyświetl przyciski tylko po najechaniu myszką na komentarz"
|
535 |
+
|
536 |
+
#~ msgid ""
|
537 |
+
#~ "Select comments of which statuses will be available for moderation on the "
|
538 |
+
#~ "front-end of your site"
|
539 |
+
#~ msgstr ""
|
540 |
+
#~ "Wybierz statusy komentarzy, które będą dostępne do moderacji na stronie"
|
541 |
+
|
542 |
+
#~ msgid ""
|
543 |
+
#~ "This will add Delete to edit buttons that allows you to permanently "
|
544 |
+
#~ "delete comments"
|
545 |
+
#~ msgstr ""
|
546 |
+
#~ "Zostanie dodany przycisk Usuń do przycików edycji, który umożliwia trwałe "
|
547 |
+
#~ "usunięcie komentarzy"
|
548 |
+
|
549 |
+
#~ msgid "Select animation for showing messages"
|
550 |
+
#~ msgstr "Wybierz animację przy wyświetlaniu komunikatów"
|
551 |
+
|
552 |
+
#~ msgid "Select animation for hiding messages"
|
553 |
+
#~ msgstr "Wybierz animację przy ukrywaniu komunikatów"
|
554 |
+
|
555 |
+
#~ msgid "Select animation effect for edit comment"
|
556 |
+
#~ msgstr "Wybierz animację przy edycji komentarza"
|
557 |
+
|
558 |
+
#~ msgid "Choose your message box style"
|
559 |
+
#~ msgstr "Wybierz styl dla pola z komunikatami"
|
560 |
+
|
561 |
+
#~ msgid "Select style for Inline Edit buttons"
|
562 |
+
#~ msgstr "Wybierz styl dla przycisków edycji"
|
563 |
+
|
564 |
+
#~ msgid "Select for how long message box should be displayed"
|
565 |
+
#~ msgstr "Wybierz przez jaki czas ma być wyświetlany komunikat"
|
566 |
+
|
567 |
+
#~ msgid "Select message box position for logged in users"
|
568 |
+
#~ msgstr "Wybierz pozycję pola z komunikatami dla zalogowanych użytkowników"
|
569 |
+
|
570 |
+
#~ msgid "Select message box position for logged out users"
|
571 |
+
#~ msgstr ""
|
572 |
+
#~ "Wybierz pozycję pola z komunikatami dla niezalogowanych użytkowników"
|
573 |
+
|
574 |
+
#~ msgid "Ajaxed Comments"
|
575 |
+
#~ msgstr "Komentarze Ajax"
|
576 |
+
|
577 |
+
#~ msgid "Ajaxed Comments Settings"
|
578 |
+
#~ msgstr "Ustawienia komentarzy Ajax"
|
579 |
+
|
580 |
+
#~ msgid "Error has occurred. Please try again later or reload a page."
|
581 |
+
#~ msgstr ""
|
582 |
+
#~ "Wystąpił nieznany błąd. Proszę spróbować później lub odświeżyć stronę."
|
583 |
+
|
584 |
+
#~ msgid "Comment is empty."
|
585 |
+
#~ msgstr "Komentarz jest pusty."
|
586 |
+
|
587 |
+
#~ msgid "Unknown error has occurred."
|
588 |
+
#~ msgstr "Wystąpił nieznany błąd."
|
589 |
+
|
590 |
+
#~ msgid "Widgets"
|
591 |
+
#~ msgstr "Widgety"
|
592 |
+
|
593 |
+
#~ msgid "Custom Post Types"
|
594 |
+
#~ msgstr "Własne typy wpisów"
|
595 |
+
|
596 |
+
#~ msgid "Custom Post Type Archives"
|
597 |
+
#~ msgstr "Archiwa własnych typów wpisów"
|
598 |
+
|
599 |
+
#~ msgid "Categories"
|
600 |
+
#~ msgstr "Kategorie"
|
601 |
+
|
602 |
+
#~ msgid "Taxonomies"
|
603 |
+
#~ msgstr "Taksonomie"
|
604 |
+
|
605 |
+
#~ msgid "Others"
|
606 |
+
#~ msgstr "Inne"
|
607 |
+
|
608 |
+
#~ msgid "Users"
|
609 |
+
#~ msgstr "Użytkownicy"
|
610 |
+
|
611 |
+
#~ msgid "Languages"
|
612 |
+
#~ msgstr "Języki"
|
613 |
+
|
614 |
+
#~ msgid "Front Page"
|
615 |
+
#~ msgstr "Strona główna"
|
616 |
+
|
617 |
+
#~ msgid "Blog Page"
|
618 |
+
#~ msgstr "Strona z wpisami"
|
619 |
+
|
620 |
+
#~ msgid "Single Posts"
|
621 |
+
#~ msgstr "Pojedyncze wpisy"
|
622 |
+
|
623 |
+
#~ msgid "Sticky Posts"
|
624 |
+
#~ msgstr "Wpisy przyklejone"
|
625 |
+
|
626 |
+
#~ msgid "Author Archive"
|
627 |
+
#~ msgstr "Archiwum autora"
|
628 |
+
|
629 |
+
#~ msgid "Date Archive"
|
630 |
+
#~ msgstr "Archiwum daty"
|
631 |
+
|
632 |
+
#~ msgid "404 Page"
|
633 |
+
#~ msgstr "Strona błędów 404"
|
634 |
+
|
635 |
+
#~ msgid "Search Page"
|
636 |
+
#~ msgstr "Strona wyszukiwania"
|
637 |
+
|
638 |
+
#~ msgid "Logged out users"
|
639 |
+
#~ msgstr "Wylogowani użytkownicy"
|
640 |
+
|
641 |
+
#~ msgid "Restrict widgets"
|
642 |
+
#~ msgstr "Ograniczenia widgetów"
|
643 |
+
|
644 |
+
#~ msgid ""
|
645 |
+
#~ "Use this settings to manage access to widgets page and to restrict "
|
646 |
+
#~ "availability of certain widgets, sidebars and widgets options to site "
|
647 |
+
#~ "administrators only."
|
648 |
+
#~ msgstr ""
|
649 |
+
#~ "Użyj tych ustawień aby określić kto może mieć dostęp do widgetów, jakie "
|
650 |
+
#~ "widgety, panele boczne i ustawienia widgetów są dostępne dla użytkowników "
|
651 |
+
#~ "a jakie tylko dla administratorów."
|
652 |
+
|
653 |
+
#~ msgid "Restrict Users"
|
654 |
+
#~ msgstr "Ograniczenia użytkowników"
|
655 |
+
|
656 |
+
#~ msgid "Select user roles restricted to manage widgets."
|
657 |
+
#~ msgstr "Wybierz role użytkowników, którzy mogą zarządzać widgetami."
|
658 |
+
|
659 |
+
#~ msgid "Restrict Sidebars"
|
660 |
+
#~ msgstr "Ograniczenia paneli bocznych"
|
661 |
+
|
662 |
+
#~ msgid "Select which sidebars will be restricted to admins only."
|
663 |
+
#~ msgstr ""
|
664 |
+
#~ "Wybierz panele boczne, które będą dostępne tylko dla administratorów."
|
665 |
+
|
666 |
+
#~ msgid "Restrict Widgets"
|
667 |
+
#~ msgstr "Ograniczenia widgetów"
|
668 |
+
|
669 |
+
#~ msgid "Select which widgets will be restricted to admins only."
|
670 |
+
#~ msgstr "Wybierz widgety, któe będą dostępne tylko dla administratorów."
|
671 |
+
|
672 |
+
#~ msgid "Restrict Widget Options"
|
673 |
+
#~ msgstr "Ograniczenia opcji widgetów"
|
674 |
+
|
675 |
+
#~ msgid "Select which widget options will be restricted to admins only."
|
676 |
+
#~ msgstr ""
|
677 |
+
#~ "Wybierz które opcje widgetów, będą dostępne tylko dla administratorów."
|
678 |
+
|
679 |
+
#~ msgid "Restrict Option Groups"
|
680 |
+
#~ msgstr "Ograniczenia grup opcji"
|
681 |
+
|
682 |
+
#~ msgid "Display widget options in groups"
|
683 |
+
#~ msgstr "Wyświetl opcje widgetów w grupach"
|
684 |
+
|
685 |
+
#~ msgid "Single %s"
|
686 |
+
#~ msgstr "Pojedyncze %s"
|
687 |
+
|
688 |
+
#~ msgid "%s Archive"
|
689 |
+
#~ msgstr "Archiwum %s"
|
690 |
+
|
691 |
+
#~ msgid "Display / Hide Widget"
|
692 |
+
#~ msgstr "Wyświetl / Ukryj widget"
|
693 |
+
|
694 |
+
#~ msgid "Display widget on selected"
|
695 |
+
#~ msgstr "Wyświetl widget na wybranych stronach"
|
696 |
+
|
697 |
+
#~ msgid "Hide widget on selected"
|
698 |
+
#~ msgstr "Ukryj widget na wybranych stronach"
|
languages/math-captcha.pot
CHANGED
@@ -1,340 +1,354 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Math Captcha\n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date:
|
6 |
-
"Last-Translator: Bartosz Arendt <info@
|
7 |
"Language-Team: dFactory <info@dfactory.eu>\n"
|
8 |
-
"Language:
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 1.
|
13 |
"X-Poedit-KeywordsList: gettext;gettext_noop;__;_e\n"
|
14 |
"X-Poedit-Basepath: .\n"
|
15 |
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
"X-Poedit-SearchPath-0: ..\n"
|
17 |
|
18 |
-
#: ../
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
msgid "one"
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: ../
|
23 |
msgid "two"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: ../
|
27 |
msgid "three"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: ../
|
31 |
msgid "four"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: ../
|
35 |
msgid "five"
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: ../
|
39 |
msgid "six"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: ../
|
43 |
msgid "seven"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: ../
|
47 |
msgid "eight"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: ../
|
51 |
msgid "nine"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: ../
|
55 |
msgid "ten"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: ../
|
59 |
msgid "eleven"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: ../
|
63 |
msgid "twelve"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: ../
|
67 |
msgid "thirteen"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: ../
|
71 |
msgid "fourteen"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: ../
|
75 |
msgid "fifteen"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: ../
|
79 |
msgid "sixteen"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: ../
|
83 |
msgid "seventeen"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: ../
|
87 |
msgid "eighteen"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: ../
|
91 |
msgid "nineteen"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: ../
|
95 |
msgid "twenty"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: ../
|
99 |
msgid "thirty"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: ../
|
103 |
msgid "forty"
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: ../
|
107 |
msgid "fifty"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: ../
|
111 |
msgid "sixty"
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: ../
|
115 |
msgid "seventy"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: ../
|
119 |
msgid "eighty"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: ../
|
123 |
msgid "ninety"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: ../
|
127 |
-
#: ../wp-math-captcha.php:816
|
128 |
-
msgid "ERROR"
|
129 |
-
msgstr ""
|
130 |
-
|
131 |
-
#: ../wp-math-captcha.php:814 ../includes/math-captcha-cf7.php:113
|
132 |
-
msgid "Please enter captcha value."
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
#: ../wp-math-captcha.php:815 ../includes/math-captcha-cf7.php:109
|
136 |
-
msgid "Invalid captcha value."
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
#: ../wp-math-captcha.php:816 ../includes/math-captcha-cf7.php:117
|
140 |
-
msgid "Captcha time expired."
|
141 |
-
msgstr ""
|
142 |
-
|
143 |
-
#: ../wp-math-captcha.php:820
|
144 |
msgid "login form"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: ../
|
148 |
msgid "registration form"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: ../
|
152 |
msgid "reset password form"
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: ../
|
156 |
msgid "comment form"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#: ../
|
160 |
msgid "bbpress"
|
161 |
msgstr ""
|
162 |
|
163 |
-
#: ../
|
164 |
msgid "contact form 7"
|
165 |
msgstr ""
|
166 |
|
167 |
-
#: ../
|
168 |
-
msgid "yes"
|
169 |
-
msgstr ""
|
170 |
-
|
171 |
-
#: ../wp-math-captcha.php:830
|
172 |
-
msgid "no"
|
173 |
-
msgstr ""
|
174 |
-
|
175 |
-
#: ../wp-math-captcha.php:834
|
176 |
msgid "addition (+)"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#: ../
|
180 |
msgid "subtraction (-)"
|
181 |
msgstr ""
|
182 |
|
183 |
-
#: ../
|
184 |
msgid "multiplication (×)"
|
185 |
msgstr ""
|
186 |
|
187 |
-
#: ../
|
188 |
msgid "division (÷)"
|
189 |
msgstr ""
|
190 |
|
191 |
-
#: ../
|
192 |
msgid "numbers"
|
193 |
msgstr ""
|
194 |
|
195 |
-
#: ../
|
196 |
msgid "words"
|
197 |
msgstr ""
|
198 |
|
199 |
-
#: ../
|
200 |
-
|
|
|
|
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: ../
|
204 |
-
msgid "
|
205 |
msgstr ""
|
206 |
|
207 |
-
#: ../
|
208 |
-
msgid "
|
|
|
209 |
msgstr ""
|
210 |
|
211 |
-
#: ../
|
212 |
-
msgid "
|
213 |
msgstr ""
|
214 |
|
215 |
-
#: ../
|
216 |
-
msgid "
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: ../
|
220 |
-
msgid "
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: ../
|
224 |
-
msgid "
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: ../
|
228 |
-
msgid "
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: ../
|
232 |
-
msgid "
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: ../
|
236 |
-
msgid "
|
237 |
msgstr ""
|
238 |
|
239 |
-
#: ../
|
240 |
-
msgid "
|
241 |
msgstr ""
|
242 |
|
243 |
-
#: ../
|
244 |
-
msgid "
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: ../
|
248 |
-
msgid "
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: ../
|
252 |
-
msgid "
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: ../
|
256 |
-
msgid "
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: ../
|
260 |
-
msgid ""
|
261 |
-
"You need to check at least one mathematical operation. Defaults settings of "
|
262 |
-
"this option restored."
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: ../
|
266 |
-
msgid ""
|
267 |
-
"You need to check at least one group. Defaults settings of this option "
|
268 |
-
"restored."
|
269 |
msgstr ""
|
270 |
|
271 |
-
#: ../
|
272 |
-
|
273 |
-
#: ../includes/math-captcha-cf7.php:148
|
274 |
-
msgid "Math Captcha"
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: ../
|
278 |
-
msgid "
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: ../
|
282 |
-
msgid ""
|
283 |
-
"If you are having problems with this plugin, please talk about them in the"
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: ../
|
287 |
-
msgid "
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: ../
|
291 |
-
msgid "
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: ../
|
295 |
-
msgid "
|
296 |
msgstr ""
|
297 |
|
298 |
-
#: ../
|
299 |
-
msgid "
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: ../
|
303 |
-
msgid "
|
304 |
msgstr ""
|
305 |
|
306 |
-
#: ../
|
307 |
-
msgid "
|
308 |
msgstr ""
|
309 |
|
310 |
-
#: ../
|
311 |
-
msgid "
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: ../
|
315 |
-
msgid "
|
|
|
|
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: ../
|
319 |
-
msgid "
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: ../
|
323 |
-
msgid "
|
|
|
|
|
324 |
msgstr ""
|
325 |
|
326 |
-
#: ../includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
msgid "Name"
|
328 |
msgstr ""
|
329 |
|
330 |
-
#: ../includes/
|
331 |
msgid "Input field settings"
|
332 |
msgstr ""
|
333 |
|
334 |
-
#: ../includes/
|
335 |
msgid "optional"
|
336 |
msgstr ""
|
337 |
|
338 |
-
#: ../includes/
|
339 |
msgid "Copy this code and paste it into the form left."
|
340 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Math Captcha\n"
|
4 |
+
"POT-Creation-Date: 2014-09-05 17:19+0100\n"
|
5 |
+
"PO-Revision-Date: 2014-09-05 17:19+0100\n"
|
6 |
+
"Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
|
7 |
"Language-Team: dFactory <info@dfactory.eu>\n"
|
8 |
+
"Language: en\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.6.9\n"
|
13 |
"X-Poedit-KeywordsList: gettext;gettext_noop;__;_e\n"
|
14 |
"X-Poedit-Basepath: .\n"
|
15 |
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
"X-Poedit-SearchPath-0: ..\n"
|
17 |
|
18 |
+
#: ../includes/class-core.php:39 ../includes/class-core.php:40
|
19 |
+
#: ../includes/class-core.php:41
|
20 |
+
msgid "ERROR"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: ../includes/class-core.php:39 ../includes/integration-cf7.php:104
|
24 |
+
msgid "Please enter captcha value."
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: ../includes/class-core.php:40 ../includes/integration-cf7.php:100
|
28 |
+
msgid "Invalid captcha value."
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: ../includes/class-core.php:41 ../includes/integration-cf7.php:108
|
32 |
+
msgid "Captcha time expired."
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: ../includes/class-core.php:428
|
36 |
msgid "one"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: ../includes/class-core.php:429
|
40 |
msgid "two"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: ../includes/class-core.php:430
|
44 |
msgid "three"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: ../includes/class-core.php:431
|
48 |
msgid "four"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: ../includes/class-core.php:432
|
52 |
msgid "five"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: ../includes/class-core.php:433
|
56 |
msgid "six"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: ../includes/class-core.php:434
|
60 |
msgid "seven"
|
61 |
msgstr ""
|
62 |
|
63 |
+
#: ../includes/class-core.php:435
|
64 |
msgid "eight"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: ../includes/class-core.php:436
|
68 |
msgid "nine"
|
69 |
msgstr ""
|
70 |
|
71 |
+
#: ../includes/class-core.php:437
|
72 |
msgid "ten"
|
73 |
msgstr ""
|
74 |
|
75 |
+
#: ../includes/class-core.php:438
|
76 |
msgid "eleven"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: ../includes/class-core.php:439
|
80 |
msgid "twelve"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: ../includes/class-core.php:440
|
84 |
msgid "thirteen"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: ../includes/class-core.php:441
|
88 |
msgid "fourteen"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: ../includes/class-core.php:442
|
92 |
msgid "fifteen"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: ../includes/class-core.php:443
|
96 |
msgid "sixteen"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: ../includes/class-core.php:444
|
100 |
msgid "seventeen"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: ../includes/class-core.php:445
|
104 |
msgid "eighteen"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: ../includes/class-core.php:446
|
108 |
msgid "nineteen"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: ../includes/class-core.php:447
|
112 |
msgid "twenty"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: ../includes/class-core.php:448
|
116 |
msgid "thirty"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: ../includes/class-core.php:449
|
120 |
msgid "forty"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: ../includes/class-core.php:450
|
124 |
msgid "fifty"
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: ../includes/class-core.php:451
|
128 |
msgid "sixty"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: ../includes/class-core.php:452
|
132 |
msgid "seventy"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: ../includes/class-core.php:453
|
136 |
msgid "eighty"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: ../includes/class-core.php:454
|
140 |
msgid "ninety"
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: ../includes/class-settings.php:34
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
msgid "login form"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: ../includes/class-settings.php:35
|
148 |
msgid "registration form"
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: ../includes/class-settings.php:36
|
152 |
msgid "reset password form"
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: ../includes/class-settings.php:37
|
156 |
msgid "comment form"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: ../includes/class-settings.php:38
|
160 |
msgid "bbpress"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: ../includes/class-settings.php:39
|
164 |
msgid "contact form 7"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: ../includes/class-settings.php:43
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
msgid "addition (+)"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: ../includes/class-settings.php:44
|
172 |
msgid "subtraction (-)"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: ../includes/class-settings.php:45
|
176 |
msgid "multiplication (×)"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: ../includes/class-settings.php:46
|
180 |
msgid "division (÷)"
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: ../includes/class-settings.php:50
|
184 |
msgid "numbers"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: ../includes/class-settings.php:51
|
188 |
msgid "words"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: ../includes/class-settings.php:62 ../includes/class-settings.php:63
|
192 |
+
#: ../includes/class-settings.php:78 ../includes/class-settings.php:81
|
193 |
+
#: ../includes/integration-cf7.php:139
|
194 |
+
msgid "Math Captcha"
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: ../includes/class-settings.php:83
|
198 |
+
msgid "Need support?"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: ../includes/class-settings.php:84
|
202 |
+
msgid ""
|
203 |
+
"If you are having problems with this plugin, please talk about them in the"
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: ../includes/class-settings.php:84
|
207 |
+
msgid "Support forum"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: ../includes/class-settings.php:86
|
211 |
+
msgid "Do you like this plugin?"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: ../includes/class-settings.php:87
|
215 |
+
msgid "Rate it 5"
|
216 |
msgstr ""
|
217 |
|
218 |
+
#: ../includes/class-settings.php:87
|
219 |
+
msgid "on WordPress.org"
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: ../includes/class-settings.php:88
|
223 |
+
msgid "Blog about it & link to the"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: ../includes/class-settings.php:88
|
227 |
+
msgid "plugin page"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: ../includes/class-settings.php:89
|
231 |
+
msgid "Check out our other"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: ../includes/class-settings.php:89
|
235 |
+
msgid "WordPress plugins"
|
236 |
msgstr ""
|
237 |
|
238 |
+
#: ../includes/class-settings.php:114
|
239 |
+
msgid "Reset to defaults"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: ../includes/class-settings.php:132
|
243 |
+
msgid "Math Captcha settings"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: ../includes/class-settings.php:133
|
247 |
+
msgid "Enable Math Captcha for"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: ../includes/class-settings.php:134
|
251 |
+
msgid "Hide for logged in users"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: ../includes/class-settings.php:135
|
255 |
+
msgid "Mathematical operations"
|
|
|
|
|
256 |
msgstr ""
|
257 |
|
258 |
+
#: ../includes/class-settings.php:136
|
259 |
+
msgid "Display captcha as"
|
|
|
|
|
260 |
msgstr ""
|
261 |
|
262 |
+
#: ../includes/class-settings.php:137
|
263 |
+
msgid "Captcha field title"
|
|
|
|
|
264 |
msgstr ""
|
265 |
|
266 |
+
#: ../includes/class-settings.php:138
|
267 |
+
msgid "Captcha time"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: ../includes/class-settings.php:139
|
271 |
+
msgid "Block Direct Comments"
|
|
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: ../includes/class-settings.php:140
|
275 |
+
msgid "Deactivation"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: ../includes/class-settings.php:161
|
279 |
+
msgid "Select where you'd like to use Math Captcha."
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: ../includes/class-settings.php:175
|
283 |
+
msgid "Enable to hide captcha for logged in users."
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: ../includes/class-settings.php:198
|
287 |
+
msgid "Select which mathematical operations to use in your captcha."
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: ../includes/class-settings.php:221
|
291 |
+
msgid "Select how you'd like to display you captcha."
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: ../includes/class-settings.php:237
|
295 |
+
msgid "How to entitle field with captcha?"
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: ../includes/class-settings.php:253
|
299 |
+
msgid "Enter the time (in seconds) a user has to enter captcha value."
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: ../includes/class-settings.php:267
|
303 |
+
msgid ""
|
304 |
+
"Blocks direct access to wp-comments-post.php. Enable this to prevent "
|
305 |
+
"spambots from posting to Wordpress via a URL."
|
306 |
msgstr ""
|
307 |
|
308 |
+
#: ../includes/class-settings.php:281
|
309 |
+
msgid "Delete settings on plugin deactivation."
|
310 |
msgstr ""
|
311 |
|
312 |
+
#: ../includes/class-settings.php:325
|
313 |
+
msgid ""
|
314 |
+
"You need to check at least one mathematical operation. Defaults settings of "
|
315 |
+
"this option restored."
|
316 |
msgstr ""
|
317 |
|
318 |
+
#: ../includes/class-settings.php:344
|
319 |
+
msgid ""
|
320 |
+
"You need to check at least one group. Defaults settings of this option "
|
321 |
+
"restored."
|
322 |
+
msgstr ""
|
323 |
+
|
324 |
+
#: ../includes/class-settings.php:381
|
325 |
+
msgid "Settings restored to defaults."
|
326 |
+
msgstr ""
|
327 |
+
|
328 |
+
#: ../includes/integration-cf7.php:151
|
329 |
msgid "Name"
|
330 |
msgstr ""
|
331 |
|
332 |
+
#: ../includes/integration-cf7.php:157
|
333 |
msgid "Input field settings"
|
334 |
msgstr ""
|
335 |
|
336 |
+
#: ../includes/integration-cf7.php:160 ../includes/integration-cf7.php:164
|
337 |
msgid "optional"
|
338 |
msgstr ""
|
339 |
|
340 |
+
#: ../includes/integration-cf7.php:170
|
341 |
msgid "Copy this code and paste it into the form left."
|
342 |
msgstr ""
|
343 |
+
|
344 |
+
#: ../wp-math-captcha.php:167
|
345 |
+
msgid "Are you sure you want to reset these settings to defaults?"
|
346 |
+
msgstr ""
|
347 |
+
|
348 |
+
#: ../wp-math-captcha.php:202
|
349 |
+
msgid "Support"
|
350 |
+
msgstr ""
|
351 |
+
|
352 |
+
#: ../wp-math-captcha.php:224
|
353 |
+
msgid "Settings"
|
354 |
+
msgstr ""
|
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:
|
7 |
-
Stable tag: 1.
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
@@ -57,6 +57,12 @@ No questions yet.
|
|
57 |
|
58 |
== Changelog ==
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
= 1.1.1 =
|
61 |
* Tweak: UI improvements for WordPress 3.8
|
62 |
|
@@ -104,5 +110,7 @@ No questions yet.
|
|
104 |
|
105 |
== Upgrade Notice ==
|
106 |
|
107 |
-
= 1.
|
108 |
-
* Tweak:
|
|
|
|
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.0
|
7 |
+
Stable tag: 1.2.0
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
+
= 1.2.0 =
|
61 |
+
* Tweak: Added option to reset settings to defaults
|
62 |
+
* Tweak: Code rewritten to singleton design pattern
|
63 |
+
* Fix: Contact Form 7 compatibility issues
|
64 |
+
* New: Option to donate this plugin :)
|
65 |
+
|
66 |
= 1.1.1 =
|
67 |
* Tweak: UI improvements for WordPress 3.8
|
68 |
|
110 |
|
111 |
== Upgrade Notice ==
|
112 |
|
113 |
+
= 1.2.0 =
|
114 |
+
* Tweak: Added option to reset settings to defaults
|
115 |
+
* Tweak: Code rewritten to singleton design pattern
|
116 |
+
* Fix: Contact Form 7 compatibility issues
|
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.
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/math-captcha/
|
@@ -21,131 +21,91 @@ The above copyright notice and this permission notice shall be included in all c
|
|
21 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22 |
*/
|
23 |
|
24 |
-
if(!defined('ABSPATH')) exit; //exit if accessed directly
|
25 |
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
class Math_Captcha
|
29 |
{
|
30 |
-
private $
|
|
|
|
|
|
|
|
|
31 |
'general' => array(
|
32 |
'enable_for' => array(
|
33 |
-
'login_form' =>
|
34 |
-
'registration_form' =>
|
35 |
-
'reset_password_form' =>
|
36 |
-
'comment_form' =>
|
37 |
-
'bbpress' =>
|
38 |
-
'contact_form_7' =>
|
39 |
),
|
40 |
-
'block_direct_comments' =>
|
41 |
-
'hide_for_logged_users' =>
|
42 |
'title' => 'Math Captcha',
|
43 |
'mathematical_operations' => array(
|
44 |
-
'addition' =>
|
45 |
-
'subtraction' =>
|
46 |
-
'multiplication' =>
|
47 |
-
'division' =>
|
48 |
),
|
49 |
'groups' => array(
|
50 |
-
'numbers' =>
|
51 |
-
'words' =>
|
52 |
),
|
53 |
'time' => 300,
|
54 |
-
'deactivation_delete' =>
|
55 |
-
'flush_rules' =>
|
56 |
),
|
57 |
-
'version' => '1.
|
58 |
);
|
59 |
-
private $session_ids = array();
|
60 |
-
private $session_number = 0;
|
61 |
-
private $options = array();
|
62 |
-
private $choices = array();
|
63 |
-
private $enable_for = array();
|
64 |
-
private $mathematical_operations = array();
|
65 |
-
private $groups = array();
|
66 |
-
private $error_messages = array();
|
67 |
-
private $errors;
|
68 |
-
private $login_failed = FALSE;
|
69 |
|
70 |
|
71 |
-
public function
|
72 |
{
|
73 |
-
|
74 |
-
|
75 |
|
76 |
-
|
77 |
-
|
78 |
|
79 |
-
if(version_compare(($db_version === FALSE ? '1.0.0' : $db_version), '1.0.9', '<'))
|
80 |
-
{
|
81 |
-
if(($array = get_option('mc_options')) !== FALSE)
|
82 |
-
{
|
83 |
-
update_option('math_captcha_options', $array);
|
84 |
-
delete_option('mc_options');
|
85 |
-
}
|
86 |
-
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
$this->options['general'] = array_merge($this->defaults['general'], (($array = get_option('math_captcha_options')) === FALSE ? array() : $array));
|
92 |
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
add_action('plugins_loaded', array(&$this, 'load_textdomain'));
|
96 |
-
add_action('plugins_loaded', array(&$this, 'load_defaults'));
|
97 |
-
add_action('init', array(&$this, 'load_actions_filters'), 1);
|
98 |
-
add_action('admin_init', array(&$this, 'register_settings'));
|
99 |
-
add_action('admin_init', array(&$this, 'flush_rewrites'));
|
100 |
-
add_action('admin_menu', array(&$this, 'admin_menu_options'));
|
101 |
add_action('admin_enqueue_scripts', array(&$this, 'admin_comments_scripts_styles'));
|
102 |
-
add_action('wp_enqueue_scripts', array(&$this, '
|
103 |
-
add_action('login_enqueue_scripts', array(&$this, '
|
104 |
|
105 |
-
//filters
|
106 |
add_filter('plugin_action_links', array(&$this, 'plugin_settings_link'), 10, 2);
|
107 |
add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
|
108 |
-
add_filter('shake_error_codes', array(&$this, 'add_shake_error_codes'), 1);
|
109 |
-
add_filter('mod_rewrite_rules', array(&$this, 'block_direct_comments'));
|
110 |
-
}
|
111 |
-
|
112 |
-
|
113 |
-
public function block_direct_comments($rules)
|
114 |
-
{
|
115 |
-
if($this->options['general']['block_direct_comments'] === TRUE)
|
116 |
-
{
|
117 |
-
$new_rules =
|
118 |
-
<<<EOT
|
119 |
-
\n# BEGIN Math Captcha
|
120 |
-
<IfModule mod_rewrite.c>
|
121 |
-
RewriteEngine On
|
122 |
-
RewriteCond %{REQUEST_METHOD} POST
|
123 |
-
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
|
124 |
-
RewriteCond %{HTTP_REFERER} !.*{$_SERVER['HTTP_HOST']}.* [OR]
|
125 |
-
RewriteCond %{HTTP_USER_AGENT} ^$
|
126 |
-
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
|
127 |
-
</IfModule>
|
128 |
-
# END Math Captcha\n\n
|
129 |
-
EOT;
|
130 |
-
|
131 |
-
return $new_rules.$rules;
|
132 |
-
}
|
133 |
-
|
134 |
-
return $rules;
|
135 |
-
}
|
136 |
-
|
137 |
-
|
138 |
-
public function flush_rewrites()
|
139 |
-
{
|
140 |
-
if($this->options['general']['flush_rules'] === TRUE)
|
141 |
-
{
|
142 |
-
global $wp_rewrite;
|
143 |
-
|
144 |
-
$wp_rewrite->flush_rules();
|
145 |
-
|
146 |
-
$this->options['general']['flush_rules'] = FALSE;
|
147 |
-
update_option('math_captcha_options', $this->options['general']);
|
148 |
-
}
|
149 |
}
|
150 |
|
151 |
|
@@ -164,1157 +124,64 @@ EOT;
|
|
164 |
*/
|
165 |
public function deactivation()
|
166 |
{
|
167 |
-
if($this->options['general']['deactivation_delete']
|
168 |
-
{
|
169 |
delete_option('math_captcha_options');
|
170 |
-
delete_option('math_captcha_version');
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
|
175 |
-
/**
|
176 |
-
* Gets error messages
|
177 |
-
*/
|
178 |
-
public function get_error_messages($error)
|
179 |
-
{
|
180 |
-
return $this->error_messages[$error];
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Gets options
|
186 |
-
*/
|
187 |
-
public function get_options($option)
|
188 |
-
{
|
189 |
-
return $this->options['general'][$option];
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Gets session's ID
|
195 |
-
*/
|
196 |
-
public function get_session_id($number = 0)
|
197 |
-
{
|
198 |
-
return $this->session_ids['multi'][$number];
|
199 |
-
}
|
200 |
-
|
201 |
-
|
202 |
-
/**
|
203 |
-
* Gets session's number for Contact Form 7 multi instances
|
204 |
-
*/
|
205 |
-
public function get_session_number()
|
206 |
-
{
|
207 |
-
return $this->session_number;
|
208 |
-
}
|
209 |
-
|
210 |
-
|
211 |
-
/**
|
212 |
-
* Loads required filters
|
213 |
-
*/
|
214 |
-
public function load_actions_filters()
|
215 |
-
{
|
216 |
-
$action = (isset($_GET['action']) && $_GET['action'] !== '' ? $_GET['action'] : NULL);
|
217 |
-
|
218 |
-
//comments
|
219 |
-
if($this->options['general']['enable_for']['comment_form'] === TRUE)
|
220 |
-
{
|
221 |
-
if(!is_user_logged_in())
|
222 |
-
add_action('comment_form_after_fields', array(&$this, 'add_captcha_form'));
|
223 |
-
else
|
224 |
-
{
|
225 |
-
if($this->options['general']['hide_for_logged_users'] === FALSE)
|
226 |
-
{
|
227 |
-
add_action('comment_form_logged_in_after', array(&$this, 'add_captcha_form'));
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
add_filter('preprocess_comment', array(&$this, 'add_comment_with_captcha'));
|
232 |
-
}
|
233 |
-
|
234 |
-
//registration
|
235 |
-
if($this->options['general']['enable_for']['registration_form'] === TRUE && (!is_user_logged_in() || (is_user_logged_in() && $this->options['general']['hide_for_logged_users'] === FALSE)) && $action === 'register')
|
236 |
-
{
|
237 |
-
add_action('register_form', array(&$this, 'add_captcha_form'));
|
238 |
-
add_action('register_post', array(&$this, 'add_user_with_captcha'), 10, 3);
|
239 |
-
add_action('signup_extra_fields', array(&$this, 'add_captcha_form'));
|
240 |
-
add_filter('wpmu_validate_user_signup', array(&$this, 'validate_user_with_captcha'));
|
241 |
-
}
|
242 |
-
|
243 |
-
//lost password
|
244 |
-
if($this->options['general']['enable_for']['reset_password_form'] === TRUE && (!is_user_logged_in() || (is_user_logged_in() && $this->options['general']['hide_for_logged_users'] === FALSE)) && $action === 'lostpassword')
|
245 |
-
{
|
246 |
-
add_action('lostpassword_form', array(&$this, 'add_captcha_form'));
|
247 |
-
add_action('lostpassword_post', array(&$this, 'check_lost_password_with_captcha'));
|
248 |
-
}
|
249 |
-
|
250 |
-
//login
|
251 |
-
if($this->options['general']['enable_for']['login_form'] === TRUE && (!is_user_logged_in() || (is_user_logged_in() && $this->options['general']['hide_for_logged_users'] === FALSE)) && $action === NULL)
|
252 |
-
{
|
253 |
-
add_action('login_form', array(&$this, 'add_captcha_form'));
|
254 |
-
add_filter('login_redirect', array(&$this, 'redirect_login_with_captcha'), 10, 3);
|
255 |
-
add_filter('authenticate', array(&$this, 'authenticate_user'), 1000, 3);
|
256 |
-
}
|
257 |
-
|
258 |
-
//bbPress
|
259 |
-
if($this->options['general']['enable_for']['bbpress'] === TRUE)
|
260 |
-
{
|
261 |
-
if(class_exists('bbPress') && (!is_user_logged_in() || (is_user_logged_in() && $this->options['general']['hide_for_logged_users'] === FALSE)))
|
262 |
-
{
|
263 |
-
add_action('bbp_theme_after_reply_form_content', array(&$this, 'add_bbp_captcha_form'));
|
264 |
-
add_action('bbp_theme_after_topic_form_content', array(&$this, 'add_bbp_captcha_form'));
|
265 |
-
add_action('bbp_new_reply_pre_extras', array(&$this, 'check_bbpress_captcha'));
|
266 |
-
add_action('bbp_new_topic_pre_extras', array(&$this, 'check_bbpress_captcha'));
|
267 |
-
}
|
268 |
-
}
|
269 |
-
|
270 |
-
//Contact Form 7
|
271 |
-
if($this->options['general']['enable_for']['contact_form_7'] === TRUE)
|
272 |
-
{
|
273 |
-
if(class_exists('WPCF7_ContactForm'))
|
274 |
-
{
|
275 |
-
global $mc_class;
|
276 |
-
$mc_class = $this;
|
277 |
-
|
278 |
-
include_once('includes/math-captcha-cf7.php');
|
279 |
-
}
|
280 |
-
}
|
281 |
-
}
|
282 |
-
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Validates lost password form
|
286 |
-
*/
|
287 |
-
public function check_lost_password_with_captcha()
|
288 |
-
{
|
289 |
-
$this->errors = new WP_Error();
|
290 |
-
$user_error = FALSE;
|
291 |
-
$user_data = NULL;
|
292 |
-
|
293 |
-
//checks captcha
|
294 |
-
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
295 |
-
{
|
296 |
-
if($this->session_ids['default'] !== '' && get_transient('mc_'.$this->session_ids['default']) !== FALSE)
|
297 |
-
{
|
298 |
-
if(strcmp(get_transient('mc_'.$this->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].$this->session_ids['default'], FALSE)) !== 0)
|
299 |
-
$this->errors->add('math-captcha-error', $this->error_messages['wrong']);
|
300 |
-
}
|
301 |
-
else
|
302 |
-
$this->errors->add('math-captcha-error', $this->error_messages['time']);
|
303 |
-
}
|
304 |
-
else
|
305 |
-
$this->errors->add('math-captcha-error', $this->error_messages['fill']);
|
306 |
-
|
307 |
-
//checks user_login (from wp-login.php)
|
308 |
-
if(empty($_POST['user_login']))
|
309 |
-
$user_error = TRUE;
|
310 |
-
elseif(strpos($_POST['user_login'], '@'))
|
311 |
-
{
|
312 |
-
$user_data = get_user_by('email', trim($_POST['user_login']));
|
313 |
-
|
314 |
-
if(empty($user_data))
|
315 |
-
$user_error = TRUE;
|
316 |
-
}
|
317 |
-
else
|
318 |
-
$user_data = get_user_by('login', trim($_POST['user_login']));
|
319 |
-
|
320 |
-
if(!$user_data)
|
321 |
-
$user_error = TRUE;
|
322 |
-
|
323 |
-
//something went wrong?
|
324 |
-
if(!empty($this->errors->errors))
|
325 |
-
{
|
326 |
-
//nasty hack (captcha is wrong but user_login is fine)
|
327 |
-
if($user_error === FALSE)
|
328 |
-
add_filter('allow_password_reset', array(&$this, 'add_lostpassword_wp_message'));
|
329 |
-
else
|
330 |
-
add_filter('login_errors', array(&$this, 'add_lostpassword_captcha_message'));
|
331 |
-
}
|
332 |
-
}
|
333 |
-
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Adds lost password errors
|
337 |
-
*/
|
338 |
-
public function add_lostpassword_captcha_message($errors)
|
339 |
-
{
|
340 |
-
return $errors.$this->errors->errors['math-captcha-error'][0];
|
341 |
-
}
|
342 |
-
|
343 |
-
|
344 |
-
/**
|
345 |
-
* Adds lost password errors (special way)
|
346 |
-
*/
|
347 |
-
public function add_lostpassword_wp_message()
|
348 |
-
{
|
349 |
-
return $this->errors;
|
350 |
-
}
|
351 |
-
|
352 |
-
|
353 |
-
/**
|
354 |
-
* Validates register form
|
355 |
-
*/
|
356 |
-
public function add_user_with_captcha($login, $email, $errors)
|
357 |
-
{
|
358 |
-
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
359 |
-
{
|
360 |
-
if($this->session_ids['default'] !== '' && get_transient('mc_'.$this->session_ids['default']) !== FALSE)
|
361 |
-
{
|
362 |
-
if(strcmp(get_transient('mc_'.$this->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].$this->session_ids['default'], FALSE)) !== 0)
|
363 |
-
$errors->add('math-captcha-error', $this->error_messages['wrong']);
|
364 |
-
}
|
365 |
-
else
|
366 |
-
$errors->add('math-captcha-error', $this->error_messages['time']);
|
367 |
-
}
|
368 |
-
else
|
369 |
-
$errors->add('math-captcha-error', $this->error_messages['fill']);
|
370 |
-
|
371 |
-
return $errors;
|
372 |
-
}
|
373 |
-
|
374 |
-
|
375 |
-
/**
|
376 |
-
* Validates register form
|
377 |
-
*/
|
378 |
-
public function validate_user_with_captcha($result)
|
379 |
-
{
|
380 |
-
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
381 |
-
{
|
382 |
-
if($this->session_ids['default'] !== '' && get_transient('mc_'.$this->session_ids['default']) !== FALSE)
|
383 |
-
{
|
384 |
-
if(strcmp(get_transient('mc_'.$this->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].$this->session_ids['default'], FALSE)) !== 0)
|
385 |
-
$results['errors']->add('math-captcha-error', $this->error_messages['wrong']);
|
386 |
-
}
|
387 |
-
else
|
388 |
-
$results['errors']->add('math-captcha-error', $this->error_messages['time']);
|
389 |
-
}
|
390 |
-
else
|
391 |
-
$results['errors']->add('math-captcha-error', $this->error_messages['fill']);
|
392 |
-
|
393 |
-
return $results;
|
394 |
-
}
|
395 |
-
|
396 |
-
|
397 |
-
/**
|
398 |
-
* Posts login form
|
399 |
-
*/
|
400 |
-
public function redirect_login_with_captcha($redirect, $bool, $errors)
|
401 |
-
{
|
402 |
-
if($this->login_failed === FALSE && !empty($_POST))
|
403 |
-
{
|
404 |
-
$error = '';
|
405 |
-
|
406 |
-
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
407 |
-
{
|
408 |
-
if($this->session_ids['default'] !== '' && get_transient('mc_'.$this->session_ids['default']) !== FALSE)
|
409 |
-
{
|
410 |
-
if(strcmp(get_transient('mc_'.$this->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].$this->session_ids['default'], FALSE)) !== 0)
|
411 |
-
$error = 'wrong';
|
412 |
-
}
|
413 |
-
else
|
414 |
-
$error = 'time';
|
415 |
-
}
|
416 |
-
else
|
417 |
-
$error = 'fill';
|
418 |
-
|
419 |
-
if(is_wp_error($errors) && !empty($error))
|
420 |
-
$errors->add('math-captcha-error', $this->error_messages[$error]);
|
421 |
-
}
|
422 |
-
|
423 |
-
return $redirect;
|
424 |
-
}
|
425 |
-
|
426 |
-
|
427 |
-
/**
|
428 |
-
* Authenticate user
|
429 |
-
*/
|
430 |
-
public function authenticate_user($user, $username, $password)
|
431 |
-
{
|
432 |
-
//user gave us valid login and password
|
433 |
-
if(!is_wp_error($user))
|
434 |
-
{
|
435 |
-
if(!empty($_POST))
|
436 |
-
{
|
437 |
-
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
438 |
-
{
|
439 |
-
if($this->session_ids['default'] !== '' && get_transient('mc_'.$this->session_ids['default']) !== FALSE)
|
440 |
-
{
|
441 |
-
if(strcmp(get_transient('mc_'.$this->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].$this->session_ids['default'], FALSE)) !== 0)
|
442 |
-
$error = 'wrong';
|
443 |
-
}
|
444 |
-
else
|
445 |
-
$error = 'time';
|
446 |
-
}
|
447 |
-
else
|
448 |
-
$error = 'fill';
|
449 |
-
}
|
450 |
-
|
451 |
-
if(!empty($error))
|
452 |
-
{
|
453 |
-
//destroy cookie
|
454 |
-
wp_clear_auth_cookie();
|
455 |
-
|
456 |
-
$user = new WP_Error();
|
457 |
-
$user->add('math-captcha-error', $this->error_messages[$error]);
|
458 |
-
|
459 |
-
//inform redirect function that we failed to login
|
460 |
-
$this->login_failed = TRUE;
|
461 |
-
}
|
462 |
-
}
|
463 |
-
|
464 |
-
return $user;
|
465 |
-
}
|
466 |
-
|
467 |
-
|
468 |
-
/**
|
469 |
-
* Adds shake
|
470 |
-
*/
|
471 |
-
public function add_shake_error_codes($codes)
|
472 |
-
{
|
473 |
-
$codes[] = 'math-captcha-error';
|
474 |
-
|
475 |
-
return $codes;
|
476 |
-
}
|
477 |
-
|
478 |
-
|
479 |
-
/**
|
480 |
-
* Adds captcha to comment form
|
481 |
-
*/
|
482 |
-
public function add_comment_with_captcha($comment)
|
483 |
-
{
|
484 |
-
if(isset($_POST['mc-value']) && (!is_admin() || DOING_AJAX) && ($comment['comment_type'] === '' || $comment['comment_type'] === 'comment'))
|
485 |
-
{
|
486 |
-
if($_POST['mc-value'] !== '')
|
487 |
-
{
|
488 |
-
if($this->session_ids['default'] !== '' && get_transient('mc_'.$this->session_ids['default']) !== FALSE)
|
489 |
-
{
|
490 |
-
if(strcmp(get_transient('mc_'.$this->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].$this->session_ids['default'], FALSE)) === 0)
|
491 |
-
return $comment;
|
492 |
-
else
|
493 |
-
wp_die($this->error_messages['wrong']);
|
494 |
-
}
|
495 |
-
else
|
496 |
-
wp_die($this->error_messages['time']);
|
497 |
-
}
|
498 |
-
else
|
499 |
-
wp_die($this->error_messages['fill']);
|
500 |
-
}
|
501 |
-
else
|
502 |
-
return $comment;
|
503 |
-
}
|
504 |
-
|
505 |
-
|
506 |
-
/**
|
507 |
-
* Initializes cookie-session
|
508 |
-
*/
|
509 |
-
public function init_mc_session()
|
510 |
-
{
|
511 |
-
if(isset($_COOKIE['mc_session_ids']))
|
512 |
-
$this->session_ids = $_COOKIE['mc_session_ids'];
|
513 |
-
else
|
514 |
-
{
|
515 |
-
foreach(array('default', 'multi') as $place)
|
516 |
-
{
|
517 |
-
switch($place)
|
518 |
-
{
|
519 |
-
case 'multi':
|
520 |
-
for($i = 0; $i < 5; $i++)
|
521 |
-
{
|
522 |
-
$this->session_ids[$place][$i] = sha1(wp_generate_password(64, FALSE, FALSE));
|
523 |
-
}
|
524 |
-
break;
|
525 |
-
|
526 |
-
case 'default':
|
527 |
-
$this->session_ids[$place] = sha1(wp_generate_password(64, FALSE, FALSE));
|
528 |
-
break;
|
529 |
-
}
|
530 |
-
}
|
531 |
-
}
|
532 |
-
|
533 |
-
if(!isset($_COOKIE['mc_session_ids']))
|
534 |
-
{
|
535 |
-
setcookie('mc_session_ids[default]', $this->session_ids['default'], current_time('timestamp', TRUE) + apply_filters('math_captcha_time', $this->options['general']['time']), COOKIEPATH, COOKIE_DOMAIN, (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? TRUE : FALSE), TRUE);
|
536 |
-
|
537 |
-
for($i = 0; $i < 5; $i++)
|
538 |
-
{
|
539 |
-
setcookie('mc_session_ids[multi]['.$i.']', $this->session_ids['multi'][$i], current_time('timestamp', TRUE) + apply_filters('math_captcha_time', $this->options['general']['time']), COOKIEPATH, COOKIE_DOMAIN);
|
540 |
-
}
|
541 |
-
}
|
542 |
-
}
|
543 |
-
|
544 |
-
|
545 |
-
/**
|
546 |
-
* Shows and generates captcha
|
547 |
-
*/
|
548 |
-
public function add_captcha_form()
|
549 |
-
{
|
550 |
-
if(is_admin())
|
551 |
-
return;
|
552 |
-
|
553 |
-
$captcha_title = apply_filters('math_captcha_title', $this->options['general']['title']);
|
554 |
-
|
555 |
-
echo '
|
556 |
-
<p class="math-captcha-form">';
|
557 |
-
|
558 |
-
if(!empty($captcha_title))
|
559 |
-
echo '
|
560 |
-
<label>'.$captcha_title.'<br /></label>';
|
561 |
-
|
562 |
-
echo '
|
563 |
-
<span>'.$this->generate_captcha_phrase('default').'</span>
|
564 |
-
</p>';
|
565 |
-
}
|
566 |
-
|
567 |
-
|
568 |
-
/**
|
569 |
-
* Shows and generates captcha for bbPress
|
570 |
-
*/
|
571 |
-
public function add_bbp_captcha_form()
|
572 |
-
{
|
573 |
-
if(is_admin())
|
574 |
-
return;
|
575 |
-
|
576 |
-
$captcha_title = apply_filters('math_captcha_title', $this->options['general']['title']);
|
577 |
-
|
578 |
-
echo '
|
579 |
-
<p class="math-captcha-form">';
|
580 |
-
|
581 |
-
if(!empty($captcha_title))
|
582 |
-
echo '
|
583 |
-
<label>'.$captcha_title.'<br /></label>';
|
584 |
-
|
585 |
-
echo '
|
586 |
-
<span>'.$this->generate_captcha_phrase('bbpress').'</span>
|
587 |
-
</p>';
|
588 |
-
}
|
589 |
-
|
590 |
-
|
591 |
-
/**
|
592 |
-
* Validates bbpress topics and replies
|
593 |
-
*/
|
594 |
-
public function check_bbpress_captcha()
|
595 |
-
{
|
596 |
-
if(isset($_POST['mc-value']) && $_POST['mc-value'] !== '')
|
597 |
-
{
|
598 |
-
if($this->session_ids['default'] !== '' && get_transient('bbp_'.$this->session_ids['default']) !== FALSE)
|
599 |
-
{
|
600 |
-
if(strcmp(get_transient('bbp_'.$this->session_ids['default']), sha1(AUTH_KEY.$_POST['mc-value'].$this->session_ids['default'], FALSE)) !== 0)
|
601 |
-
bbp_add_error('math-captcha-wrong', $this->error_messages['wrong']);
|
602 |
-
}
|
603 |
-
else
|
604 |
-
bbp_add_error('math-captcha-wrong', $this->error_messages['time']);
|
605 |
-
}
|
606 |
-
else
|
607 |
-
bbp_add_error('math-captcha-wrong', $this->error_messages['fill']);
|
608 |
-
}
|
609 |
-
|
610 |
-
|
611 |
-
/**
|
612 |
-
* Encodes chars
|
613 |
-
*/
|
614 |
-
private function encode_operation($string)
|
615 |
-
{
|
616 |
-
$chars = str_split($string);
|
617 |
-
$seed = mt_rand(0, (int)abs(crc32($string) / strlen($string)));
|
618 |
-
|
619 |
-
foreach($chars as $key => $char)
|
620 |
-
{
|
621 |
-
$ord = ord($char);
|
622 |
-
|
623 |
-
//ignore non-ascii chars
|
624 |
-
if($ord < 128)
|
625 |
-
{
|
626 |
-
//pseudo "random function"
|
627 |
-
$r = ($seed * (1 + $key)) % 100;
|
628 |
-
|
629 |
-
if($r > 60 && $char !== '@') {} // plain character (not encoded), if not @-sign
|
630 |
-
elseif($r < 45) $chars[$key] = '&#x'.dechex($ord).';'; //hexadecimal
|
631 |
-
else $chars[$key] = '&#'.$ord.';'; //decimal (ascii)
|
632 |
-
}
|
633 |
-
}
|
634 |
-
|
635 |
-
return implode('', $chars);
|
636 |
-
}
|
637 |
-
|
638 |
-
|
639 |
-
/**
|
640 |
-
* Converts numbers to words
|
641 |
-
*/
|
642 |
-
private function numberToWords($number)
|
643 |
-
{
|
644 |
-
$words = array(
|
645 |
-
1 => __('one', 'math-captcha'),
|
646 |
-
2 => __('two', 'math-captcha'),
|
647 |
-
3 => __('three', 'math-captcha'),
|
648 |
-
4 => __('four', 'math-captcha'),
|
649 |
-
5 => __('five', 'math-captcha'),
|
650 |
-
6 => __('six', 'math-captcha'),
|
651 |
-
7 => __('seven', 'math-captcha'),
|
652 |
-
8 => __('eight', 'math-captcha'),
|
653 |
-
9 => __('nine', 'math-captcha'),
|
654 |
-
10 => __('ten', 'math-captcha'),
|
655 |
-
11 => __('eleven', 'math-captcha'),
|
656 |
-
12 => __('twelve', 'math-captcha'),
|
657 |
-
13 => __('thirteen', 'math-captcha'),
|
658 |
-
14 => __('fourteen', 'math-captcha'),
|
659 |
-
15 => __('fifteen', 'math-captcha'),
|
660 |
-
16 => __('sixteen', 'math-captcha'),
|
661 |
-
17 => __('seventeen', 'math-captcha'),
|
662 |
-
18 => __('eighteen', 'math-captcha'),
|
663 |
-
19 => __('nineteen', 'math-captcha'),
|
664 |
-
20 => __('twenty', 'math-captcha'),
|
665 |
-
30 => __('thirty', 'math-captcha'),
|
666 |
-
40 => __('forty', 'math-captcha'),
|
667 |
-
50 => __('fifty', 'math-captcha'),
|
668 |
-
60 => __('sixty', 'math-captcha'),
|
669 |
-
70 => __('seventy', 'math-captcha'),
|
670 |
-
80 => __('eighty', 'math-captcha'),
|
671 |
-
90 => __('ninety', 'math-captcha')
|
672 |
-
);
|
673 |
-
|
674 |
-
if(isset($words[$number]))
|
675 |
-
return $words[$number];
|
676 |
-
else
|
677 |
-
{
|
678 |
-
$reverse = FALSE;
|
679 |
-
|
680 |
-
switch(get_bloginfo('language'))
|
681 |
-
{
|
682 |
-
case 'de-DE':
|
683 |
-
$spacer = 'und';
|
684 |
-
$reverse = TRUE;
|
685 |
-
break;
|
686 |
-
|
687 |
-
case 'nl-NL':
|
688 |
-
$spacer = 'en';
|
689 |
-
$reverse = TRUE;
|
690 |
-
break;
|
691 |
-
|
692 |
-
case 'ru-RU':
|
693 |
-
case 'pl-PL':
|
694 |
-
case 'en-EN':
|
695 |
-
default:
|
696 |
-
$spacer = ' ';
|
697 |
-
}
|
698 |
-
|
699 |
-
$first = (int)(substr($number, 0, 1) * 10);
|
700 |
-
$second = (int)substr($number, -1);
|
701 |
-
|
702 |
-
return ($reverse === FALSE ? $words[$first].$spacer.$words[$second] : $words[$second].$spacer.$words[$first]);
|
703 |
-
}
|
704 |
-
}
|
705 |
-
|
706 |
-
|
707 |
-
/**
|
708 |
-
* Generates captcha
|
709 |
-
*/
|
710 |
-
public function generate_captcha_phrase($form = '')
|
711 |
-
{
|
712 |
-
$ops = array(
|
713 |
-
'addition' => '+',
|
714 |
-
'subtraction' => '−',
|
715 |
-
'multiplication' => '×',
|
716 |
-
'division' => '÷',
|
717 |
-
);
|
718 |
-
|
719 |
-
$operations = $groups = array();
|
720 |
-
$input = '<input type="text" size="2" length="2" id="mc-input" class="mc-input" name="mc-value" value="" aria-required="true" />';
|
721 |
-
|
722 |
-
//available operations
|
723 |
-
foreach($this->options['general']['mathematical_operations'] as $operation => $enable)
|
724 |
-
{
|
725 |
-
if($enable === TRUE)
|
726 |
-
$operations[] = $operation;
|
727 |
-
}
|
728 |
-
|
729 |
-
//available groups
|
730 |
-
foreach($this->options['general']['groups'] as $group => $enable)
|
731 |
-
{
|
732 |
-
if($enable === TRUE)
|
733 |
-
$groups[] = $group;
|
734 |
-
}
|
735 |
-
|
736 |
-
//number of groups
|
737 |
-
$ao = count($groups);
|
738 |
-
|
739 |
-
//operation
|
740 |
-
$rnd_op = $operations[mt_rand(0, count($operations) - 1)];
|
741 |
-
$number[3] = $ops[$rnd_op];
|
742 |
-
|
743 |
-
//place where to put empty input
|
744 |
-
$rnd_input = mt_rand(0, 2);
|
745 |
-
|
746 |
-
//which random operation
|
747 |
-
switch($rnd_op)
|
748 |
-
{
|
749 |
-
case 'addition':
|
750 |
-
if($rnd_input === 0)
|
751 |
-
{
|
752 |
-
$number[0] = mt_rand(1, 10);
|
753 |
-
$number[1] = mt_rand(1, 89);
|
754 |
-
}
|
755 |
-
elseif($rnd_input === 1)
|
756 |
-
{
|
757 |
-
$number[0] = mt_rand(1, 89);
|
758 |
-
$number[1] = mt_rand(1, 10);
|
759 |
-
}
|
760 |
-
elseif($rnd_input === 2)
|
761 |
-
{
|
762 |
-
$number[0] = mt_rand(1, 9);
|
763 |
-
$number[1] = mt_rand(1, 10 - $number[0]);
|
764 |
-
}
|
765 |
-
|
766 |
-
$number[2] = $number[0] + $number[1];
|
767 |
-
break;
|
768 |
-
|
769 |
-
case 'subtraction':
|
770 |
-
if($rnd_input === 0)
|
771 |
-
{
|
772 |
-
$number[0] = mt_rand(2, 10);
|
773 |
-
$number[1] = mt_rand(1, $number[0] - 1);
|
774 |
-
}
|
775 |
-
elseif($rnd_input === 1)
|
776 |
-
{
|
777 |
-
$number[0] = mt_rand(11, 99);
|
778 |
-
$number[1] = mt_rand(1, 10);
|
779 |
-
}
|
780 |
-
elseif($rnd_input === 2)
|
781 |
-
{
|
782 |
-
$number[0] = mt_rand(11, 99);
|
783 |
-
$number[1] = mt_rand($number[0] - 10, $number[0] - 1);
|
784 |
-
}
|
785 |
-
|
786 |
-
$number[2] = $number[0] - $number[1];
|
787 |
-
break;
|
788 |
-
|
789 |
-
case 'multiplication':
|
790 |
-
if($rnd_input === 0)
|
791 |
-
{
|
792 |
-
$number[0] = mt_rand(1, 10);
|
793 |
-
$number[1] = mt_rand(1, 9);
|
794 |
-
}
|
795 |
-
elseif($rnd_input === 1)
|
796 |
-
{
|
797 |
-
$number[0] = mt_rand(1, 9);
|
798 |
-
$number[1] = mt_rand(1, 10);
|
799 |
-
}
|
800 |
-
elseif($rnd_input === 2)
|
801 |
-
{
|
802 |
-
$number[0] = mt_rand(1, 10);
|
803 |
-
$number[1] = ($number[0] > 5 ? 1 : ($number[0] === 4 && $number[0] === 5 ? mt_rand(1, 2) : ($number[0] === 3 ? mt_rand(1, 3) : ($number[0] === 2 ? mt_rand(1, 5) : mt_rand(1, 10)))));
|
804 |
-
}
|
805 |
-
|
806 |
-
$number[2] = $number[0] * $number[1];
|
807 |
-
break;
|
808 |
-
|
809 |
-
case 'division':
|
810 |
-
if($rnd_input === 0)
|
811 |
-
{
|
812 |
-
$divide = array(2 => array(1, 2), 3 => array(1, 3), 4 => array(1, 2, 4), 5 => array(1, 5), 6 => array(1, 2, 3, 6), 7 => array(1, 7), 8 => array(1, 2, 4, 8), 9 => array(1, 3, 9), 10 => array(1, 2, 5, 10));
|
813 |
-
$number[0] = mt_rand(2, 10);
|
814 |
-
$number[1] = $divide[$number[0]][mt_rand(0, count($divide[$number[0]]) - 1)];
|
815 |
-
}
|
816 |
-
elseif($rnd_input === 1)
|
817 |
-
{
|
818 |
-
$divide = array(1 => 99, 2 => 49, 3 => 33, 4 => 24, 5 => 19, 6 => 16, 7 => 14, 8 => 12, 9 => 11, 10 => 9);
|
819 |
-
$number[1] = mt_rand(1, 10);
|
820 |
-
$number[0] = $number[1] * mt_rand(1, $divide[$number[1]]);
|
821 |
-
}
|
822 |
-
elseif($rnd_input === 2)
|
823 |
-
{
|
824 |
-
$divide = array(1 => 99, 2 => 49, 3 => 33, 4 => 24, 5 => 19, 6 => 16, 7 => 14, 8 => 12, 9 => 11, 10 => 9);
|
825 |
-
$number[2] = mt_rand(1, 10);
|
826 |
-
$number[0] = $number[2] * mt_rand(1, $divide[$number[2]]);
|
827 |
-
$number[1] = (int)($number[0] / $number[2]);
|
828 |
-
}
|
829 |
-
|
830 |
-
if(!isset($number[2]))
|
831 |
-
{
|
832 |
-
$number[2] = (int)($number[0] / $number[1]);
|
833 |
-
}
|
834 |
-
break;
|
835 |
-
}
|
836 |
-
|
837 |
-
//words
|
838 |
-
if($ao === 1 && $groups[0] === 'words')
|
839 |
-
{
|
840 |
-
if($rnd_input === 0)
|
841 |
-
{
|
842 |
-
$number[1] = $this->numberToWords($number[1]);
|
843 |
-
$number[2] = $this->numberToWords($number[2]);
|
844 |
-
}
|
845 |
-
elseif($rnd_input === 1)
|
846 |
-
{
|
847 |
-
$number[0] = $this->numberToWords($number[0]);
|
848 |
-
$number[2] = $this->numberToWords($number[2]);
|
849 |
-
}
|
850 |
-
elseif($rnd_input === 2)
|
851 |
-
{
|
852 |
-
$number[0] = $this->numberToWords($number[0]);
|
853 |
-
$number[1] = $this->numberToWords($number[1]);
|
854 |
-
}
|
855 |
-
}
|
856 |
-
//numbers and words
|
857 |
-
elseif($ao === 2)
|
858 |
-
{
|
859 |
-
if($rnd_input === 0)
|
860 |
-
{
|
861 |
-
if(mt_rand(1, 2) === 2)
|
862 |
-
{
|
863 |
-
$number[1] = $this->numberToWords($number[1]);
|
864 |
-
$number[2] = $this->numberToWords($number[2]);
|
865 |
-
}
|
866 |
-
else
|
867 |
-
$number[$tmp = mt_rand(1, 2)] = $this->numberToWords($number[$tmp]);
|
868 |
-
}
|
869 |
-
elseif($rnd_input === 1)
|
870 |
-
{
|
871 |
-
if(mt_rand(1, 2) === 2)
|
872 |
-
{
|
873 |
-
$number[0] = $this->numberToWords($number[0]);
|
874 |
-
$number[2] = $this->numberToWords($number[2]);
|
875 |
-
}
|
876 |
-
else
|
877 |
-
$number[$tmp = array_rand(array(0 => 0, 2 => 2), 1)] = $this->numberToWords($number[$tmp]);
|
878 |
-
}
|
879 |
-
elseif($rnd_input === 2)
|
880 |
-
{
|
881 |
-
if(mt_rand(1, 2) === 2)
|
882 |
-
{
|
883 |
-
$number[0] = $this->numberToWords($number[0]);
|
884 |
-
$number[1] = $this->numberToWords($number[1]);
|
885 |
-
}
|
886 |
-
else
|
887 |
-
$number[$tmp = mt_rand(0, 1)] = $this->numberToWords($number[$tmp]);
|
888 |
-
}
|
889 |
-
}
|
890 |
-
|
891 |
-
if(in_array($form, array('default', 'bbpress'), TRUE))
|
892 |
-
{
|
893 |
-
//position of empty input
|
894 |
-
if($rnd_input === 0)
|
895 |
-
$return = $input.' '.$number[3].' '.$this->encode_operation($number[1]).' = '.$this->encode_operation($number[2]);
|
896 |
-
elseif($rnd_input === 1)
|
897 |
-
$return = $this->encode_operation($number[0]).' '.$number[3].' '.$input.' = '.$this->encode_operation($number[2]);
|
898 |
-
elseif($rnd_input === 2)
|
899 |
-
$return = $this->encode_operation($number[0]).' '.$number[3].' '.$this->encode_operation($number[1]).' = '.$input;
|
900 |
-
|
901 |
-
$transient_name = ($form === 'bbpress' ? 'bbp' : 'mc');
|
902 |
-
$session_id = $this->session_ids['default'];
|
903 |
-
}
|
904 |
-
elseif($form === 'cf7')
|
905 |
-
{
|
906 |
-
$return = array();
|
907 |
-
|
908 |
-
if($rnd_input === 0)
|
909 |
-
{
|
910 |
-
$return['input'] = 1;
|
911 |
-
$return[2] = ' '.$number[3].' '.$this->encode_operation($number[1]).' = ';
|
912 |
-
$return[3] = $this->encode_operation($number[2]);
|
913 |
-
}
|
914 |
-
elseif($rnd_input === 1)
|
915 |
-
{
|
916 |
-
$return[1] = $this->encode_operation($number[0]).' '.$number[3].' ';
|
917 |
-
$return['input'] = 2;
|
918 |
-
$return[3] = ' = '.$this->encode_operation($number[2]);
|
919 |
-
}
|
920 |
-
elseif($rnd_input === 2)
|
921 |
-
{
|
922 |
-
$return[1] = $this->encode_operation($number[0]).' '.$number[3].' ';
|
923 |
-
$return[2] = $this->encode_operation($number[1]).' = ';
|
924 |
-
$return['input'] = 3;
|
925 |
-
}
|
926 |
-
|
927 |
-
$transient_name = 'cf7';
|
928 |
-
$session_id = $this->session_ids['multi'][$this->session_number++];
|
929 |
-
}
|
930 |
-
|
931 |
-
set_transient($transient_name.'_'.$session_id, sha1(AUTH_KEY.$number[$rnd_input].$session_id, FALSE), apply_filters('math_captcha_time', $this->options['general']['time']));
|
932 |
-
|
933 |
-
return $return;
|
934 |
-
}
|
935 |
-
|
936 |
-
|
937 |
-
/**
|
938 |
-
* Load defaults
|
939 |
-
*/
|
940 |
-
public function load_defaults()
|
941 |
-
{
|
942 |
-
$this->error_messages = array(
|
943 |
-
'fill' => '<strong>'. __('ERROR', 'math-captcha').'</strong>: '.__('Please enter captcha value.', 'math-captcha'),
|
944 |
-
'wrong' => '<strong>'. __('ERROR', 'math-captcha').'</strong>: '.__('Invalid captcha value.', 'math-captcha'),
|
945 |
-
'time' => '<strong>'. __('ERROR', 'math-captcha').'</strong>: '.__('Captcha time expired.', 'math-captcha')
|
946 |
-
);
|
947 |
-
|
948 |
-
$this->enable_for = array(
|
949 |
-
'login_form' => __('login form', 'math-captcha'),
|
950 |
-
'registration_form' => __('registration form', 'math-captcha'),
|
951 |
-
'reset_password_form' => __('reset password form', 'math-captcha'),
|
952 |
-
'comment_form' => __('comment form', 'math-captcha'),
|
953 |
-
'bbpress' => __('bbpress', 'math-captcha'),
|
954 |
-
'contact_form_7' => __('contact form 7', 'math-captcha')
|
955 |
-
);
|
956 |
-
|
957 |
-
$this->choices = array(
|
958 |
-
'yes' => __('yes', 'math-captcha'),
|
959 |
-
'no' => __('no', 'math-captcha')
|
960 |
-
);
|
961 |
-
|
962 |
-
$this->mathematical_operations = array(
|
963 |
-
'addition' => __('addition (+)', 'math-captcha'),
|
964 |
-
'subtraction' => __('subtraction (-)', 'math-captcha'),
|
965 |
-
'multiplication' => __('multiplication (×)', 'math-captcha'),
|
966 |
-
'division' => __('division (÷)', 'math-captcha')
|
967 |
-
);
|
968 |
-
|
969 |
-
$this->groups = array(
|
970 |
-
'numbers' => __('numbers', 'math-captcha'),
|
971 |
-
'words' => __('words', 'math-captcha')
|
972 |
-
);
|
973 |
-
}
|
974 |
-
|
975 |
-
|
976 |
-
/**
|
977 |
-
* Registers settings
|
978 |
-
*/
|
979 |
-
public function register_settings()
|
980 |
-
{
|
981 |
-
//inline edit
|
982 |
-
register_setting('math_captcha_options', 'math_captcha_options', array(&$this, 'validate_configuration'));
|
983 |
-
add_settings_section('math_captcha_settings', __('Math Captcha settings', 'math-captcha'), '', 'math_captcha_options');
|
984 |
-
add_settings_field('mc_enable_for', __('Enable Math Captcha for', 'math-captcha'), array(&$this, 'mc_enable_captcha_for'), 'math_captcha_options', 'math_captcha_settings');
|
985 |
-
add_settings_field('mc_hide_for_logged_users', __('Hide for logged in users', 'math-captcha'), array(&$this, 'mc_hide_for_logged_users'), 'math_captcha_options', 'math_captcha_settings');
|
986 |
-
add_settings_field('mc_mathematical_operations', __('Mathematical operations', 'math-captcha'), array(&$this, 'mc_mathematical_operations'), 'math_captcha_options', 'math_captcha_settings');
|
987 |
-
add_settings_field('mc_groups', __('Display captcha as', 'math-captcha'), array(&$this, 'mc_groups'), 'math_captcha_options', 'math_captcha_settings');
|
988 |
-
add_settings_field('mc_title', __('Captcha field title', 'math-captcha'), array(&$this, 'mc_title'), 'math_captcha_options', 'math_captcha_settings');
|
989 |
-
add_settings_field('mc_time', __('Captcha time', 'math-captcha'), array(&$this, 'mc_time'), 'math_captcha_options', 'math_captcha_settings');
|
990 |
-
add_settings_field('mc_block_direct_comments', __('Block Direct Comments', 'math-captcha'), array(&$this, 'mc_block_direct_comments'), 'math_captcha_options', 'math_captcha_settings');
|
991 |
-
add_settings_field('mc_deactivation_delete', __('Deactivation', 'math-captcha'), array(&$this, 'mc_deactivation_delete'), 'math_captcha_options', 'math_captcha_settings');
|
992 |
-
}
|
993 |
-
|
994 |
-
|
995 |
-
/**
|
996 |
-
* Setting field - enable for
|
997 |
-
*/
|
998 |
-
public function mc_enable_captcha_for()
|
999 |
-
{
|
1000 |
-
echo '
|
1001 |
-
<div class="wplikebtns">';
|
1002 |
-
|
1003 |
-
foreach($this->enable_for as $val => $trans)
|
1004 |
-
{
|
1005 |
-
echo '
|
1006 |
-
<input id="mc-enable-for-'.$val.'" type="checkbox" name="math_captcha_options[enable_for][]" value="'.$val.'" '.checked(TRUE, $this->options['general']['enable_for'][$val], FALSE).' '.disabled((($val === 'contact_form_7' && !class_exists('WPCF7_ContactForm')) || ($val === 'bbpress' && !class_exists('bbPress'))), TRUE, FALSE).' />
|
1007 |
-
<label for="mc-enable-for-'.$val.'">'.$trans.'</label>';
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
echo '
|
1011 |
-
<p class="description">'.__('Select where you\'d like to use Math Captcha.', 'math-captcha').'</p>
|
1012 |
-
</div>';
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
|
1016 |
-
/**
|
1017 |
-
* Setting field - hide for logged in users
|
1018 |
-
*/
|
1019 |
-
public function mc_hide_for_logged_users()
|
1020 |
-
{
|
1021 |
-
echo '
|
1022 |
-
<div class="wplikebtns">';
|
1023 |
-
|
1024 |
-
foreach($this->choices as $val => $trans)
|
1025 |
-
{
|
1026 |
-
echo '
|
1027 |
-
<input id="mc-hide-for-logged-'.$val.'" type="radio" name="math_captcha_options[hide_for_logged_users]" value="'.$val.'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['general']['hide_for_logged_users'], FALSE).' />
|
1028 |
-
<label for="mc-hide-for-logged-'.$val.'">'.$trans.'</label>';
|
1029 |
-
}
|
1030 |
-
|
1031 |
-
echo '
|
1032 |
-
<p class="description">'.__('Would you like to hide captcha for logged in users?', 'math-captcha').'</p>
|
1033 |
-
</div>';
|
1034 |
}
|
1035 |
|
1036 |
|
1037 |
/**
|
1038 |
-
*
|
1039 |
-
*/
|
1040 |
-
public function mc_title()
|
1041 |
-
{
|
1042 |
-
echo '
|
1043 |
-
<div>
|
1044 |
-
<input type="text" name="math_captcha_options[title]" value="'.$this->options['general']['title'].'" />
|
1045 |
-
<p class="description">'.__('How to entitle field with captcha?', 'math-captcha').'</p>
|
1046 |
-
</div>';
|
1047 |
-
}
|
1048 |
-
|
1049 |
-
|
1050 |
-
/**
|
1051 |
-
* Setting field - time
|
1052 |
-
*/
|
1053 |
-
public function mc_time()
|
1054 |
-
{
|
1055 |
-
echo '
|
1056 |
-
<div>
|
1057 |
-
<input type="text" name="math_captcha_options[time]" value="'.$this->options['general']['time'].'" />
|
1058 |
-
<p class="description">'.__('Enter the time (in seconds) a user has to enter captcha value.', 'math-captcha').'</p>
|
1059 |
-
</div>';
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
|
1063 |
-
/**
|
1064 |
-
* Setting field - block direct comments
|
1065 |
-
*/
|
1066 |
-
public function mc_block_direct_comments()
|
1067 |
-
{
|
1068 |
-
echo '
|
1069 |
-
<div class="wplikebtns">';
|
1070 |
-
|
1071 |
-
foreach($this->choices as $val => $trans)
|
1072 |
-
{
|
1073 |
-
echo '
|
1074 |
-
<input id="mc-block-direct-comments-'.$val.'" type="radio" name="math_captcha_options[block_direct_comments]" value="'.$val.'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['general']['block_direct_comments'], FALSE).' />
|
1075 |
-
<label for="mc-block-direct-comments-'.$val.'">'.$trans.'</label>';
|
1076 |
-
}
|
1077 |
-
|
1078 |
-
echo '
|
1079 |
-
<p class="description">'.__('Blocks direct access to wp-comments-post.php. Enable this to prevent spambots from posting to Wordpress via a URL.', 'math-captcha').'</p>
|
1080 |
-
</div>';
|
1081 |
-
}
|
1082 |
-
|
1083 |
-
|
1084 |
-
/**
|
1085 |
-
* Setting field - delete settings during deactivation
|
1086 |
-
*/
|
1087 |
-
public function mc_deactivation_delete()
|
1088 |
-
{
|
1089 |
-
echo '
|
1090 |
-
<div class="wplikebtns">';
|
1091 |
-
|
1092 |
-
foreach($this->choices as $val => $trans)
|
1093 |
-
{
|
1094 |
-
echo '
|
1095 |
-
<input id="mc-deactivation-delete-'.$val.'" type="radio" name="math_captcha_options[deactivation_delete]" value="'.$val.'" '.checked(($val === 'yes' ? TRUE : FALSE), $this->options['general']['deactivation_delete'], FALSE).' />
|
1096 |
-
<label for="mc-deactivation-delete-'.$val.'">'.$trans.'</label>';
|
1097 |
-
}
|
1098 |
-
|
1099 |
-
echo '
|
1100 |
-
<p class="description">'.__('Delete settings on plugin deactivation', 'math-captcha').'</p>
|
1101 |
-
</div>';
|
1102 |
-
}
|
1103 |
-
|
1104 |
-
|
1105 |
-
/**
|
1106 |
-
* Setting field - methematical operations
|
1107 |
-
*/
|
1108 |
-
public function mc_mathematical_operations()
|
1109 |
-
{
|
1110 |
-
echo '
|
1111 |
-
<div class="wplikebtns">';
|
1112 |
-
|
1113 |
-
foreach($this->mathematical_operations as $val => $trans)
|
1114 |
-
{
|
1115 |
-
echo '
|
1116 |
-
<input id="mc-mathematical-operations-'.$val.'" type="checkbox" name="math_captcha_options[mathematical_operations][]" value="'.$val.'" '.checked(TRUE, $this->options['general']['mathematical_operations'][$val], FALSE).' />
|
1117 |
-
<label for="mc-mathematical-operations-'.$val.'">'.$trans.'</label>';
|
1118 |
-
}
|
1119 |
-
|
1120 |
-
echo '
|
1121 |
-
<p class="description">'.__('Select which mathematical operations to use in your captcha.', 'math-captcha').'</p>
|
1122 |
-
</div>';
|
1123 |
-
}
|
1124 |
-
|
1125 |
-
|
1126 |
-
/**
|
1127 |
-
* Setting field - groups
|
1128 |
*/
|
1129 |
-
public function
|
1130 |
{
|
1131 |
-
|
1132 |
-
<div class="wplikebtns">';
|
1133 |
-
|
1134 |
-
foreach($this->groups as $val => $trans)
|
1135 |
-
{
|
1136 |
-
echo '
|
1137 |
-
<input id="mc-groups-'.$val.'" type="checkbox" name="math_captcha_options[groups][]" value="'.$val.'" '.checked(TRUE, $this->options['general']['groups'][$val], FALSE).' />
|
1138 |
-
<label for="mc-groups-'.$val.'">'.$trans.'</label>';
|
1139 |
-
}
|
1140 |
-
|
1141 |
-
echo '
|
1142 |
-
<p class="description">'.__('Select how you\'d like to display you captcha.', 'math-captcha').'</p>
|
1143 |
-
</div>';
|
1144 |
}
|
1145 |
|
1146 |
|
1147 |
/**
|
1148 |
-
*
|
1149 |
*/
|
1150 |
-
public function
|
1151 |
{
|
1152 |
-
if(
|
1153 |
{
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
if(empty($input['enable_for']))
|
1159 |
-
{
|
1160 |
-
foreach($this->defaults['general']['enable_for'] as $enable => $bool)
|
1161 |
-
{
|
1162 |
-
$input['enable_for'][$enable] = FALSE;
|
1163 |
-
}
|
1164 |
-
}
|
1165 |
-
else
|
1166 |
-
{
|
1167 |
-
foreach($this->enable_for as $enable => $trans)
|
1168 |
-
{
|
1169 |
-
$enable_for[$enable] = (in_array($enable, $input['enable_for']) ? TRUE : FALSE);
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
$input['enable_for'] = $enable_for;
|
1173 |
-
}
|
1174 |
-
|
1175 |
-
if(!class_exists('WPCF7_ContactForm') && $this->options['general']['enable_for']['contact_form_7'] === TRUE)
|
1176 |
-
$input['enable_for']['contact_form_7'] = TRUE;
|
1177 |
-
|
1178 |
-
if(!class_exists('bbPress') && $this->options['general']['enable_for']['bbpress'] === TRUE)
|
1179 |
-
$input['enable_for']['bbpress'] = TRUE;
|
1180 |
-
|
1181 |
-
if(empty($input['mathematical_operations']))
|
1182 |
-
{
|
1183 |
-
add_settings_error('empty-operations', 'settings_updated', __('You need to check at least one mathematical operation. Defaults settings of this option restored.', 'math-captcha'), 'error');
|
1184 |
-
|
1185 |
-
$input['mathematical_operations'] = $this->defaults['general']['mathematical_operations'];
|
1186 |
-
}
|
1187 |
-
else
|
1188 |
-
{
|
1189 |
-
foreach($this->mathematical_operations as $operation => $trans)
|
1190 |
-
{
|
1191 |
-
$mathematical_operations[$operation] = (in_array($operation, $input['mathematical_operations']) ? TRUE : FALSE);
|
1192 |
-
}
|
1193 |
-
|
1194 |
-
$input['mathematical_operations'] = $mathematical_operations;
|
1195 |
-
}
|
1196 |
-
|
1197 |
-
if(empty($input['groups']))
|
1198 |
-
{
|
1199 |
-
add_settings_error('empty-groups', 'settings_updated', __('You need to check at least one group. Defaults settings of this option restored.', 'math-captcha'), 'error');
|
1200 |
-
|
1201 |
-
$input['groups'] = $this->defaults['general']['groups'];
|
1202 |
-
}
|
1203 |
-
else
|
1204 |
-
{
|
1205 |
-
foreach($this->groups as $group => $trans)
|
1206 |
-
{
|
1207 |
-
$groups[$group] = (in_array($group, $input['groups']) ? TRUE : FALSE);
|
1208 |
-
}
|
1209 |
-
|
1210 |
-
$input['groups'] = $groups;
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
$input['hide_for_logged_users'] = (isset($input['hide_for_logged_users']) && in_array($input['hide_for_logged_users'], array_keys($this->choices)) ? ($input['hide_for_logged_users'] === 'yes' ? TRUE : FALSE) : $this->defaults['general']['hide_for_logged_users']);
|
1214 |
-
|
1215 |
-
$input['block_direct_comments'] = (isset($input['block_direct_comments']) && in_array($input['block_direct_comments'], array_keys($this->choices)) ? ($input['block_direct_comments'] === 'yes' ? TRUE : FALSE) : $this->defaults['general']['block_direct_comments']);
|
1216 |
-
|
1217 |
-
$input['deactivation_delete'] = (isset($input['deactivation_delete']) && in_array($input['deactivation_delete'], array_keys($this->choices)) ? ($input['deactivation_delete'] === 'yes' ? TRUE : FALSE) : $this->options['general']['deactivation_delete']);
|
1218 |
-
|
1219 |
-
$input['flush_rules'] = TRUE;
|
1220 |
-
$input['title'] = trim(sanitize_text_field($input['title']));
|
1221 |
-
|
1222 |
-
$time = (int)$input['time'];
|
1223 |
-
$input['time'] = ($time < 0 ? $this->defaults['general']['time'] : $time);
|
1224 |
-
}
|
1225 |
-
|
1226 |
-
return $input;
|
1227 |
-
}
|
1228 |
-
|
1229 |
-
|
1230 |
-
/**
|
1231 |
-
* Adds options menu
|
1232 |
-
*/
|
1233 |
-
public function admin_menu_options()
|
1234 |
-
{
|
1235 |
-
add_options_page(
|
1236 |
-
__('Math Captcha', 'math-captcha'),
|
1237 |
-
__('Math Captcha', 'math-captcha'),
|
1238 |
-
'manage_options',
|
1239 |
-
'math-captcha',
|
1240 |
-
array(&$this, 'options_page')
|
1241 |
-
);
|
1242 |
-
}
|
1243 |
-
|
1244 |
-
|
1245 |
-
/**
|
1246 |
-
* Shows options page
|
1247 |
-
*/
|
1248 |
-
public function options_page()
|
1249 |
-
{
|
1250 |
-
echo '
|
1251 |
-
<div class="wrap">'.screen_icon().'
|
1252 |
-
<h2>'.__('Math Captcha', 'math-captcha').'</h2>
|
1253 |
-
<div class="math-captcha-settings">
|
1254 |
-
<div class="df-credits">
|
1255 |
-
<h3 class="hndl">'.__('Math Captcha', 'math-captcha').'</h3>
|
1256 |
-
<div class="inside">
|
1257 |
-
<h4 class="inner">'.__('Need support?', 'math-captcha').'</h4>
|
1258 |
-
<p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'math-captcha').' <a href="http://dfactory.eu/support/" target="_blank" title="'.__('Support forum','math-captcha').'">'.__('Support forum', 'math-captcha').'</a></p>
|
1259 |
-
<hr />
|
1260 |
-
<h4 class="inner">'.__('Do you like this plugin?', 'math-captcha').'</h4>
|
1261 |
-
<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 />'.
|
1262 |
-
__('Blog about it & link to the', 'math-captcha').' <a href="http://dfactory.eu/plugins/math-captcha/" target="_blank" title="'.__('plugin page', 'math-captcha').'">'.__('plugin page', 'math-captcha').'</a><br />'.
|
1263 |
-
__('Check out our other', 'math-captcha').' <a href="http://dfactory.eu/plugins/" target="_blank" title="'.__('WordPress plugins', 'math-captcha').'">'.__('WordPress plugins', 'math-captcha').'</a>
|
1264 |
-
</p>
|
1265 |
-
<hr />
|
1266 |
-
<p class="df-link inner">Created by <a href="http://www.dfactory.eu" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.plugins_url('/images/logo-dfactory.png' , __FILE__ ).'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
|
1267 |
-
</div>
|
1268 |
-
</div>
|
1269 |
-
<form action="options.php" method="post">';
|
1270 |
|
1271 |
-
|
1272 |
-
settings_fields('math_captcha_options');
|
1273 |
-
do_settings_sections('math_captcha_options');
|
1274 |
-
submit_button('', 'primary', 'save_math_captcha_options', TRUE);
|
1275 |
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
}
|
1282 |
|
|
|
1283 |
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
{
|
1291 |
-
wp_enqueue_script(
|
1292 |
-
'math-captcha',
|
1293 |
-
plugins_url('/js/admin.js', __FILE__),
|
1294 |
-
array('jquery', 'jquery-ui-core', 'jquery-ui-button')
|
1295 |
);
|
1296 |
-
|
1297 |
-
wp_enqueue_style('math-captcha-admin', plugins_url('/css/admin.css', __FILE__));
|
1298 |
-
wp_enqueue_style('math-captcha-wplike', plugins_url('/css/wp-like-ui-theme.css', __FILE__));
|
1299 |
}
|
1300 |
}
|
1301 |
|
1302 |
|
1303 |
/**
|
1304 |
-
* Enqueues scripts and styles (
|
1305 |
*/
|
1306 |
-
public function
|
1307 |
{
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
|
|
1311 |
|
1312 |
-
|
1313 |
-
* Loads textdomain
|
1314 |
-
*/
|
1315 |
-
public function load_textdomain()
|
1316 |
-
{
|
1317 |
-
load_plugin_textdomain('math-captcha', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
|
1318 |
}
|
1319 |
|
1320 |
|
@@ -1361,4 +228,19 @@ EOT;
|
|
1361 |
return $links;
|
1362 |
}
|
1363 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1364 |
?>
|
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.0
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/math-captcha/
|
21 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22 |
*/
|
23 |
|
|
|
24 |
|
25 |
+
if(!defined('ABSPATH')) exit;
|
26 |
+
|
27 |
+
define('MATH_CAPTCHA_URL', plugins_url('', __FILE__));
|
28 |
+
define('MATH_CAPTCHA_PATH', plugin_dir_path(__FILE__));
|
29 |
+
define('MATH_CAPTCHA_REL_PATH', dirname(plugin_basename(__FILE__)).'/');
|
30 |
+
|
31 |
+
include_once(MATH_CAPTCHA_PATH.'includes/class-cookie-session.php');
|
32 |
+
include_once(MATH_CAPTCHA_PATH.'includes/class-update.php');
|
33 |
+
include_once(MATH_CAPTCHA_PATH.'includes/class-core.php');
|
34 |
+
include_once(MATH_CAPTCHA_PATH.'includes/class-settings.php');
|
35 |
+
|
36 |
|
37 |
class Math_Captcha
|
38 |
{
|
39 |
+
private static $_instance;
|
40 |
+
public $core;
|
41 |
+
public $cookie_session;
|
42 |
+
public $options;
|
43 |
+
public $defaults = array(
|
44 |
'general' => array(
|
45 |
'enable_for' => array(
|
46 |
+
'login_form' => false,
|
47 |
+
'registration_form' => true,
|
48 |
+
'reset_password_form' => true,
|
49 |
+
'comment_form' => true,
|
50 |
+
'bbpress' => false,
|
51 |
+
'contact_form_7' => false
|
52 |
),
|
53 |
+
'block_direct_comments' => false,
|
54 |
+
'hide_for_logged_users' => true,
|
55 |
'title' => 'Math Captcha',
|
56 |
'mathematical_operations' => array(
|
57 |
+
'addition' => true,
|
58 |
+
'subtraction' => true,
|
59 |
+
'multiplication' => false,
|
60 |
+
'division' => false
|
61 |
),
|
62 |
'groups' => array(
|
63 |
+
'numbers' => true,
|
64 |
+
'words' => false
|
65 |
),
|
66 |
'time' => 300,
|
67 |
+
'deactivation_delete' => false,
|
68 |
+
'flush_rules' => false
|
69 |
),
|
70 |
+
'version' => '1.2.0'
|
71 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
|
74 |
+
public static function instance()
|
75 |
{
|
76 |
+
if(self::$_instance === null)
|
77 |
+
self::$_instance = new self();
|
78 |
|
79 |
+
return self::$_instance;
|
80 |
+
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
private function __clone() {}
|
84 |
+
private function __wakeup() {}
|
85 |
|
|
|
86 |
|
87 |
+
/**
|
88 |
+
*
|
89 |
+
*/
|
90 |
+
public function __construct()
|
91 |
+
{
|
92 |
+
register_activation_hook(__FILE__, array(&$this, 'activation'));
|
93 |
+
register_deactivation_hook(__FILE__, array(&$this, 'deactivation'));
|
94 |
+
|
95 |
+
// settings
|
96 |
+
$this->options = array(
|
97 |
+
'general' => array_merge($this->defaults['general'], get_option('math_captcha_options', $this->defaults['general']))
|
98 |
+
);
|
99 |
+
|
100 |
+
// actions
|
101 |
add_action('plugins_loaded', array(&$this, 'load_textdomain'));
|
|
|
|
|
|
|
|
|
|
|
102 |
add_action('admin_enqueue_scripts', array(&$this, 'admin_comments_scripts_styles'));
|
103 |
+
add_action('wp_enqueue_scripts', array(&$this, 'frontend_comments_scripts_styles'));
|
104 |
+
add_action('login_enqueue_scripts', array(&$this, 'frontend_comments_scripts_styles'));
|
105 |
|
106 |
+
// filters
|
107 |
add_filter('plugin_action_links', array(&$this, 'plugin_settings_link'), 10, 2);
|
108 |
add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
|
111 |
|
124 |
*/
|
125 |
public function deactivation()
|
126 |
{
|
127 |
+
if($this->options['general']['deactivation_delete'])
|
|
|
128 |
delete_option('math_captcha_options');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
130 |
|
131 |
|
132 |
/**
|
133 |
+
* Loads textdomain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
*/
|
135 |
+
public function load_textdomain()
|
136 |
{
|
137 |
+
load_plugin_textdomain('math-captcha', false, MATH_CAPTCHA_REL_PATH.'languages/');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
|
141 |
/**
|
142 |
+
* Enqueues scripts and styles (admin)
|
143 |
*/
|
144 |
+
public function admin_comments_scripts_styles($page)
|
145 |
{
|
146 |
+
if($page === 'settings_page_math-captcha')
|
147 |
{
|
148 |
+
wp_register_style(
|
149 |
+
'math-captcha-admin',
|
150 |
+
MATH_CAPTCHA_URL.'/css/admin.css'
|
151 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
|
153 |
+
wp_enqueue_style('math-captcha-admin');
|
|
|
|
|
|
|
154 |
|
155 |
+
wp_register_script(
|
156 |
+
'math-captcha-admin-settings',
|
157 |
+
MATH_CAPTCHA_URL.'/js/admin-settings.js',
|
158 |
+
array('jquery')
|
159 |
+
);
|
|
|
160 |
|
161 |
+
wp_enqueue_script('math-captcha-admin-settings');
|
162 |
|
163 |
+
wp_localize_script(
|
164 |
+
'math-captcha-admin-settings',
|
165 |
+
'mcArgsSettings',
|
166 |
+
array(
|
167 |
+
'resetToDefaults' => __('Are you sure you want to reset these settings to defaults?', 'math-captcha')
|
168 |
+
)
|
|
|
|
|
|
|
|
|
|
|
169 |
);
|
|
|
|
|
|
|
170 |
}
|
171 |
}
|
172 |
|
173 |
|
174 |
/**
|
175 |
+
* Enqueues scripts and styles (frontend)
|
176 |
*/
|
177 |
+
public function frontend_comments_scripts_styles($page)
|
178 |
{
|
179 |
+
wp_register_style(
|
180 |
+
'math-captcha-frontend',
|
181 |
+
MATH_CAPTCHA_URL.'/css/frontend.css'
|
182 |
+
);
|
183 |
|
184 |
+
wp_enqueue_style('math-captcha-frontend');
|
|
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
|
228 |
return $links;
|
229 |
}
|
230 |
}
|
231 |
+
|
232 |
+
|
233 |
+
function Math_Captcha()
|
234 |
+
{
|
235 |
+
static $instance;
|
236 |
+
|
237 |
+
// first call to instance() initializes the plugin
|
238 |
+
if($instance === null || !($instance instanceof Math_Captcha))
|
239 |
+
$instance = Math_Captcha::instance();
|
240 |
+
|
241 |
+
return $instance;
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
Math_Captcha();
|
246 |
?>
|