/**
         * Display content
         * @return void
         */
        function display_content()
        {
            global $wp_version, $cptch_options;
            if (isset($_SERVER)) {
                $sever_vars = array('HTTP_X_REAL_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'REMOTE_ADDR');
                foreach ($sever_vars as $var) {
                    if (isset($_SERVER[$var]) && !empty($_SERVER[$var])) {
                        if (filter_var($_SERVER[$var], FILTER_VALIDATE_IP)) {
                            $my_ip = $_SERVER[$var];
                            break;
                        } else {
                            /* if proxy */
                            $ip_array = explode(',', $_SERVER[$var]);
                            if (is_array($ip_array) && !empty($ip_array) && filter_var($ip_array[0], FILTER_VALIDATE_IP)) {
                                $my_ip = $ip_array[0];
                                break;
                            }
                        }
                    }
                }
            }
            $this->prepare_items();
            $limit_attempts_info = $this->get_limit_attempts_info();
            $disabled = $limit_attempts_info['disabled'] ? ' disabled="disabled"' : '';
            if ($limit_attempts_info['actived']) {
                $checked = $this->disable_list ? ' checked="checked"' : '';
                $hidden = $this->disable_list;
            } else {
                $checked = '';
                $hidden = false;
            }
            ?>
			<p><strong><?php 
            _e('For IP addresses from the whitelist CAPTCHA will not be displayed', 'captcha');
            ?>
</strong></p>
			<?php 
            if (!(isset($_REQUEST['cptch_show_whitelist_form']) || isset($_REQUEST['cptch_add_to_whitelist']))) {
                ?>
				<form method="post" action="admin.php?page=captcha.php&amp;action=whitelist" style="margin: 10px 0;">
					<table>
						<tr>
							<td>
								<label for="cptch_use_la_whitelist">
									<input type="checkbox" name="cptch_use_la_whitelist" value="1" id="cptch_use_la_whitelist"<?php 
                echo $disabled . $checked;
                ?>
/>
									<?php 
                echo $limit_attempts_info['label'];
                ?>
								</label>
								<div class="bws_help_box dashicons dashicons-editor-help cptch_thumb_block">
									<div class="bws_hidden_help_text" style="width: 200px;">
										<p><?php 
                printf(__('With this option, CAPTCHA will not be displayed for IP-addresses from the whitelist of %s', 'captcha'), $limit_attempts_info['name']);
                ?>
</p>
										<?php 
                if (!empty($limit_attempts_info['notice'])) {
                    ?>
											<p class="bws_info"><?php 
                    echo $limit_attempts_info['notice'];
                    ?>
</p>
										<?php 
                }
                ?>
									</div>
								</div>
							<td>
						</tr>
						<tr>
							<td class="cptch_whitelist_buttons">
								<div class="alignleft">
									<button class="button" name="cptch_show_whitelist_form" value="on"<?php 
                echo $hidden ? ' style="display: none;"' : '';
                ?>
><?php 
                _e('Add IP to whitelist', 'captcha');
                ?>
</button>
								</div>
								<div class="alignleft">
									<input type="submit" name="cptch_load_limit_attempts_whitelist" class="button" value="<?php 
                _e('Load IP to whitelist', 'captcha');
                ?>
" style="float: left;<?php 
                echo $hidden ? 'display: none;' : '';
                ?>
" <?php 
                echo $disabled;
                ?>
/>
									<div class="bws_help_box dashicons dashicons-editor-help cptch_thumb_block"<?php 
                echo $hidden ? ' style="display: none;"' : '';
                ?>
>
										<div class="bws_hidden_help_text" style="width: 200px;">
											<p><?php 
                printf(__('By click on this button, all IP-addresses from the whitelist of %s will be loaded to the whitelist of %s', 'captcha'), $limit_attempts_info['name'], 'Captcha by BestWebSoft');
                ?>
</p>
											<?php 
                if (!empty($limit_attempts_info['notice'])) {
                    ?>
												<p class="bws_info"><?php 
                    echo $limit_attempts_info['notice'];
                    ?>
</p>
											<?php 
                }
                ?>
										</div>
									</div>
								</div>
								<noscript>
									<div class="alignleft">
										<input type="submit" name="cptch_save_add_ip_form_button" class="button-primary" value="<?php 
                _e('Save changes', 'captcha');
                ?>
" />
									</div>
								</noscript>
								<?php 
                wp_nonce_field($this->basename, 'captcha_nonce_name');
                ?>
								<input type="hidden" name="cptch_save_add_ip_form" value="1"/>
							<td>
						</tr>
					</table>
				</form>
			<?php 
            }
            ?>
			<form method="post" action="admin.php?page=captcha.php&amp;action=whitelist" style="margin: 10px 0;<?php 
            echo !(isset($_REQUEST['cptch_show_whitelist_form']) || isset($_REQUEST['cptch_add_to_whitelist'])) ? 'display: none;' : '';
            ?>
">
				<div style="margin: 10px 0;">
					<input type="text" maxlength="31" name="cptch_add_to_whitelist" />
					<?php 
            if (isset($my_ip)) {
                ?>
						<br />
						<label id="cptch_add_my_ip">
							<input type="checkbox" name="cptch_add_to_whitelist_my_ip" value="1" /> 
							<?php 
                _e('My IP', 'captcha');
                ?>
							<input type="hidden" name="cptch_add_to_whitelist_my_ip_value" value="<?php 
                echo $my_ip;
                ?>
" />
						</label>
					<?php 
            }
            ?>
					<br /><input type="submit" class="button-secondary" value="<?php 
            _e('Add IP to whitelist', 'captcha');
            ?>
" />
					<?php 
            wp_nonce_field($this->basename, 'captcha_nonce_name');
            ?>
				</div>
				<div style="margin: 10px 0;">
					<span class="bws_info" style="line-height: 2;"><?php 
            _e("Allowed formats:", 'captcha');
            ?>
&nbsp;<code>192.168.0.1</code></span><br/>
					<span class="bws_info" style="line-height: 2;"><?php 
            _e("Allowed diapason:", 'captcha');
            ?>
&nbsp;<code>0.0.0.0 - 255.255.255.255</code></span>
				</div>
				<?php 
            cptch_pro_block('cptch_whitelist_banner');
            ?>
			</form>
			<?php 
            if (!$hidden) {
                ?>
				<form id="cptch_whitelist_search" method="post" action="admin.php?page=captcha.php&amp;action=whitelist">
					<?php 
                $this->search_box(__('Search IP', 'captcha'), 'search_whitelisted_ip');
                wp_nonce_field($this->basename, 'captcha_nonce_name');
                ?>
				</form>
				<form id="cptch_whitelist" method="post" action="admin.php?page=captcha.php&amp;action=whitelist">
					<?php 
                $this->display();
                wp_nonce_field($this->basename, 'captcha_nonce_name');
                ?>
				</form>
			<?php 
            }
        }
Пример #2
0
    function cptch_settings_page()
    {
        global $cptch_options, $wp_version, $cptch_plugin_info, $cptch_option_defaults, $wpdb;
        $error = $message = "";
        $plugin_basename = plugin_basename(__FILE__);
        /* These fields for the 'Enable CAPTCHA on the' block which is located at the admin setting captcha page */
        $cptch_admin_fields_enable = array(array('cptch_login_form', __('Login form', 'captcha'), 'login_form.jpg'), array('cptch_register_form', __('Registration form', 'captcha'), 'register_form.jpg'), array('cptch_lost_password_form', __('Reset Password form', 'captcha'), 'lost_password_form.jpg'), array('cptch_comments_form', __('Comments form', 'captcha'), 'comment_form.jpg'));
        $cptch_admin_fields_hide = array(array('cptch_hide_register', __('in Comments form for registered users', 'captcha')));
        /* These fields for the 'Arithmetic actions for CAPTCHA' block which is located at the admin setting captcha page */
        $cptch_admin_fields_actions = array(array('cptch_math_action_plus', __('Plus (&#43;)', 'captcha'), __('Plus', 'captcha')), array('cptch_math_action_minus', __('Minus (&minus;)', 'captcha'), __('Minus', 'captcha')), array('cptch_math_action_increase', __('Multiplication (&times;)', 'captcha'), __('Multiply', 'captcha')));
        /* This fields for the 'Difficulty for CAPTCHA' block which is located at the admin setting captcha page */
        $cptch_admin_fields_difficulty = array(array('cptch_difficulty_number', __('Numbers', 'captcha'), __('Numbers', 'captcha')), array('cptch_difficulty_word', __('Words', 'captcha'), __('Words', 'captcha')), array('cptch_difficulty_image', __('Images', 'captcha')));
        if (!function_exists('get_plugins')) {
            require_once ABSPATH . 'wp-admin/includes/plugin.php';
        }
        $all_plugins = get_plugins();
        $is_network = is_multisite() && is_network_admin();
        $admin_url = $is_network ? network_admin_url('/') : admin_url('/');
        $bws_contact_form = cptch_plugin_status(array('contact-form-plugin/contact_form.php', 'contact-form-pro/contact_form_pro.php'), $all_plugins, $is_network);
        /* Save data for settings page */
        if (isset($_REQUEST['cptch_form_submit']) && check_admin_referer($plugin_basename, 'cptch_nonce_name')) {
            /* hide pro blocks */
            if (isset($_POST['bws_hide_premium_options']) && check_admin_referer($plugin_basename, 'cptch_nonce_name')) {
                $hide_result = bws_hide_premium_options($cptch_options);
                $cptch_options = $hide_result['options'];
            }
            $cptch_options['cptch_login_form'] = isset($_REQUEST['cptch_login_form']) ? 1 : 0;
            $cptch_options['cptch_register_form'] = isset($_REQUEST['cptch_register_form']) ? 1 : 0;
            $cptch_options['cptch_lost_password_form'] = isset($_REQUEST['cptch_lost_password_form']) ? 1 : 0;
            $cptch_options['cptch_comments_form'] = isset($_REQUEST['cptch_comments_form']) ? 1 : 0;
            $cptch_options['cptch_hide_register'] = isset($_REQUEST['cptch_hide_register']) ? 1 : 0;
            $cptch_options['cptch_contact_form'] = isset($_REQUEST['cptch_contact_form']) ? 1 : 0;
            $cptch_options['cptch_label_form'] = isset($_REQUEST['cptch_label_form']) ? stripslashes(esc_html($_REQUEST['cptch_label_form'])) : '';
            $cptch_options['cptch_required_symbol'] = isset($_REQUEST['cptch_required_symbol']) ? stripslashes(esc_html($_REQUEST['cptch_required_symbol'])) : '';
            $cptch_options['cptch_error_empty_value'] = isset($_REQUEST['cptch_error_empty_value']) ? stripslashes(esc_html($_REQUEST['cptch_error_empty_value'])) : '';
            $cptch_options['cptch_error_incorrect_value'] = isset($_REQUEST['cptch_error_incorrect_value']) ? stripslashes(esc_html($_REQUEST['cptch_error_incorrect_value'])) : '';
            $cptch_options['cptch_error_time_limit'] = isset($_REQUEST['cptch_error_time_limit']) ? stripslashes(esc_html($_REQUEST['cptch_error_time_limit'])) : '';
            $cptch_options['whitelist_message'] = isset($_REQUEST['cptch_whitelist_message']) ? stripslashes(esc_html($_REQUEST['cptch_whitelist_message'])) : '';
            if ($cptch_options['cptch_error_empty_value'] == '') {
                $cptch_options['cptch_error_empty_value'] = $cptch_option_defaults['cptch_error_empty_value'];
            }
            if ($cptch_options['cptch_error_incorrect_value'] == '') {
                $cptch_options['cptch_error_incorrect_value'] = $cptch_option_defaults['cptch_error_incorrect_value'];
            }
            if ($cptch_options['cptch_error_time_limit'] == '') {
                $cptch_options['cptch_error_time_limit'] = $cptch_option_defaults['cptch_error_time_limit'];
            }
            $cptch_options['cptch_math_action_plus'] = isset($_REQUEST['cptch_math_action_plus']) ? 1 : 0;
            $cptch_options['cptch_math_action_minus'] = isset($_REQUEST['cptch_math_action_minus']) ? 1 : 0;
            $cptch_options['cptch_math_action_increase'] = isset($_REQUEST['cptch_math_action_increase']) ? 1 : 0;
            $cptch_options['cptch_difficulty_number'] = isset($_REQUEST['cptch_difficulty_number']) ? 1 : 0;
            $cptch_options['cptch_difficulty_word'] = isset($_REQUEST['cptch_difficulty_word']) ? 1 : 0;
            $cptch_options['cptch_difficulty_image'] = isset($_REQUEST['cptch_difficulty_image']) ? 1 : 0;
            $cptch_options['used_packages'] = isset($_REQUEST['cptch_used_packages']) ? $_REQUEST['cptch_used_packages'] : array();
            $cptch_options['display_reload_button'] = isset($_REQUEST['cptch_display_reload_button']) ? 1 : 0;
            $cptch_options['enlarge_images'] = isset($_REQUEST['cptch_enlarge_images']) ? 1 : 0;
            $cptch_options['use_time_limit'] = isset($_REQUEST['cptch_use_time_limit']) ? 1 : 0;
            $cptch_options['time_limit'] = !isset($_REQUEST['cptch_time_limit']) || !is_numeric($_REQUEST['cptch_time_limit']) || 10 > $_REQUEST['cptch_time_limit'] ? 120 : $_REQUEST['cptch_time_limit'];
            /* Check select one point in the blocks Arithmetic actions and Difficulty on settings page */
            $arithmetic_actions = isset($_REQUEST['cptch_math_action_plus']) || isset($_REQUEST['cptch_math_action_minus']) || isset($_REQUEST['cptch_math_action_increase']) ? true : false;
            $complexity_level = isset($_REQUEST['cptch_difficulty_number']) || isset($_REQUEST['cptch_difficulty_word']) || isset($_REQUEST['cptch_difficulty_image']) ? true : false;
            $image_optins = isset($_REQUEST['cptch_difficulty_image']) && isset($_REQUEST['cptch_used_packages']) || !isset($_REQUEST['cptch_difficulty_image']) ? true : false;
            /* if 'Arithmetic actions'- or 'Complexity level'- options are disabled */
            if (!$arithmetic_actions || !$complexity_level) {
                $error = __("Please select one item in the block Arithmetic and Complexity for CAPTCHA", 'captcha');
                /* if 'Use packages'-options are disabled */
            } elseif (!$image_optins) {
                $error = __("Please select one item in the block Enable image packages", 'captcha');
            } else {
                if (!is_null($wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}cptch_whitelist` LIMIT 1"))) {
                    $cptch_options['whitelist_is_empty'] = false;
                }
                /* Update options in the database */
                update_option('cptch_options', $cptch_options);
                $message = __("Settings saved.", 'captcha');
            }
        }
        if (!class_exists('Cptch_package_loader')) {
            require_once dirname(__FILE__) . '/includes/package_loader.php';
        }
        $package_loader = new Cptch_package_loader();
        $error .= $package_loader->error;
        if (isset($_REQUEST['bws_restore_confirm']) && check_admin_referer($plugin_basename, 'bws_settings_nonce_name')) {
            $cptch_options = $cptch_option_defaults;
            update_option('cptch_options', $cptch_options);
            $message = __('All plugin settings were restored.', 'captcha');
        }
        require_once dirname(__FILE__) . '/includes/pro_banners.php';
        /* GO PRO */
        if (isset($_GET['action']) && 'go_pro' == $_GET['action']) {
            $go_pro_result = bws_go_pro_tab_check($plugin_basename, 'cptch_options');
            if (!empty($go_pro_result['error'])) {
                $error = $go_pro_result['error'];
            } elseif (!empty($go_pro_result['message'])) {
                $message = $go_pro_result['message'];
            }
        }
        /* Display form on the setting page */
        ?>
		<div class="wrap">
			<h1><?php 
        _e('Captcha Settings', 'captcha');
        ?>
</h1>
			<ul class="subsubsub cptch_how_to_use">
				<li><a href="https://docs.google.com/document/d/11_TUSAjMjG7hLa53lmyTZ1xox03hNlEA4tRmllFep3I/edit" target="_blank"><?php 
        _e('How to Use Step-by-step Instruction', 'captcha');
        ?>
</a></li>
			</ul>
			<h2 class="nav-tab-wrapper">
				<a class="nav-tab<?php 
        if (!isset($_GET['action'])) {
            echo ' nav-tab-active';
        }
        ?>
" href="admin.php?page=captcha.php"><?php 
        _e('Basic', 'captcha');
        ?>
</a>
				<a class="nav-tab<?php 
        if (isset($_GET['action']) && 'advanced' == $_GET['action']) {
            echo ' nav-tab-active';
        }
        ?>
" href="admin.php?page=captcha.php&amp;action=advanced"><?php 
        _e('Advanced', 'captcha');
        ?>
</a>
				<a class="nav-tab <?php 
        if (isset($_GET['action']) && 'whitelist' == $_GET['action']) {
            echo ' nav-tab-active';
        }
        ?>
" href="admin.php?page=captcha.php&amp;action=whitelist"><?php 
        _e('Whitelist', 'captcha');
        ?>
</a>
				<a class="nav-tab bws_go_pro_tab<?php 
        if (isset($_GET['action']) && 'go_pro' == $_GET['action']) {
            echo ' nav-tab-active';
        }
        ?>
" href="admin.php?page=captcha.php&amp;action=go_pro"><?php 
        _e('Go PRO', 'captcha');
        ?>
</a>
			</h2>
			<div class="updated fade" <?php 
        if ('' == $message || "" != $error) {
            echo "style=\"display:none\"";
        }
        ?>
><p><strong><?php 
        echo $message;
        ?>
</strong></p></div>
			<div class="error" <?php 
        if ("" == $error) {
            echo "style=\"display:none\"";
        }
        ?>
><p><strong><?php 
        echo $error;
        ?>
</strong></p></div>
			<?php 
        if (!isset($_GET['action']) || !in_array($_GET['action'], array('whitelist', 'go_pro'))) {
            if (isset($_REQUEST['bws_restore_default']) && check_admin_referer($plugin_basename, 'bws_settings_nonce_name')) {
                bws_form_restore_default_confirm($plugin_basename);
            } else {
                bws_show_settings_notice();
                if (!empty($hide_result['message'])) {
                    ?>
						<div class="updated fade"><p><strong><?php 
                    echo $hide_result['message'];
                    ?>
</strong></p></div>
					<?php 
                }
                ?>
					<form class="bws_form" method="post" action="admin.php?page=captcha.php<?php 
                if (isset($_GET['action']) && 'advanced' == $_GET['action']) {
                    echo '&action=advanced';
                }
                ?>
">
						<table class="form-table"<?php 
                if (isset($_GET['action'])) {
                    echo ' style="display: none;"';
                }
                ?>
>
							<tr valign="top">
								<th scope="row"><?php 
                _e('Enable CAPTCHA for', 'captcha');
                ?>
:</th>
								<td>
									<fieldset>
										<legend class="screen-reader-text"><span><?php 
                _e('Enable CAPTCHA for', 'captcha');
                ?>
</span></legend>
										<p><i><?php 
                _e('WordPress default', 'captcha');
                ?>
</i></p>
										<?php 
                foreach ($cptch_admin_fields_enable as $fields) {
                    if (in_array($fields[0], array('cptch_register_form', 'cptch_lost_password_form')) && !in_array(get_current_blog_id(), array(0, 1))) {
                        $notice = '<br /><span class="bws_info">' . __('This option is available only for main blog', 'captcha') . '</span>';
                        $disable_reg_form = ' disabled="disabled"';
                        $checked = '';
                    } else {
                        $notice = $disable_reg_form = '';
                        $checked = 1 == $cptch_options[$fields[0]] ? ' checked="checked"' : '';
                    }
                    ?>
											<label><input<?php 
                    echo $disable_reg_form . $checked;
                    ?>
 type="checkbox" name="<?php 
                    echo $fields[0];
                    ?>
" value="<?php 
                    echo $fields[0];
                    ?>
"/> <?php 
                    echo $fields[1];
                    ?>
</label>
											<div class="bws_help_box dashicons dashicons-editor-help cptch_thumb_block">
												<div class="bws_hidden_help_text"><img src="<?php 
                    echo plugins_url('captcha/images') . '/' . $fields[2];
                    ?>
" title="<?php 
                    echo $fields[1];
                    ?>
" alt="<?php 
                    echo $fields[1];
                    ?>
"/></div>
											</div>
											<?php 
                    echo $notice;
                    ?>
											<br />
										<?php 
                }
                ?>
										<br />
										<p><i><?php 
                _e('Plugins', 'captcha');
                ?>
</i></p>
										<?php 
                if ('actived' == $bws_contact_form['status']) {
                    $disabled_attr = $info = '';
                } elseif ('deactivated' == $bws_contact_form['status']) {
                    $disabled_attr = "disabled='disabled'";
                    $info = '<span class="bws_info">' . __('You should', 'captcha') . '&nbsp;<a href="' . $admin_url . 'plugins.php">' . __('activate', 'captcha') . '&nbsp;Contact Form&nbsp;' . (is_network_admin() ? __('for network', 'captcha') : '') . '</a>' . '&nbsp;' . __('to use this functionality', 'captcha') . '</span>';
                } elseif ('not_installed' == $bws_contact_form['status']) {
                    $disabled_attr = "disabled='disabled'";
                    $info = '<span class="bws_info">' . __('You should', 'captcha') . '&nbsp;<a href="http://http://bestwebsoft.com/products/contact-form/?k=9ab9d358ad3a23b8a99a8328595ede2e&pn=72&v=' . $cptch_plugin_info["Version"] . '&wp_v=' . $wp_version . '">' . __('download', 'captcha') . '&nbsp;Contact Form&nbsp;</a>' . '&nbsp;' . __('to use this functionality', 'captcha') . '</span>';
                }
                ?>
										<label><input <?php 
                echo $disabled_attr;
                ?>
 type="checkbox" name="cptch_contact_form" value="1" <?php 
                if (1 == $cptch_options['cptch_contact_form']) {
                    echo 'checked="checked"';
                }
                ?>
 /> Contact Form by BestWebSoft</label> 
										<div class="bws_help_box dashicons dashicons-editor-help cptch_thumb_block">
											<div class="bws_hidden_help_text">
												<img src="<?php 
                echo plugins_url('captcha/images/contact_form.jpg');
                ?>
" title="Contact Form" alt="Contact Form"/>
											</div>
										</div>
										<?php 
                echo $info;
                ?>
										<br />
										<?php 
                echo apply_filters('cptch_forms_list', '');
                ?>
										<span class="bws_info"><?php 
                _e('If you would like to add Captcha to a custom form, please see', 'captcha');
                ?>
 <a href="http://bestwebsoft.com/products/captcha/faq" target="_blank">FAQ</a></span>
									</fieldset>
								</td>
							</tr>
						</table>
						<?php 
                if (!isset($_GET['action'])) {
                    cptch_pro_block('cptch_basic_banner');
                }
                ?>
						<table class="form-table"<?php 
                if (isset($_GET['action'])) {
                    echo ' style="display: none;"';
                }
                ?>
>
							<tr valign="top">
								<th scope="row"><?php 
                _e('Hide CAPTCHA', 'captcha');
                ?>
</th>
								<td><?php 
                foreach ($cptch_admin_fields_hide as $fields) {
                    ?>
										<label><input type="checkbox" name="<?php 
                    echo $fields[0];
                    ?>
" value="<?php 
                    echo $fields[0];
                    ?>
" <?php 
                    if (1 == $cptch_options[$fields[0]]) {
                        echo "checked=\"checked\"";
                    }
                    ?>
 /> <?php 
                    echo $fields[1];
                    ?>
</label><br />
									<?php 
                }
                ?>
								</td>
							</tr>
							<tr valign="top">
								<th scope="row"><?php 
                _e('Title', 'captcha');
                ?>
</th>
								<td><input class="cptch_settings_input" type="text" name="cptch_label_form" value="<?php 
                echo $cptch_options['cptch_label_form'];
                ?>
" maxlength="100" /></td>
							</tr>
							<tr valign="top">
								<th scope="row"><?php 
                _e("Required symbol", 'captcha');
                ?>
</th>
								<td colspan="2">
									<input class="cptch_settings_input" type="text" name="cptch_required_symbol" value="<?php 
                echo $cptch_options['cptch_required_symbol'];
                ?>
" maxlength="100" />
								</td>
							</tr>
							<tr valign="top">
								<th scope="row"><?php 
                _e('Show "Reload" button', 'captcha');
                ?>
</th>
								<td>
									<input type="checkbox" name="cptch_display_reload_button" value="1" <?php 
                if (1 == $cptch_options['display_reload_button']) {
                    echo 'checked="checked"';
                }
                ?>
 />
								</td>
							</tr>
							<tr valign="top">
								<th scope="row"><?php 
                _e('Arithmetic actions', 'captcha');
                ?>
</th>
								<td colspan="2">
									<fieldset>
										<legend class="screen-reader-text"><span><?php 
                _e('Arithmetic actions for CAPTCHA', 'captcha');
                ?>
</span></legend>
										<?php 
                foreach ($cptch_admin_fields_actions as $actions) {
                    ?>
											<label><input type="checkbox" name="<?php 
                    echo $actions[0];
                    ?>
" value="1" <?php 
                    if (1 == $cptch_options[$actions[0]]) {
                        echo "checked=\"checked\"";
                    }
                    ?>
 /> <?php 
                    echo $actions[1];
                    ?>
</label>
											<div class="bws_help_box dashicons dashicons-editor-help">
												<div class="bws_hidden_help_text"><?php 
                    cptch_display_example($actions[0]);
                    ?>
</div>
											</div>				
											<br />
										<?php 
                }
                ?>
									</fieldset>
								</td>
							</tr>
							<tr valign="top">
								<th scope="row"><?php 
                _e('Complexity', 'captcha');
                ?>
</th>
								<td colspan="2"><fieldset>
									<legend class="screen-reader-text"><span><?php 
                _e('Complexity', 'captcha');
                ?>
</span></legend>
									<?php 
                foreach ($cptch_admin_fields_difficulty as $diff) {
                    ?>
										<label><input type="checkbox" name="<?php 
                    echo $diff[0];
                    ?>
" value="<?php 
                    echo $cptch_options[$diff[0]];
                    ?>
" <?php 
                    if (1 == $cptch_options[$diff[0]]) {
                        echo "checked=\"checked\"";
                    }
                    ?>
 /> <?php 
                    echo $diff[1];
                    ?>
</label>
										<div class="bws_help_box dashicons dashicons-editor-help">
											<div class="bws_hidden_help_text<?php 
                    echo 'cptch_difficulty_image' == $diff[0] ? ' cptch_images_example' : '';
                    ?>
"><?php 
                    cptch_display_example($diff[0]);
                    ?>
</div>
										</div>
										<br />
									<?php 
                }
                ?>
								</fieldset></td>
							</tr>
						</table>
						<?php 
                $package_list = $wpdb->get_results("SELECT `id`, `name` FROM `{$wpdb->base_prefix}cptch_packages` ORDER BY `name` ASC;");
                if (!empty($package_list)) {
                    ?>
								<table class="form-table"<?php 
                    if (!isset($_GET['action'])) {
                        echo ' style="display: none;"';
                    }
                    ?>
>
									<tr class="cptch_packages">
										<th scope="row"><?php 
                    _e('Enable image packages', 'captcha');
                    ?>
</th>
										<td>
											<select name="cptch_used_packages[]" multiple="multiple">
												<?php 
                    foreach ($package_list as $pack) {
                        ?>
													<option value="<?php 
                        echo $pack->id;
                        ?>
"<?php 
                        if (in_array($pack->id, $cptch_options['used_packages'])) {
                            echo ' selected="selected"';
                        }
                        ?>
><?php 
                        echo $pack->name;
                        ?>
</option>
												<?php 
                    }
                    ?>
											</select>
										</td>
									</tr>
									<tr class="cptch_packages">
										<th scope="row"><?php 
                    _e('Enlarge images on mouseover', 'captcha');
                    ?>
</th>
										<td>
											<input type="checkbox" name="cptch_enlarge_images" value="1"<?php 
                    if (1 == $cptch_options['enlarge_images']) {
                        echo ' checked="checked"';
                    }
                    ?>
 /><br/>
										</td>
									</tr>
								</table>
						<?php 
                }
                if (isset($_GET['action']) && 'advanced' == $_GET['action']) {
                    cptch_pro_block('cptch_advanced_banner');
                }
                ?>
						<table class="form-table"<?php 
                if (!isset($_GET['action'])) {
                    echo ' style="display: none;"';
                }
                ?>
>
							<tr valign="top">
								<th scope="row"><?php 
                _e('Enable time limit', 'captcha');
                ?>
</th>
								<td>
									<input type="checkbox" name="cptch_use_time_limit" value="1"<?php 
                if (1 == $cptch_options['use_time_limit']) {
                    echo ' checked="checked"';
                }
                ?>
 />
								</td>
							</tr>
							<tr valign="top" class="cptch_limt_options"<?php 
                if (0 == $cptch_options['use_time_limit']) {
                    echo ' style="display: none;"';
                }
                ?>
>
								<th scope="row"><?php 
                _e('Set time limit', 'captcha');
                ?>
</th>
								<td>
									<label for="cptch_time_limit">
										<input type="number" name="cptch_time_limit" id ="cptch_time_limit" min="10" max="9999" step="1" value="<?php 
                echo $cptch_options['time_limit'];
                ?>
" style="width: 70px;"/>&nbsp;<?php 
                _e('seconds', 'captcha');
                ?>

									</label>
								</td>
							</tr>
							<tr valign="top">
								<th scope="row"><?php 
                _e("Notification messages", 'captcha');
                ?>
</th>
								<td colspan="2">
									<p><i><?php 
                _e("Error", 'captcha');
                ?>
</i></p>
									<p><input class="cptch_settings_input" type="text" name="cptch_error_empty_value" value="<?php 
                echo $cptch_options['cptch_error_empty_value'];
                ?>
" maxlength="100" />&nbsp;<?php 
                _e('If CAPTCHA field is empty', 'captcha');
                ?>
</p>
									<p><input class="cptch_settings_input" type="text" name="cptch_error_incorrect_value" value="<?php 
                echo $cptch_options['cptch_error_incorrect_value'];
                ?>
" maxlength="100" />&nbsp;<?php 
                _e('If CAPTCHA is incorrect', 'captcha');
                ?>
</p>
									<p><input class="cptch_settings_input" type="text" name="cptch_error_time_limit" value="<?php 
                echo $cptch_options['cptch_error_time_limit'];
                ?>
" maxlength="100" />&nbsp;<?php 
                _e('If time limit is exhausted', 'captcha');
                ?>
</p>
									<p><i><?php 
                _e("Info", 'captcha');
                ?>
</i></p>
									<p><input class="cptch_settings_input" type="text" name="cptch_whitelist_message" value="<?php 
                echo $cptch_options['whitelist_message'];
                ?>
" maxlength="100"  />&nbsp;<?php 
                _e('If the user IP is added to the whitelist (this message will be displayed instead of CAPTCHA).', 'captcha');
                ?>
</p>
								</td>
							</tr>
						</table>
						<input type="hidden" name="cptch_form_submit" value="submit" />
						<p class="submit">
							<input id="bws-submit-button" type="submit" class="button-primary" value="<?php 
                _e('Save Changes', 'captcha');
                ?>
" />
						</p>
						<?php 
                wp_nonce_field($plugin_basename, 'cptch_nonce_name');
                ?>
					</form>
					<?php 
                bws_form_restore_default_settings($plugin_basename);
            }
        } elseif ('go_pro' == $_GET['action']) {
            $show = bws_hide_premium_options_check($cptch_options) ? true : false;
            bws_go_pro_tab_show($show, $cptch_plugin_info, $plugin_basename, 'captcha.php', 'captcha_pro.php', 'captcha-pro/captcha_pro.php', 'captcha', '9701bbd97e61e52baa79c58c3caacf6d', '75', isset($go_pro_result['pro_plugin_is_activated']));
        } elseif ('whitelist' == $_GET['action']) {
            $limit_attempts_info = cptch_plugin_status(array('limit-attempts/limit-attempts.php', 'limit-attempts-pro/limit-attempts-pro.php'), $all_plugins, $is_network);
            require_once dirname(__FILE__) . '/includes/whitelist.php';
            $cptch_whitelist = new Cptch_Whitelist($plugin_basename, $limit_attempts_info);
            $cptch_whitelist->display_content();
        }
        bws_plugin_reviews_block($cptch_plugin_info['Name'], 'captcha');
        ?>
		</div>
	<?php 
    }