/** * admin_settings_template * * @access public * @param EE_Registration_Config $EE_Registration_Config * @return array */ public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { try { $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); // if not displaying a form, then check for form submission if ($recaptcha_settings_form->was_submitted()) { // capture form data $recaptcha_settings_form->receive_form_submission(); // validate form data if ($recaptcha_settings_form->is_valid()) { // grab validated data from form $valid_data = $recaptcha_settings_form->valid_data(); // user proofing recaptcha: If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message. if (apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) && $valid_data['main_settings']['use_captcha'] && (!$EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey'])))) { $valid_data['main_settings']['use_captcha'] = FALSE; EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); } $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; $EE_Registration_Config->recaptcha_privatekey = $valid_data['main_settings']['recaptcha_privatekey']; $EE_Registration_Config->recaptcha_type = $valid_data['appearance_settings']['recaptcha_type']; $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; } else { if ($recaptcha_settings_form->submission_error_message() != '') { EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); } } } } catch (EE_Error $e) { $e->get_error(); } // d( $EE_Registration_Config ); // die(); return $EE_Registration_Config; }
/** * display_recaptcha * * @access public * @return string html */ public static function display_recaptcha($current_step, $next_step) { // don't display if not using recaptcha or user is logged in if (EE_Registry::instance()->CFG->registration->use_captcha && !is_user_logged_in()) { // verify library is loaded if (!function_exists('recaptcha_get_html')) { // EE_Registry::instance()->load_file( EE_THIRD_PARTY . 'recaptchalib.php', '', '' ); require_once EE_THIRD_PARTY . 'recaptchalib.php'; } // only display if they have NOT passed the test yet if (!EED_Recaptcha::recaptcha_passed()) { ?> <script type="text/javascript"> /* <! [CDATA [ */ var RecaptchaOptions = { theme : "<?php echo EE_Registry::instance()->CFG->registration->recaptcha_theme; ?> ", lang : "<?php echo EE_Registry::instance()->CFG->registration->recaptcha_language; ?> " }; /* ] ]> */ </script> <p id="spco-captcha" class="reg-page-form-field-wrap-pg"> <span><?php echo __('Anti-Spam Measure: Please enter the following phrase:', 'event_espresso'); ?> </span> <?php echo recaptcha_get_html(EE_Registry::instance()->CFG->registration->recaptcha_publickey, NULL, is_ssl() ? TRUE : FALSE); ?> </p> <?php } } }