|
@@ -43,7 +43,7 @@ discard block |
|
|
block discarded – undo |
43
|
43
|
* @return EED_Recaptcha |
44
|
44
|
*/ |
45
|
45
|
public static function instance() { |
46
|
|
- return parent::get_instance( __CLASS__ ); |
|
46
|
+ return parent::get_instance(__CLASS__); |
47
|
47
|
} |
48
|
48
|
|
49
|
49
|
|
|
@@ -56,17 +56,17 @@ discard block |
|
|
block discarded – undo |
56
|
56
|
*/ |
57
|
57
|
public static function set_hooks() { |
58
|
58
|
// use_captcha ? |
59
|
|
- if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
59
|
+ if (EE_Registry::instance()->CFG->registration->use_captcha) { |
60
|
60
|
EED_Recaptcha::set_definitions(); |
61
|
61
|
EED_Recaptcha::enqueue_styles_and_scripts(); |
62
|
|
- add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
63
|
|
- add_action( 'AHEE__before_spco_whats_next_buttons', array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 ); |
64
|
|
- add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
65
|
|
- add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
66
|
|
- add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
67
|
|
- add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 ); |
|
62
|
+ add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
63
|
+ add_action('AHEE__before_spco_whats_next_buttons', array('EED_Recaptcha', 'display_recaptcha'), 10, 0); |
|
64
|
+ add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
65
|
+ add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
66
|
+ add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
67
|
+ add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1); |
68
|
68
|
} |
69
|
|
- add_filter( 'wp_headers', array( 'EED_Recaptcha', 'add_security_headers' ), 99 ); |
|
69
|
+ add_filter('wp_headers', array('EED_Recaptcha', 'add_security_headers'), 99); |
70
|
70
|
} |
71
|
71
|
|
72
|
72
|
|
|
@@ -80,16 +80,16 @@ discard block |
|
|
block discarded – undo |
80
|
80
|
public static function set_hooks_admin() { |
81
|
81
|
EED_Recaptcha::set_definitions(); |
82
|
82
|
// use_captcha ? |
83
|
|
- if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
83
|
+ if (EE_Registry::instance()->CFG->registration->use_captcha) { |
84
|
84
|
EED_Recaptcha::enqueue_styles_and_scripts(); |
85
|
|
- add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
86
|
|
- add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
87
|
|
- add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
85
|
+ add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
86
|
+ add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
87
|
+ add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
88
|
88
|
} |
89
|
89
|
// admin settings |
90
|
|
- add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
91
|
|
- add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
92
|
|
- add_filter( 'wp_headers', array( 'EED_Recaptcha', 'add_security_headers' ), 99 ); |
|
90
|
+ add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
91
|
+ add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
92
|
+ add_filter('wp_headers', array('EED_Recaptcha', 'add_security_headers'), 99); |
93
|
93
|
} |
94
|
94
|
|
95
|
95
|
|
|
@@ -101,11 +101,11 @@ discard block |
|
|
block discarded – undo |
101
|
101
|
* @return void |
102
|
102
|
*/ |
103
|
103
|
public static function set_definitions() { |
104
|
|
- if ( is_user_logged_in() ) { |
|
104
|
+ if (is_user_logged_in()) { |
105
|
105
|
EED_Recaptcha::$_not_a_robot = true; |
106
|
106
|
} |
107
|
|
- define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
108
|
|
- define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
107
|
+ define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
108
|
+ define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
109
|
109
|
} |
110
|
110
|
|
111
|
111
|
|
|
@@ -119,7 +119,7 @@ discard block |
|
|
block discarded – undo |
119
|
119
|
public static function set_late_hooks() { |
120
|
120
|
add_filter( |
121
|
121
|
'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
122
|
|
- array( 'EED_Recaptcha', 'not_a_robot' ) |
|
122
|
+ array('EED_Recaptcha', 'not_a_robot') |
123
|
123
|
); |
124
|
124
|
} |
125
|
125
|
|
|
@@ -132,11 +132,11 @@ discard block |
|
|
block discarded – undo |
132
|
132
|
* @return void |
133
|
133
|
*/ |
134
|
134
|
public static function enqueue_styles_and_scripts() { |
135
|
|
- wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
136
|
|
- wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE ); |
137
|
|
- EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' ); |
138
|
|
- EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
139
|
|
- EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
135
|
+ wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
136
|
+ wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE); |
|
137
|
+ EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
138
|
+ EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
139
|
+ EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
140
|
140
|
} |
141
|
141
|
|
142
|
142
|
|
|
@@ -147,7 +147,7 @@ discard block |
|
|
block discarded – undo |
147
|
147
|
* @access public |
148
|
148
|
* @param \WP $WP |
149
|
149
|
*/ |
150
|
|
- public function run( $WP ) { |
|
150
|
+ public function run($WP) { |
151
|
151
|
} |
152
|
152
|
|
153
|
153
|
|
|
@@ -157,8 +157,7 @@ discard block |
|
|
block discarded – undo |
157
|
157
|
* @return boolean |
158
|
158
|
*/ |
159
|
159
|
public static function not_a_robot() { |
160
|
|
- $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
161
|
|
- EED_Recaptcha::recaptcha_passed(); |
|
160
|
+ $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
162
|
161
|
return $not_a_robot; |
163
|
162
|
} |
164
|
163
|
|
|
@@ -174,23 +173,23 @@ discard block |
|
|
block discarded – undo |
174
|
173
|
*/ |
175
|
174
|
public static function display_recaptcha() { |
176
|
175
|
// logged in means you have already passed a turing test of sorts |
177
|
|
- if ( is_user_logged_in() ) { |
|
176
|
+ if (is_user_logged_in()) { |
178
|
177
|
return; |
179
|
178
|
} |
180
|
179
|
// don't display if not using recaptcha or user is logged in |
181
|
|
- if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
180
|
+ if (EE_Registry::instance()->CFG->registration->use_captcha) { |
182
|
181
|
// only display if they have NOT passed the test yet |
183
|
|
- if ( ! EED_Recaptcha::$_not_a_robot ) { |
184
|
|
- EE_Registry::instance()->load_helper( 'Template' ); |
|
182
|
+ if ( ! EED_Recaptcha::$_not_a_robot) { |
|
183
|
+ EE_Registry::instance()->load_helper('Template'); |
185
|
184
|
EEH_Template::display_template( |
186
|
|
- RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
185
|
+ RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
187
|
186
|
array( |
188
|
187
|
'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
189
|
188
|
'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
190
|
189
|
'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
191
|
190
|
) |
192
|
191
|
); |
193
|
|
- wp_enqueue_script( 'google_recaptcha' ); |
|
192
|
+ wp_enqueue_script('google_recaptcha'); |
194
|
193
|
} |
195
|
194
|
} |
196
|
195
|
} |
|
@@ -221,17 +220,17 @@ discard block |
|
|
block discarded – undo |
221
|
220
|
*/ |
222
|
221
|
public static function recaptcha_passed() { |
223
|
222
|
// logged in means you have already passed a turing test of sorts |
224
|
|
- if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
223
|
+ if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
225
|
224
|
return TRUE; |
226
|
225
|
} |
227
|
226
|
// was test already passed? |
228
|
|
- $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
229
|
|
- $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
227
|
+ $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
228
|
+ $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
230
|
229
|
// verify recaptcha |
231
|
230
|
EED_Recaptcha::_get_recaptcha_response(); |
232
|
|
- if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
231
|
+ if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
233
|
232
|
$recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
234
|
|
- EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
233
|
+ EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
235
|
234
|
EE_Registry::instance()->SSN->update(); |
236
|
235
|
} |
237
|
236
|
EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
|
@@ -247,8 +246,8 @@ discard block |
|
|
block discarded – undo |
247
|
246
|
* @param array $recaptcha_response |
248
|
247
|
* @return boolean |
249
|
248
|
*/ |
250
|
|
- public static function recaptcha_response( $recaptcha_response = array() ) { |
251
|
|
- if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
249
|
+ public static function recaptcha_response($recaptcha_response = array()) { |
|
250
|
+ if (EED_Recaptcha::_bypass_recaptcha()) { |
252
|
251
|
$recaptcha_response['bypass_recaptcha'] = TRUE; |
253
|
252
|
$recaptcha_response['recaptcha_passed'] = TRUE; |
254
|
253
|
} else { |
|
@@ -268,16 +267,16 @@ discard block |
|
|
block discarded – undo |
268
|
267
|
*/ |
269
|
268
|
private static function _bypass_recaptcha() { |
270
|
269
|
// an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
271
|
|
- $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
270
|
+ $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
272
|
271
|
// does $bypass_request_params_array have any values ? |
273
|
|
- if ( empty( $bypass_request_params_array )) { |
|
272
|
+ if (empty($bypass_request_params_array)) { |
274
|
273
|
return FALSE; |
275
|
274
|
} |
276
|
275
|
// initially set bypass to TRUE |
277
|
276
|
$bypass_recaptcha = TRUE; |
278
|
|
- foreach ( $bypass_request_params_array as $key => $value ) { |
|
277
|
+ foreach ($bypass_request_params_array as $key => $value) { |
279
|
278
|
// if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass |
280
|
|
- $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
279
|
+ $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
281
|
280
|
} |
282
|
281
|
return $bypass_recaptcha; |
283
|
282
|
} |
|
@@ -292,7 +291,7 @@ discard block |
|
|
block discarded – undo |
292
|
291
|
* @return boolean |
293
|
292
|
*/ |
294
|
293
|
private static function _get_recaptcha_response() { |
295
|
|
- EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
294
|
+ EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
296
|
295
|
} |
297
|
296
|
|
298
|
297
|
|
|
@@ -306,28 +305,28 @@ discard block |
|
|
block discarded – undo |
306
|
305
|
*/ |
307
|
306
|
private static function _process_recaptcha_response() { |
308
|
307
|
// verify library is loaded |
309
|
|
- if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) { |
310
|
|
- require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' ); |
|
308
|
+ if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) { |
|
309
|
+ require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php'); |
311
|
310
|
} |
312
|
311
|
// The response from reCAPTCHA |
313
|
312
|
EED_Recaptcha::_get_recaptcha_response(); |
314
|
313
|
$recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
315
|
314
|
// Was there a reCAPTCHA response? |
316
|
|
- if ( $recaptcha_response ) { |
|
315
|
+ if ($recaptcha_response) { |
317
|
316
|
// add "Access-Control-Allow-Origin" header |
318
|
317
|
//add_filter( 'wp_headers', array( 'EED_Recaptcha', 'add_access_control_allow_origin_header' ), 999 ); |
319
|
318
|
// if allow_url_fopen is Off, then set a different request method |
320
|
|
- $request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
319
|
+ $request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
321
|
320
|
$recaptcha = new \ReCaptcha\ReCaptcha( |
322
|
321
|
EE_Registry::instance()->CFG->registration->recaptcha_privatekey, |
323
|
322
|
$request_method |
324
|
323
|
); |
325
|
324
|
$recaptcha_response = $recaptcha->verify( |
326
|
325
|
EED_Recaptcha::$_recaptcha_response, |
327
|
|
- $_SERVER[ 'REMOTE_ADDR' ] |
|
326
|
+ $_SERVER['REMOTE_ADDR'] |
328
|
327
|
); |
329
|
328
|
} |
330
|
|
- if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) { |
|
329
|
+ if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) { |
331
|
330
|
return TRUE; |
332
|
331
|
} |
333
|
332
|
// sorry... it appears you can't don't know what soup or hamburgers are !!! |
|
@@ -343,8 +342,8 @@ discard block |
|
|
block discarded – undo |
343
|
342
|
* @param array $headers |
344
|
343
|
* @return array |
345
|
344
|
*/ |
346
|
|
- public static function add_access_control_allow_origin_header( $headers ) { |
347
|
|
- $headers[ 'Access-Control-Allow-Origin' ] = "www.google.com"; |
|
345
|
+ public static function add_access_control_allow_origin_header($headers) { |
|
346
|
+ $headers['Access-Control-Allow-Origin'] = "www.google.com"; |
348
|
347
|
return $headers; |
349
|
348
|
} |
350
|
349
|
|
|
@@ -357,9 +356,9 @@ discard block |
|
|
block discarded – undo |
357
|
356
|
* @param array $headers |
358
|
357
|
* @return array |
359
|
358
|
*/ |
360
|
|
- public static function add_security_headers( $headers ) { |
361
|
|
- $headers[ 'X-Frame-Options' ] = "SAMEORIGIN"; |
362
|
|
- $headers[ 'X-XSS-Protection' ] = "1; mode=block"; |
|
359
|
+ public static function add_security_headers($headers) { |
|
360
|
+ $headers['X-Frame-Options'] = "SAMEORIGIN"; |
|
361
|
+ $headers['X-XSS-Protection'] = "1; mode=block"; |
363
|
362
|
return $headers; |
364
|
363
|
} |
365
|
364
|
|
|
@@ -391,8 +390,8 @@ discard block |
|
|
block discarded – undo |
391
|
390
|
*/ |
392
|
391
|
protected static function _recaptcha_settings_form() { |
393
|
392
|
|
394
|
|
- EE_Registry::instance()->load_helper( 'HTML' ); |
395
|
|
- EE_Registry::instance()->load_helper( 'Template' ); |
|
393
|
+ EE_Registry::instance()->load_helper('HTML'); |
|
394
|
+ EE_Registry::instance()->load_helper('Template'); |
396
|
395
|
|
397
|
396
|
return new EE_Form_Section_Proper( |
398
|
397
|
array( |
|
@@ -402,12 +401,12 @@ discard block |
|
|
block discarded – undo |
402
|
401
|
'subsections' => apply_filters( |
403
|
402
|
'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
404
|
403
|
array( |
405
|
|
- 'main_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))), |
|
404
|
+ 'main_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))), |
406
|
405
|
'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
407
|
|
- 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
406
|
+ 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))), |
408
|
407
|
'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
409
|
408
|
// 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
410
|
|
- 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
409
|
+ 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
411
|
410
|
) |
412
|
411
|
) |
413
|
412
|
) |
|
@@ -434,28 +433,28 @@ discard block |
|
|
block discarded – undo |
434
|
433
|
array( |
435
|
434
|
'use_captcha' => new EE_Yes_No_Input( |
436
|
435
|
array( |
437
|
|
- 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
436
|
+ 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
438
|
437
|
'html_help_text' => sprintf( |
439
|
|
- __( 'reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ), |
|
438
|
+ __('reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'), |
440
|
439
|
'<a href="https://www.google.com/recaptcha/intro/index.html">', |
441
|
440
|
'</a>' |
442
|
441
|
), |
443
|
|
- 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
442
|
+ 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
444
|
443
|
'display_html_label_text' => FALSE |
445
|
444
|
) |
446
|
445
|
), |
447
|
446
|
'recaptcha_publickey' => new EE_Text_Input( |
448
|
447
|
array( |
449
|
|
- 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
450
|
|
- 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
451
|
|
- 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
448
|
+ 'html_label_text' => __('Site Key', 'event_espresso'), |
|
449
|
+ 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
450
|
+ 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
452
|
451
|
) |
453
|
452
|
), |
454
|
453
|
'recaptcha_privatekey' => new EE_Text_Input( |
455
|
454
|
array( |
456
|
|
- 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
457
|
|
- 'html_help_text' => __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ), |
458
|
|
- 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
455
|
+ 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
456
|
+ 'html_help_text' => __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'), |
|
457
|
+ 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
459
|
458
|
) |
460
|
459
|
) |
461
|
460
|
) |
|
@@ -487,81 +486,81 @@ discard block |
|
|
block discarded – undo |
487
|
486
|
array( |
488
|
487
|
'recaptcha_theme' => new EE_Radio_Button_Input( |
489
|
488
|
array( |
490
|
|
- 'light' => __( 'Light', 'event_espresso' ), |
491
|
|
- 'dark' => __( 'Dark', 'event_espresso' ) |
|
489
|
+ 'light' => __('Light', 'event_espresso'), |
|
490
|
+ 'dark' => __('Dark', 'event_espresso') |
492
|
491
|
), |
493
|
492
|
array( |
494
|
|
- 'html_label_text' => __( 'Theme', 'event_espresso' ), |
495
|
|
- 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
496
|
|
- 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
493
|
+ 'html_label_text' => __('Theme', 'event_espresso'), |
|
494
|
+ 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
495
|
+ 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
497
|
496
|
'display_html_label_text' => FALSE |
498
|
497
|
) |
499
|
498
|
), |
500
|
499
|
'recaptcha_type' => new EE_Radio_Button_Input( |
501
|
500
|
array( |
502
|
|
- 'image' => __( 'Image', 'event_espresso' ), |
503
|
|
- 'audio' => __( 'Audio', 'event_espresso' ) |
|
501
|
+ 'image' => __('Image', 'event_espresso'), |
|
502
|
+ 'audio' => __('Audio', 'event_espresso') |
504
|
503
|
), |
505
|
504
|
array( |
506
|
|
- 'html_label_text' => __( 'Type', 'event_espresso' ), |
507
|
|
- 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
508
|
|
- 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
505
|
+ 'html_label_text' => __('Type', 'event_espresso'), |
|
506
|
+ 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
507
|
+ 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
509
|
508
|
'display_html_label_text' =>FALSE |
510
|
509
|
) |
511
|
510
|
), |
512
|
511
|
'recaptcha_language' => new EE_Select_Input( |
513
|
512
|
array( |
514
|
|
- 'ar' => __( 'Arabic', 'event_espresso' ), |
515
|
|
- 'bg' => __( 'Bulgarian', 'event_espresso' ), |
516
|
|
- 'ca' => __( 'Catalan', 'event_espresso' ), |
517
|
|
- 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
518
|
|
- 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
519
|
|
- 'hr' => __( 'Croatian', 'event_espresso' ), |
520
|
|
- 'cs' => __( 'Czech', 'event_espresso' ), |
521
|
|
- 'da' => __( 'Danish', 'event_espresso' ), |
522
|
|
- 'nl' => __( 'Dutch', 'event_espresso' ), |
523
|
|
- 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
524
|
|
- 'en' => __( 'English (US)', 'event_espresso' ), |
525
|
|
- 'fil' => __( 'Filipino', 'event_espresso' ), |
526
|
|
- 'fi' => __( 'Finnish', 'event_espresso' ), |
527
|
|
- 'fr' => __( 'French', 'event_espresso' ), |
528
|
|
- 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
529
|
|
- 'de' => __( 'German', 'event_espresso' ), |
530
|
|
- 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
531
|
|
- 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
532
|
|
- 'el' => __( 'Greek', 'event_espresso' ), |
533
|
|
- 'iw' => __( 'Hebrew', 'event_espresso' ), |
534
|
|
- 'hi' => __( 'Hindi', 'event_espresso' ), |
535
|
|
- 'hu' => __( 'Hungarian', 'event_espresso' ), |
536
|
|
- 'id' => __( 'Indonesian', 'event_espresso' ), |
537
|
|
- 'it' => __( 'Italian', 'event_espresso' ), |
538
|
|
- 'ja' => __( 'Japanese', 'event_espresso' ), |
539
|
|
- 'ko' => __( 'Korean', 'event_espresso' ), |
540
|
|
- 'lv' => __( 'Latvian', 'event_espresso' ), |
541
|
|
- 'lt' => __( 'Lithuanian', 'event_espresso' ), |
542
|
|
- 'no' => __( 'Norwegian', 'event_espresso' ), |
543
|
|
- 'fa' => __( 'Persian', 'event_espresso' ), |
544
|
|
- 'pl' => __( 'Polish', 'event_espresso' ), |
545
|
|
- 'pt' => __( 'Portuguese', 'event_espresso' ), |
546
|
|
- 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
547
|
|
- 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
548
|
|
- 'ro' => __( 'Romanian', 'event_espresso' ), |
549
|
|
- 'ru' => __( 'Russian', 'event_espresso' ), |
550
|
|
- 'sr' => __( 'Serbian', 'event_espresso' ), |
551
|
|
- 'sk' => __( 'Slovak', 'event_espresso' ), |
552
|
|
- 'sl' => __( 'Slovenian', 'event_espresso' ), |
553
|
|
- 'es' => __( 'Spanish', 'event_espresso' ), |
554
|
|
- 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
555
|
|
- 'sv' => __( 'Swedish', 'event_espresso' ), |
556
|
|
- 'th' => __( 'Thai', 'event_espresso' ), |
557
|
|
- 'tr' => __( 'Turkish', 'event_espresso' ), |
558
|
|
- 'uk' => __( 'Ukrainian', 'event_espresso' ), |
559
|
|
- 'vi' => __( 'Vietnamese', 'event_espresso') |
|
513
|
+ 'ar' => __('Arabic', 'event_espresso'), |
|
514
|
+ 'bg' => __('Bulgarian', 'event_espresso'), |
|
515
|
+ 'ca' => __('Catalan', 'event_espresso'), |
|
516
|
+ 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
517
|
+ 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
518
|
+ 'hr' => __('Croatian', 'event_espresso'), |
|
519
|
+ 'cs' => __('Czech', 'event_espresso'), |
|
520
|
+ 'da' => __('Danish', 'event_espresso'), |
|
521
|
+ 'nl' => __('Dutch', 'event_espresso'), |
|
522
|
+ 'en-GB' => __('English (UK)', 'event_espresso'), |
|
523
|
+ 'en' => __('English (US)', 'event_espresso'), |
|
524
|
+ 'fil' => __('Filipino', 'event_espresso'), |
|
525
|
+ 'fi' => __('Finnish', 'event_espresso'), |
|
526
|
+ 'fr' => __('French', 'event_espresso'), |
|
527
|
+ 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
528
|
+ 'de' => __('German', 'event_espresso'), |
|
529
|
+ 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
530
|
+ 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
531
|
+ 'el' => __('Greek', 'event_espresso'), |
|
532
|
+ 'iw' => __('Hebrew', 'event_espresso'), |
|
533
|
+ 'hi' => __('Hindi', 'event_espresso'), |
|
534
|
+ 'hu' => __('Hungarian', 'event_espresso'), |
|
535
|
+ 'id' => __('Indonesian', 'event_espresso'), |
|
536
|
+ 'it' => __('Italian', 'event_espresso'), |
|
537
|
+ 'ja' => __('Japanese', 'event_espresso'), |
|
538
|
+ 'ko' => __('Korean', 'event_espresso'), |
|
539
|
+ 'lv' => __('Latvian', 'event_espresso'), |
|
540
|
+ 'lt' => __('Lithuanian', 'event_espresso'), |
|
541
|
+ 'no' => __('Norwegian', 'event_espresso'), |
|
542
|
+ 'fa' => __('Persian', 'event_espresso'), |
|
543
|
+ 'pl' => __('Polish', 'event_espresso'), |
|
544
|
+ 'pt' => __('Portuguese', 'event_espresso'), |
|
545
|
+ 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
546
|
+ 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
547
|
+ 'ro' => __('Romanian', 'event_espresso'), |
|
548
|
+ 'ru' => __('Russian', 'event_espresso'), |
|
549
|
+ 'sr' => __('Serbian', 'event_espresso'), |
|
550
|
+ 'sk' => __('Slovak', 'event_espresso'), |
|
551
|
+ 'sl' => __('Slovenian', 'event_espresso'), |
|
552
|
+ 'es' => __('Spanish', 'event_espresso'), |
|
553
|
+ 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
554
|
+ 'sv' => __('Swedish', 'event_espresso'), |
|
555
|
+ 'th' => __('Thai', 'event_espresso'), |
|
556
|
+ 'tr' => __('Turkish', 'event_espresso'), |
|
557
|
+ 'uk' => __('Ukrainian', 'event_espresso'), |
|
558
|
+ 'vi' => __('Vietnamese', 'event_espresso') |
560
|
559
|
), |
561
|
560
|
array( |
562
|
|
- 'html_label_text' => __( 'Language', 'event_espresso' ), |
563
|
|
- 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
564
|
|
- 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
561
|
+ 'html_label_text' => __('Language', 'event_espresso'), |
|
562
|
+ 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
563
|
+ 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
565
|
564
|
) |
566
|
565
|
) |
567
|
566
|
) |
|
@@ -609,25 +608,25 @@ discard block |
|
|
block discarded – undo |
609
|
608
|
* @param EE_Registration_Config $EE_Registration_Config |
610
|
609
|
* @return array |
611
|
610
|
*/ |
612
|
|
- public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
611
|
+ public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
613
|
612
|
try { |
614
|
613
|
$recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
615
|
614
|
// if not displaying a form, then check for form submission |
616
|
|
- if ( $recaptcha_settings_form->was_submitted() ) { |
|
615
|
+ if ($recaptcha_settings_form->was_submitted()) { |
617
|
616
|
// capture form data |
618
|
617
|
$recaptcha_settings_form->receive_form_submission(); |
619
|
618
|
// validate form data |
620
|
|
- if ( $recaptcha_settings_form->is_valid() ) { |
|
619
|
+ if ($recaptcha_settings_form->is_valid()) { |
621
|
620
|
// grab validated data from form |
622
|
621
|
$valid_data = $recaptcha_settings_form->valid_data(); |
623
|
622
|
// 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. |
624
|
623
|
if ( |
625
|
|
- apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
624
|
+ apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
626
|
625
|
&& $valid_data['main_settings']['use_captcha'] |
627
|
|
- && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
626
|
+ && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
628
|
627
|
) { |
629
|
628
|
$valid_data['main_settings']['use_captcha'] = FALSE; |
630
|
|
- 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__ ); |
|
629
|
+ 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__); |
631
|
630
|
} |
632
|
631
|
$EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
633
|
632
|
$EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
|
@@ -636,12 +635,12 @@ discard block |
|
|
block discarded – undo |
636
|
635
|
$EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
637
|
636
|
$EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
638
|
637
|
} else { |
639
|
|
- if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
640
|
|
- EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
638
|
+ if ($recaptcha_settings_form->submission_error_message() != '') { |
|
639
|
+ EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
641
|
640
|
} |
642
|
641
|
} |
643
|
642
|
} |
644
|
|
- } catch( EE_Error $e ) { |
|
643
|
+ } catch (EE_Error $e) { |
645
|
644
|
$e->get_error(); |
646
|
645
|
} |
647
|
646
|
|