public function check_captcha_validation($errors)
 {
     $options = WPPlugin::retrieve_options('recaptcha_options');
     if (empty($_POST['g-recaptcha-response']) || $_POST['g-recaptcha-response'] == '') {
         $errors->add('blank_captcha', $options['no_response_error']);
         return $errors;
     }
     $reCaptchaLib = new ReCaptcha($options['secret']);
     $response = $reCaptchaLib->verifyResponse($_SERVER['REMOTE_ADDR'], $_POST['g-recaptcha-response']);
     // response is bad, add incorrect response error
     if (!$response->success) {
         $errors->add('captcha_wrong', $response->error);
     }
     return $errors;
 }
Example #2
0
 function register_default_options()
 {
     if ($this->options) {
         return;
     }
     $option_defaults = array();
     $old_options = WPPlugin::retrieve_options("recaptcha");
     if ($old_options) {
         // keys
         $option_defaults['public_key'] = $old_options['mailhide_pub'];
         // mailhide public key
         $option_defaults['private_key'] = $old_options['mailhide_priv'];
         // mailhide private key
         // placement
         $option_defaults['use_in_posts'] = $old_options['use_mailhide_posts'];
         // mailhide for posts/pages
         $option_defaults['use_in_comments'] = $old_options['use_mailhide_comments'];
         // use mailhide for comments
         $option_defaults['use_in_rss'] = $old_options['use_mailhide_rss'];
         // use mailhide for the rss feed of the posts/pages
         $option_defaults['use_in_rss_comments'] = $old_options['use_mailhide_rss_comments'];
         // use mailhide for the rss comments
         // bypass levels
         $option_defaults['bypass_for_registered_users'] = $old_options['mh_bypass'] == "on" ? 1 : 0;
         // whether to sometimes skip the MailHide filter for registered users
         $option_defaults['minimum_bypass_level'] = $old_options['mh_bypasslevel'];
         // who can see full emails normally (should be a valid WordPress capability slug)
         if ($option_defaults['minimum_bypass_level'] == "level_10") {
             $option_defaults['minimum_bypass_level'] = "activate_plugins";
         }
         // styling
         $option_defaults['replace_link_with'] = $old_options['mh_replace_link'];
         // name the link something else
         $option_defaults['replace_title_with'] = $old_options['mh_replace_title'];
         // title of the link
     } else {
         // keys
         $option_defaults['public_key'] = '';
         // mailhide public key
         $option_defaults['private_key'] = '';
         // mailhide private key
         // placement
         $option_defaults['use_in_posts'] = 0;
         // mailhide for posts/pages
         $option_defaults['use_in_comments'] = 0;
         // use mailhide for comments
         $option_defaults['use_in_rss'] = 0;
         // use mailhide for the rss feed of the posts/pages
         $option_defaults['use_in_rss_comments'] = 0;
         // use mailhide for the rss comments
         // bypass levels
         $option_defaults['bypass_for_registered_users'] = 0;
         // whether to sometimes skip the MailHide filter for registered users
         $option_defaults['minimum_bypass_level'] = 'read';
         // who can see full emails normally (should be a valid WordPress capability slug)
         // styling
         $option_defaults['replace_link_with'] = '';
         // name the link something else
         $option_defaults['replace_title_with'] = '';
         // title of the link
     }
     // add the option based on what environment we're in
     WPPlugin::add_options($this->options_name, $option_defaults);
 }
Example #3
0
 function register_default_options()
 {
     if ($this->options) {
         return;
     }
     $option_defaults = array();
     $old_options = WPPlugin::retrieve_options("recaptcha");
     if ($old_options) {
         $option_defaults['public_key'] = $old_options['pubkey'];
         // the public key for reCAPTCHA
         $option_defaults['private_key'] = $old_options['privkey'];
         // the private key for reCAPTCHA
         // placement
         $option_defaults['show_in_comments'] = $old_options['re_comments'];
         // whether or not to show reCAPTCHA on the comment post
         $option_defaults['show_in_registration'] = $old_options['re_registration'];
         // whether or not to show reCAPTCHA on the registration page
         // bypass levels
         $option_defaults['bypass_for_registered_users'] = $old_options['re_bypass'] == "on" ? 1 : 0;
         // whether to skip reCAPTCHAs for registered users
         $option_defaults['minimum_bypass_level'] = $old_options['re_bypasslevel'];
         // who doesn't have to do the reCAPTCHA (should be a valid WordPress capability slug)
         if ($option_defaults['minimum_bypass_level'] == "level_10") {
             $option_defaults['minimum_bypass_level'] = "activate_plugins";
         }
         // styling
         $option_defaults['comments_theme'] = $old_options['re_theme'];
         // the default theme for reCAPTCHA on the comment post
         $option_defaults['registration_theme'] = $old_options['re_theme_reg'];
         // the default theme for reCAPTCHA on the registration form
         $option_defaults['recaptcha_language'] = $old_options['re_lang'];
         // the default language for reCAPTCHA
         $option_defaults['xhtml_compliance'] = $old_options['re_xhtml'];
         // whether or not to be XHTML 1.0 Strict compliant
         $option_defaults['comments_tab_index'] = $old_options['re_tabindex'];
         // the default tabindex for reCAPTCHA
         $option_defaults['registration_tab_index'] = 30;
         // the default tabindex for reCAPTCHA
         // error handling
         $option_defaults['no_response_error'] = $old_options['error_blank'];
         // message for no CAPTCHA response
         $option_defaults['incorrect_response_error'] = $old_options['error_incorrect'];
         // message for incorrect CAPTCHA response
     } else {
         // keys
         $option_defaults['public_key'] = '';
         // the public key for reCAPTCHA
         $option_defaults['private_key'] = '';
         // the private key for reCAPTCHA
         // placement
         $option_defaults['show_in_comments'] = 1;
         // whether or not to show reCAPTCHA on the comment post
         $option_defaults['show_in_registration'] = 1;
         // whether or not to show reCAPTCHA on the registration page
         // bypass levels
         $option_defaults['bypass_for_registered_users'] = 1;
         // whether to skip reCAPTCHAs for registered users
         $option_defaults['minimum_bypass_level'] = 'read';
         // who doesn't have to do the reCAPTCHA (should be a valid WordPress capability slug)
         // styling
         $option_defaults['comments_theme'] = 'red';
         // the default theme for reCAPTCHA on the comment post
         $option_defaults['registration_theme'] = 'red';
         // the default theme for reCAPTCHA on the registration form
         $option_defaults['recaptcha_language'] = 'en';
         // the default language for reCAPTCHA
         $option_defaults['xhtml_compliance'] = 0;
         // whether or not to be XHTML 1.0 Strict compliant
         $option_defaults['comments_tab_index'] = 5;
         // the default tabindex for reCAPTCHA
         $option_defaults['registration_tab_index'] = 30;
         // the default tabindex for reCAPTCHA
         // error handling
         $option_defaults['no_response_error'] = '<strong>ERROR</strong>: Please fill in the reCAPTCHA form.';
         // message for no CAPTCHA response
         $option_defaults['incorrect_response_error'] = '<strong>ERROR</strong>: That reCAPTCHA response was incorrect.';
         // message for incorrect CAPTCHA response
     }
     // add the option based on what environment we're in
     WPPlugin::add_options($this->options_name, $option_defaults);
 }
Example #4
0
 function register_default_options()
 {
     if ($this->options) {
         return;
     }
     $option_defaults = array();
     $old_options = WPPlugin::retrieve_options("recaptcha");
     if ($old_options) {
         $option_defaults['site_key'] = $old_options['pubkey'];
         $option_defaults['secret'] = $old_options['privkey'];
         // styling
         $option_defaults['recaptcha_language'] = $old_options['re_lang'];
         // error handling
         $option_defaults['no_response_error'] = $old_options['error_blank'];
     } else {
         $old_options = WPPlugin::retrieve_options($this->options_name);
         if ($old_options) {
             $option_defaults['site_key'] = $old_options['public_key'];
             $option_defaults['secret'] = $old_options['private_key'];
             $option_defaults['comments_theme'] = 'standard';
             $option_defaults['recaptcha_language'] = $old_options['recaptcha_language'];
             $option_defaults['no_response_error'] = $old_options['no_response_error'];
         } else {
             $option_defaults['site_key'] = '';
             $option_defaults['secret'] = '';
             $option_defaults['comments_theme'] = 'standard';
             $option_defaults['recaptcha_language'] = 'en';
             $option_defaults['no_response_error'] = '<strong>ERROR</strong>: Please fill in the reCAPTCHA form.';
         }
     }
     // add the option based on what environment we're in
     WPPlugin::add_options($this->options_name, $option_defaults);
 }
 function __construct($options_name)
 {
     $this->environment = WPPlugin::determine_environment();
     $this->options_name = $options_name;
     $this->options = WPPlugin::retrieve_options($this->options_name);
 }
 function register_default_options()
 {
     if ($this->options) {
         return;
     }
     $option_defaults = array();
     $old_options = WPPlugin::retrieve_options("confidentCaptcha");
     if ($old_options) {
         $option_defaults['api_key'] = $old_options['api_key'];
         $option_defaults['public_key'] = $old_options['public_key'];
         $option_defaults['show_in_comments'] = $old_options['cc_comments'];
         $option_defaults['show_in_registration'] = $old_options['cc_registration'];
         $option_defaults['bypass_for_registered_users'] = $old_options['cc_bypass'] == "on" ? 1 : 0;
         $option_defaults['minimum_bypass_level'] = $old_options['cc_bypasslevel'];
         if ($option_defaults['minimum_bypass_level'] == "level_10") {
             $option_defaults['minimum_bypass_level'] = "activate_plugins";
         }
         $option_defaults['confidentCaptcha_language'] = $old_options['cc_lang'];
         $option_defaults['xhtml_compliance'] = $old_options['cc_xhtml'];
         $option_defaults['comments_tab_index'] = $old_options['cc_tabindex'];
         $option_defaults['registration_tab_index'] = 30;
         $option_defaults['debug_mode'] = 'FALSE';
         $option_defaults['failure_policy'] = 'math';
     } else {
         $option_defaults['api_key'] = '';
         $option_defaults['public_key'] = '';
         $option_defaults['show_in_comments'] = 1;
         $option_defaults['show_in_registration'] = 1;
         $option_defaults['show_in_lost_password'] = 1;
         $option_defaults['show_in_login_page'] = 0;
         $option_defaults['bypass_for_registered_users'] = 1;
         $option_defaults['minimum_bypass_level'] = 'read';
         $option_defaults['confidentCaptcha_language'] = 'en';
         $option_defaults['xhtml_compliance'] = 0;
         $option_defaults['comments_tab_index'] = 5;
         $option_defaults['registration_tab_index'] = 30;
         $option_defaults['debug_mode'] = 'FALSE';
         $option_defaults['failure_policy'] = 'math';
     }
     WPPlugin::add_options($this->options_name, $option_defaults);
 }
 function register_default_options()
 {
     // XTEC ********** MODIFICAT -> To update new keys if they exists before. In the following version, probably this patch won't be necessary
     // 2015.06.12 @mmartinez
     if ($this->options && !array_key_exists('site_key', $this->options) && array_key_exists('public_key', $this->options)) {
         $this->options['site_key'] = $this->options['public_key'];
         $this->options['secret'] = $this->options['private_key'];
     } else {
         if ($this->options) {
             return;
         }
     }
     // *********** ORIGINAL
     /*
             if ($this->options)
                 return;
     */
     // *********** FI
     $option_defaults = array();
     $old_options = WPPlugin::retrieve_options("recaptcha");
     if ($old_options) {
         $option_defaults['site_key'] = $old_options['pubkey'];
         $option_defaults['secret'] = $old_options['privkey'];
         // styling
         $option_defaults['recaptcha_language'] = $old_options['re_lang'];
         // error handling
         $option_defaults['no_response_error'] = $old_options['error_blank'];
     } else {
         $old_options = WPPlugin::retrieve_options($this->options_name);
         if ($old_options) {
             $option_defaults['site_key'] = $old_options['public_key'];
             $option_defaults['secret'] = $old_options['private_key'];
             $option_defaults['comments_theme'] = 'standard';
             $option_defaults['recaptcha_language'] = $old_options['recaptcha_language'];
             $option_defaults['no_response_error'] = $old_options['no_response_error'];
         } else {
             // XTEC ********** MODIFICAT -> Changed default keys (for Agora) and default language to Catalan
             // 2015.11.09 @sarjona
             if (is_agora()) {
                 global $agora;
                 if (isset($agora['recaptchapublickey']) && isset($agora['recaptchaprivatekey'])) {
                     $option_defaults['site_key'] = $agora['recaptchapublickey'];
                     $option_defaults['secret'] = $agora['recaptchaprivatekey'];
                 }
                 $option_defaults['comments_theme'] = 'standard';
                 $option_defaults['recaptcha_language'] = 'ca';
             } else {
                 $option_defaults['site_key'] = '';
                 $option_defaults['secret'] = '';
                 $option_defaults['comments_theme'] = 'standard';
                 $option_defaults['recaptcha_language'] = 'en';
             }
             // *********** ORIGINAL
             /*
                            $option_defaults['site_key'] = '';
                            $option_defaults['secret'] = '';
                            $option_defaults['comments_theme'] = 'standard';
                            $option_defaults['recaptcha_language'] = 'en';
             */
             // *********** FI
             $option_defaults['no_response_error'] = '<strong>ERROR</strong>: Please fill in the reCAPTCHA form.';
         }
     }
     // add the option based on what environment we're in
     WPPlugin::add_options($this->options_name, $option_defaults);
 }
 */
if (defined('ALLOW_INCLUDE') === false) {
    die('no direct access');
}
// XTEC ********** AFEGIT -> Update site parameters (to share them in all blogs)
// 2015.06.12 @sarjona
if (is_xtecblocs() && isset($_REQUEST['settings-updated'])) {
    // Move recaptcha options from current blog (wp_options) to site option (wp_sitemeta)
    update_site_option('recaptcha_options', $this->validate_options(get_option('recaptcha_options')));
    // Remove recaptcha options from current blog (wp_options)
    delete_option('recaptcha_options');
    $this->options = WPPlugin::retrieve_options('recaptcha_options');
} else {
    if (is_agora()) {
        global $agora;
        $this->options = WPPlugin::retrieve_options('recaptcha_options');
        $this->options['site_key'] = $agora['recaptchapublickey'];
        $this->options['secret'] = $agora['recaptchaprivatekey'];
    }
}
// ********** FI
?>

<div class="wrap">
   <a name="recaptcha"></a>
   <h2><?php 
_e('reCAPTCHA Options', 'recaptcha');
?>
</h2>
   <p><?php 
_e('reCAPTCHA is a free, accessible CAPTCHA service that helps to block spam on your blog.', 'recaptcha');