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 (+)', 'captcha'), __('Plus', 'captcha')), array('cptch_math_action_minus', __('Minus (−)', 'captcha'), __('Minus', 'captcha')), array('cptch_math_action_increase', __('Multiplication (×)', '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&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&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&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') . ' <a href="' . $admin_url . 'plugins.php">' . __('activate', 'captcha') . ' Contact Form ' . (is_network_admin() ? __('for network', 'captcha') : '') . '</a>' . ' ' . __('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') . ' <a href="http://http://bestwebsoft.com/products/contact-form/?k=9ab9d358ad3a23b8a99a8328595ede2e&pn=72&v=' . $cptch_plugin_info["Version"] . '&wp_v=' . $wp_version . '">' . __('download', 'captcha') . ' Contact Form </a>' . ' ' . __('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;"/> <?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" /> <?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" /> <?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" /> <?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" /> <?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 }
function cptch_settings_page() { global $cptch_options, $wp_version, $cptch_plugin_info, $cptch_option_defaults; $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 (+)', 'captcha'), __('Plus', 'captcha')), array('cptch_math_action_minus', __('Minus (−)', 'captcha'), __('Minus', 'captcha')), array('cptch_math_action_increase', __('Multiplication (×)', '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'))); if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); /* Save data for settings page */ if (isset($_REQUEST['cptch_form_submit']) && check_admin_referer($plugin_basename, 'cptch_nonce_name')) { $cptch_request_options = array(); $cptch_request_options['cptch_login_form'] = isset($_REQUEST['cptch_login_form']) ? 1 : 0; $cptch_request_options['cptch_register_form'] = isset($_REQUEST['cptch_register_form']) ? 1 : 0; $cptch_request_options['cptch_lost_password_form'] = isset($_REQUEST['cptch_lost_password_form']) ? 1 : 0; $cptch_request_options['cptch_comments_form'] = isset($_REQUEST['cptch_comments_form']) ? 1 : 0; $cptch_request_options['cptch_hide_register'] = isset($_REQUEST['cptch_hide_register']) ? 1 : 0; $cptch_request_options['cptch_contact_form'] = isset($_REQUEST['cptch_contact_form']) ? 1 : 0; $cptch_request_options['cptch_label_form'] = isset($_REQUEST['cptch_label_form']) ? stripslashes(esc_html($_REQUEST['cptch_label_form'])) : ''; $cptch_request_options['cptch_required_symbol'] = isset($_REQUEST['cptch_required_symbol']) ? stripslashes(esc_html($_REQUEST['cptch_required_symbol'])) : ''; $cptch_request_options['cptch_error_empty_value'] = isset($_REQUEST['cptch_error_empty_value']) ? stripslashes(esc_html($_REQUEST['cptch_error_empty_value'])) : ''; $cptch_request_options['cptch_error_incorrect_value'] = isset($_REQUEST['cptch_error_incorrect_value']) ? stripslashes(esc_html($_REQUEST['cptch_error_incorrect_value'])) : ''; if ($cptch_request_options['cptch_error_empty_value'] == '') { $cptch_request_options['cptch_error_empty_value'] = $cptch_option_defaults['cptch_error_empty_value']; } if ($cptch_request_options['cptch_error_incorrect_value'] == '') { $cptch_request_options['cptch_error_incorrect_value'] = $cptch_option_defaults['cptch_error_incorrect_value']; } $cptch_request_options['cptch_math_action_plus'] = isset($_REQUEST['cptch_math_action_plus']) ? 1 : 0; $cptch_request_options['cptch_math_action_minus'] = isset($_REQUEST['cptch_math_action_minus']) ? 1 : 0; $cptch_request_options['cptch_math_action_increase'] = isset($_REQUEST['cptch_math_action_increase']) ? 1 : 0; $cptch_request_options['cptch_difficulty_number'] = isset($_REQUEST['cptch_difficulty_number']) ? 1 : 0; $cptch_request_options['cptch_difficulty_word'] = isset($_REQUEST['cptch_difficulty_word']) ? 1 : 0; /* Array merge incase this version has added new options */ $cptch_options = array_merge($cptch_options, $cptch_request_options); /* Check select one point in the blocks Arithmetic actions and Difficulty on settings page */ if (!isset($_REQUEST['cptch_difficulty_number']) && !isset($_REQUEST['cptch_difficulty_word']) || !isset($_REQUEST['cptch_math_action_plus']) && !isset($_REQUEST['cptch_math_action_minus']) && !isset($_REQUEST['cptch_math_action_increase'])) { $error = __("Please select one item in the block Arithmetic and Complexity for CAPTCHA", 'captcha'); } else { /* Update options in the database */ update_option('cptch_options', $cptch_options); $message = __("Settings saved.", 'captcha'); } } 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'); } /* GO PRO */ if (isset($_GET['action']) && 'go_pro' == $_GET['action']) { $go_pro_result = bws_go_pro_tab_check($plugin_basename); if (!empty($go_pro_result['error'])) { $error = $go_pro_result['error']; } } /* Display form on the setting page */ ?> <div class="wrap"> <div class="icon32 icon32-bws" id="icon-options-general"></div> <h2><?php _e('Captcha Settings', 'captcha'); ?> </h2> <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('Settings', 'captcha'); ?> </a> <a class="nav-tab <?php if (isset($_GET['action']) && 'whitelist' == $_GET['action']) { echo ' nav-tab-active'; } ?> " href="admin.php?page=captcha.php&action=whitelist"><?php _e('Whitelist', 'captcha'); ?> </a> <a class="nav-tab" href="http://bestwebsoft.com/products/captcha/faq/" target="_blank"><?php _e('FAQ', '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&action=go_pro"><?php _e('Go PRO', 'captcha'); ?> </a> </h2> <div id="cptch_settings_notice" class="updated fade" style="display:none"><p><strong><?php _e("Notice:", 'captcha'); ?> </strong> <?php _e("The plugin's settings have been changed. In order to save them please don't forget to click the 'Save Changes' button.", 'captcha'); ?> </p></div> <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'])) { if (isset($_REQUEST['bws_restore_default']) && check_admin_referer($plugin_basename, 'bws_settings_nonce_name')) { bws_form_restore_default_confirm($plugin_basename); } else { ?> <form id="cptch_settings_form" method="post" action="admin.php?page=captcha.php"> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Enable CAPTCHA for:', 'captcha'); ?> </th> <td><fieldset> <legend class="screen-reader-text"><span><?php _e('Arithmetic actions for CAPTCHA', 'captcha'); ?> </span></legend> <?php foreach ($cptch_admin_fields_enable 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], 'captcha'); ?> </label> <div class="cptch_help_box cptch_thumb_block"> <div class="cptch_hidden_help_text cptch_thumb"><img src="<?php echo plugins_url('captcha/images') . '/' . $fields[2]; ?> " title="<?php echo $fields[1]; ?> " alt="<?php echo $fields[1]; ?> "/></div> </div><br /> <?php } if (array_key_exists('contact-form-plugin/contact_form.php', $all_plugins) || array_key_exists('contact-form-pro/contact_form_pro.php', $all_plugins)) { if (is_plugin_active('contact-form-plugin/contact_form.php') || is_plugin_active('contact-form-pro/contact_form_pro.php')) { ?> <label><input type="checkbox" name="cptch_contact_form" value="1" <?php if (1 == $cptch_options['cptch_contact_form']) { echo "checked=\"checked\""; } ?> /> Contact form by BestWebSoft</label> <?php } else { ?> <label><input disabled='disabled' type="checkbox" name="cptch_contact_form" value="1" <?php if (1 == $cptch_options['cptch_contact_form']) { echo "checked=\"checked\""; } ?> /> Contact form by BestWebSoft</label> <span class="cptch_span"><a href="<?php echo bloginfo("url"); ?> /wp-admin/plugins.php"><?php _e('Activate contact form', 'captcha'); ?> </a></span> <?php } ?> <div class="cptch_help_box cptch_thumb_block"> <div class="cptch_hidden_help_text cptch_thumb"><img src="<?php echo plugins_url('captcha/images/contact_form.jpg'); ?> " title="<?php _e('Contact Form', 'captcha'); ?> " alt="<?php _e('Contact Form', 'captcha'); ?> "/></div> </div><br /> <?php } else { ?> <label><input disabled='disabled' type="checkbox" name="cptch_contact_form" value="1" <?php if (1 == $cptch_options['cptch_contact_form']) { echo "checked=\"checked\""; } ?> /> Contact form by BestWebSoft</label> <span class="cptch_span"><a href="http://bestwebsoft.com/products/contact-form/?k=d70b58e1739ab4857d675fed2213cedc&pn=75&v=<?php echo $cptch_plugin_info["Version"]; ?> &wp_v=<?php echo $wp_version; ?> "><?php _e('Download contact form', 'captcha'); ?> </a></span> <div class="cptch_help_box cptch_thumb_block"> <div class="cptch_hidden_help_text cptch_thumb"><img src="<?php echo plugins_url('captcha/images/contact_form.jpg'); ?> " title="<?php _e('Contact Form', 'captcha'); ?> " alt="<?php _e('Contact Form', 'captcha'); ?> "/></div> </div><br /> <?php } echo apply_filters('cptch_forms_list', ''); ?> <span class="cptch_span"><?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> <div class="bws_pro_version_bloc"> <div class="bws_pro_version_table_bloc"> <div class="bws_table_bg"></div> <table class="form-table bws_pro_version"> <tr valign="top"> <th scope="row"> <?php _e('Enable CAPTCHA for:', 'captcha'); ?> </th> <td> <label><input disabled='disabled' type="checkbox" name="cptchpr_subscriber" value="1" /> Subscriber by BestWebSoft</label> </td> </tr> <tr valign="top"> <th scope="row"> <strong>Buddypress</strong><br/> <?php _e('Enable CAPTCHA for:', 'captcha'); ?> </th> <td><fieldset> <legend class="screen-reader-text"><span>Buddypress <?php _e('Enable CAPTCHA for:', 'captcha'); ?> </span></legend> <label><input disabled='disabled' type="checkbox" name="cptchpr_buddypress_register_form" value="1" /> <?php _e('Registration form', 'captcha'); ?> </label><br /> <label><input disabled='disabled' type="checkbox" name="cptchpr_buddypress_comment_form" value="1" /> <?php _e('Comments form', 'captcha'); ?> </label><br /> <label><input disabled='disabled' type="checkbox" name="cptchpr_buddypress_group_form" value="1" /> <?php _e('"Create a Group" form', 'captcha'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"> <strong>Contact Form 7</strong><br/> <?php _e('Enable CAPTCHA:', 'captcha'); ?> </th> <td><br/> <input disabled='disabled' type="checkbox" name="cptchpr_cf7" value="1" /><br /> </td> </tr> <tr valign="top"> <th scope="row" colspan="2"> * <?php _e('If you upgrade to Pro version all your settings will be saved.', 'captcha'); ?> </th> </tr> </table> </div> <div class="bws_pro_version_tooltip"> <div class="bws_info"> <?php _e('Unlock premium options by upgrading to PRO version.', 'captcha'); ?> <a href="http://bestwebsoft.com/products/captcha/?k=9701bbd97e61e52baa79c58c3caacf6d&pn=75&v=<?php echo $cptch_plugin_info["Version"]; ?> &wp_v=<?php echo $wp_version; ?> " target="_blank" title="Captcha Pro"><?php _e('Learn More', 'captcha'); ?> </a> </div> <a class="bws_button" href="http://bestwebsoft.com/products/captcha/buy/?k=9701bbd97e61e52baa79c58c3caacf6d&pn=75&v=<?php echo $cptch_plugin_info["Version"]; ?> &wp_v=<?php echo $wp_version; ?> " target="_blank" title="Captcha Pro"> <?php _e('Go', 'captcha'); ?> <strong>PRO</strong> </a> <div class="clear"></div> </div> </div> <table class="form-table"> <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 for CAPTCHA in the form', '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("Error messages", 'captcha'); ?> </th> <td colspan="2"> <p><input class="cptch_settings_input" type="text" name="cptch_error_empty_value" value="<?php echo $cptch_options['cptch_error_empty_value']; ?> " maxlength="100" /> <?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" /> <?php _e('If CAPTCHA is incorrect', 'captcha'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Arithmetic actions for CAPTCHA', '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="<?php echo $cptch_options[$actions[0]]; ?> " <?php if (1 == $cptch_options[$actions[0]]) { echo "checked=\"checked\""; } ?> /> <?php echo __($actions[1], 'captcha'); ?> </label> <div class="cptch_help_box"> <div class="cptch_hidden_help_text"><?php cptch_display_example($actions[0]); ?> </div> </div> <br /> <?php } ?> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><?php _e('CAPTCHA complexity level', 'captcha'); ?> </th> <td colspan="2"><fieldset> <legend class="screen-reader-text"><span><?php _e('CAPTCHA complexity level', '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], 'captcha'); ?> </label> <div class="cptch_help_box"> <div class="cptch_hidden_help_text"><?php cptch_display_example($diff[0]); ?> </div> </div> <br /> <?php } ?> </fieldset></td> </tr> </table> <input type="hidden" name="cptch_form_submit" value="submit" /> <p class="submit"> <input 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']) { bws_go_pro_tab($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']) { require_once dirname(__FILE__) . '/whitelist.php'; $cptch_whitelist = new Cptch_Whitelist($plugin_basename, $cptch_plugin_info['Version'], 'captcha'); $cptch_whitelist->display_content(); } bws_plugin_reviews_block($cptch_plugin_info['Name'], 'captcha'); ?> </div> <?php }