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; }
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); }
function register_stylesheets() { $path = WPPlugin::url_to_plugin_directory() . '/recaptcha.css'; echo '<link rel="stylesheet" type="text/css" href="' . $path . '" />'; }
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); }
static function add_options($options_name, $options) { // XTEC ********** MODIFICAT -> Added WordPressMS to share site_options // 2012.04.04 @mmartinez if (WPPlugin::determine_environment() == Environment::WordPressMU || WPPlugin::determine_environment() == Environment::WordPressMS) { // *********** ORIGINAL /* if (WPPlugin::determine_environment() == Environment::WordPressMU) */ // *********** FI return add_site_option($options_name, $options); } else { return add_option($options_name, $options); } }
function uninstall_options($name) { unregister_setting("{$name}_group", $name); WPPlugin::remove_options($name); }
static function add_options($options_name, $options) { if (WPPlugin::determine_environment() == Environment::WordPressMU || WPPlugin::determine_environment() == Environment::WordPressMS) { return add_site_option($options_name, $options); } else { return add_option($options_name, $options); } }
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');