/**
     * Wrap the standard reCAPTCHA form field in typical BP registration form container markup.
     *
     * @since 1.0.3
     */
    public static function display_captcha()
    {
        $section_class = apply_filters('ncr_bp_register_section_class', 'register-section');
        ?>
		<div class="<?php 
        echo $section_class;
        ?>
" id="ncr-robot-check">
			<h4><?php 
        _e('Verify that you are a human.', self::$textdomain);
        ?>
</h4>
			<?php 
        parent::display_captcha();
        do_action('bp_failed_recaptcha_verification_errors');
        ?>
		</div>
		<?php 
    }
Example #2
0
 public static function initialize()
 {
     self::$plugin_options = get_option('ncr_options');
     self::$site_key = isset(self::$plugin_options['site_key']) ? self::$plugin_options['site_key'] : '';
     self::$secret_key = isset(self::$plugin_options['secrete_key']) ? self::$plugin_options['secrete_key'] : '';
     self::$theme = isset(self::$plugin_options['theme']) ? self::$plugin_options['theme'] : 'light';
     self::$language = isset(self::$plugin_options['language']) ? self::$plugin_options['language'] : '';
     self::$error_message = isset(self::$plugin_options['error_message']) ? self::$plugin_options['error_message'] : wp_kses(__('<strong>ERROR</strong>: Please retry CAPTCHA', 'ncr-catpcha'), array('strong' => array()));
     self::$script_handle = 'g-recaptcha';
     self::$textdomain = 'ncr-captcha';
     add_action('plugins_loaded', array(__CLASS__, 'load_plugin_textdomain'));
     // initialize if login is activated
     if (isset(self::$plugin_options['captcha_registration']) && self::$plugin_options['captcha_registration'] == 'yes' || isset(self::$plugin_options['captcha_login']) && self::$plugin_options['captcha_login'] == 'yes') {
         add_action('login_enqueue_scripts', array(__CLASS__, 'header_script'));
         add_action('login_enqueue_scripts', array(__CLASS__, 'default_wp_login_reg_css'));
     }
     // Add the "async" attribute to our registered script.
     add_filter('script_loader_tag', array(__CLASS__, 'add_async_attribute'), 10, 2);
 }
<?php

/*
Plugin Name: No CAPTCHA reCAPTCHA
Plugin URI: http://w3guy.com
Description: Protect WordPress login, registration and comment form from spam with the new No CAPTCHA reCAPTCHA
Version: 1.1
Author: Agbonghama Collins
Author URI: http://w3guy.com
License: GPL2
Text Domain: ncr-captcha
Domain Path: /lang/
*/
require_once dirname(__FILE__) . '/base-class.php';
require_once dirname(__FILE__) . '/registration.php';
require_once dirname(__FILE__) . '/buddypress-registration.php';
require_once dirname(__FILE__) . '/comment-form.php';
require_once dirname(__FILE__) . '/login.php';
require_once dirname(__FILE__) . '/settings.php';
register_activation_hook(__FILE__, array('Ncr_No_Captcha_Recaptcha', 'on_activation'));
register_uninstall_hook(__FILE__, array('Ncr_No_Captcha_Recaptcha', 'on_uninstall'));
Ncr_No_Captcha_Recaptcha::initialize();
Ncr_Registration_Captcha::initialize();
Ncr_BP_Registration_Captcha::initialize();
Ncr_Comment_Captcha::initialize();
Ncr_Login_Captcha::initialize();
Ncr_Settings_Page::initialize();