@@ -102,8 +102,8 @@ |
||
102 | 102 | // use_captcha ? |
103 | 103 | if ( |
104 | 104 | EE_Registry::instance()->CFG->registration->use_captcha |
105 | - && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
106 | - && ! ( |
|
105 | + && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
106 | + && ! ( |
|
107 | 107 | EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
108 | 108 | && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
109 | 109 | ) |
@@ -43,7 +43,7 @@ discard block |
||
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 | |
@@ -59,32 +59,32 @@ discard block |
||
59 | 59 | if ( |
60 | 60 | EE_Registry::instance()->CFG->registration->use_captcha |
61 | 61 | && ! ( |
62 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
63 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
62 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
63 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
64 | 64 | ) |
65 | 65 | ) { |
66 | 66 | EED_Recaptcha::set_definitions(); |
67 | 67 | EED_Recaptcha::enqueue_styles_and_scripts(); |
68 | - add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
|
68 | + add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
69 | 69 | add_action( |
70 | 70 | 'AHEE__before_spco_whats_next_buttons', |
71 | - array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 |
|
71 | + array('EED_Recaptcha', 'display_recaptcha'), 10, 0 |
|
72 | 72 | ); |
73 | 73 | add_filter( |
74 | 74 | 'FHEE__EED_Single_Page_Checkout__init___continue_reg', |
75 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
75 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
76 | 76 | ); |
77 | 77 | add_filter( |
78 | 78 | 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', |
79 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
79 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
80 | 80 | ); |
81 | 81 | add_filter( |
82 | 82 | 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', |
83 | - array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 |
|
83 | + array('EED_Recaptcha', 'recaptcha_response'), 10, 1 |
|
84 | 84 | ); |
85 | 85 | add_filter( |
86 | 86 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
87 | - array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 |
|
87 | + array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1 |
|
88 | 88 | ); |
89 | 89 | } |
90 | 90 | } |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | // use_captcha ? |
103 | 103 | if ( |
104 | 104 | EE_Registry::instance()->CFG->registration->use_captcha |
105 | - && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
105 | + && EE_Registry::instance()->REQ->get('step', '') !== '' |
|
106 | 106 | && ! ( |
107 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
108 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
107 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
108 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
109 | 109 | ) |
110 | 110 | ) { |
111 | 111 | EED_Recaptcha::enqueue_styles_and_scripts(); |
112 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
113 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
114 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
112 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
113 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
114 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
115 | 115 | } |
116 | 116 | // admin settings |
117 | - add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
|
118 | - add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
|
117 | + add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
118 | + add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @return void |
128 | 128 | */ |
129 | 129 | public static function set_definitions() { |
130 | - if ( is_user_logged_in() ) { |
|
130 | + if (is_user_logged_in()) { |
|
131 | 131 | EED_Recaptcha::$_not_a_robot = true; |
132 | 132 | } |
133 | - define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
134 | - define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
133 | + define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
134 | + define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | public static function set_late_hooks() { |
146 | 146 | add_filter( |
147 | 147 | 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
148 | - array( 'EED_Recaptcha', 'not_a_robot' ) |
|
148 | + array('EED_Recaptcha', 'not_a_robot') |
|
149 | 149 | ); |
150 | 150 | } |
151 | 151 | |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | * @return void |
159 | 159 | */ |
160 | 160 | public static function enqueue_styles_and_scripts() { |
161 | - wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
162 | - 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 ); |
|
163 | - 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' ); |
|
164 | - 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' ); |
|
165 | - EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
161 | + wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
162 | + 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); |
|
163 | + 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'); |
|
164 | + 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'); |
|
165 | + EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @access public |
174 | 174 | * @param \WP $WP |
175 | 175 | */ |
176 | - public function run( $WP ) { |
|
176 | + public function run($WP) { |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -183,8 +183,7 @@ discard block |
||
183 | 183 | * @return boolean |
184 | 184 | */ |
185 | 185 | public static function not_a_robot() { |
186 | - $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
|
187 | - EED_Recaptcha::recaptcha_passed(); |
|
186 | + $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
|
188 | 187 | return $not_a_robot; |
189 | 188 | } |
190 | 189 | |
@@ -200,22 +199,22 @@ discard block |
||
200 | 199 | */ |
201 | 200 | public static function display_recaptcha() { |
202 | 201 | // logged in means you have already passed a turing test of sorts |
203 | - if ( is_user_logged_in() ) { |
|
202 | + if (is_user_logged_in()) { |
|
204 | 203 | return; |
205 | 204 | } |
206 | 205 | // don't display if not using recaptcha or user is logged in |
207 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
206 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
208 | 207 | // only display if they have NOT passed the test yet |
209 | - if ( ! EED_Recaptcha::$_not_a_robot ) { |
|
208 | + if ( ! EED_Recaptcha::$_not_a_robot) { |
|
210 | 209 | EEH_Template::display_template( |
211 | - RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
210 | + RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
|
212 | 211 | array( |
213 | 212 | 'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
214 | 213 | 'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
215 | 214 | 'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
216 | 215 | ) |
217 | 216 | ); |
218 | - wp_enqueue_script( 'google_recaptcha' ); |
|
217 | + wp_enqueue_script('google_recaptcha'); |
|
219 | 218 | } |
220 | 219 | } |
221 | 220 | } |
@@ -246,17 +245,17 @@ discard block |
||
246 | 245 | */ |
247 | 246 | public static function recaptcha_passed() { |
248 | 247 | // logged in means you have already passed a turing test of sorts |
249 | - if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
248 | + if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
|
250 | 249 | return TRUE; |
251 | 250 | } |
252 | 251 | // was test already passed? |
253 | - $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
|
254 | - $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
252 | + $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
253 | + $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
|
255 | 254 | // verify recaptcha |
256 | 255 | EED_Recaptcha::_get_recaptcha_response(); |
257 | - if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
256 | + if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
|
258 | 257 | $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
259 | - EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
258 | + EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
|
260 | 259 | } |
261 | 260 | EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
262 | 261 | return $recaptcha_passed; |
@@ -271,8 +270,8 @@ discard block |
||
271 | 270 | * @param array $recaptcha_response |
272 | 271 | * @return boolean |
273 | 272 | */ |
274 | - public static function recaptcha_response( $recaptcha_response = array() ) { |
|
275 | - if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
273 | + public static function recaptcha_response($recaptcha_response = array()) { |
|
274 | + if (EED_Recaptcha::_bypass_recaptcha()) { |
|
276 | 275 | $recaptcha_response['bypass_recaptcha'] = TRUE; |
277 | 276 | $recaptcha_response['recaptcha_passed'] = TRUE; |
278 | 277 | } else { |
@@ -292,16 +291,16 @@ discard block |
||
292 | 291 | */ |
293 | 292 | private static function _bypass_recaptcha() { |
294 | 293 | // an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
295 | - $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
294 | + $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
|
296 | 295 | // does $bypass_request_params_array have any values ? |
297 | - if ( empty( $bypass_request_params_array )) { |
|
296 | + if (empty($bypass_request_params_array)) { |
|
298 | 297 | return FALSE; |
299 | 298 | } |
300 | 299 | // initially set bypass to TRUE |
301 | 300 | $bypass_recaptcha = TRUE; |
302 | - foreach ( $bypass_request_params_array as $key => $value ) { |
|
301 | + foreach ($bypass_request_params_array as $key => $value) { |
|
303 | 302 | // 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 |
304 | - $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
303 | + $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
|
305 | 304 | } |
306 | 305 | return $bypass_recaptcha; |
307 | 306 | } |
@@ -316,7 +315,7 @@ discard block |
||
316 | 315 | * @return boolean |
317 | 316 | */ |
318 | 317 | private static function _get_recaptcha_response() { |
319 | - EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
318 | + EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
|
320 | 319 | } |
321 | 320 | |
322 | 321 | |
@@ -330,26 +329,26 @@ discard block |
||
330 | 329 | */ |
331 | 330 | private static function _process_recaptcha_response() { |
332 | 331 | // verify library is loaded |
333 | - if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) { |
|
334 | - require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' ); |
|
332 | + if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) { |
|
333 | + require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php'); |
|
335 | 334 | } |
336 | 335 | // The response from reCAPTCHA |
337 | 336 | EED_Recaptcha::_get_recaptcha_response(); |
338 | 337 | $recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
339 | 338 | // Was there a reCAPTCHA response? |
340 | - if ( $recaptcha_response ) { |
|
339 | + if ($recaptcha_response) { |
|
341 | 340 | // if allow_url_fopen is Off, then set a different request method |
342 | - $request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
341 | + $request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
343 | 342 | $recaptcha = new \ReCaptcha\ReCaptcha( |
344 | 343 | EE_Registry::instance()->CFG->registration->recaptcha_privatekey, |
345 | 344 | $request_method |
346 | 345 | ); |
347 | 346 | $recaptcha_response = $recaptcha->verify( |
348 | 347 | EED_Recaptcha::$_recaptcha_response, |
349 | - $_SERVER[ 'REMOTE_ADDR' ] |
|
348 | + $_SERVER['REMOTE_ADDR'] |
|
350 | 349 | ); |
351 | 350 | } |
352 | - if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) { |
|
351 | + if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) { |
|
353 | 352 | return TRUE; |
354 | 353 | } |
355 | 354 | // sorry... it appears you can't don't know what soup or hamburgers are !!! |
@@ -393,12 +392,12 @@ discard block |
||
393 | 392 | 'subsections' => apply_filters( |
394 | 393 | 'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
395 | 394 | array( |
396 | - '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' ))), |
|
395 | + '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'))), |
|
397 | 396 | 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
398 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
397 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))), |
|
399 | 398 | 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
400 | 399 | // 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
401 | - 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
400 | + 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
|
402 | 401 | ) |
403 | 402 | ) |
404 | 403 | ) |
@@ -425,28 +424,28 @@ discard block |
||
425 | 424 | array( |
426 | 425 | 'use_captcha' => new EE_Yes_No_Input( |
427 | 426 | array( |
428 | - 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
427 | + 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
|
429 | 428 | 'html_help_text' => sprintf( |
430 | - __( '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' ), |
|
429 | + __('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'), |
|
431 | 430 | '<a href="https://www.google.com/recaptcha/intro/index.html">', |
432 | 431 | '</a>' |
433 | 432 | ), |
434 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
433 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
435 | 434 | 'display_html_label_text' => FALSE |
436 | 435 | ) |
437 | 436 | ), |
438 | 437 | 'recaptcha_publickey' => new EE_Text_Input( |
439 | 438 | array( |
440 | - 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
|
441 | - 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
|
442 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
439 | + 'html_label_text' => __('Site Key', 'event_espresso'), |
|
440 | + 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
441 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
|
443 | 442 | ) |
444 | 443 | ), |
445 | 444 | 'recaptcha_privatekey' => new EE_Text_Input( |
446 | 445 | array( |
447 | - 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
|
448 | - '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' ), |
|
449 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
446 | + 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
447 | + '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'), |
|
448 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
|
450 | 449 | ) |
451 | 450 | ) |
452 | 451 | ) |
@@ -478,81 +477,81 @@ discard block |
||
478 | 477 | array( |
479 | 478 | 'recaptcha_theme' => new EE_Radio_Button_Input( |
480 | 479 | array( |
481 | - 'light' => __( 'Light', 'event_espresso' ), |
|
482 | - 'dark' => __( 'Dark', 'event_espresso' ) |
|
480 | + 'light' => __('Light', 'event_espresso'), |
|
481 | + 'dark' => __('Dark', 'event_espresso') |
|
483 | 482 | ), |
484 | 483 | array( |
485 | - 'html_label_text' => __( 'Theme', 'event_espresso' ), |
|
486 | - 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
|
487 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
484 | + 'html_label_text' => __('Theme', 'event_espresso'), |
|
485 | + 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
486 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
488 | 487 | 'display_html_label_text' => FALSE |
489 | 488 | ) |
490 | 489 | ), |
491 | 490 | 'recaptcha_type' => new EE_Radio_Button_Input( |
492 | 491 | array( |
493 | - 'image' => __( 'Image', 'event_espresso' ), |
|
494 | - 'audio' => __( 'Audio', 'event_espresso' ) |
|
492 | + 'image' => __('Image', 'event_espresso'), |
|
493 | + 'audio' => __('Audio', 'event_espresso') |
|
495 | 494 | ), |
496 | 495 | array( |
497 | - 'html_label_text' => __( 'Type', 'event_espresso' ), |
|
498 | - 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
|
499 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
496 | + 'html_label_text' => __('Type', 'event_espresso'), |
|
497 | + 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
498 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
500 | 499 | 'display_html_label_text' =>FALSE |
501 | 500 | ) |
502 | 501 | ), |
503 | 502 | 'recaptcha_language' => new EE_Select_Input( |
504 | 503 | array( |
505 | - 'ar' => __( 'Arabic', 'event_espresso' ), |
|
506 | - 'bg' => __( 'Bulgarian', 'event_espresso' ), |
|
507 | - 'ca' => __( 'Catalan', 'event_espresso' ), |
|
508 | - 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
|
509 | - 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
|
510 | - 'hr' => __( 'Croatian', 'event_espresso' ), |
|
511 | - 'cs' => __( 'Czech', 'event_espresso' ), |
|
512 | - 'da' => __( 'Danish', 'event_espresso' ), |
|
513 | - 'nl' => __( 'Dutch', 'event_espresso' ), |
|
514 | - 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
|
515 | - 'en' => __( 'English (US)', 'event_espresso' ), |
|
516 | - 'fil' => __( 'Filipino', 'event_espresso' ), |
|
517 | - 'fi' => __( 'Finnish', 'event_espresso' ), |
|
518 | - 'fr' => __( 'French', 'event_espresso' ), |
|
519 | - 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
|
520 | - 'de' => __( 'German', 'event_espresso' ), |
|
521 | - 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
|
522 | - 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
|
523 | - 'el' => __( 'Greek', 'event_espresso' ), |
|
524 | - 'iw' => __( 'Hebrew', 'event_espresso' ), |
|
525 | - 'hi' => __( 'Hindi', 'event_espresso' ), |
|
526 | - 'hu' => __( 'Hungarian', 'event_espresso' ), |
|
527 | - 'id' => __( 'Indonesian', 'event_espresso' ), |
|
528 | - 'it' => __( 'Italian', 'event_espresso' ), |
|
529 | - 'ja' => __( 'Japanese', 'event_espresso' ), |
|
530 | - 'ko' => __( 'Korean', 'event_espresso' ), |
|
531 | - 'lv' => __( 'Latvian', 'event_espresso' ), |
|
532 | - 'lt' => __( 'Lithuanian', 'event_espresso' ), |
|
533 | - 'no' => __( 'Norwegian', 'event_espresso' ), |
|
534 | - 'fa' => __( 'Persian', 'event_espresso' ), |
|
535 | - 'pl' => __( 'Polish', 'event_espresso' ), |
|
536 | - 'pt' => __( 'Portuguese', 'event_espresso' ), |
|
537 | - 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
|
538 | - 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
|
539 | - 'ro' => __( 'Romanian', 'event_espresso' ), |
|
540 | - 'ru' => __( 'Russian', 'event_espresso' ), |
|
541 | - 'sr' => __( 'Serbian', 'event_espresso' ), |
|
542 | - 'sk' => __( 'Slovak', 'event_espresso' ), |
|
543 | - 'sl' => __( 'Slovenian', 'event_espresso' ), |
|
544 | - 'es' => __( 'Spanish', 'event_espresso' ), |
|
545 | - 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
|
546 | - 'sv' => __( 'Swedish', 'event_espresso' ), |
|
547 | - 'th' => __( 'Thai', 'event_espresso' ), |
|
548 | - 'tr' => __( 'Turkish', 'event_espresso' ), |
|
549 | - 'uk' => __( 'Ukrainian', 'event_espresso' ), |
|
550 | - 'vi' => __( 'Vietnamese', 'event_espresso') |
|
504 | + 'ar' => __('Arabic', 'event_espresso'), |
|
505 | + 'bg' => __('Bulgarian', 'event_espresso'), |
|
506 | + 'ca' => __('Catalan', 'event_espresso'), |
|
507 | + 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
508 | + 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
509 | + 'hr' => __('Croatian', 'event_espresso'), |
|
510 | + 'cs' => __('Czech', 'event_espresso'), |
|
511 | + 'da' => __('Danish', 'event_espresso'), |
|
512 | + 'nl' => __('Dutch', 'event_espresso'), |
|
513 | + 'en-GB' => __('English (UK)', 'event_espresso'), |
|
514 | + 'en' => __('English (US)', 'event_espresso'), |
|
515 | + 'fil' => __('Filipino', 'event_espresso'), |
|
516 | + 'fi' => __('Finnish', 'event_espresso'), |
|
517 | + 'fr' => __('French', 'event_espresso'), |
|
518 | + 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
519 | + 'de' => __('German', 'event_espresso'), |
|
520 | + 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
521 | + 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
522 | + 'el' => __('Greek', 'event_espresso'), |
|
523 | + 'iw' => __('Hebrew', 'event_espresso'), |
|
524 | + 'hi' => __('Hindi', 'event_espresso'), |
|
525 | + 'hu' => __('Hungarian', 'event_espresso'), |
|
526 | + 'id' => __('Indonesian', 'event_espresso'), |
|
527 | + 'it' => __('Italian', 'event_espresso'), |
|
528 | + 'ja' => __('Japanese', 'event_espresso'), |
|
529 | + 'ko' => __('Korean', 'event_espresso'), |
|
530 | + 'lv' => __('Latvian', 'event_espresso'), |
|
531 | + 'lt' => __('Lithuanian', 'event_espresso'), |
|
532 | + 'no' => __('Norwegian', 'event_espresso'), |
|
533 | + 'fa' => __('Persian', 'event_espresso'), |
|
534 | + 'pl' => __('Polish', 'event_espresso'), |
|
535 | + 'pt' => __('Portuguese', 'event_espresso'), |
|
536 | + 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
537 | + 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
538 | + 'ro' => __('Romanian', 'event_espresso'), |
|
539 | + 'ru' => __('Russian', 'event_espresso'), |
|
540 | + 'sr' => __('Serbian', 'event_espresso'), |
|
541 | + 'sk' => __('Slovak', 'event_espresso'), |
|
542 | + 'sl' => __('Slovenian', 'event_espresso'), |
|
543 | + 'es' => __('Spanish', 'event_espresso'), |
|
544 | + 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
545 | + 'sv' => __('Swedish', 'event_espresso'), |
|
546 | + 'th' => __('Thai', 'event_espresso'), |
|
547 | + 'tr' => __('Turkish', 'event_espresso'), |
|
548 | + 'uk' => __('Ukrainian', 'event_espresso'), |
|
549 | + 'vi' => __('Vietnamese', 'event_espresso') |
|
551 | 550 | ), |
552 | 551 | array( |
553 | - 'html_label_text' => __( 'Language', 'event_espresso' ), |
|
554 | - 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
|
555 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
552 | + 'html_label_text' => __('Language', 'event_espresso'), |
|
553 | + 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
554 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
556 | 555 | ) |
557 | 556 | ) |
558 | 557 | ) |
@@ -600,25 +599,25 @@ discard block |
||
600 | 599 | * @param EE_Registration_Config $EE_Registration_Config |
601 | 600 | * @return array |
602 | 601 | */ |
603 | - public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
602 | + public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
|
604 | 603 | try { |
605 | 604 | $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
606 | 605 | // if not displaying a form, then check for form submission |
607 | - if ( $recaptcha_settings_form->was_submitted() ) { |
|
606 | + if ($recaptcha_settings_form->was_submitted()) { |
|
608 | 607 | // capture form data |
609 | 608 | $recaptcha_settings_form->receive_form_submission(); |
610 | 609 | // validate form data |
611 | - if ( $recaptcha_settings_form->is_valid() ) { |
|
610 | + if ($recaptcha_settings_form->is_valid()) { |
|
612 | 611 | // grab validated data from form |
613 | 612 | $valid_data = $recaptcha_settings_form->valid_data(); |
614 | 613 | // 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. |
615 | 614 | if ( |
616 | - apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
615 | + apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
|
617 | 616 | && $valid_data['main_settings']['use_captcha'] |
618 | - && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
617 | + && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
|
619 | 618 | ) { |
620 | 619 | $valid_data['main_settings']['use_captcha'] = FALSE; |
621 | - 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__ ); |
|
620 | + 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__); |
|
622 | 621 | } |
623 | 622 | $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
624 | 623 | $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
@@ -627,12 +626,12 @@ discard block |
||
627 | 626 | $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
628 | 627 | $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
629 | 628 | } else { |
630 | - if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
|
631 | - EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
629 | + if ($recaptcha_settings_form->submission_error_message() != '') { |
|
630 | + EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
632 | 631 | } |
633 | 632 | } |
634 | 633 | } |
635 | - } catch( EE_Error $e ) { |
|
634 | + } catch (EE_Error $e) { |
|
636 | 635 | $e->get_error(); |
637 | 636 | } |
638 | 637 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -17,27 +17,27 @@ |
||
17 | 17 | class TicketSelectorIframeEmbedButton extends IframeEmbedButton |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * TicketSelectorIframeEmbedButton constructor. |
|
22 | - */ |
|
23 | - public function __construct() |
|
24 | - { |
|
25 | - parent::__construct( |
|
26 | - esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
27 | - 'ticket_selector' |
|
28 | - ); |
|
29 | - } |
|
30 | - |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * Adds an iframe embed code button to the Event editor. |
|
35 | - */ |
|
36 | - public function addEventEditorIframeEmbedButton() |
|
37 | - { |
|
38 | - // add button for iframe code to event editor. |
|
39 | - $this->addEventEditorIframeEmbedButtonFilter(); |
|
40 | - } |
|
20 | + /** |
|
21 | + * TicketSelectorIframeEmbedButton constructor. |
|
22 | + */ |
|
23 | + public function __construct() |
|
24 | + { |
|
25 | + parent::__construct( |
|
26 | + esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
27 | + 'ticket_selector' |
|
28 | + ); |
|
29 | + } |
|
30 | + |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * Adds an iframe embed code button to the Event editor. |
|
35 | + */ |
|
36 | + public function addEventEditorIframeEmbedButton() |
|
37 | + { |
|
38 | + // add button for iframe code to event editor. |
|
39 | + $this->addEventEditorIframeEmbedButtonFilter(); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | 43 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\libraries\iframe_display\IframeEmbedButton; |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | |
9 | 9 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function __construct() |
24 | 24 | { |
25 | 25 | parent::__construct( |
26 | - esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
26 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
27 | 27 | 'ticket_selector' |
28 | 28 | ); |
29 | 29 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\libraries\iframe_display\Iframe; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * @return mixed|null |
27 | 27 | * @throws \EE_Error |
28 | 28 | */ |
29 | - public static function create( $class_name, $arguments = array() ) { |
|
30 | - if ( empty( $class_name ) ) { |
|
29 | + public static function create($class_name, $arguments = array()) { |
|
30 | + if (empty($class_name)) { |
|
31 | 31 | throw new \EE_Error( |
32 | - __( 'You must provide a class name in order to instantiate it.', 'event_espresso' ) |
|
32 | + __('You must provide a class name in order to instantiate it.', 'event_espresso') |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | // if ( ! class_exists( $class_name ) ) { |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | // ); |
42 | 42 | // } |
43 | 43 | $object = null; |
44 | - switch ( $class_name ) { |
|
44 | + switch ($class_name) { |
|
45 | 45 | |
46 | 46 | case 'EE_Request' : |
47 | - $object = new \EE_Request( $_GET, $_POST, $_COOKIE ); |
|
47 | + $object = new \EE_Request($_GET, $_POST, $_COOKIE); |
|
48 | 48 | break; |
49 | 49 | |
50 | 50 | case 'Iframe' : |
51 | - $title = isset( $arguments['title'] ) ? $arguments['title'] : null; |
|
52 | - $content = isset( $arguments['content'] ) ? $arguments['content'] : null; |
|
53 | - $object = new Iframe( $title, $content ); |
|
51 | + $title = isset($arguments['title']) ? $arguments['title'] : null; |
|
52 | + $content = isset($arguments['content']) ? $arguments['content'] : null; |
|
53 | + $object = new Iframe($title, $content); |
|
54 | 54 | break; |
55 | 55 | |
56 | 56 | default : |
57 | - $object = new $class_name( $arguments ); |
|
57 | + $object = new $class_name($arguments); |
|
58 | 58 | |
59 | 59 | } |
60 | 60 |
@@ -274,26 +274,26 @@ discard block |
||
274 | 274 | if ( ! $this->validate_ipn( $update_info, $payment ) ) { |
275 | 275 | return $payment; |
276 | 276 | } |
277 | - // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction, |
|
278 | - // registrations, ticket counts, etc) |
|
279 | - if ( |
|
280 | - ( |
|
281 | - $update_info[ 'payment_status' ] === 'Refunded' |
|
282 | - || $update_info[ 'payment_status' ] === 'Partially_Refunded' |
|
283 | - ) |
|
284 | - && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true ) |
|
285 | - ) { |
|
286 | - throw new EventEspresso\core\exceptions\IpnException( |
|
287 | - sprintf( |
|
288 | - esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'), |
|
289 | - $update_info['payment_status'] |
|
290 | - ), |
|
291 | - EventEspresso\core\exceptions\IpnException::UNSUPPORTED, |
|
292 | - null, |
|
293 | - $payment, |
|
294 | - $update_info |
|
295 | - ); |
|
296 | - } |
|
277 | + // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction, |
|
278 | + // registrations, ticket counts, etc) |
|
279 | + if ( |
|
280 | + ( |
|
281 | + $update_info[ 'payment_status' ] === 'Refunded' |
|
282 | + || $update_info[ 'payment_status' ] === 'Partially_Refunded' |
|
283 | + ) |
|
284 | + && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true ) |
|
285 | + ) { |
|
286 | + throw new EventEspresso\core\exceptions\IpnException( |
|
287 | + sprintf( |
|
288 | + esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'), |
|
289 | + $update_info['payment_status'] |
|
290 | + ), |
|
291 | + EventEspresso\core\exceptions\IpnException::UNSUPPORTED, |
|
292 | + null, |
|
293 | + $payment, |
|
294 | + $update_info |
|
295 | + ); |
|
296 | + } |
|
297 | 297 | //ok, well let's process this payment then! |
298 | 298 | switch ( $update_info[ 'payment_status' ] ) { |
299 | 299 | |
@@ -541,17 +541,17 @@ discard block |
||
541 | 541 | |
542 | 542 | //might paypal have changed the taxes? |
543 | 543 | if( $this->_paypal_taxes && $payment_was_itemized ) { |
544 | - // note that we're doing this BEFORE adding shipping; |
|
544 | + // note that we're doing this BEFORE adding shipping; |
|
545 | 545 | // we actually want PayPal's shipping to remain non-taxable |
546 | - $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' ); |
|
547 | - $this->_line_item->set_total_tax_to( |
|
548 | - $transaction_total_line_item, |
|
549 | - (float)$update_info['tax'], |
|
550 | - esc_html__( 'Taxes', 'event_espresso' ), |
|
551 | - esc_html__( 'Calculated by Paypal', 'event_espresso' ), |
|
552 | - 'paypal_tax' |
|
553 | - ); |
|
554 | - $grand_total_needs_resaving = TRUE; |
|
546 | + $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' ); |
|
547 | + $this->_line_item->set_total_tax_to( |
|
548 | + $transaction_total_line_item, |
|
549 | + (float)$update_info['tax'], |
|
550 | + esc_html__( 'Taxes', 'event_espresso' ), |
|
551 | + esc_html__( 'Calculated by Paypal', 'event_espresso' ), |
|
552 | + 'paypal_tax' |
|
553 | + ); |
|
554 | + $grand_total_needs_resaving = TRUE; |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | $shipping_amount = (float)$update_info[ 'mc_shipping' ]; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return EEG_Paypal_Standard |
71 | 71 | */ |
72 | 72 | public function __construct() { |
73 | - $this->set_uses_separate_IPN_request( true ) ; |
|
73 | + $this->set_uses_separate_IPN_request(true); |
|
74 | 74 | parent::__construct(); |
75 | 75 | } |
76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * Also sets the gateway url class variable based on whether debug mode is enabled or not |
81 | 81 | * @param array $settings_array |
82 | 82 | */ |
83 | - public function set_settings($settings_array){ |
|
83 | + public function set_settings($settings_array) { |
|
84 | 84 | parent::set_settings($settings_array); |
85 | 85 | $this->_gateway_url = $this->_debug_mode |
86 | 86 | ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' |
@@ -114,42 +114,42 @@ discard block |
||
114 | 114 | |
115 | 115 | $total_discounts_to_cart_total = $transaction->paid(); |
116 | 116 | //only itemize the order if we're paying for the rest of the order's amount |
117 | - if( EEH_Money::compare_floats( $payment->amount(), $transaction->total(), '==' ) ) { |
|
118 | - $payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true ); |
|
117 | + if (EEH_Money::compare_floats($payment->amount(), $transaction->total(), '==')) { |
|
118 | + $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true); |
|
119 | 119 | //this payment is for the remaining transaction amount, |
120 | 120 | //keep track of exactly how much the itemized order amount equals |
121 | 121 | $itemized_sum = 0; |
122 | 122 | $shipping_previously_added = 0; |
123 | 123 | //so let's show all the line items |
124 | - foreach($total_line_item->get_items() as $line_item){ |
|
125 | - if ( $line_item instanceof EE_Line_Item ) { |
|
124 | + foreach ($total_line_item->get_items() as $line_item) { |
|
125 | + if ($line_item instanceof EE_Line_Item) { |
|
126 | 126 | //it's some kind of discount |
127 | - if( $line_item->total() < 0 ) { |
|
128 | - $total_discounts_to_cart_total += abs( $line_item->total() ); |
|
127 | + if ($line_item->total() < 0) { |
|
128 | + $total_discounts_to_cart_total += abs($line_item->total()); |
|
129 | 129 | $itemized_sum += $line_item->total(); |
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | //dont include shipping again. |
133 | - if( strpos( $line_item->code(), 'paypal_shipping_') === 0 ) { |
|
133 | + if (strpos($line_item->code(), 'paypal_shipping_') === 0) { |
|
134 | 134 | $shipping_previously_added = $line_item->total(); |
135 | 135 | continue; |
136 | 136 | } |
137 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
138 | - $this->_format_line_item_name( $line_item, $payment ), |
|
137 | + $redirect_args['item_name_'.$item_num] = substr( |
|
138 | + $this->_format_line_item_name($line_item, $payment), |
|
139 | 139 | 0, 127 |
140 | 140 | ); |
141 | - $redirect_args[ 'amount_' . $item_num ] = $line_item->unit_price(); |
|
142 | - $redirect_args[ 'quantity_' . $item_num ] = $line_item->quantity(); |
|
141 | + $redirect_args['amount_'.$item_num] = $line_item->unit_price(); |
|
142 | + $redirect_args['quantity_'.$item_num] = $line_item->quantity(); |
|
143 | 143 | //if we're not letting PayPal calculate shipping, tell them its 0 |
144 | - if ( ! $this->_paypal_shipping ) { |
|
145 | - $redirect_args[ 'shipping_' . $item_num ] = '0'; |
|
146 | - $redirect_args[ 'shipping2_' . $item_num ] = '0'; |
|
144 | + if ( ! $this->_paypal_shipping) { |
|
145 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
146 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
147 | 147 | } |
148 | 148 | $item_num++; |
149 | 149 | $itemized_sum += $line_item->total(); |
150 | 150 | } |
151 | 151 | } |
152 | - $taxes_li = $this->_line_item->get_taxes_subtotal( $total_line_item ); |
|
152 | + $taxes_li = $this->_line_item->get_taxes_subtotal($total_line_item); |
|
153 | 153 | //ideally itemized sum equals the transaction total. but if not (which is weird) |
154 | 154 | //and the itemized sum is LESS than the transaction total |
155 | 155 | //add another line item |
@@ -159,47 +159,47 @@ discard block |
||
159 | 159 | $transaction->total() - $itemized_sum - $taxes_li->total() - $shipping_previously_added, |
160 | 160 | 2 |
161 | 161 | ); |
162 | - if( $itemized_sum_diff_from_txn_total < 0 ) { |
|
162 | + if ($itemized_sum_diff_from_txn_total < 0) { |
|
163 | 163 | //itemized sum is too big |
164 | - $total_discounts_to_cart_total += abs( $itemized_sum_diff_from_txn_total ); |
|
165 | - } elseif( $itemized_sum_diff_from_txn_total > 0 ) { |
|
166 | - $redirect_args[ 'item_name_' . $item_num ] = substr( |
|
167 | - __( 'Other charges', 'event_espresso' ), 0, 127 ); |
|
168 | - $redirect_args[ 'amount_' . $item_num ] = $this->format_currency( $itemized_sum_diff_from_txn_total ); |
|
169 | - $redirect_args[ 'quantity_' . $item_num ] = 1; |
|
164 | + $total_discounts_to_cart_total += abs($itemized_sum_diff_from_txn_total); |
|
165 | + } elseif ($itemized_sum_diff_from_txn_total > 0) { |
|
166 | + $redirect_args['item_name_'.$item_num] = substr( |
|
167 | + __('Other charges', 'event_espresso'), 0, 127 ); |
|
168 | + $redirect_args['amount_'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total); |
|
169 | + $redirect_args['quantity_'.$item_num] = 1; |
|
170 | 170 | $item_num++; |
171 | 171 | } |
172 | - if( $total_discounts_to_cart_total > 0 ) { |
|
173 | - $redirect_args[ 'discount_amount_cart' ] = $this->format_currency( $total_discounts_to_cart_total ); |
|
172 | + if ($total_discounts_to_cart_total > 0) { |
|
173 | + $redirect_args['discount_amount_cart'] = $this->format_currency($total_discounts_to_cart_total); |
|
174 | 174 | } |
175 | 175 | //add our taxes to the order if we're NOT using PayPal's |
176 | - if( ! $this->_paypal_taxes ){ |
|
176 | + if ( ! $this->_paypal_taxes) { |
|
177 | 177 | $redirect_args['tax_cart'] = $total_line_item->get_total_tax(); |
178 | 178 | } |
179 | 179 | } else { |
180 | - $payment->update_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, false ); |
|
180 | + $payment->update_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, false); |
|
181 | 181 | //partial payment that's not for the remaining amount, so we can't send an itemized list |
182 | - $redirect_args['item_name_' . $item_num] = substr( |
|
183 | - $this->_format_partial_payment_line_item_name( $payment ), |
|
182 | + $redirect_args['item_name_'.$item_num] = substr( |
|
183 | + $this->_format_partial_payment_line_item_name($payment), |
|
184 | 184 | 0, 127 |
185 | 185 | ); |
186 | - $redirect_args['amount_' . $item_num] = $payment->amount(); |
|
187 | - $redirect_args['shipping_' . $item_num ] = '0'; |
|
188 | - $redirect_args['shipping2_' . $item_num ] = '0'; |
|
186 | + $redirect_args['amount_'.$item_num] = $payment->amount(); |
|
187 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
188 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
189 | 189 | $redirect_args['tax_cart'] = '0'; |
190 | 190 | $item_num++; |
191 | 191 | } |
192 | 192 | |
193 | - if($this->_debug_mode){ |
|
194 | - $redirect_args['item_name_' . $item_num] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
195 | - $redirect_args['amount_' . $item_num] = 0; |
|
193 | + if ($this->_debug_mode) { |
|
194 | + $redirect_args['item_name_'.$item_num] = 'DEBUG INFO (this item only added in sandbox mode'; |
|
195 | + $redirect_args['amount_'.$item_num] = 0; |
|
196 | 196 | $redirect_args['on0_'.$item_num] = 'NOTIFY URL'; |
197 | - $redirect_args['os0_' . $item_num] = $notify_url; |
|
197 | + $redirect_args['os0_'.$item_num] = $notify_url; |
|
198 | 198 | $redirect_args['on1_'.$item_num] = 'RETURN URL'; |
199 | - $redirect_args['os1_' . $item_num] = $return_url; |
|
199 | + $redirect_args['os1_'.$item_num] = $return_url; |
|
200 | 200 | // $redirect_args['option_index_' . $item_num] = 1; // <-- dunno if this is needed ? |
201 | - $redirect_args['shipping_' . $item_num ] = '0'; |
|
202 | - $redirect_args['shipping2_' . $item_num ] = '0'; |
|
201 | + $redirect_args['shipping_'.$item_num] = '0'; |
|
202 | + $redirect_args['shipping2_'.$item_num] = '0'; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $redirect_args['business'] = $this->_paypal_id; |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | $redirect_args['cmd'] = '_cart'; |
210 | 210 | $redirect_args['upload'] = 1; |
211 | 211 | $redirect_args['currency_code'] = $payment->currency_code(); |
212 | - $redirect_args['rm'] = 2;//makes the user return with method=POST |
|
213 | - if($this->_image_url){ |
|
212 | + $redirect_args['rm'] = 2; //makes the user return with method=POST |
|
213 | + if ($this->_image_url) { |
|
214 | 214 | $redirect_args['image_url'] = $this->_image_url; |
215 | 215 | } |
216 | 216 | $redirect_args['no_shipping'] = $this->_shipping_details; |
217 | - $redirect_args['bn'] = 'EventEspresso_SP';//EE will blow up if you change this |
|
217 | + $redirect_args['bn'] = 'EventEspresso_SP'; //EE will blow up if you change this |
|
218 | 218 | |
219 | - $redirect_args = apply_filters( "FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this ); |
|
219 | + $redirect_args = apply_filters("FHEE__EEG_Paypal_Standard__set_redirection_info__arguments", $redirect_args, $this); |
|
220 | 220 | |
221 | 221 | $payment->set_redirect_url($this->_gateway_url); |
222 | 222 | $payment->set_redirect_args($redirect_args); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $this->log( |
225 | 225 | array( |
226 | 226 | 'message' => sprintf( |
227 | - __( 'PayPal payment request initiated.', 'event_espresso' ) |
|
227 | + __('PayPal payment request initiated.', 'event_espresso') |
|
228 | 228 | ), |
229 | 229 | 'transaction' => $transaction->model_field_array(), |
230 | 230 | ), |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | * @return \EEI_Payment updated |
245 | 245 | * @throws \EE_Error, IpnException |
246 | 246 | */ |
247 | - public function handle_payment_update( $update_info, $transaction ){ |
|
247 | + public function handle_payment_update($update_info, $transaction) { |
|
248 | 248 | // verify there's payment data that's been sent |
249 | - if ( empty( $update_info[ 'payment_status' ] ) || empty( $update_info[ 'txn_id' ] ) ) { |
|
249 | + if (empty($update_info['payment_status']) || empty($update_info['txn_id'])) { |
|
250 | 250 | // log the results |
251 | 251 | $this->log( |
252 | 252 | array( |
253 | 253 | 'message' => sprintf( |
254 | - __( 'PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso' ) |
|
254 | + __('PayPal IPN response is missing critical payment data. This may indicate a PDT request and require your PayPal account settings to be corrected.', 'event_espresso') |
|
255 | 255 | ), |
256 | 256 | 'update_info' => $update_info, |
257 | 257 | ), |
@@ -259,33 +259,33 @@ discard block |
||
259 | 259 | ); |
260 | 260 | // waaaait... is this a PDT request? (see https://developer.paypal.com/docs/classic/products/payment-data-transfer/) |
261 | 261 | // indicated by the "tx" argument? If so, we don't need it. We'll just use the IPN data when it comes |
262 | - if ( isset( $update_info[ 'tx' ] ) ) { |
|
262 | + if (isset($update_info['tx'])) { |
|
263 | 263 | return $transaction->last_payment(); |
264 | 264 | } else { |
265 | 265 | return null; |
266 | 266 | } |
267 | 267 | } |
268 | - $payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr( $update_info[ 'txn_id' ] ); |
|
269 | - if ( ! $payment instanceof EEI_Payment ) { |
|
268 | + $payment = $this->_pay_model->get_payment_by_txn_id_chq_nmbr($update_info['txn_id']); |
|
269 | + if ( ! $payment instanceof EEI_Payment) { |
|
270 | 270 | $payment = $transaction->last_payment(); |
271 | 271 | } |
272 | 272 | // ok, then validate the IPN. Even if we've already processed this payment, |
273 | 273 | // let PayPal know we don't want to hear from them anymore! |
274 | - if ( ! $this->validate_ipn( $update_info, $payment ) ) { |
|
274 | + if ( ! $this->validate_ipn($update_info, $payment)) { |
|
275 | 275 | return $payment; |
276 | 276 | } |
277 | 277 | // kill request here if this is a refund, we don't support them yet (we'd need to adjust the transaction, |
278 | 278 | // registrations, ticket counts, etc) |
279 | 279 | if ( |
280 | 280 | ( |
281 | - $update_info[ 'payment_status' ] === 'Refunded' |
|
282 | - || $update_info[ 'payment_status' ] === 'Partially_Refunded' |
|
281 | + $update_info['payment_status'] === 'Refunded' |
|
282 | + || $update_info['payment_status'] === 'Partially_Refunded' |
|
283 | 283 | ) |
284 | - && apply_filters( 'FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true ) |
|
284 | + && apply_filters('FHEE__EEG_Paypal_Standard__handle_payment_update__kill_refund_request', true) |
|
285 | 285 | ) { |
286 | 286 | throw new EventEspresso\core\exceptions\IpnException( |
287 | 287 | sprintf( |
288 | - esc_html__( 'Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'), |
|
288 | + esc_html__('Event Espresso does not yet support %1$s IPNs from PayPal', 'event_espresso'), |
|
289 | 289 | $update_info['payment_status'] |
290 | 290 | ), |
291 | 291 | EventEspresso\core\exceptions\IpnException::UNSUPPORTED, |
@@ -295,34 +295,34 @@ discard block |
||
295 | 295 | ); |
296 | 296 | } |
297 | 297 | //ok, well let's process this payment then! |
298 | - switch ( $update_info[ 'payment_status' ] ) { |
|
298 | + switch ($update_info['payment_status']) { |
|
299 | 299 | |
300 | 300 | case 'Completed' : |
301 | 301 | $status = $this->_pay_model->approved_status(); |
302 | - $gateway_response = esc_html__( 'The payment is approved.', 'event_espresso' ); |
|
302 | + $gateway_response = esc_html__('The payment is approved.', 'event_espresso'); |
|
303 | 303 | break; |
304 | 304 | |
305 | 305 | case 'Pending' : |
306 | 306 | $status = $this->_pay_model->pending_status(); |
307 | - $gateway_response = esc_html__( 'The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso' ); |
|
307 | + $gateway_response = esc_html__('The payment is in progress. Another message will be sent when payment is approved.', 'event_espresso'); |
|
308 | 308 | break; |
309 | 309 | |
310 | 310 | case 'Denied' : |
311 | 311 | $status = $this->_pay_model->declined_status(); |
312 | - $gateway_response = esc_html__( 'The payment has been declined.', 'event_espresso' ); |
|
312 | + $gateway_response = esc_html__('The payment has been declined.', 'event_espresso'); |
|
313 | 313 | break; |
314 | 314 | |
315 | 315 | case 'Expired' : |
316 | 316 | case 'Failed' : |
317 | 317 | $status = $this->_pay_model->failed_status(); |
318 | - $gateway_response = esc_html__( 'The payment failed for technical reasons or expired.', 'event_espresso' ); |
|
318 | + $gateway_response = esc_html__('The payment failed for technical reasons or expired.', 'event_espresso'); |
|
319 | 319 | break; |
320 | 320 | |
321 | 321 | case 'Refunded' : |
322 | 322 | case 'Partially_Refunded' : |
323 | 323 | // even though it's a refund, we consider the payment as approved, it just has a negative value |
324 | 324 | $status = $this->_pay_model->approved_status(); |
325 | - $gateway_response = esc_html__( 'The payment has been refunded. Please update registrations accordingly.', 'event_espresso' ); |
|
325 | + $gateway_response = esc_html__('The payment has been refunded. Please update registrations accordingly.', 'event_espresso'); |
|
326 | 326 | break; |
327 | 327 | |
328 | 328 | case 'Voided' : |
@@ -330,19 +330,19 @@ discard block |
||
330 | 330 | case 'Canceled_Reversal' : |
331 | 331 | default : |
332 | 332 | $status = $this->_pay_model->cancelled_status(); |
333 | - $gateway_response = esc_html__( 'The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso' ); |
|
333 | + $gateway_response = esc_html__('The payment was cancelled, reversed, or voided. Please update registrations accordingly.', 'event_espresso'); |
|
334 | 334 | break; |
335 | 335 | |
336 | 336 | } |
337 | 337 | |
338 | 338 | //check if we've already processed this payment |
339 | - if ( $payment instanceof EEI_Payment ) { |
|
339 | + if ($payment instanceof EEI_Payment) { |
|
340 | 340 | //payment exists. if this has the exact same status and amount, don't bother updating. just return |
341 | - if ( $payment->status() === $status && (float)$payment->amount() === (float)$update_info[ 'mc_gross' ] ) { |
|
341 | + if ($payment->status() === $status && (float) $payment->amount() === (float) $update_info['mc_gross']) { |
|
342 | 342 | // DUPLICATED IPN! don't bother updating transaction |
343 | 343 | throw new IpnException( |
344 | 344 | sprintf( |
345 | - esc_html__( 'It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso' ), |
|
345 | + esc_html__('It appears we have received a duplicate IPN from PayPal for payment %d', 'event_espresso'), |
|
346 | 346 | $payment->ID() |
347 | 347 | ), |
348 | 348 | IpnException::DUPLICATE, |
@@ -352,14 +352,14 @@ discard block |
||
352 | 352 | ); |
353 | 353 | } else { |
354 | 354 | // new payment yippee !!! |
355 | - $payment->set_status( $status ); |
|
356 | - $payment->set_amount( (float)$update_info[ 'mc_gross' ] ); |
|
357 | - $payment->set_gateway_response( $gateway_response ); |
|
358 | - $payment->set_details( $update_info ); |
|
359 | - $payment->set_txn_id_chq_nmbr( $update_info[ 'txn_id' ] ); |
|
355 | + $payment->set_status($status); |
|
356 | + $payment->set_amount((float) $update_info['mc_gross']); |
|
357 | + $payment->set_gateway_response($gateway_response); |
|
358 | + $payment->set_details($update_info); |
|
359 | + $payment->set_txn_id_chq_nmbr($update_info['txn_id']); |
|
360 | 360 | $this->log( |
361 | 361 | array( |
362 | - 'message' => esc_html__( 'Updated payment either from IPN or as part of POST from PayPal', 'event_espresso' ), |
|
362 | + 'message' => esc_html__('Updated payment either from IPN or as part of POST from PayPal', 'event_espresso'), |
|
363 | 363 | 'url' => $this->_process_response_url(), |
364 | 364 | 'payment' => $payment->model_field_array(), |
365 | 365 | 'IPN_data' => $update_info |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | } |
372 | - do_action( 'FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this ); |
|
372 | + do_action('FHEE__EEG_Paypal_Standard__handle_payment_update__payment_processed', $payment, $this); |
|
373 | 373 | return $payment; |
374 | 374 | } |
375 | 375 | |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | * @return boolean |
385 | 385 | * @throws \EE_Error |
386 | 386 | */ |
387 | - public function validate_ipn( $update_info, $payment ) { |
|
387 | + public function validate_ipn($update_info, $payment) { |
|
388 | 388 | //allow us to skip validating IPNs with PayPal (useful for testing) |
389 | - if ( apply_filters( 'FHEE__EEG_Paypal_Standard__validate_ipn__skip', false ) ) { |
|
389 | + if (apply_filters('FHEE__EEG_Paypal_Standard__validate_ipn__skip', false)) { |
|
390 | 390 | return true; |
391 | 391 | } |
392 | 392 | //...otherwise, we actually don't care what the $update_info is, we need to look |
@@ -394,22 +394,22 @@ discard block |
||
394 | 394 | // Reading POSTed data directly from $_POST causes serialization issues with array data in the POST. |
395 | 395 | // Instead, read raw POST data from the input stream. |
396 | 396 | // @see https://gist.github.com/xcommerce-gists/3440401 |
397 | - $raw_post_data = file_get_contents( 'php://input' ); |
|
398 | - $raw_post_array = explode( '&', $raw_post_data ); |
|
397 | + $raw_post_data = file_get_contents('php://input'); |
|
398 | + $raw_post_array = explode('&', $raw_post_data); |
|
399 | 399 | $update_info = array(); |
400 | - foreach ( $raw_post_array as $keyval ) { |
|
401 | - $keyval = explode( '=', $keyval ); |
|
402 | - if ( count( $keyval ) === 2 ) { |
|
403 | - $update_info[ $keyval[ 0 ] ] = urldecode( $keyval[ 1 ] ); |
|
400 | + foreach ($raw_post_array as $keyval) { |
|
401 | + $keyval = explode('=', $keyval); |
|
402 | + if (count($keyval) === 2) { |
|
403 | + $update_info[$keyval[0]] = urldecode($keyval[1]); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | // read the IPN message sent from PayPal and prepend 'cmd=_notify-validate' |
407 | 407 | $req = 'cmd=_notify-validate'; |
408 | - $uses_get_magic_quotes = function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() === 1 |
|
408 | + $uses_get_magic_quotes = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() === 1 |
|
409 | 409 | ? true |
410 | 410 | : false; |
411 | - foreach ( $update_info as $key => $value ) { |
|
412 | - $value = $uses_get_magic_quotes ? urlencode( stripslashes( $value ) ) : urlencode( $value ); |
|
411 | + foreach ($update_info as $key => $value) { |
|
412 | + $value = $uses_get_magic_quotes ? urlencode(stripslashes($value)) : urlencode($value); |
|
413 | 413 | $req .= "&$key=$value"; |
414 | 414 | } |
415 | 415 | // HTTP POST the complete, unaltered IPN back to PayPal |
@@ -418,38 +418,38 @@ discard block |
||
418 | 418 | array( |
419 | 419 | 'body' => $req, |
420 | 420 | 'sslverify' => false, |
421 | - 'timeout' => 60 , |
|
421 | + 'timeout' => 60, |
|
422 | 422 | // make sure to set a site specific unique "user-agent" string since the WordPres default gets declined by PayPal |
423 | 423 | // plz see: https://github.com/websharks/s2member/issues/610 |
424 | - 'user-agent' => 'Event Espresso v' . EVENT_ESPRESSO_VERSION . '; ' . home_url(), |
|
424 | + 'user-agent' => 'Event Espresso v'.EVENT_ESPRESSO_VERSION.'; '.home_url(), |
|
425 | 425 | 'httpversion' => '1.1' |
426 | 426 | ) |
427 | 427 | ); |
428 | 428 | // then check the response |
429 | 429 | if ( |
430 | - array_key_exists( 'body', $response ) |
|
431 | - && ! is_wp_error( $response ) |
|
432 | - && strcmp( $response[ 'body' ], "VERIFIED" ) === 0 |
|
430 | + array_key_exists('body', $response) |
|
431 | + && ! is_wp_error($response) |
|
432 | + && strcmp($response['body'], "VERIFIED") === 0 |
|
433 | 433 | ) { |
434 | 434 | return true; |
435 | 435 | } |
436 | 436 | // huh, something's wack... the IPN didn't validate. We must have replied to the IPN incorrectly, |
437 | 437 | // or their API must have changed: http://www.paypalobjects.com/en_US/ebook/PP_OrderManagement_IntegrationGuide/ipn.html |
438 | - if( $response instanceof WP_Error ) { |
|
438 | + if ($response instanceof WP_Error) { |
|
439 | 439 | $error_msg = sprintf( |
440 | - esc_html__( 'WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso' ), |
|
440 | + esc_html__('WP Error. Code: "%1$s", Message: "%2$s", Data: "%3$s"', 'event_espresso'), |
|
441 | 441 | $response->get_error_code(), |
442 | 442 | $response->get_error_message(), |
443 | - print_r( $response->get_error_data(), true ) |
|
443 | + print_r($response->get_error_data(), true) |
|
444 | 444 | ); |
445 | - } elseif( is_array( $response ) && isset( $response[ 'body' ] ) ) { |
|
446 | - $error_msg = $response[ 'body' ]; |
|
445 | + } elseif (is_array($response) && isset($response['body'])) { |
|
446 | + $error_msg = $response['body']; |
|
447 | 447 | } else { |
448 | - $error_msg = print_r( $response, true ); |
|
448 | + $error_msg = print_r($response, true); |
|
449 | 449 | } |
450 | - $payment->set_gateway_response( sprintf( esc_html__( "IPN Validation failed! Paypal responded with '%s'", "event_espresso" ), $error_msg ) ); |
|
451 | - $payment->set_details( array( 'REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response ) ); |
|
452 | - $payment->set_status( EEM_Payment::status_id_failed ); |
|
450 | + $payment->set_gateway_response(sprintf(esc_html__("IPN Validation failed! Paypal responded with '%s'", "event_espresso"), $error_msg)); |
|
451 | + $payment->set_details(array('REQUEST' => $update_info, 'VALIDATION_RESPONSE' => $response)); |
|
452 | + $payment->set_status(EEM_Payment::status_id_failed); |
|
453 | 453 | // log the results |
454 | 454 | $this->log( |
455 | 455 | array( |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | * @return string |
470 | 470 | */ |
471 | 471 | protected function _process_response_url() { |
472 | - if ( isset( $_SERVER[ 'HTTP_HOST' ], $_SERVER[ 'REQUEST_URI' ] ) ) { |
|
472 | + if (isset($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'])) { |
|
473 | 473 | $url = is_ssl() ? 'https://' : 'http://'; |
474 | - $url .= EEH_URL::filter_input_server_url( 'HTTP_HOST' ); |
|
474 | + $url .= EEH_URL::filter_input_server_url('HTTP_HOST'); |
|
475 | 475 | $url .= EEH_URL::filter_input_server_url(); |
476 | 476 | } else { |
477 | 477 | $url = 'unknown'; |
@@ -488,12 +488,12 @@ discard block |
||
488 | 488 | * @param EEI_Payment $payment |
489 | 489 | * @throws \EE_Error |
490 | 490 | */ |
491 | - public function update_txn_based_on_payment( $payment ) { |
|
491 | + public function update_txn_based_on_payment($payment) { |
|
492 | 492 | $update_info = $payment->details(); |
493 | 493 | /** @var EE_Transaction $transaction */ |
494 | 494 | $transaction = $payment->transaction(); |
495 | - $payment_was_itemized = $payment->get_extra_meta( EEG_Paypal_Standard::itemized_payment_option_name, true, false ); |
|
496 | - if( ! $transaction ){ |
|
495 | + $payment_was_itemized = $payment->get_extra_meta(EEG_Paypal_Standard::itemized_payment_option_name, true, false); |
|
496 | + if ( ! $transaction) { |
|
497 | 497 | $this->log( |
498 | 498 | esc_html__( |
499 | 499 | 'Payment with ID %d has no related transaction, and so update_txn_based_on_payment couldn\'t be executed properly', |
@@ -503,10 +503,10 @@ discard block |
||
503 | 503 | ); |
504 | 504 | return; |
505 | 505 | } |
506 | - if( |
|
507 | - ! is_array( $update_info ) |
|
508 | - || ! isset( $update_info[ 'mc_shipping' ] ) |
|
509 | - || ! isset( $update_info[ 'tax' ] ) |
|
506 | + if ( |
|
507 | + ! is_array($update_info) |
|
508 | + || ! isset($update_info['mc_shipping']) |
|
509 | + || ! isset($update_info['tax']) |
|
510 | 510 | ) { |
511 | 511 | $this->log( |
512 | 512 | array( |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | ); |
522 | 522 | return; |
523 | 523 | } |
524 | - if( $payment->status() !== $this->_pay_model->approved_status() ) { |
|
524 | + if ($payment->status() !== $this->_pay_model->approved_status()) { |
|
525 | 525 | $this->log( |
526 | 526 | array( |
527 | 527 | 'message' => esc_html__( |
@@ -540,44 +540,44 @@ discard block |
||
540 | 540 | $transaction_total_line_item = $transaction->total_line_item(); |
541 | 541 | |
542 | 542 | //might paypal have changed the taxes? |
543 | - if( $this->_paypal_taxes && $payment_was_itemized ) { |
|
543 | + if ($this->_paypal_taxes && $payment_was_itemized) { |
|
544 | 544 | // note that we're doing this BEFORE adding shipping; |
545 | 545 | // we actually want PayPal's shipping to remain non-taxable |
546 | - $this->_line_item->set_line_items_taxable( $transaction_total_line_item, true, 'paypal_shipping' ); |
|
546 | + $this->_line_item->set_line_items_taxable($transaction_total_line_item, true, 'paypal_shipping'); |
|
547 | 547 | $this->_line_item->set_total_tax_to( |
548 | 548 | $transaction_total_line_item, |
549 | - (float)$update_info['tax'], |
|
550 | - esc_html__( 'Taxes', 'event_espresso' ), |
|
551 | - esc_html__( 'Calculated by Paypal', 'event_espresso' ), |
|
549 | + (float) $update_info['tax'], |
|
550 | + esc_html__('Taxes', 'event_espresso'), |
|
551 | + esc_html__('Calculated by Paypal', 'event_espresso'), |
|
552 | 552 | 'paypal_tax' |
553 | 553 | ); |
554 | 554 | $grand_total_needs_resaving = TRUE; |
555 | 555 | } |
556 | 556 | |
557 | - $shipping_amount = (float)$update_info[ 'mc_shipping' ]; |
|
557 | + $shipping_amount = (float) $update_info['mc_shipping']; |
|
558 | 558 | //might paypal have added shipping? |
559 | - if( $this->_paypal_shipping && $shipping_amount && $payment_was_itemized ){ |
|
559 | + if ($this->_paypal_shipping && $shipping_amount && $payment_was_itemized) { |
|
560 | 560 | $this->_line_item->add_unrelated_item( |
561 | 561 | $transaction_total_line_item, |
562 | - sprintf( esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID() ), |
|
562 | + sprintf(esc_html__('Shipping for transaction %1$s', 'event_espresso'), $transaction->ID()), |
|
563 | 563 | $shipping_amount, |
564 | 564 | esc_html__('Shipping charges calculated by Paypal', 'event_espresso'), |
565 | 565 | 1, |
566 | 566 | false, |
567 | - 'paypal_shipping_' . $transaction->ID() |
|
567 | + 'paypal_shipping_'.$transaction->ID() |
|
568 | 568 | ); |
569 | 569 | $grand_total_needs_resaving = true; |
570 | 570 | } |
571 | 571 | |
572 | - if( $grand_total_needs_resaving ){ |
|
573 | - $transaction_total_line_item->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
572 | + if ($grand_total_needs_resaving) { |
|
573 | + $transaction_total_line_item->save_this_and_descendants_to_txn($transaction->ID()); |
|
574 | 574 | /** @var EE_Registration_Processor $registration_processor */ |
575 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
576 | - $registration_processor->update_registration_final_prices( $transaction ); |
|
575 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
576 | + $registration_processor->update_registration_final_prices($transaction); |
|
577 | 577 | } |
578 | 578 | $this->log( |
579 | 579 | array( |
580 | - 'message' => esc_html__( 'Updated transaction related to payment', 'event_espresso' ), |
|
580 | + 'message' => esc_html__('Updated transaction related to payment', 'event_espresso'), |
|
581 | 581 | 'url' => $this->_process_response_url(), |
582 | 582 | 'transaction (updated)' => $transaction->model_field_array(), |
583 | 583 | 'payment (updated)' => $payment->model_field_array(), |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | namespace EventEspresso\core\exceptions; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -21,71 +21,71 @@ discard block |
||
21 | 21 | class IpnException extends \LogicException |
22 | 22 | { |
23 | 23 | |
24 | - const DUPLICATE = 1; |
|
24 | + const DUPLICATE = 1; |
|
25 | 25 | |
26 | - const UNABLE_TO_VALIDATE = 2; |
|
26 | + const UNABLE_TO_VALIDATE = 2; |
|
27 | 27 | |
28 | - const UNSUPPORTED = 3; |
|
28 | + const UNSUPPORTED = 3; |
|
29 | 29 | |
30 | - /** |
|
31 | - * @var \EE_Payment |
|
32 | - */ |
|
33 | - protected $payment; |
|
30 | + /** |
|
31 | + * @var \EE_Payment |
|
32 | + */ |
|
33 | + protected $payment; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @var mixed IPN data, usually an array or object |
|
37 | - */ |
|
38 | - protected $ipn_data; |
|
35 | + /** |
|
36 | + * @var mixed IPN data, usually an array or object |
|
37 | + */ |
|
38 | + protected $ipn_data; |
|
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | - public function __construct( |
|
43 | - $message, |
|
44 | - $code = 0, |
|
45 | - \Exception $previous = null, |
|
46 | - \EE_Payment $payment = null, |
|
47 | - $ipn_data = array() |
|
48 | - ) { |
|
49 | - parent::__construct($message, $code, $previous); |
|
50 | - $this->payment = $payment; |
|
51 | - $this->ipn_data = $ipn_data; |
|
52 | - } |
|
42 | + public function __construct( |
|
43 | + $message, |
|
44 | + $code = 0, |
|
45 | + \Exception $previous = null, |
|
46 | + \EE_Payment $payment = null, |
|
47 | + $ipn_data = array() |
|
48 | + ) { |
|
49 | + parent::__construct($message, $code, $previous); |
|
50 | + $this->payment = $payment; |
|
51 | + $this->ipn_data = $ipn_data; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Gets the payment associated with this IPN, if known |
|
58 | - * |
|
59 | - * @return \EE_Payment |
|
60 | - */ |
|
61 | - public function getPayment() |
|
62 | - { |
|
63 | - return $this->payment; |
|
64 | - } |
|
56 | + /** |
|
57 | + * Gets the payment associated with this IPN, if known |
|
58 | + * |
|
59 | + * @return \EE_Payment |
|
60 | + */ |
|
61 | + public function getPayment() |
|
62 | + { |
|
63 | + return $this->payment; |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array) |
|
70 | - * |
|
71 | - * @return array |
|
72 | - * @throws \EE_Error |
|
73 | - */ |
|
74 | - public function getPaymentProperties() |
|
75 | - { |
|
76 | - return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array(); |
|
77 | - } |
|
68 | + /** |
|
69 | + * Returns the payment's properties as an array (even if there is no payment, in which case it's an empty array) |
|
70 | + * |
|
71 | + * @return array |
|
72 | + * @throws \EE_Error |
|
73 | + */ |
|
74 | + public function getPaymentProperties() |
|
75 | + { |
|
76 | + return $this->getPayment() instanceof \EE_Payment ? $this->getPayment()->model_field_array() : array(); |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * Returns an array, object, or string, however, the IPN data was received |
|
83 | - * |
|
84 | - * @return mixed |
|
85 | - */ |
|
86 | - public function getIpnData() |
|
87 | - { |
|
88 | - return $this->ipn_data; |
|
89 | - } |
|
81 | + /** |
|
82 | + * Returns an array, object, or string, however, the IPN data was received |
|
83 | + * |
|
84 | + * @return mixed |
|
85 | + */ |
|
86 | + public function getIpnData() |
|
87 | + { |
|
88 | + return $this->ipn_data; |
|
89 | + } |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | \ No newline at end of file |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\modules\invalid_checkout_access\InvalidCheckoutAccess; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | public static function set_hooks_admin() { |
37 | 37 | add_action( |
38 | 38 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
39 | - array( 'EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form' ), |
|
39 | + array('EED_Invalid_Checkout_Access', 'display_invalid_checkout_access_form'), |
|
40 | 40 | 15 |
41 | 41 | ); |
42 | 42 | add_filter( |
43 | 43 | 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
44 | - array( 'EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form' ) |
|
44 | + array('EED_Invalid_Checkout_Access', 'process_invalid_checkout_access_form') |
|
45 | 45 | ); |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @var WP $WP |
55 | 55 | */ |
56 | - public function run( $WP ) { |
|
56 | + public function run($WP) { |
|
57 | 57 | // TODO: Implement run() method. |
58 | 58 | } |
59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return InvalidCheckoutAccess |
64 | 64 | */ |
65 | 65 | public static function getInvalidCheckoutAccess() { |
66 | - if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess ) { |
|
66 | + if ( ! self::$invalid_checkout_access_form instanceof InvalidCheckoutAccess) { |
|
67 | 67 | self::$invalid_checkout_access_form = new InvalidCheckoutAccess(); |
68 | 68 | } |
69 | 69 | return self::$invalid_checkout_access_form; |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param \EE_Registration_Config $EE_Registration_Config |
91 | 91 | * @return \EE_Registration_Config |
92 | 92 | */ |
93 | - public static function process_invalid_checkout_access_form( \EE_Registration_Config $EE_Registration_Config ) { |
|
93 | + public static function process_invalid_checkout_access_form(\EE_Registration_Config $EE_Registration_Config) { |
|
94 | 94 | $invalid_checkout_access_form = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess(); |
95 | - return $invalid_checkout_access_form->processForm( $EE_Registration_Config ); |
|
95 | + return $invalid_checkout_access_form->processForm($EE_Registration_Config); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\exceptions; |
3 | 3 | |
4 | -defined( 'ABSPATH' ) || exit; |
|
4 | +defined('ABSPATH') || exit; |
|
5 | 5 | |
6 | 6 | |
7 | 7 | |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | * @param int $code |
23 | 23 | * @param \Exception $previous |
24 | 24 | */ |
25 | - public function __construct( $message = '', $code = 0, \Exception $previous = null ) { |
|
26 | - if ( empty( $message ) ) { |
|
27 | - $message = esc_html__( 'The session data is either missing or invalid.', 'event_espresso' ); |
|
25 | + public function __construct($message = '', $code = 0, \Exception $previous = null) { |
|
26 | + if (empty($message)) { |
|
27 | + $message = esc_html__('The session data is either missing or invalid.', 'event_espresso'); |
|
28 | 28 | } |
29 | - parent::__construct( $message, $code, $previous ); |
|
29 | + parent::__construct($message, $code, $previous); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <div class="padding"> |
2 | - <p><?php printf( esc_html__( 'Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso' ), '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank">','</a>' ); ?></p> |
|
2 | + <p><?php printf(esc_html__('Check out the %1$sroadmap for Event Espresso%2$s.', 'event_espresso'), '<a href="https://trello.com/b/zg9DCIpe/event-espresso-public-roadmap" target="_blank">', '</a>'); ?></p> |
|
3 | 3 | </div> |
4 | 4 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <div class="padding"> |
2 | - <h3><?php esc_html_e( 'Frequently Asked Questions about Event Espresso', 'event_espresso' ); ?></h3> |
|
2 | + <h3><?php esc_html_e('Frequently Asked Questions about Event Espresso', 'event_espresso'); ?></h3> |
|
3 | 3 | |
4 | - <h4><?php esc_html_e( 'New to Event Espresso?', 'event_espresso' ); ?></h4> |
|
4 | + <h4><?php esc_html_e('New to Event Espresso?', 'event_espresso'); ?></h4> |
|
5 | 5 | |
6 | - <p><?php printf( esc_html__( 'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', 'event_espresso' ), '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">','</a>','<em>','</em>' ); ?></p> |
|
6 | + <p><?php printf(esc_html__('Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">', '</a>', '<em>', '</em>'); ?></p> |
|
7 | 7 | </div> |
8 | 8 | \ No newline at end of file |