PluginProbe
Captcha Code / 3.0
Captcha Code v3.0
trunk 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.31 3.32
← All changes | wpCaptcha.php +1170 -367 2.83.0 View file →
@@ -1,433 +1,1236 @@
1 1 <?php
2 2 /*
3 3 Plugin Name: Captcha Code
4 4 Description: Adds captcha to front-end forms.
5 -Version: 2.8
5 +Version: 3.0
6 6 Author: WebFactory Ltd
7 -Author URI: http://www.webfactoryltd.com/
8 -Text Domain: captcha-code-authentication
9 -Domain Path: /languages
7 +Author URI: https://www.webfactoryltd.com/
10 8 License: GPL2
11 9
12 - This program is free software; you can redistribute it and/or modify
13 - it under the terms of the GNU General Public License, version 2, as
14 - published by the Free Software Foundation.
10 +This program is free software; you can redistribute it and/or modify
11 +it under the terms of the GNU General Public License, version 2, as
12 +published by the Free Software Foundation.
15 13
16 - This program is distributed in the hope that it will be useful,
17 - but WITHOUT ANY WARRANTY; without even the implied warranty of
18 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 - GNU General Public License for more details.
14 +This program is distributed in the hope that it will be useful,
15 +but WITHOUT ANY WARRANTY; without even the implied warranty of
16 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 +GNU General Public License for more details.
20 18
21 - You should have received a copy of the GNU General Public License
22 - along with this program; if not, write to the Free Software
23 - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 +You should have received a copy of the GNU General Public License
20 +along with this program; if not, write to the Free Software
21 +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 22 */
25 23
26 -define('WP_CAPTCHA_DIR_URL', plugin_dir_url(__FILE__));
27 -define('WP_CAPTCHA_DIR', dirname(__FILE__));
24 +define('WP_CAPTCHA_CODE_URL', plugin_dir_url(__FILE__));
25 +define('WP_CAPTCHA_CODE_DIR', dirname(__FILE__));
26 +define('WP_CAPTCHA_CODE_OPTIONS', 'wp_captcha_code_options');
28 27
29 -require 'general_options.php';
28 +require_once WP_CAPTCHA_CODE_DIR . '/wf-flyout/wf-flyout.php';
30 29
31 -/* Hook to initalize the admin menu */
32 -add_action('admin_menu', 'wp_captcha_admin_menu');
33 -/* Hook to initialize sessions */
34 -add_action('init', 'wp_captcha_init_sessions');
30 +class WP_Captcha_Code
31 +{
32 + static $version;
33 + static $options;
35 34
36 -/* Hook to store the plugin status */
37 -register_activation_hook(__FILE__, 'wp_captcha_enabled');
38 -register_deactivation_hook(__FILE__, 'wp_captcha_disabled');
35 + static function init()
36 + {
37 + self::$version = self::get_plugin_version();
38 + $options = self::load_options();
39 39
40 -function wp_captcha_enabled()
41 -{
42 - update_option('wpcaptcha_status', 'enabled');
43 -}
44 -function wp_captcha_disabled()
45 -{
46 - update_option('wpcaptcha_status', 'disabled');
47 -}
40 + if (!session_id()) {
41 + @session_start();
42 + }
48 43
49 -/* To add the menus in the admin section */
50 -function wp_captcha_admin_menu()
51 -{
44 + if (is_admin()) {
45 + new wf_flyout(__FILE__);
46 +
47 + add_action('admin_menu', array(__CLASS__, 'admin_menu'));
48 + add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
49 + add_action('admin_action_wp_captcha_code_install_wp301', array(__CLASS__, 'install_wp301'));
50 + add_filter('admin_footer_text', array(__CLASS__, 'admin_footer_text'));
51 + add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(__CLASS__, 'plugin_action_links'));
52 + } else {
53 + if ($options['show_login'] == 'yes') {
54 + add_action('login_form', array(__CLASS__, 'captcha_for_login'));
55 + add_filter('login_errors', array(__CLASS__, 'captcha_login_errors'));
56 + add_filter('login_redirect', array(__CLASS__, 'captcha_login_redirect'), 10, 3);
57 + }
58 +
59 + if ($options['show_comments'] == 'yes') {
60 + add_action('comment_form_after_fields', array(__CLASS__, 'captcha_comment_form'), 1);
61 + add_action('comment_form_logged_in_after', array(__CLASS__, 'captcha_comment_form'), 1);
62 + add_filter('preprocess_comment', array(__CLASS__, 'captcha_comment_post'));
63 + }
64 +
65 + if ($options['show_registration'] == 'yes') {
66 + add_action('register_form', array(__CLASS__, 'wp_captcha_register'));
67 + add_action('register_post', array(__CLASS__, 'captcha_register_post'), 10, 3);
68 + add_action('signup_extra_fields', array(__CLASS__, 'wp_captcha_register'));
69 + add_filter('wpmu_validate_user_signup', array(__CLASS__, 'captcha_register_validate'));
70 + }
71 +
72 + if ($options['show_lost_password'] == 'yes') {
73 + add_action('lostpassword_form', array(__CLASS__, 'captcha_lostpassword'));
74 + add_action('lostpassword_post', array(__CLASS__, 'captcha_lostpassword_post'), 10, 3);
75 + }
76 + }
77 + } // init
78 +
79 +
80 + // add settings link to plugins page
81 + static function plugin_action_links($links)
82 + {
83 + $settings_link = '<a href="' . admin_url('options-general.php?page=captcha-code-authentication') . '" title="Configure Captcha">Configure Captcha</a>';
84 + $pro_link = '<a href="' . admin_url('options-general.php?page=captcha-code-authentication#get-pro') . '" title="Get PRO"><b>Get PRO</b></a>';
85 +
86 + array_unshift($links, $settings_link);
87 + array_unshift($links, $pro_link);
88 +
89 + return $links;
90 + } // plugin_action_links
91 +
92 + static function admin_enqueue_scripts($hook)
93 + {
94 + if ('settings_page_captcha-code-authentication' == $hook) {
95 + wp_enqueue_style('wp-jquery-ui-dialog');
96 + wp_enqueue_style('wp-captcha-code-admin', WP_CAPTCHA_CODE_URL . 'css/wp-captcha-code.css', array(), self::$version);
97 +
98 + wp_enqueue_script('jquery-ui-core');
99 + wp_enqueue_script('jquery-ui-position');
100 + wp_enqueue_script('jquery-effects-core');
101 + wp_enqueue_script('jquery-effects-blind');
102 + wp_enqueue_script('jquery-ui-dialog');
103 +
104 + $js_localize = array(
105 + 'wp301_install_url' => add_query_arg(array('action' => 'wp_captcha_code_install_wp301', '_wpnonce' => wp_create_nonce('install_wp301'), 'rnd' => rand()), admin_url('admin.php'))
106 + );
107 + wp_enqueue_script('wp-captcha-code-admin', WP_CAPTCHA_CODE_URL . 'js/wp-captcha-code.js', array('jquery'), self::$version, true);
108 + wp_localize_script('wp-captcha-code-admin', 'wp_captcha_code_vars', $js_localize);
109 + }
110 + } // admin_enqueue_scripts
111 +
112 + static function is_plugin_page()
113 + {
114 + $current_screen = get_current_screen();
115 +
116 + if ($current_screen->id == 'settings_page_captcha-code-authentication') {
117 + return true;
118 + } else {
119 + return false;
120 + }
121 + } // is_plugin_page
122 +
123 + static function admin_footer_text($text)
124 + {
125 + if (!self::is_plugin_page()) {
126 + return $text;
127 + }
128 +
129 + $text = '<i class="wp-captcha-code-footer">Captcha Code v' . self::$version . ' <a href="' . self::generate_web_link('admin_footer') . '" title="Visit WP Captcha page for more info" target="_blank">WebFactory Ltd</a>. Please <a target="_blank" href="https://wordpress.org/support/plugin/captcha-code-authentication/reviews/#new-post" title="Rate the plugin">rate the plugin <span>★★★★★</span></a> to help us spread the word. Thank you 🙌 from the WebFactory team!</i>';
130 +
131 + return $text;
132 + } // admin_footer_text
133 +
134 + static function generate_web_link($placement = '', $page = '/', $params = array(), $anchor = '')
135 + {
136 + $base_url = 'https://getwpcaptcha.com';
137 +
138 + if ('/' != $page) {
139 + $page = '/' . trim($page, '/') . '/';
140 + }
141 + if ($page == '//') {
142 + $page = '/';
143 + }
144 +
145 + $parts = array_merge(array('utm_source' => 'captcha-code-authentication', 'utm_content' => $placement), $params);
146 +
147 + if (!empty($anchor)) {
148 + $anchor = '#' . trim($anchor, '#');
149 + }
150 +
151 + $out = $base_url . $page . '?' . http_build_query($parts, '', '&amp;') . $anchor;
152 +
153 + return $out;
154 + } // generate_web_link
155 +
156 + static function load_options()
157 + {
158 + $options = get_option(WP_CAPTCHA_CODE_OPTIONS, array());
159 + $change = false;
160 +
161 + if (!isset($options['meta'])) {
162 + $options['meta'] = array('first_version' => self::$version, 'first_install' => current_time('timestamp', true));
163 + $change = true;
164 + }
165 + if (!isset($options['dismissed_notices'])) {
166 + $options['dismissed_notices'] = array();
167 + $change = true;
168 + }
169 +
170 + if (!isset($options['options'])) {
171 + $options['options'] = array();
172 +
173 + $options['options']['show_login'] = get_option('wpcaptcha_login') !== false ? get_option('wpcaptcha_login') : 'yes';
174 + $options['options']['show_registration'] = get_option('wpcaptcha_register') !== false ? get_option('wpcaptcha_register') : 'yes';
175 + $options['options']['show_lost_password'] = get_option('wpcaptcha_lost') !== false ? get_option('wpcaptcha_lost') : 'yes';
176 + $options['options']['show_comments'] = get_option('wpcaptcha_comments') !== false ? get_option('wpcaptcha_comments') : 'yes';
177 + $options['options']['show_logged_in'] = get_option('wpcaptcha_registered') !== false ? get_option('wpcaptcha_registered') : 'no';
178 + $options['options']['captcha_type'] = get_option('wpcaptcha_type') !== false ? get_option('wpcaptcha_type') : 'alphanumeric';
179 + $options['options']['captcha_letters'] = get_option('wpcaptcha_letters') !== false ? get_option('wpcaptcha_letters') : 'capital';
180 + $options['options']['total_no_of_characters'] = get_option('wpcaptcha_total_no_of_characters') !== false ? get_option('wpcaptcha_total_no_of_characters') : 3;
181 +
182 + $change = true;
183 + }
184 +
185 + if (isset($_POST['submit'])) {
186 + if (!isset($_POST['wpcatpcha_update_admin_options_nonce']) || !wp_verify_nonce($_POST['wpcatpcha_update_admin_options_nonce'], 'wpcatpcha_update_admin_options')) {
187 + echo '<div id="message" class="updated fade">
188 + <p><strong>' . esc_html__('Sorry, your nonce did not verify.', 'captcha-code-authentication') . '</strong></p>
189 + </div>';
190 + } else {
191 + if (isset($_POST['captcha_show_login'])) {
192 + $options['options']['show_login'] = sanitize_text_field($_POST['captcha_show_login']);
193 + }
194 +
195 + if (isset($_POST['captcha_show_registration'])) {
196 + $options['options']['show_registration'] = sanitize_text_field($_POST['captcha_show_registration']);
197 + }
198 +
199 + if (isset($_POST['captcha_show_lost'])) {
200 + $options['options']['show_lost_password'] = sanitize_text_field($_POST['captcha_show_lost']);
201 + }
202 +
203 + if (isset($_POST['captcha_show_comments'])) {
204 + $options['options']['show_comments'] = sanitize_text_field($_POST['captcha_show_comments']);
205 + }
206 +
207 + if (isset($_POST['captcha_show_logged_in'])) {
208 + $options['options']['show_logged_in'] = sanitize_text_field($_POST['captcha_show_logged_in']);
209 + }
210 +
211 + if (isset($_POST['captcha_type'])) {
212 + $options['options']['captcha_type'] = sanitize_text_field($_POST['captcha_type']);
213 + }
214 +
215 + if (isset($_POST['captcha_letters'])) {
216 + $options['options']['captcha_letters'] = sanitize_text_field($_POST['captcha_letters']);
217 + }
218 +
219 + if (isset($_POST['total_no_of_characters'])) {
220 + $options['options']['total_no_of_characters'] = sanitize_text_field($_POST['total_no_of_characters']);
221 + }
222 +
223 + $change = true;
224 +
225 + echo '<div id="message" class="updated fade">
226 + <p><strong>' . esc_html__('Options saved.', 'captcha-code-authentication') . '</strong></p>
227 + </div>';
228 + }
229 + }
230 +
231 +
232 + if ($change) {
233 + update_option(WP_CAPTCHA_CODE_OPTIONS, $options, true);
234 + }
235 +
236 + self::$options = $options;
237 + return $options['options'];
238 + } // load_options
239 +
240 + static function get_options()
241 + {
242 + return self::$options['options'];
243 + } // get_options
244 +
245 + static function update_options($key, $data)
246 + {
247 + if (false === in_array($key, array('meta', 'dismissed_notices', 'options'))) {
248 + user_error('Unknown options key.', E_USER_ERROR);
249 + return false;
250 + }
251 +
252 + self::$options[$key] = $data;
253 + $tmp = update_option(WP_CAPTCHA_CODE_OPTIONS, self::$options);
254 +
255 + return $tmp;
256 + } // update_options
257 +
258 + static function get_plugin_version()
259 + {
260 + $plugin_data = get_file_data(__FILE__, array('version' => 'Version'), 'plugin');
261 +
262 + return $plugin_data['version'];
263 + } // get_plugin_version
264 +
265 + static function admin_menu()
266 + {
52 267 add_options_page(
53 - __('Captcha Settings'),
54 - __('Captcha Settings'),
55 - 'manage_options',
56 - 'wp_captcha_slug',
57 - 'wp_captcha_general_options');
58 -}
268 + esc_html__('Captcha'),
269 + esc_html__('Captcha'),
270 + 'manage_options',
271 + 'captcha-code-authentication',
272 + array(__CLASS__, 'options_page')
273 + );
274 + } // admin_menu
59 275
60 -function wp_captcha_init_sessions()
61 -{
62 - if(!session_id()){
63 - session_start();
64 - }
65 - load_plugin_textdomain('captcha-code-authentication', false, dirname( plugin_basename(__FILE__)).'/languages');
66 -}
276 + static function captcha_for_login()
277 + {
278 + echo '<p class="login-form-captcha">
279 + <label><b>' . esc_html__('Captcha', 'captcha-code-authentication') . ' </b> <span class="required">*</span></label>
280 + <div style="clear:both;"></div><div style="clear:both;"></div>';
281 + self::generate_captcha_image();
67 282
68 -/* Captcha for login authentication starts here */
283 + if (isset($_GET['captcha']) && $_GET['captcha'] == 'confirm_error') {
284 + echo '<label style="color:#FF0000;" id="capt_err">' . esc_html($_SESSION['captcha_error']) . '</label><div style="clear:both;"></div>';;
285 + $_SESSION['captcha_error'] = '';
286 + }
69 287
70 -$login_captcha = get_option('wpcaptcha_login');
71 -if($login_captcha == 'yes'){
72 - add_action('login_form', 'include_ctl_captcha_for_login');
73 - add_filter( 'login_errors', 'include_ctl_captcha_login_errors' );
74 - add_filter( 'login_redirect', 'include_ctl_captcha_login_redirect', 10, 3 );
75 -}
288 + echo '<label>' . esc_html__('Type the text displayed above', 'captcha-code-authentication') . ':</label>
289 + <input id="captcha_code" name="captcha_code" size="15" type="text" tabindex="30" />
290 + </p>';
291 + return true;
292 + } // captcha_for_login
76 293
77 -/* Function to include captcha for login form */
78 -function include_ctl_captcha_for_login()
79 -{
80 - echo '<p class="login-form-captcha">
81 - <label><b>'. __('Captcha', 'captcha-code-authentication').' </b> <span class="required">*</span></label>
82 - <div style="clear:both;"></div><div style="clear:both;"></div>';
83 - ctl_captcha_generate_code();
84 -
85 - /* Will retrieve the get varibale and prints a message from url if the captcha is wrong */
86 - if(isset($_GET['captcha']) && $_GET['captcha'] == 'confirm_error' ) {
87 - echo '<label style="color:#FF0000;" id="capt_err">'.esc_html($_SESSION['captcha_error']).'</label><div style="clear:both;"></div>';;
88 - $_SESSION['captcha_error'] = '';
89 - }
90 -
91 - echo '<label>'.__('Type the text displayed above', 'captcha-code-authentication').':</label>
92 - <input id="captcha_code" name="captcha_code" size="15" type="text" tabindex="30" />
93 - </p>';
94 - return true;
95 -}
294 + static function captcha_login_errors($errors)
295 + {
296 + if (isset($_REQUEST['action']) && 'register' == sanitize_text_field($_REQUEST['action'])) {
297 + return ($errors);
298 + }
96 299
97 -/* Hook to find out the errors while logging in */
98 -function include_ctl_captcha_login_errors($errors)
99 -{
100 - if( isset( $_REQUEST['action'] ) && 'register' == $_REQUEST['action'] )
101 - return($errors);
102 -
103 - if(esc_html($_SESSION['captcha_code']) != $_REQUEST['captcha_code']){
104 - return $errors.'<label id="capt_err" for="captcha_code_error">'.__('Captcha confirmation error!', 'captcha-code-authentication').'</label>';
105 - }
106 - return $errors;
107 -}
300 + if (esc_html($_SESSION['captcha_code']) != sanitize_text_field($_REQUEST['captcha_code'])) {
301 + return $errors . '<label id="capt_err" for="captcha_code_error">' . esc_html__('Captcha confirmation error!', 'captcha-code-authentication') . '</label>';
302 + }
303 + return $errors;
304 + } // captcha_login_errors
108 305
109 -/* Hook to redirect after captcha confirmation */
110 -function include_ctl_captcha_login_redirect($url)
111 -{
112 -
113 - /* Captcha mismatch */
114 - if(isset($_SESSION['captcha_code']) && isset($_REQUEST['captcha_code']) && esc_html($_SESSION['captcha_code']) != $_REQUEST['captcha_code']){
115 - $_SESSION['captcha_error'] = __('Incorrect captcha confirmation!', 'captcha-code-authentication');
116 - wp_clear_auth_cookie();
117 - return $_SERVER["REQUEST_URI"]."/?captcha='confirm_error'";
118 - }
119 - /* Captcha match: take to the admin panel */
120 - else{
121 - return home_url('/wp-admin/');
122 - }
123 -}
306 + static function captcha_login_redirect($url)
307 + {
308 + /* Captcha mismatch */
309 + if (empty($_REQUEST['captcha_code']) || (isset($_SESSION['captcha_code']) && esc_html($_SESSION['captcha_code']) != sanitize_text_field($_REQUEST['captcha_code']))) {
310 + $_SESSION['captcha_error'] = esc_html__('Incorrect captcha confirmation!', 'captcha-code-authentication');
311 + wp_clear_auth_cookie();
312 + return $_SERVER["REQUEST_URI"] . "/?captcha='confirm_error'";
313 + }
314 + /* Captcha match: take to the admin panel */ else {
315 + return home_url('/wp-admin/');
316 + }
317 + } // captcha_login_redirect
124 318
125 -/* <!-- Captcha for login authentication ends here --> */
319 + static function captcha_comment_form()
320 + {
321 + $options = self::get_options();
126 322
127 -/* Captcha for Comments ends here */
128 -$comment_captcha = get_option('wpcaptcha_comments');
129 -if($comment_captcha == 'yes')
130 -{
131 - global $wp_version;
132 - if( version_compare($wp_version,'3','>=') ) { // wp 3.0 +
133 - add_action( 'comment_form_after_fields', 'include_ctl_captcha_comment_form_wp3', 1 );
134 - add_action( 'comment_form_logged_in_after', 'include_ctl_captcha_comment_form_wp3', 1 );
135 - }
136 - // for WP before WP 3.0
137 - add_action( 'comment_form', 'include_ctl_captcha_comment_form' );
138 - add_filter( 'preprocess_comment', 'include_ctl_captcha_comment_post' );
139 -}
323 + if (is_user_logged_in() && $options['show_logged_in'] == 'yes') {
324 + return true;
325 + }
140 326
141 -/* Function to include captcha for comments form */
142 -function include_ctl_captcha_comment_form()
143 -{
144 - $c_registered = get_option('wpcaptcha_registered');
145 - if ( is_user_logged_in() && $c_registered == 'yes') {
146 - return true;
147 - }
148 - echo '<p class="comment-form-captcha">
149 - <label><b>'. __('Captcha', 'captcha-code-authentication').' </b><span class="required">*</span></label>
150 - <div style="clear:both;"></div><div style="clear:both;"></div>';
151 - ctl_captcha_generate_code();
152 - echo '<label>'.__('Type the text displayed above', 'captcha-code-authentication').':</label>
153 - <input id="captcha_code" name="captcha_code" size="15" type="text" />
154 - <div style="clear:both;"></div>
155 - </p>';
156 - return true;
157 -}
327 + echo '<p class="comment-form-captcha">
328 + <label><b>' . esc_html__('Captcha', 'captcha-code-authentication') . ' </b><span class="required">*</span></label>
329 + <div style="clear:both;"></div><div style="clear:both;"></div>';
330 + self::generate_captcha_image();
331 + echo '<label>' . esc_html__('Type the text displayed above', 'captcha-code-authentication') . ':</label>
332 + <input id="captcha_code" name="captcha_code" size="15" type="text" />
333 + <div style="clear:both;"></div>
334 + </p>';
158 335
159 -/* Function to include captcha for comments form > wp3 */
160 -function include_ctl_captcha_comment_form_wp3()
161 -{
162 - $c_registered = get_option('wpcaptcha_registered');
163 - if ( is_user_logged_in() && $c_registered == 'yes') {
164 - return true;
165 - }
166 -
167 - echo '<p class="comment-form-captcha">
168 - <label><b>'. __('Captcha', 'captcha-code-authentication').' </b><span class="required">*</span></label>
169 - <div style="clear:both;"></div><div style="clear:both;"></div>';
170 - ctl_captcha_generate_code();
171 - echo '<label>'.__('Type the text displayed above', 'captcha-code-authentication').':</label>
172 - <input id="captcha_code" name="captcha_code" size="15" type="text" />
173 - <div style="clear:both;"></div>
174 - </p>';
175 -
176 - remove_action( 'comment_form', 'include_ctl_captcha_comment_form' );
177 -
178 - return true;
179 -}
336 + remove_action('comment_form', 'captcha_comment_form');
180 337
181 -// this function checks captcha posted with the comment
182 -function include_ctl_captcha_comment_post($comment)
183 -{
184 - $c_registered = get_option('wpcaptcha_registered');
185 - if (is_user_logged_in() && $c_registered == 'yes') {
186 - return $comment;
187 - }
338 + return true;
339 + } // captcha_comment_form
188 340
189 - // skip captcha for comment replies from the admin menu
190 - if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'replyto-comment' &&
191 - ( check_ajax_referer( 'replyto-comment', '_ajax_nonce', false ) || check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment', false ) ) ) {
192 - // skip capthca
193 - return $comment;
194 - }
341 + static function captcha_comment_post($comment)
342 + {
343 + $options = self::get_options();
195 344
196 - // Skip captcha for trackback or pingback
197 - if ( $comment['comment_type'] != '' && $comment['comment_type'] != 'comment' ) {
198 - // skip captcha
199 - return $comment;
200 - }
201 -
202 - // If captcha is empty
203 - if(empty($_REQUEST['captcha_code']))
204 - wp_die( __('CAPTCHA cannot be empty.', 'captcha-code-authentication' ) );
345 + if (is_user_logged_in() && $options['show_logged_in'] == 'yes') {
346 + return $comment;
347 + }
205 348
206 - // captcha was matched
207 - if($_SESSION['captcha_code'] == $_REQUEST['captcha_code']) return($comment);
208 - else wp_die( __('Error: Incorrect CAPTCHA. Press your browser\'s back button and try again.', 'captcha-code-authentication'));
209 -}
349 + // skip captcha for comment replies from the admin menu
350 + if (
351 + isset($_REQUEST['action']) && $_REQUEST['action'] == 'replyto-comment' &&
352 + (check_ajax_referer('replyto-comment', '_ajax_nonce', false) || check_ajax_referer('replyto-comment', '_ajax_nonce-replyto-comment', false))
353 + ) {
354 + // skip captcha
355 + return $comment;
356 + }
210 357
211 -/* <!-- Captcha for Comments authentication ends here --> */
358 + // Skip captcha for trackback or pingback
359 + if ($comment['comment_type'] != '' && $comment['comment_type'] != 'comment') {
360 + // skip captcha
361 + return $comment;
362 + }
212 363
213 -// Add captcha in the register form
214 -$register_captcha = get_option('wpcaptcha_register');
215 -if($register_captcha == 'yes')
216 -{
217 - add_action('register_form', 'include_ctl_wp_captcha_register');
218 - add_action( 'register_post', 'include_ctl_captcha_register_post', 10, 3 );
219 - add_action( 'signup_extra_fields', 'include_ctl_wp_captcha_register' );
220 - add_filter( 'wpmu_validate_user_signup', 'include_ctl_captcha_register_validate' );
221 -}
364 + // If captcha is empty
365 + if (empty($_REQUEST['captcha_code']))
366 + wp_die(esc_html__('CAPTCHA cannot be empty.', 'captcha-code-authentication'));
222 367
223 -/* Function to include captcha for register form */
224 -function include_ctl_wp_captcha_register($default)
225 -{
226 - echo '<p class="register-form-captcha">
227 - <label><b>'. __('Captcha', 'captcha-code-authentication').' </b><span class="required">*</span></label>
228 - <div style="clear:both;"></div><div style="clear:both;"></div>';
229 - ctl_captcha_generate_code();
230 - echo '<label>'.__('Type the text displayed above', 'captcha-code-authentication').':</label>
231 - <input id="captcha_code" name="captcha_code" size="15" type="text" />
232 - </p>';
233 - return true;
234 -}
368 + // captcha was matched
369 + if ($_SESSION['captcha_code'] == $_REQUEST['captcha_code']) {
370 + return ($comment);
371 + } else {
372 + wp_die(esc_html__('Error: Incorrect CAPTCHA. Press your browser\'s back button and try again.', 'captcha-code-authentication'));
373 + }
374 + } // captcha_comment_post
235 375
236 -/* This function checks captcha posted with registration */
237 -function include_ctl_captcha_register_post($login,$email,$errors)
238 -{
239 - // If captcha is blank - add error
240 - if ( isset( $_REQUEST['captcha_code'] ) && "" == $_REQUEST['captcha_code'] )
241 - {
242 - $errors->add('captcha_blank', '<strong>'.__('ERROR', 'captcha-code-authentication').'</strong>: '.__('Please complete the CAPTCHA.', 'captcha-code-authentication'));
243 - return $errors;
244 - }
376 + static function wp_captcha_register($default)
377 + {
378 + echo '<p class="register-form-captcha">
379 + <label><b>' . esc_html__('Captcha', 'captcha-code-authentication') . ' </b><span class="required">*</span></label>
380 + <div style="clear:both;"></div><div style="clear:both;"></div>';
381 + self::generate_captcha_image();
382 + echo '<label>' . esc_html__('Type the text displayed above', 'captcha-code-authentication') . ':</label>
383 + <input id="captcha_code" name="captcha_code" size="15" type="text" />
384 + </p>';
385 + return true;
386 + } // wp_captcha_register
245 387
246 - if ( isset( $_REQUEST['captcha_code'] ) && ($_SESSION['captcha_code'] == $_REQUEST['captcha_code'] )) {
247 - // captcha was matched
248 - } else {
249 - $errors->add('captcha_wrong', '<strong>'.__('ERROR', 'captcha-code-authentication').'</strong>: '.__('That CAPTCHA was incorrect.', 'captcha-code-authentication'));
250 - }
251 - return($errors);
252 -}
253 -/* End of the function include_ctl_captcha_register_post */
388 + static function captcha_register_post($login, $email, $errors)
389 + {
390 + // If captcha is blank - add error
391 + if (isset($_REQUEST['captcha_code']) && "" == $_REQUEST['captcha_code']) {
392 + $errors->add('captcha_blank', '<strong>' . esc_html__('ERROR', 'captcha-code-authentication') . '</strong>: ' . esc_html__('Please complete the CAPTCHA.', 'captcha-code-authentication'));
393 + return $errors;
394 + }
254 395
255 -function include_ctl_captcha_register_validate($results)
256 -{
257 - if ( isset( $_REQUEST['captcha_code'] ) && "" == $_REQUEST['captcha_code'] ) {
258 - $results['errors']->add('captcha_blank', '<strong>'.__('ERROR', 'captcha-code-authentication').'</strong>: '.__('Please complete the CAPTCHA.', 'captcha-code-authentication'));
259 - return $results;
260 - }
396 + if (isset($_REQUEST['captcha_code']) && ($_SESSION['captcha_code'] == $_REQUEST['captcha_code'])) {
397 + // captcha was matched
398 + } else {
399 + $errors->add('captcha_wrong', '<strong>' . esc_html__('ERROR', 'captcha-code-authentication') . '</strong>: ' . esc_html__('That CAPTCHA was incorrect.', 'captcha-code-authentication'));
400 + }
401 + return ($errors);
402 + } // captcha_register_post
261 403
262 - if ( isset( $_REQUEST['captcha_code'] ) && ($_SESSION['captcha_code'] == $_REQUEST['captcha_code'] )) {
263 - // captcha was matched
264 - } else {
265 - $results['errors']->add('captcha_wrong', '<strong>'.__('ERROR', 'captcha-code-authentication').'</strong>: '.__('That CAPTCHA was incorrect.', 'captcha-code-authentication'));
266 - }
267 - return($results);
268 -}
269 -/* End of the function include_ctl_captcha_register_validate */
404 + static function captcha_register_validate($results)
405 + {
406 + if (isset($_REQUEST['captcha_code']) && "" == $_REQUEST['captcha_code']) {
407 + $results['errors']->add('captcha_blank', '<strong>' . esc_html__('ERROR', 'captcha-code-authentication') . '</strong>: ' . esc_html__('Please complete the CAPTCHA.', 'captcha-code-authentication'));
408 + return $results;
409 + }
270 410
271 -$lost_captcha = get_option('wpcaptcha_lost');
272 -// Add captcha into lost password form
273 -if($lost_captcha == 'yes'){
274 - add_action( 'lostpassword_form', 'include_ctl_captcha_lostpassword' );
275 - add_action( 'lostpassword_post', 'include_ctl_captcha_lostpassword_post', 10, 3 );
276 -}
411 + if (isset($_REQUEST['captcha_code']) && ($_SESSION['captcha_code'] == $_REQUEST['captcha_code'])) {
412 + // captcha was matched
413 + } else {
414 + $results['errors']->add('captcha_wrong', '<strong>' . esc_html__('ERROR', 'captcha-code-authentication') . '</strong>: ' . esc_html__('That CAPTCHA was incorrect.', 'captcha-code-authentication'));
415 + }
416 + return ($results);
417 + } // captcha_register_validate
277 418
278 -/* Function to include captcha for lost password form */
279 -function include_ctl_captcha_lostpassword($default)
280 -{
281 - echo '<p class="lost-form-captcha">
282 - <label><b>'. __('Captcha', 'captcha-code-authentication').' </b><span class="required">*</span></label>
283 - <div style="clear:both;"></div><div style="clear:both;"></div>';
284 - ctl_captcha_generate_code();
285 - echo '<label>'.__('Type the text displayed above', 'captcha-code-authentication').':</label>
286 - <input id="captcha_code" name="captcha_code" size="15" type="text" />
287 - </p>';
288 -}
419 + static function captcha_lostpassword($default)
420 + {
421 + echo '<p class="lost-form-captcha">
422 + <label><b>' . esc_html__('Captcha', 'captcha-code-authentication') . ' </b><span class="required">*</span></label>
423 + <div style="clear:both;"></div><div style="clear:both;"></div>';
424 + self::generate_captcha_image();
425 + echo '<label>' . esc_html__('Type the text displayed above', 'captcha-code-authentication') . ':</label>
426 + <input id="captcha_code" name="captcha_code" size="15" type="text" />
427 + </p>';
428 + } // captcha_lostpassword
289 429
290 -function include_wp_captcha_lostpassword_post() {
291 - if( isset( $_REQUEST['user_login'] ) && "" == $_REQUEST['user_login'] )
292 - return;
430 + static function captcha_lostpassword_post()
431 + {
432 + if (isset($_REQUEST['user_login']) && "" == $_REQUEST['user_login'])
433 + return;
293 434
294 - // If captcha doesn't entered
295 - if ( isset( $_REQUEST['captcha_code'] ) && "" == $_REQUEST['captcha_code'] ) {
296 - wp_die( __( 'Please complete the CAPTCHA.', 'captcha-code-authentication' ) );
297 - }
298 -
299 - // Check entered captcha
300 - if ( isset( $_REQUEST['captcha_code'] ) && ($_SESSION['captcha_code'] == $_REQUEST['captcha_code'] )) {
301 - return;
302 - } else {
303 - wp_die( __( 'Error: Incorrect CAPTCHA. Press your browser\'s back button and try again.', 'captcha-code-authentication' ) );
304 - }
305 -}
435 + // If captcha doesn't entered
436 + if (empty($_REQUEST['captcha_code'])) {
437 + wp_die(esc_html__('Please complete the CAPTCHA.', 'captcha-code-authentication'));
438 + }
306 439
307 -function ctl_captcha_generate_code()
308 -{
309 - //Settings: You can customize the captcha here
310 - $image_width = 120;
311 - $image_height = 40;
440 + // Check entered captcha
441 + if (isset($_REQUEST['captcha_code']) && ($_SESSION['captcha_code'] == $_REQUEST['captcha_code'])) {
442 + return;
443 + } else {
444 + wp_die(esc_html__('Error: Incorrect CAPTCHA. Press your browser\'s back button and try again.', 'captcha-code-authentication'));
445 + }
446 + } // captcha_lostpassword_post
312 447
313 - $characters_on_image = get_option('wpcaptcha_total_no_of_characters');
314 - if($characters_on_image < 3 || $characters_on_image > 6) $characters_on_image = 6;
448 + static function generate_captcha_image()
449 + {
450 + $image_width = 120;
451 + $image_height = 40;
315 452
316 - $wpcaptcha_type = get_option('wpcaptcha_type');
317 - $wpcaptcha_letters = get_option('wpcaptcha_letters');
453 + $options = self::get_options();
318 454
319 - $font = dirname(__FILE__) . '/monofont.ttf';
455 + $font = WP_CAPTCHA_CODE_DIR . '/css/monofont.ttf';
320 456
321 - //The characters that can be used in the CAPTCHA code.
322 - //avoid confusing characters (l 1 and i for example)
323 - if(!empty($wpcaptcha_type) && $wpcaptcha_type == 'alphanumeric')
324 - {
325 - switch($wpcaptcha_letters)
326 - {
327 - case 'capital':
328 - $possible_letters = '23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
329 - break;
330 - case 'small':
331 - $possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
332 - break;
333 - case 'capitalsmall':
334 - $possible_letters = '23456789bcdfghjkmnpqrstvwxyzABCEFGHJKMNPRSTVWXYZ';
335 - break;
336 - default:
337 - $possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
338 - break;
457 + if (!empty($options['captcha_type']) && $options['captcha_type'] == 'alphanumeric') {
458 + switch ($options['captcha_letters']) {
459 + case 'capital':
460 + $possible_letters = '23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
461 + break;
462 + case 'small':
463 + $possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
464 + break;
465 + case 'capitalsmall':
466 + $possible_letters = '23456789bcdfghjkmnpqrstvwxyzABCEFGHJKMNPRSTVWXYZ';
467 + break;
468 + default:
469 + $possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
470 + break;
471 + }
472 + } elseif (!empty($options['captcha_type']) && $options['captcha_type'] == 'alphabets') {
473 + switch ($options['captcha_letters']) {
474 + case 'capital':
475 + $possible_letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
476 + break;
477 + case 'small':
478 + $possible_letters = 'bcdfghjkmnpqrstvwxyz';
479 + break;
480 + case 'capitalsmall':
481 + $possible_letters = 'bcdfghjkmnpqrstvwxyzABCEFGHJKMNPRSTVWXYZ';
482 + break;
483 + default:
484 + $possible_letters = 'abcdefghijklmnopqrstuvwxyz';
485 + break;
486 + }
487 + } elseif (!empty($options['captcha_type']) && $options['captcha_type'] == 'numbers') {
488 + $possible_letters = '0123456789';
489 + } else {
490 + $possible_letters = '0123456789';
491 + }
492 + $random_dots = 0;
493 + $random_lines = 20;
494 + $captcha_text_color = "0x142864";
495 + $captcha_noice_color = "0x142864";
496 +
497 + $code = '';
498 +
499 + $i = 0;
500 + while ($i < $options['total_no_of_characters']) {
501 + $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters) - 1), 1);
502 + $i++;
503 + }
504 +
505 + $font_size = $image_height * 0.75;
506 + $image = @imagecreate($image_width, $image_height);
507 +
508 + /* setting the background, text and noise colours here */
509 + imagecolorallocate($image, 255, 255, 255);
510 +
511 + $arr_text_color = self::captcha_hexrgb($captcha_text_color);
512 + $text_color = imagecolorallocate(
513 + $image,
514 + $arr_text_color['red'],
515 + $arr_text_color['green'],
516 + $arr_text_color['blue']
517 + );
518 +
519 + $arr_noice_color = self::captcha_hexrgb($captcha_noice_color);
520 + $image_noise_color = imagecolorallocate(
521 + $image,
522 + $arr_noice_color['red'],
523 + $arr_noice_color['green'],
524 + $arr_noice_color['blue']
525 + );
526 +
527 + /* generating the dots randomly in background */
528 + for ($i = 0; $i < $random_dots; $i++) {
529 + imagefilledellipse($image, mt_rand(0, $image_width), mt_rand(0, $image_height), 2, 3, $image_noise_color);
530 + }
531 +
532 + /* generating lines randomly in background of image */
533 + for ($i = 0; $i < $random_lines; $i++) {
534 + imageline($image, mt_rand(0, $image_width), mt_rand(0, $image_height), mt_rand(0, $image_width), mt_rand(0, $image_height), $image_noise_color);
535 + }
536 +
537 + /* create a text box and add 6 letters code in it */
538 + $textbox = imagettfbbox($font_size, 0, $font, $code);
539 + $x = ($image_width - $textbox[4]) / 2;
540 + $y = ($image_height - $textbox[5]) / 2;
541 + imagettftext($image, $font_size, 0, (int)$x, (int)$y, $text_color, $font, $code);
542 +
543 + ob_start();
544 + imagejpeg($image); //showing the image
545 + echo '<img src="data:image/png;base64,' . esc_html(base64_encode(ob_get_clean())) . '" width="100">';
546 + imagedestroy($image); //destroying the image instance
547 + $_SESSION['captcha_code'] = $code;
548 + } // generate_captcha_image
549 +
550 + static function captcha_hexrgb($hexstr)
551 + {
552 + $int = hexdec($hexstr);
553 +
554 + return array(
555 + "red" => 0xFF & ($int >> 0x10),
556 + "green" => 0xFF & ($int >> 0x8),
557 + "blue" => 0xFF & $int
558 + );
559 + } // captcha_hexrgb
560 +
561 + static function create_select_options($options, $selected = null, $output = true)
562 + {
563 + $out = "\n";
564 +
565 + foreach ($options as $tmp) {
566 + if ((is_array($selected) && in_array($tmp['val'], $selected)) || $selected == $tmp['val']) {
567 + $out .= "<option selected=\"selected\" value=\"{$tmp['val']}\" " . (isset($tmp['class']) ? "class=\"{$tmp['class']}\"" : "") . ">{$tmp['label']}&nbsp;</option>\n";
568 + } else {
569 + $out .= "<option value=\"{$tmp['val']}\" " . (isset($tmp['class']) ? "class=\"{$tmp['class']}\"" : "") . ">{$tmp['label']}&nbsp;</option>\n";
570 + }
571 + }
572 +
573 + if ($output) {
574 + self::wp_kses_wf($out);
575 + } else {
576 + return $out;
577 + }
578 + } // create_select_options
579 +
580 + static function options_page()
581 + {
582 + $options = self::get_options();
583 +
584 + echo '<div class="wrap">';
585 + echo '<h1><img src="' . esc_url(WP_CAPTCHA_CODE_URL . '/images/wp-captcha-logo.png') . '" alt="WP Captcha PRO" title="WP Captcha PRO"></h1>';
586 + echo '<form method="post" action="">';
587 + echo '<div id="wp_captcha_code_settings">';
588 + wp_nonce_field('wpcatpcha_update_admin_options', 'wpcatpcha_update_admin_options_nonce');
589 + echo '<table class="form-table">';
590 + $captcha = array();
591 + $captcha[] = array('val' => 'builtin', 'label' => 'Built-in Captcha');
592 + $captcha[] = array('val' => 'icons', 'label' => 'Built-in Icon Captcha', 'class' => 'pro-option');
593 + $captcha[] = array('val' => 'recaptchav2', 'label' => 'Google reCAPTCHA v2', 'class' => 'pro-option');
594 + $captcha[] = array('val' => 'recaptchav3', 'label' => 'Google reCAPTCHA v3', 'class' => 'pro-option');
595 + $captcha[] = array('val' => 'hcaptcha', 'label' => 'hCaptcha', 'class' => 'pro-option');
596 + $captcha[] = array('val' => 'cloudflare', 'label' => 'Cloudflare Turnstile', 'class' => 'pro-option');
597 +
598 + echo '<tr valign="top">
599 + <th scope="row"><label for="captcha">Captcha:</label></th>
600 + <td><select id="cc-captcha" name="">';
601 + self::create_select_options($captcha, 'builtin');
602 + echo '</select>';
603 + echo '</td></tr>';
604 + echo '<tr valign="top">
605 + <th scope="row" style="width:260px;"><label for="captcha_letters">' . esc_html__('Select Captcha letters type', 'captcha-code-authentication') . ':</label></th>
606 + <td>
607 + <select id="captcha_letters" name="captcha_letters" style="margin:0;">
608 + <option value="capital" ' . ($options['captcha_letters'] == 'capital' ? 'selected="selected"' : '') . '>' . esc_html__('Capital letters only', 'captcha-code-authentication') . '</option>
609 + <option value="small" ' . ($options['captcha_letters'] == 'small' ? 'selected="selected"' : '') . '>' . esc_html__('Small letters only', 'captcha-code-authentication') . '</option>
610 + <option value="capitalsmall" ' . ($options['captcha_letters'] == 'capitalsmall' ? 'selected="selected"' : '') . '>' . esc_html__('Capital & Small letters', 'captcha-code-authentication') . '</option>
611 + </select>
612 + </td>
613 + </tr>
614 + <tr valign="top">
615 + <th scope="row"><label for="captcha_type">' . esc_html__('Select a Captcha type', 'captcha-code-authentication') . ':</label></th>
616 + <td>
617 + <select id="captcha_type" name="captcha_type" style="margin:0;">
618 + <option value="alphanumeric" ' . ($options['captcha_type'] == 'alphanumeric' ? 'selected="selected"' : '') . '>' . esc_html__('Alphanumeric', 'captcha-code-authentication') . '</option>
619 + <option value="alphabets" ' . ($options['captcha_type'] == 'alphabets' ? 'selected="selected"' : '') . '>' . esc_html__('Alphabets only', 'captcha-code-authentication') . '</option>
620 + <option value="numbers" ' . ($options['captcha_type'] == 'numbers' ? 'selected="selected"' : '') . '>' . esc_html__('Numbers only', 'captcha-code-authentication') . '</option>
621 + </select>
622 + </td>
623 + </tr>
624 + <tr valign="top">
625 + <th scope="row"><label for="total_no_of_characters">' . esc_html__('Total number of Captcha Characters', 'captcha-code-authentication') . ':</label></th>
626 + <td>
627 + <select id="total_no_of_characters" name="total_no_of_characters" style="margin:0;width: 50px;">';
628 + for ($i = 3; $i <= 6; $i++) {
629 + echo '<option value="' . intval($i) . '" ';
630 + if ($options['total_no_of_characters'] == $i) echo 'selected="selected"';
631 + echo '>' . intval($i) . '</option>';
632 + }
633 + echo '</select>
634 + </td>
635 + </tr>
636 + </table>
637 + <h3>' . esc_html__('Display Options', 'captcha-code-authentication') . '</h3>
638 + <table class="form-table">
639 + <tr valign="top">
640 + <th scope="row" style="width:260px;"><label for="captcha_show_login">' . esc_html__("Enable Captcha for Login form", "captcha-code-authentication") . ':</label></th>
641 + <td>
642 + <select name="captcha_show_login" id="captcha_show_login" style="width:75px;margin:0;">
643 + <option value="yes" ' . ($options['show_login'] == 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('Yes', 'captcha-code-authentication') . '</option>
644 + <option value="no" ' . ($options['show_login'] != 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('No', 'captcha-code-authentication') . '</option>
645 + </select>
646 + </td>
647 + </tr>
648 + <tr valign="top">
649 + <th scope="row"><label for="captcha_show_registration">' . esc_html__('Enable Captcha for Register form', 'captcha-code-authentication') . ':</label></th>
650 + <td>
651 + <select name="captcha_show_registration" id="captcha_show_registration" style="width:75px;margin:0;">
652 + <option value="yes" ' . ($options['show_registration'] == 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('Yes', 'captcha-code-authentication') . '</option>
653 + <option value="no" ' . ($options['show_registration'] != 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('No', 'captcha-code-authentication') . '</option>
654 + </select>
655 + </td>
656 + </tr>
657 + <tr valign="top">
658 + <th scope="row"><label for="captcha_show_lost_password">' . esc_html__('Enable Captcha for Lost Password form', 'captcha-code-authentication') . ':</label></th>
659 + <td>
660 + <select name="captcha_show_lost_password" id="captcha_show_lost_password" style="width:75px;margin:0;">
661 + <option value="yes" ' . ($options['show_lost_password'] == 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('Yes', 'captcha-code-authentication') . '</option>
662 + <option value="no" ' . ($options['show_lost_password'] != 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('No', 'captcha-code-authentication') . '</option>
663 + </select>
664 + </td>
665 + </tr>
666 + <tr valign="top">
667 + <th scope="row"><label for="captcha_show_comments">' . esc_html__('Enable Captcha for Comments form', 'captcha-code-authentication') . ':</label></th>
668 + <td>
669 + <select name="captcha_show_comments" id="captcha_show_comments" style="width:75px;margin:0;">
670 + <option value="yes" ' . ($options['show_comments'] == 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('Yes', 'captcha-code-authentication') . '</option>
671 + <option value="no" ' . ($options['show_comments'] != 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('No', 'captcha-code-authentication') . '</option>
672 + </select>
673 + </td>
674 + </tr>
675 + <tr valign="top">
676 + <th scope="row"><label for="captcha_show_logged_in">' . esc_html__('Hide Captcha for logged in users', 'captcha-code-authentication') . ':</label></th>
677 + <td>
678 + <select name="captcha_show_logged_in" id="captcha_show_logged_in" style="width:75px;margin:0;">
679 + <option value="yes" ' . ($options['show_logged_in'] == 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('Yes', 'captcha-code-authentication') . '</option>
680 + <option value="no" ' . ($options['show_logged_in'] != 'yes' ? 'selected="selected"' : '') . '>' . esc_html__('No', 'captcha-code-authentication') . '</option>
681 + </select>
682 + </td>
683 + </tr>
684 + <tr height="60">
685 + <td>';
686 + submit_button();
687 + echo '</td>
688 + <td></td>
689 + </tr>
690 + </table>';
691 +
692 + echo '</div>';
693 +
694 + echo '<div id="wp_captcha_code_sidebar">';
695 + echo '<div class="sidebar-box pro-ad-box">
696 + <p class="text-center"><a href="#" data-pro-feature="cc-sidebar-box-logo" class="open-pro-dialog">
697 + <img src="' . esc_url(WP_CAPTCHA_CODE_URL . '/images/wp-captcha-logo.png') . '" alt="WP Captcha PRO" title="WP Captcha PRO"></a><br><b>PRO version is here! Grab the launch discount.</b></p>
698 + <ul class="plain-list">
699 + <li>7 Types of Captcha + GDPR Compatibility</li>
700 + <li>Login Page Customization - Visual &amp; URL</li>
701 + <li>Advanced Login Page Protection</li>
702 + <li>Email Based Two Factor Authentication (2FA)</li>
703 + <li>Advanced Firewall + Cloud Blacklists</li>
704 + <li>Country Blocking (whitelist &amp; blacklist)</li>
705 + <li>Temporary Access Links</li>
706 + <li>Recovery URL - You Can Never Get Locked Out</li>
707 + <li>Licenses &amp; Sites Manager (remote SaaS dashboard)</li>
708 + <li>White-label Mode</li>
709 + <li>Complete Codeless Plugin Rebranding</li>
710 + <li>Email support from plugin developers</li>
711 + </ul>
712 +
713 + <p class="text-center"><a href="#" class="open-pro-dialog button button-buy" data-pro-feature="cc-sidebar-box">Get PRO Now</a></p>
714 + </div>';
715 +
716 + if (!defined('EPS_REDIRECT_VERSION') && !defined('WF301_PLUGIN_FILE')) {
717 + echo '<div class="sidebar-box pro-ad-box box-301">
718 + <h3 class="textcenter"><b>Problems with redirects?<br>Moving content around or changing posts\' URL?<br>Old URLs giving you problems?<br><br><u>Improve your SEO &amp; manage all redirects in one place!</u></b></h3>
719 +
720 + <p class="text-center"><a href="#" class="install-wp301">
721 + <img src="' . esc_url(WP_CAPTCHA_CODE_URL . '/images/wp-301-logo.png') . '" alt="WP 301 Redirects" title="WP 301 Redirects"></a></p>
722 +
723 + <p class="text-center"><a href="#" class="button button-buy install-wp301">Install and activate the <u>free</u> WP 301 Redirects plugin</a></p>
724 +
725 + <p><a href="https://wordpress.org/plugins/eps-301-redirects/" target="_blank">WP 301 Redirects</a> is a free WP plugin maintained by the same team as this WP Captcha plugin. It has <b>+250,000 users, 5-star rating</b>, and is hosted on the official WP repository.</p>
726 + </div>';
727 + }
728 +
729 + echo '<div class="sidebar-box" style="margin-top: 35px; margin-bottom: 35px;">
730 + <p>Need help? Ask on the <a href="https://wordpress.org/support/plugin/captcha-code-authentication/" target="_blank">support forum</a>. We\'ll answer ASAP!</p>
731 + <p>Please <a href="https://wordpress.org/support/plugin/captcha-code-authentication/reviews/#new-post" target="_blank">rate the plugin ★★★★★</a> to <b>keep it up-to-date &amp; maintained</b>. It only takes a second to rate. Thank you! 👋</p>
732 + </div>';
733 + echo '</div>';
734 +
735 + echo '</form>';
736 +
737 + echo ' <div id="wp-captcha-code-pro-dialog" style="display: none;" title="WP Captcha PRO is here!"><span class="ui-helper-hidden-accessible"><input type="text"/></span>
738 +
739 + <div class="center logo"><a href="https://getwpcaptcha.com/?ref=wp-captcha-code-free-pricing-table" target="_blank"><img src="' . esc_url(WP_CAPTCHA_CODE_URL . '/images/wp-captcha-logo.png') . '" alt="WP Captcha PRO" title="WP Captcha PRO"></a><br>
740 +
741 + <span>Grab the limited PRO <b>Launch Discount</b></span>
742 + </div>
743 +
744 + <table id="wp-captcha-code-pro-table">
745 + <tr>
746 + <td class="center">Personal License</td>
747 + <td class="center">Team License</td>
748 + <td class="center">Agency License</td>
749 + </tr>
750 +
751 + <tr class="prices">
752 + <td class="center"><span><del>$59</del> $49</span> <b>/year</b></td>
753 + <td class="center"><span><del>$119</del> $99</span> <b>/year</b></td>
754 + <td class="center"><span><del>$149</del> $119</span> <b>/year</b></td>
755 + </tr>
756 +
757 + <tr>
758 + <td><span class="dashicons dashicons-yes"></span><b>1 Site License</b> ($49 per site)</td>
759 + <td><span class="dashicons dashicons-yes"></span><b>5 Sites License</b> ($20 per site)</td>
760 + <td><span class="dashicons dashicons-yes"></span><b>100 Sites License</b> ($1.2 per site)</td>
761 + </tr>
762 +
763 + <tr>
764 + <td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>
765 + <td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>
766 + <td><span class="dashicons dashicons-yes"></span>All Plugin Features</td>
767 + </tr>
768 +
769 + <tr>
770 + <td><span class="dashicons dashicons-yes"></span>7 Types of Captcha</td>
771 + <td><span class="dashicons dashicons-yes"></span>7 Types of Captcha</td>
772 + <td><span class="dashicons dashicons-yes"></span>7 Types of Captcha</td>
773 + </tr>
774 +
775 + <tr>
776 + <td><span class="dashicons dashicons-yes"></span>Advanced Firewall + Cloud Blacklists</td>
777 + <td><span class="dashicons dashicons-yes"></span>Advanced Firewall + Cloud Blacklists</td>
778 + <td><span class="dashicons dashicons-yes"></span>Advanced Firewall + Cloud Blacklists</td>
779 + </tr>
780 +
781 + <tr>
782 + <td><span class="dashicons dashicons-yes"></span>Login Page Customization</td>
783 + <td><span class="dashicons dashicons-yes"></span>Login Page Customization</td>
784 + <td><span class="dashicons dashicons-yes"></span>Login Page Customization</td>
785 + </tr>
786 +
787 + <tr>
788 + <td><span class="dashicons dashicons-yes"></span>Email Based 2FA</td>
789 + <td><span class="dashicons dashicons-yes"></span>Email Based 2FA</td>
790 + <td><span class="dashicons dashicons-yes"></span>Email Based 2FA</td>
791 + </tr>
792 +
793 + <tr>
794 + <td><span class="dashicons dashicons-yes"></span>Temporary Access Links</td>
795 + <td><span class="dashicons dashicons-yes"></span>Temporary Access Links</td>
796 + <td><span class="dashicons dashicons-yes"></span>Temporary Access Links</td>
797 + </tr>
798 +
799 + <tr>
800 + <td><span class="dashicons dashicons-yes"></span>Country Blocking</td>
801 + <td><span class="dashicons dashicons-yes"></span>Country Blocking</td>
802 + <td><span class="dashicons dashicons-yes"></span>Country Blocking</td>
803 + </tr>
804 +
805 + <tr>
806 + <td><span class="dashicons dashicons-yes"></span>SaaS Dashboard</td>
807 + <td><span class="dashicons dashicons-yes"></span>SaaS Dashboard</td>
808 + <td><span class="dashicons dashicons-yes"></span>SaaS Dashboard</td>
809 + </tr>
810 +
811 + <tr>
812 + <td><span class="dashicons dashicons-no"></span>White-label Mode</td>
813 + <td><span class="dashicons dashicons-yes"></span>White-label Mode</td>
814 + <td><span class="dashicons dashicons-yes"></span>White-label Mode</td>
815 + </tr>
816 +
817 + <tr>
818 + <td><span class="dashicons dashicons-no"></span>Full Plugin Rebranding</td>
819 + <td><span class="dashicons dashicons-no"></span>Full Plugin Rebranding</td>
820 + <td><span class="dashicons dashicons-yes"></span>Full Plugin Rebranding</td>
821 + </tr>
822 +
823 + <tr>
824 + <td><a class="button button-buy" data-href-org="https://getwpcaptcha.com/buy/?product=personal-yearly-launch&ref=pricing-table" href="https://getwpcaptcha.com/buy/?product=personal-yearly-launch&ref=pricing-table" target="_blank"><del>$59</del> $49 <small>/y</small><br>BUY NOW</a>
825 + <br>or <a class="button-buy" data-href-org="https://getwpcaptcha.com/buy/?product=personal-ltd-launch&ref=pricing-table" href="https://getwpcaptcha.com/buy/?product=personal-ltd-launch&ref=pricing-table" target="_blank">only <del>$99</del> $79 for a lifetime license</a></td>
826 + <td><a class="button button-buy" data-href-org="https://getwpcaptcha.com/buy/?product=team-yearly-launch&ref=pricing-table" href="https://getwpcaptcha.com/buy/?product=team-yearly-launch&ref=pricing-table" target="_blank"><del>$119</del> $99 <small>/y</small><br>BUY NOW</a></td>
827 + <td><a class="button button-buy" data-href-org="https://getwpcaptcha.com/buy/?product=agency-yearly-launch&ref=pricing-table" href="https://getwpcaptcha.com/buy/?product=agency-yearly-launch&ref=pricing-table" target="_blank"><del>$149</del> $119 <small>/y</small><br>BUY NOW</a></td>
828 + </tr>
829 +
830 + </table>
831 +
832 + <div class="center footer"><b>100% No-Risk Money Back Guarantee!</b> If you don\'t like the plugin over the next 7 days, we will happily refund 100% of your money. No questions asked! Payments are processed by our merchant of records - <a href="https://paddle.com/" target="_blank">Paddle</a>.</div>
833 + </div>';
834 + echo '</div>';
835 + } // options_page
836 +
837 + static function install_wp301()
838 + {
839 + check_ajax_referer('install_wp301');
840 +
841 + if (false === current_user_can('administrator')) {
842 + wp_die('Sorry, you have to be an admin to run this action.');
843 + }
844 +
845 + $plugin_slug = 'eps-301-redirects/eps-301-redirects.php';
846 + $plugin_zip = 'https://downloads.wordpress.org/plugin/eps-301-redirects.latest-stable.zip';
847 +
848 + @include_once ABSPATH . 'wp-admin/includes/plugin.php';
849 + @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
850 + @include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
851 + @include_once ABSPATH . 'wp-admin/includes/file.php';
852 + @include_once ABSPATH . 'wp-admin/includes/misc.php';
853 + echo '<style>
854 + body{
855 + font-family: sans-serif;
856 + font-size: 14px;
857 + line-height: 1.5;
858 + color: #444;
339 859 }
340 - }
341 - elseif(!empty($wpcaptcha_type) && $wpcaptcha_type == 'alphabets')
342 - {
343 - switch($wpcaptcha_letters)
344 - {
345 - case 'capital':
346 - $possible_letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
347 - break;
348 - case 'small':
349 - $possible_letters = 'bcdfghjkmnpqrstvwxyz';
350 - break;
351 - case 'capitalsmall':
352 - $possible_letters = 'bcdfghjkmnpqrstvwxyzABCEFGHJKMNPRSTVWXYZ';
353 - break;
354 - default:
355 - $possible_letters = 'abcdefghijklmnopqrstuvwxyz';
356 - break;
357 - }
358 - }
359 - elseif(!empty($wpcaptcha_type) && $wpcaptcha_type == 'numbers')
360 - {
361 - $possible_letters = '0123456789';
362 - }
363 - else
364 - {
365 - $possible_letters = '0123456789';
366 - }
367 - $random_dots = 0;
368 - $random_lines = 20;
369 - $captcha_text_color="0x142864";
370 - $captcha_noice_color = "0x142864";
860 + </style>';
371 861
372 - $code = '';
862 + echo '<div style="margin: 20px; color:#444;">';
863 + echo 'If things are not done in a minute <a target="_parent" href="' . admin_url('plugin-install.php?s=301%20redirects%20webfactory&tab=search&type=term') . '">install the plugin manually via Plugins page</a><br><br>';
864 + echo 'Starting ...<br><br>';
373 865
866 + wp_cache_flush();
867 + $upgrader = new Plugin_Upgrader();
868 + echo 'Check if WP 301 Redirects is already installed ... <br />';
869 + if (self::is_plugin_installed($plugin_slug)) {
870 + echo 'WP 301 Redirects is already installed! <br /><br />Making sure it\'s the latest version.<br />';
871 + $upgrader->upgrade($plugin_slug);
872 + $installed = true;
873 + } else {
874 + echo 'Installing WP 301 Redirects.<br />';
875 + $installed = $upgrader->install($plugin_zip);
876 + }
877 + wp_cache_flush();
374 878
375 - $i = 0;
376 - while ($i < $characters_on_image)
377 - {
378 - $code .= substr($possible_letters, mt_rand(0, strlen($possible_letters)-1), 1);
379 - $i++;
380 - }
879 + if (!is_wp_error($installed) && $installed) {
880 + echo 'Activating WP 301 Redirects.<br />';
881 + $activate = activate_plugin($plugin_slug);
381 882
883 + if (is_null($activate)) {
884 + echo 'WP 301 Redirects Activated.<br />';
382 885
383 - $font_size = $image_height * 0.75;
384 - $image = @imagecreate($image_width, $image_height);
886 + echo '<script>setTimeout(function() { top.location = "' . admin_url('options-general.php?page=eps_redirects') . '"; }, 1000);</script>';
887 + echo '<br>If you are not redirected in a few seconds - <a href="' . admin_url('options-general.php?page=eps_redirects') . '" target="_parent">click here</a>.';
888 + }
889 + } else {
890 + echo 'Could not install WP 301 Redirects. You\'ll have to <a target="_parent" href="' . admin_url('plugin-install.php?s=301%20redirects%20webfactory&tab=search&type=term') . '">download and install manually</a>.';
891 + }
385 892
893 + echo '</div>';
894 + } // install_wp301
386 895
387 - /* setting the background, text and noise colours here */
388 - $background_color = imagecolorallocate($image, 255, 255, 255);
896 + static function is_plugin_installed($slug)
897 + {
898 + if (!function_exists('get_plugins')) {
899 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
900 + }
901 + $all_plugins = get_plugins();
389 902
390 - $arr_text_color = ctl_captcha_hexrgb($captcha_text_color);
391 - $text_color = imagecolorallocate($image, $arr_text_color['red'],
392 - $arr_text_color['green'], $arr_text_color['blue']);
903 + if (!empty($all_plugins[$slug])) {
904 + return true;
905 + } else {
906 + return false;
907 + }
908 + } // is_plugin_installed
393 909
394 - $arr_noice_color = ctl_captcha_hexrgb($captcha_noice_color);
395 - $image_noise_color = imagecolorallocate($image, $arr_noice_color['red'],
396 - $arr_noice_color['green'], $arr_noice_color['blue']);
910 + static function wp_kses_wf($html)
911 + {
912 + add_filter('safe_style_css', function ($styles) {
913 + $styles_wf = array(
914 + 'text-align',
915 + 'margin',
916 + 'color',
917 + 'float',
918 + 'border',
919 + 'background',
920 + 'background-color',
921 + 'border-bottom',
922 + 'border-bottom-color',
923 + 'border-bottom-style',
924 + 'border-bottom-width',
925 + 'border-collapse',
926 + 'border-color',
927 + 'border-left',
928 + 'border-left-color',
929 + 'border-left-style',
930 + 'border-left-width',
931 + 'border-right',
932 + 'border-right-color',
933 + 'border-right-style',
934 + 'border-right-width',
935 + 'border-spacing',
936 + 'border-style',
937 + 'border-top',
938 + 'border-top-color',
939 + 'border-top-style',
940 + 'border-top-width',
941 + 'border-width',
942 + 'caption-side',
943 + 'clear',
944 + 'cursor',
945 + 'direction',
946 + 'font',
947 + 'font-family',
948 + 'font-size',
949 + 'font-style',
950 + 'font-variant',
951 + 'font-weight',
952 + 'height',
953 + 'letter-spacing',
954 + 'line-height',
955 + 'margin-bottom',
956 + 'margin-left',
957 + 'margin-right',
958 + 'margin-top',
959 + 'overflow',
960 + 'padding',
961 + 'padding-bottom',
962 + 'padding-left',
963 + 'padding-right',
964 + 'padding-top',
965 + 'text-decoration',
966 + 'text-indent',
967 + 'vertical-align',
968 + 'width',
969 + 'display',
970 + );
397 971
972 + foreach ($styles_wf as $style_wf) {
973 + $styles[] = $style_wf;
974 + }
975 + return $styles;
976 + });
398 977
399 - /* generating the dots randomly in background */
400 - for( $i=0; $i<$random_dots; $i++ )
401 - {
402 - imagefilledellipse($image, mt_rand(0,$image_width), mt_rand(0,$image_height), 2, 3, $image_noise_color);
403 - }
978 + $allowed_tags = wp_kses_allowed_html('post');
979 + $allowed_tags['input'] = array(
980 + 'type' => true,
981 + 'style' => true,
982 + 'class' => true,
983 + 'id' => true,
984 + 'checked' => true,
985 + 'disabled' => true,
986 + 'name' => true,
987 + 'size' => true,
988 + 'placeholder' => true,
989 + 'value' => true,
990 + 'data-*' => true,
991 + 'size' => true,
992 + 'disabled' => true
993 + );
404 994
995 + $allowed_tags['textarea'] = array(
996 + 'type' => true,
997 + 'style' => true,
998 + 'class' => true,
999 + 'id' => true,
1000 + 'checked' => true,
1001 + 'disabled' => true,
1002 + 'name' => true,
1003 + 'size' => true,
1004 + 'placeholder' => true,
1005 + 'value' => true,
1006 + 'data-*' => true,
1007 + 'cols' => true,
1008 + 'rows' => true,
1009 + 'disabled' => true,
1010 + 'autocomplete' => true
1011 + );
405 1012
406 - /* generating lines randomly in background of image */
407 - for( $i=0; $i<$random_lines; $i++ ) {
408 - imageline($image, mt_rand(0,$image_width), mt_rand(0,$image_height), mt_rand(0,$image_width), mt_rand(0,$image_height), $image_noise_color);
409 - }
1013 + $allowed_tags['select'] = array(
1014 + 'type' => true,
1015 + 'style' => true,
1016 + 'class' => true,
1017 + 'id' => true,
1018 + 'checked' => true,
1019 + 'disabled' => true,
1020 + 'name' => true,
1021 + 'size' => true,
1022 + 'placeholder' => true,
1023 + 'value' => true,
1024 + 'data-*' => true,
1025 + 'multiple' => true,
1026 + 'disabled' => true
1027 + );
410 1028
1029 + $allowed_tags['option'] = array(
1030 + 'type' => true,
1031 + 'style' => true,
1032 + 'class' => true,
1033 + 'id' => true,
1034 + 'checked' => true,
1035 + 'disabled' => true,
1036 + 'name' => true,
1037 + 'size' => true,
1038 + 'placeholder' => true,
1039 + 'value' => true,
1040 + 'selected' => true,
1041 + 'data-*' => true
1042 + );
411 1043
412 - /* create a text box and add 6 letters code in it */
413 - $textbox = imagettfbbox($font_size, 0, $font, $code);
414 - $x = ($image_width - $textbox[4])/2;
415 - $y = ($image_height - $textbox[5])/2;
416 - imagettftext($image, $font_size, 0, $x, $y, $text_color, $font , $code);
1044 + $allowed_tags['optgroup'] = array(
1045 + 'type' => true,
1046 + 'style' => true,
1047 + 'class' => true,
1048 + 'id' => true,
1049 + 'checked' => true,
1050 + 'disabled' => true,
1051 + 'name' => true,
1052 + 'size' => true,
1053 + 'placeholder' => true,
1054 + 'value' => true,
1055 + 'selected' => true,
1056 + 'data-*' => true,
1057 + 'label' => true
1058 + );
417 1059
418 - ob_start();
419 - imagejpeg($image);//showing the image
420 - printf('<img src="data:image/png;base64,%s"/ width="100">', base64_encode(ob_get_clean()));
421 - imagedestroy($image);//destroying the image instance
422 - $_SESSION['captcha_code'] = $code;
423 -}
1060 + $allowed_tags['a'] = array(
1061 + 'href' => true,
1062 + 'data-*' => true,
1063 + 'class' => true,
1064 + 'style' => true,
1065 + 'id' => true,
1066 + 'target' => true,
1067 + 'data-*' => true,
1068 + 'role' => true,
1069 + 'aria-controls' => true,
1070 + 'aria-selected' => true,
1071 + 'disabled' => true
1072 + );
424 1073
425 -function ctl_captcha_hexrgb ($hexstr)
426 -{
427 - $int = hexdec($hexstr);
1074 + $allowed_tags['div'] = array(
1075 + 'style' => true,
1076 + 'class' => true,
1077 + 'id' => true,
1078 + 'data-*' => true,
1079 + 'role' => true,
1080 + 'aria-labelledby' => true,
1081 + 'value' => true,
1082 + 'aria-modal' => true,
1083 + 'tabindex' => true
1084 + );
428 1085
429 - return array("red" => 0xFF & ($int >> 0x10),
430 - "green" => 0xFF & ($int >> 0x8),
431 - "blue" => 0xFF & $int);
432 -}
433 -?>
1086 + $allowed_tags['li'] = array(
1087 + 'style' => true,
1088 + 'class' => true,
1089 + 'id' => true,
1090 + 'data-*' => true,
1091 + 'role' => true,
1092 + 'aria-labelledby' => true,
1093 + 'value' => true,
1094 + 'aria-modal' => true,
1095 + 'tabindex' => true
1096 + );
1097 +
1098 + $allowed_tags['span'] = array(
1099 + 'style' => true,
1100 + 'class' => true,
1101 + 'id' => true,
1102 + 'data-*' => true,
1103 + 'aria-hidden' => true
1104 + );
1105 +
1106 + $allowed_tags['style'] = array(
1107 + 'class' => true,
1108 + 'id' => true,
1109 + 'type' => true,
1110 + 'style' => true
1111 + );
1112 +
1113 + $allowed_tags['fieldset'] = array(
1114 + 'class' => true,
1115 + 'id' => true,
1116 + 'type' => true,
1117 + 'style' => true
1118 + );
1119 +
1120 + $allowed_tags['link'] = array(
1121 + 'class' => true,
1122 + 'id' => true,
1123 + 'type' => true,
1124 + 'rel' => true,
1125 + 'href' => true,
1126 + 'media' => true,
1127 + 'style' => true
1128 + );
1129 +
1130 + $allowed_tags['form'] = array(
1131 + 'style' => true,
1132 + 'class' => true,
1133 + 'id' => true,
1134 + 'method' => true,
1135 + 'action' => true,
1136 + 'data-*' => true,
1137 + 'style' => true
1138 + );
1139 +
1140 + $allowed_tags['script'] = array(
1141 + 'class' => true,
1142 + 'id' => true,
1143 + 'type' => true,
1144 + 'src' => true,
1145 + 'style' => true
1146 + );
1147 +
1148 + $allowed_tags['table'] = array(
1149 + 'class' => true,
1150 + 'id' => true,
1151 + 'type' => true,
1152 + 'cellpadding' => true,
1153 + 'cellspacing' => true,
1154 + 'border' => true,
1155 + 'style' => true
1156 + );
1157 +
1158 + $allowed_tags['canvas'] = array(
1159 + 'class' => true,
1160 + 'id' => true,
1161 + 'style' => true
1162 + );
1163 +
1164 + echo wp_kses($html, $allowed_tags);
1165 +
1166 + add_filter('safe_style_css', function ($styles) {
1167 + $styles_wf = array(
1168 + 'text-align',
1169 + 'margin',
1170 + 'color',
1171 + 'float',
1172 + 'border',
1173 + 'background',
1174 + 'background-color',
1175 + 'border-bottom',
1176 + 'border-bottom-color',
1177 + 'border-bottom-style',
1178 + 'border-bottom-width',
1179 + 'border-collapse',
1180 + 'border-color',
1181 + 'border-left',
1182 + 'border-left-color',
1183 + 'border-left-style',
1184 + 'border-left-width',
1185 + 'border-right',
1186 + 'border-right-color',
1187 + 'border-right-style',
1188 + 'border-right-width',
1189 + 'border-spacing',
1190 + 'border-style',
1191 + 'border-top',
1192 + 'border-top-color',
1193 + 'border-top-style',
1194 + 'border-top-width',
1195 + 'border-width',
1196 + 'caption-side',
1197 + 'clear',
1198 + 'cursor',
1199 + 'direction',
1200 + 'font',
1201 + 'font-family',
1202 + 'font-size',
1203 + 'font-style',
1204 + 'font-variant',
1205 + 'font-weight',
1206 + 'height',
1207 + 'letter-spacing',
1208 + 'line-height',
1209 + 'margin-bottom',
1210 + 'margin-left',
1211 + 'margin-right',
1212 + 'margin-top',
1213 + 'overflow',
1214 + 'padding',
1215 + 'padding-bottom',
1216 + 'padding-left',
1217 + 'padding-right',
1218 + 'padding-top',
1219 + 'text-decoration',
1220 + 'text-indent',
1221 + 'vertical-align',
1222 + 'width'
1223 + );
1224 +
1225 + foreach ($styles_wf as $style_wf) {
1226 + if (($key = array_search($style_wf, $styles)) !== false) {
1227 + unset($styles[$key]);
1228 + }
1229 + }
1230 + return $styles;
1231 + });
1232 + } // is_plugin_installed
1233 +} // WP_Captcha_Code
1234 +
1235 +add_action('init', array('WP_Captcha_Code', 'init'));
1236 +