@@ -16,15 +16,15 @@ |
||
16 | 16 | |
17 | 17 | ?> |
18 | 18 | <p> |
19 | - <?php esc_html_e('Organizer Name: ', 'event_espresso') . espresso_organization_name($VNU_ID); ?> |
|
19 | + <?php esc_html_e('Organizer Name: ', 'event_espresso').espresso_organization_name($VNU_ID); ?> |
|
20 | 20 | <br/> |
21 | - <?php esc_html_e('Organizer Email: ', 'event_espresso') . espresso_organization_email($VNU_ID); ?> |
|
21 | + <?php esc_html_e('Organizer Email: ', 'event_espresso').espresso_organization_email($VNU_ID); ?> |
|
22 | 22 | <br/> |
23 | - <?php esc_html_e('Venue Phone: ', 'event_espresso') . espresso_venue_phone($VNU_ID); ?> |
|
23 | + <?php esc_html_e('Venue Phone: ', 'event_espresso').espresso_venue_phone($VNU_ID); ?> |
|
24 | 24 | </p> |
25 | -<p><?php esc_html_e('Categories: ', 'event_espresso') . espresso_venue_categories($VNU_ID); ?></p> |
|
26 | -<p><?php esc_html_e('Address: ', 'event_espresso') . espresso_venue_address($VNU_ID); ?></p> |
|
27 | -<p><?php esc_html_e('Website: ', 'event_espresso') . espresso_venue_website($VNU_ID); ?></p> |
|
28 | -<p><?php esc_html_e('Description: ', 'event_espresso') . $venue_description; ?></p> |
|
25 | +<p><?php esc_html_e('Categories: ', 'event_espresso').espresso_venue_categories($VNU_ID); ?></p> |
|
26 | +<p><?php esc_html_e('Address: ', 'event_espresso').espresso_venue_address($VNU_ID); ?></p> |
|
27 | +<p><?php esc_html_e('Website: ', 'event_espresso').espresso_venue_website($VNU_ID); ?></p> |
|
28 | +<p><?php esc_html_e('Description: ', 'event_espresso').$venue_description; ?></p> |
|
29 | 29 | <br/> |
30 | 30 | |
31 | 31 | \ No newline at end of file |
@@ -10,9 +10,9 @@ |
||
10 | 10 | <head> |
11 | 11 | <title>[organization]<?php esc_html__(' Invoice #', 'event_espresso'); ?>[registration_code] |
12 | 12 | <?php esc_html__( |
13 | - ' for ', |
|
14 | - 'event_espresso' |
|
15 | - ); ?>[name]</title> |
|
13 | + ' for ', |
|
14 | + 'event_espresso' |
|
15 | + ); ?>[name]</title> |
|
16 | 16 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
17 | 17 | <!-- Base Stylesheet do not change or remove --> |
18 | 18 | <link rel="stylesheet" type="text/css" href="[base_url]base.css" media="screen"/> |
@@ -55,8 +55,8 @@ |
||
55 | 55 | */ |
56 | 56 | public function run($WP) |
57 | 57 | { |
58 | - if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) { |
|
59 | - require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php'); |
|
58 | + if (is_readable(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php')) { |
|
59 | + require_once(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php'); |
|
60 | 60 | } else { |
61 | 61 | $msg = esc_html__('The Invoice.class.php file could not be loaded.', 'event_espresso'); |
62 | 62 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
@@ -10,91 +10,91 @@ |
||
10 | 10 | */ |
11 | 11 | class EED_Invoice extends EED_Module |
12 | 12 | { |
13 | - /** |
|
14 | - * @return EED_Invoice|EED_Module |
|
15 | - * @throws EE_Error |
|
16 | - * @throws ReflectionException |
|
17 | - */ |
|
18 | - public static function instance() |
|
19 | - { |
|
20 | - return parent::get_instance(__CLASS__); |
|
21 | - } |
|
13 | + /** |
|
14 | + * @return EED_Invoice|EED_Module |
|
15 | + * @throws EE_Error |
|
16 | + * @throws ReflectionException |
|
17 | + */ |
|
18 | + public static function instance() |
|
19 | + { |
|
20 | + return parent::get_instance(__CLASS__); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
26 | - * |
|
27 | - * @access public |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public static function set_hooks() |
|
31 | - { |
|
32 | - EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice'); |
|
33 | - EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice'); |
|
34 | - } |
|
24 | + /** |
|
25 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
26 | + * |
|
27 | + * @access public |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public static function set_hooks() |
|
31 | + { |
|
32 | + EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice'); |
|
33 | + EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice'); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
39 | - * |
|
40 | - * @access public |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public static function set_hooks_admin() |
|
44 | - { |
|
45 | - } |
|
37 | + /** |
|
38 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
39 | + * |
|
40 | + * @access public |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public static function set_hooks_admin() |
|
44 | + { |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * run - initial module setup |
|
50 | - * |
|
51 | - * @access public |
|
52 | - * @return void |
|
53 | - */ |
|
54 | - public function run($WP) |
|
55 | - { |
|
56 | - if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) { |
|
57 | - require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php'); |
|
58 | - } else { |
|
59 | - $msg = esc_html__('The Invoice.class.php file could not be loaded.', 'event_espresso'); |
|
60 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
61 | - } |
|
62 | - } |
|
48 | + /** |
|
49 | + * run - initial module setup |
|
50 | + * |
|
51 | + * @access public |
|
52 | + * @return void |
|
53 | + */ |
|
54 | + public function run($WP) |
|
55 | + { |
|
56 | + if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) { |
|
57 | + require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php'); |
|
58 | + } else { |
|
59 | + $msg = esc_html__('The Invoice.class.php file could not be loaded.', 'event_espresso'); |
|
60 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | - /** |
|
66 | - * invoice_launch |
|
67 | - * |
|
68 | - * @access public |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - public function launch_invoice() |
|
72 | - { |
|
73 | - $this->run(null); |
|
74 | - $request = self::getRequest(); |
|
75 | - if ($request->requestParamIsSet('id')) { |
|
76 | - $id = $request->getRequestParam('id', '', 'key'); |
|
77 | - $invoice = new Invoice($id); |
|
78 | - $invoice->send_invoice(); |
|
79 | - } |
|
80 | - } |
|
65 | + /** |
|
66 | + * invoice_launch |
|
67 | + * |
|
68 | + * @access public |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + public function launch_invoice() |
|
72 | + { |
|
73 | + $this->run(null); |
|
74 | + $request = self::getRequest(); |
|
75 | + if ($request->requestParamIsSet('id')) { |
|
76 | + $id = $request->getRequestParam('id', '', 'key'); |
|
77 | + $invoice = new Invoice($id); |
|
78 | + $invoice->send_invoice(); |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * download_invoice |
|
85 | - * |
|
86 | - * @access public |
|
87 | - * @return void |
|
88 | - */ |
|
89 | - public function download_invoice() |
|
90 | - { |
|
91 | - $this->run(null); |
|
92 | - $request = self::getRequest(); |
|
93 | - if ($request->requestParamIsSet('id')) { |
|
94 | - $id = $request->getRequestParam('id', '', 'key'); |
|
95 | - $invoice = new Invoice($id); |
|
96 | - // send invoice but force download |
|
97 | - $invoice->send_invoice(true); |
|
98 | - } |
|
99 | - } |
|
83 | + /** |
|
84 | + * download_invoice |
|
85 | + * |
|
86 | + * @access public |
|
87 | + * @return void |
|
88 | + */ |
|
89 | + public function download_invoice() |
|
90 | + { |
|
91 | + $this->run(null); |
|
92 | + $request = self::getRequest(); |
|
93 | + if ($request->requestParamIsSet('id')) { |
|
94 | + $id = $request->getRequestParam('id', '', 'key'); |
|
95 | + $invoice = new Invoice($id); |
|
96 | + // send invoice but force download |
|
97 | + $invoice->send_invoice(true); |
|
98 | + } |
|
99 | + } |
|
100 | 100 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $txn_update_params |
99 | 99 | ); |
100 | 100 | // check if transaction has a primary registrant and that it has a related Attendee object |
101 | - if (! $this->_validate_primary_registrant()) { |
|
101 | + if ( ! $this->_validate_primary_registrant()) { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | // you don't have to go home but you can't stay here ! |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | protected function _validate_primary_registrant() |
231 | 231 | { |
232 | - if (! $this->checkout->transaction_has_primary_registrant()) { |
|
232 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
233 | 233 | EE_Error::add_error( |
234 | 234 | esc_html__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), |
235 | 235 | __FILE__, |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | public function update_reg_step() |
256 | 256 | { |
257 | 257 | EE_Error::doing_it_wrong( |
258 | - __CLASS__ . '::' . __FILE__, |
|
258 | + __CLASS__.'::'.__FILE__, |
|
259 | 259 | esc_html__( |
260 | 260 | 'Can not call update_reg_step() on the Finalize Registration reg step.', |
261 | 261 | 'event_espresso' |
@@ -14,252 +14,252 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_SPCO_Reg_Step_Finalize_Registration extends EE_SPCO_Reg_Step |
16 | 16 | { |
17 | - /** |
|
18 | - * class constructor |
|
19 | - * |
|
20 | - * @access public |
|
21 | - * @param EE_Checkout $checkout |
|
22 | - */ |
|
23 | - public function __construct(EE_Checkout $checkout) |
|
24 | - { |
|
25 | - $this->request = EED_Single_Page_Checkout::getRequest(); |
|
26 | - $this->_slug = 'finalize_registration'; |
|
27 | - $this->_name = esc_html__('Finalize Registration', 'event_espresso'); |
|
28 | - $this->_submit_button_text = $this->_name; |
|
29 | - $this->_template = ''; |
|
30 | - $this->checkout = $checkout; |
|
31 | - } |
|
17 | + /** |
|
18 | + * class constructor |
|
19 | + * |
|
20 | + * @access public |
|
21 | + * @param EE_Checkout $checkout |
|
22 | + */ |
|
23 | + public function __construct(EE_Checkout $checkout) |
|
24 | + { |
|
25 | + $this->request = EED_Single_Page_Checkout::getRequest(); |
|
26 | + $this->_slug = 'finalize_registration'; |
|
27 | + $this->_name = esc_html__('Finalize Registration', 'event_espresso'); |
|
28 | + $this->_submit_button_text = $this->_name; |
|
29 | + $this->_template = ''; |
|
30 | + $this->checkout = $checkout; |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - public function translate_js_strings() |
|
35 | - { |
|
36 | - } |
|
34 | + public function translate_js_strings() |
|
35 | + { |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - public function enqueue_styles_and_scripts() |
|
40 | - { |
|
41 | - } |
|
39 | + public function enqueue_styles_and_scripts() |
|
40 | + { |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * @return boolean |
|
46 | - */ |
|
47 | - public function initialize_reg_step() |
|
48 | - { |
|
49 | - // there's actually no reg form to process if this is the final step |
|
50 | - if ($this->is_current_step()) { |
|
51 | - $this->checkout->step = $this->slug(); |
|
52 | - $this->checkout->action = 'process_reg_step'; |
|
53 | - $this->checkout->generate_reg_form = false; |
|
54 | - $this->request->setRequestParam('step', $this->checkout->step); |
|
55 | - $this->request->setRequestParam('action', $this->checkout->action); |
|
56 | - } |
|
57 | - return true; |
|
58 | - } |
|
44 | + /** |
|
45 | + * @return boolean |
|
46 | + */ |
|
47 | + public function initialize_reg_step() |
|
48 | + { |
|
49 | + // there's actually no reg form to process if this is the final step |
|
50 | + if ($this->is_current_step()) { |
|
51 | + $this->checkout->step = $this->slug(); |
|
52 | + $this->checkout->action = 'process_reg_step'; |
|
53 | + $this->checkout->generate_reg_form = false; |
|
54 | + $this->request->setRequestParam('step', $this->checkout->step); |
|
55 | + $this->request->setRequestParam('action', $this->checkout->action); |
|
56 | + } |
|
57 | + return true; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - public function generate_reg_form() |
|
65 | - { |
|
66 | - // create empty form so that things don't break |
|
67 | - $this->reg_form = new EE_Form_Section_Proper(); |
|
68 | - return ''; |
|
69 | - } |
|
61 | + /** |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + public function generate_reg_form() |
|
65 | + { |
|
66 | + // create empty form so that things don't break |
|
67 | + $this->reg_form = new EE_Form_Section_Proper(); |
|
68 | + return ''; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * @return boolean |
|
74 | - * @throws RuntimeException |
|
75 | - * @throws EE_Error |
|
76 | - * @throws ReflectionException |
|
77 | - */ |
|
78 | - public function process_reg_step() |
|
79 | - { |
|
80 | - // ensure all data gets refreshed from the db |
|
81 | - $this->checkout->refresh_all_entities(true); |
|
82 | - // ensures that all details and statuses for transaction, registration, and payments are updated |
|
83 | - $txn_update_params = $this->_finalize_transaction(); |
|
84 | - // maybe send messages |
|
85 | - $this->_set_notification_triggers(); |
|
86 | - // send messages |
|
87 | - /** @type EE_Registration_Processor $registration_processor */ |
|
88 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
89 | - $registration_processor->trigger_registration_update_notifications( |
|
90 | - $this->checkout->transaction->primary_registration(), |
|
91 | - $txn_update_params |
|
92 | - ); |
|
93 | - // set a hook point |
|
94 | - do_action( |
|
95 | - 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', |
|
96 | - $this->checkout, |
|
97 | - $txn_update_params |
|
98 | - ); |
|
99 | - // check if transaction has a primary registrant and that it has a related Attendee object |
|
100 | - if (! $this->_validate_primary_registrant()) { |
|
101 | - return false; |
|
102 | - } |
|
103 | - // you don't have to go home but you can't stay here ! |
|
104 | - $this->checkout->redirect = true; |
|
105 | - $this->checkout->continue_reg = true; |
|
106 | - $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
107 | - if ( |
|
108 | - ! ( |
|
109 | - $this->checkout->payment_method instanceof EE_Payment_Method |
|
110 | - && $this->checkout->payment_method->is_off_site() |
|
111 | - ) |
|
112 | - ) { |
|
113 | - // mark this reg step as completed |
|
114 | - $this->set_completed(); |
|
115 | - } |
|
116 | - $this->checkout->set_exit_spco(); |
|
117 | - return true; |
|
118 | - } |
|
72 | + /** |
|
73 | + * @return boolean |
|
74 | + * @throws RuntimeException |
|
75 | + * @throws EE_Error |
|
76 | + * @throws ReflectionException |
|
77 | + */ |
|
78 | + public function process_reg_step() |
|
79 | + { |
|
80 | + // ensure all data gets refreshed from the db |
|
81 | + $this->checkout->refresh_all_entities(true); |
|
82 | + // ensures that all details and statuses for transaction, registration, and payments are updated |
|
83 | + $txn_update_params = $this->_finalize_transaction(); |
|
84 | + // maybe send messages |
|
85 | + $this->_set_notification_triggers(); |
|
86 | + // send messages |
|
87 | + /** @type EE_Registration_Processor $registration_processor */ |
|
88 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
89 | + $registration_processor->trigger_registration_update_notifications( |
|
90 | + $this->checkout->transaction->primary_registration(), |
|
91 | + $txn_update_params |
|
92 | + ); |
|
93 | + // set a hook point |
|
94 | + do_action( |
|
95 | + 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', |
|
96 | + $this->checkout, |
|
97 | + $txn_update_params |
|
98 | + ); |
|
99 | + // check if transaction has a primary registrant and that it has a related Attendee object |
|
100 | + if (! $this->_validate_primary_registrant()) { |
|
101 | + return false; |
|
102 | + } |
|
103 | + // you don't have to go home but you can't stay here ! |
|
104 | + $this->checkout->redirect = true; |
|
105 | + $this->checkout->continue_reg = true; |
|
106 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
107 | + if ( |
|
108 | + ! ( |
|
109 | + $this->checkout->payment_method instanceof EE_Payment_Method |
|
110 | + && $this->checkout->payment_method->is_off_site() |
|
111 | + ) |
|
112 | + ) { |
|
113 | + // mark this reg step as completed |
|
114 | + $this->set_completed(); |
|
115 | + } |
|
116 | + $this->checkout->set_exit_spco(); |
|
117 | + return true; |
|
118 | + } |
|
119 | 119 | |
120 | 120 | |
121 | - /** |
|
122 | - * _finalize_transaction |
|
123 | - * ensures that all details and statuses for transaction, registration, and payments are updated |
|
124 | - * |
|
125 | - * @return array |
|
126 | - * @throws RuntimeException |
|
127 | - * @throws EE_Error |
|
128 | - * @throws ReflectionException |
|
129 | - */ |
|
130 | - protected function _finalize_transaction() |
|
131 | - { |
|
132 | - /** @type EE_Transaction_Processor $transaction_processor */ |
|
133 | - $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
134 | - // set revisit flag in txn processor |
|
135 | - $transaction_processor->set_revisit($this->checkout->revisit); |
|
136 | - // at this point we'll consider a TXN to not have been abandoned |
|
137 | - $this->checkout->transaction->toggle_abandoned_transaction_status(); |
|
138 | - if ($this->checkout->cart instanceof EE_Cart) { |
|
139 | - // save TXN data to the cart |
|
140 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
|
141 | - $this->checkout->transaction->ID() |
|
142 | - ); |
|
143 | - } |
|
144 | - // maybe update status, but don't save transaction just yet |
|
145 | - $this->checkout->transaction->update_status_based_on_total_paid(false); |
|
146 | - // this will result in the base session properties getting saved to the TXN_Session_data field |
|
147 | - $session_data = EE_Registry::instance()->SSN->get_session_data(null, true); |
|
148 | - // anonymize the last part of the IP address, now that the transaction is complete (we won't be using the IP address |
|
149 | - // for spam or bot detection now) |
|
150 | - if (function_exists('wp_privacy_anonymize_ip') && isset($session_data['ip_address'])) { |
|
151 | - $session_data['ip_address'] = wp_privacy_anonymize_ip($session_data['ip_address']); |
|
152 | - } |
|
153 | - $this->checkout->transaction->set_txn_session_data($session_data); |
|
154 | - // update the TXN if payment conditions have changed, but do NOT trigger notifications, |
|
155 | - // because we will do that in process_reg_step() after setting some more triggers |
|
156 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
157 | - $this->checkout->transaction, |
|
158 | - $this->checkout->payment, |
|
159 | - $this->checkout->reg_cache_where_params, |
|
160 | - false |
|
161 | - ); |
|
162 | - } |
|
121 | + /** |
|
122 | + * _finalize_transaction |
|
123 | + * ensures that all details and statuses for transaction, registration, and payments are updated |
|
124 | + * |
|
125 | + * @return array |
|
126 | + * @throws RuntimeException |
|
127 | + * @throws EE_Error |
|
128 | + * @throws ReflectionException |
|
129 | + */ |
|
130 | + protected function _finalize_transaction() |
|
131 | + { |
|
132 | + /** @type EE_Transaction_Processor $transaction_processor */ |
|
133 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
134 | + // set revisit flag in txn processor |
|
135 | + $transaction_processor->set_revisit($this->checkout->revisit); |
|
136 | + // at this point we'll consider a TXN to not have been abandoned |
|
137 | + $this->checkout->transaction->toggle_abandoned_transaction_status(); |
|
138 | + if ($this->checkout->cart instanceof EE_Cart) { |
|
139 | + // save TXN data to the cart |
|
140 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
|
141 | + $this->checkout->transaction->ID() |
|
142 | + ); |
|
143 | + } |
|
144 | + // maybe update status, but don't save transaction just yet |
|
145 | + $this->checkout->transaction->update_status_based_on_total_paid(false); |
|
146 | + // this will result in the base session properties getting saved to the TXN_Session_data field |
|
147 | + $session_data = EE_Registry::instance()->SSN->get_session_data(null, true); |
|
148 | + // anonymize the last part of the IP address, now that the transaction is complete (we won't be using the IP address |
|
149 | + // for spam or bot detection now) |
|
150 | + if (function_exists('wp_privacy_anonymize_ip') && isset($session_data['ip_address'])) { |
|
151 | + $session_data['ip_address'] = wp_privacy_anonymize_ip($session_data['ip_address']); |
|
152 | + } |
|
153 | + $this->checkout->transaction->set_txn_session_data($session_data); |
|
154 | + // update the TXN if payment conditions have changed, but do NOT trigger notifications, |
|
155 | + // because we will do that in process_reg_step() after setting some more triggers |
|
156 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( |
|
157 | + $this->checkout->transaction, |
|
158 | + $this->checkout->payment, |
|
159 | + $this->checkout->reg_cache_where_params, |
|
160 | + false |
|
161 | + ); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | |
165 | - /** |
|
166 | - * If request is not a revisit, and an Off-Site gateway using IPNs has NOT been selected... |
|
167 | - * OR |
|
168 | - * if it IS a revisit and the TXN and/or one or more REG statuses have changed... |
|
169 | - * then trigger notifications |
|
170 | - * |
|
171 | - * @return void |
|
172 | - * @throws EE_Error |
|
173 | - * @throws ReflectionException |
|
174 | - */ |
|
175 | - protected function _set_notification_triggers() |
|
176 | - { |
|
165 | + /** |
|
166 | + * If request is not a revisit, and an Off-Site gateway using IPNs has NOT been selected... |
|
167 | + * OR |
|
168 | + * if it IS a revisit and the TXN and/or one or more REG statuses have changed... |
|
169 | + * then trigger notifications |
|
170 | + * |
|
171 | + * @return void |
|
172 | + * @throws EE_Error |
|
173 | + * @throws ReflectionException |
|
174 | + */ |
|
175 | + protected function _set_notification_triggers() |
|
176 | + { |
|
177 | 177 | |
178 | - if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
179 | - // let's start with the assumption that we need to trigger notifications |
|
180 | - // then toggle this to false for conditions where we know we don't need to |
|
181 | - $deliver_notifications = true; |
|
182 | - if ( |
|
178 | + if ($this->checkout->payment_method instanceof EE_Payment_Method) { |
|
179 | + // let's start with the assumption that we need to trigger notifications |
|
180 | + // then toggle this to false for conditions where we know we don't need to |
|
181 | + $deliver_notifications = true; |
|
182 | + if ( |
|
183 | 183 | // if SPCO revisit |
184 | - filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN) |
|
185 | - // and TXN or REG statuses have NOT changed due to a payment |
|
186 | - && ! ( |
|
187 | - $this->checkout->transaction->txn_status_updated() |
|
188 | - || $this->checkout->any_reg_status_updated() |
|
189 | - ) |
|
190 | - ) { |
|
191 | - $deliver_notifications = false; |
|
192 | - } |
|
193 | - if ($this->checkout->payment_method->is_off_site()) { |
|
194 | - /** @var EE_Gateway $gateway */ |
|
195 | - $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
196 | - // and the gateway uses a separate request to process the IPN |
|
197 | - /** @var RequestInterface $request */ |
|
198 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
199 | - if ( |
|
200 | - $gateway instanceof EE_Offsite_Gateway |
|
201 | - && $gateway->handle_IPN_in_this_request($request->requestParams(), true) |
|
202 | - ) { |
|
203 | - // IPN request will handle triggering notifications |
|
204 | - $deliver_notifications = false; |
|
205 | - // no really... don't send any notices in this request |
|
206 | - remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
207 | - add_filter( |
|
208 | - 'FHEE__EED_Messages___maybe_registration__deliver_notifications', |
|
209 | - '__return_false', |
|
210 | - 15 |
|
211 | - ); |
|
212 | - } |
|
213 | - } |
|
214 | - if ($deliver_notifications) { |
|
215 | - // send out notifications |
|
216 | - add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
217 | - } |
|
218 | - } |
|
219 | - } |
|
184 | + filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN) |
|
185 | + // and TXN or REG statuses have NOT changed due to a payment |
|
186 | + && ! ( |
|
187 | + $this->checkout->transaction->txn_status_updated() |
|
188 | + || $this->checkout->any_reg_status_updated() |
|
189 | + ) |
|
190 | + ) { |
|
191 | + $deliver_notifications = false; |
|
192 | + } |
|
193 | + if ($this->checkout->payment_method->is_off_site()) { |
|
194 | + /** @var EE_Gateway $gateway */ |
|
195 | + $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
|
196 | + // and the gateway uses a separate request to process the IPN |
|
197 | + /** @var RequestInterface $request */ |
|
198 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
199 | + if ( |
|
200 | + $gateway instanceof EE_Offsite_Gateway |
|
201 | + && $gateway->handle_IPN_in_this_request($request->requestParams(), true) |
|
202 | + ) { |
|
203 | + // IPN request will handle triggering notifications |
|
204 | + $deliver_notifications = false; |
|
205 | + // no really... don't send any notices in this request |
|
206 | + remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications'); |
|
207 | + add_filter( |
|
208 | + 'FHEE__EED_Messages___maybe_registration__deliver_notifications', |
|
209 | + '__return_false', |
|
210 | + 15 |
|
211 | + ); |
|
212 | + } |
|
213 | + } |
|
214 | + if ($deliver_notifications) { |
|
215 | + // send out notifications |
|
216 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
217 | + } |
|
218 | + } |
|
219 | + } |
|
220 | 220 | |
221 | 221 | |
222 | - /** |
|
223 | - * check if transaction has a primary registrant and that it has a related Attendee object |
|
224 | - * |
|
225 | - * @return boolean |
|
226 | - * @throws EE_Error |
|
227 | - * @throws ReflectionException |
|
228 | - */ |
|
229 | - protected function _validate_primary_registrant() |
|
230 | - { |
|
231 | - if (! $this->checkout->transaction_has_primary_registrant()) { |
|
232 | - EE_Error::add_error( |
|
233 | - esc_html__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), |
|
234 | - __FILE__, |
|
235 | - __FUNCTION__, |
|
236 | - __LINE__ |
|
237 | - ); |
|
238 | - $this->checkout->redirect = false; |
|
239 | - $this->checkout->continue_reg = false; |
|
240 | - return false; |
|
241 | - } |
|
242 | - // setup URL for redirect |
|
243 | - $this->checkout->redirect_url = add_query_arg( |
|
244 | - ['e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()], |
|
245 | - $this->checkout->thank_you_page_url |
|
246 | - ); |
|
247 | - return true; |
|
248 | - } |
|
222 | + /** |
|
223 | + * check if transaction has a primary registrant and that it has a related Attendee object |
|
224 | + * |
|
225 | + * @return boolean |
|
226 | + * @throws EE_Error |
|
227 | + * @throws ReflectionException |
|
228 | + */ |
|
229 | + protected function _validate_primary_registrant() |
|
230 | + { |
|
231 | + if (! $this->checkout->transaction_has_primary_registrant()) { |
|
232 | + EE_Error::add_error( |
|
233 | + esc_html__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), |
|
234 | + __FILE__, |
|
235 | + __FUNCTION__, |
|
236 | + __LINE__ |
|
237 | + ); |
|
238 | + $this->checkout->redirect = false; |
|
239 | + $this->checkout->continue_reg = false; |
|
240 | + return false; |
|
241 | + } |
|
242 | + // setup URL for redirect |
|
243 | + $this->checkout->redirect_url = add_query_arg( |
|
244 | + ['e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()], |
|
245 | + $this->checkout->thank_you_page_url |
|
246 | + ); |
|
247 | + return true; |
|
248 | + } |
|
249 | 249 | |
250 | 250 | |
251 | - /** |
|
252 | - * @return void |
|
253 | - */ |
|
254 | - public function update_reg_step() |
|
255 | - { |
|
256 | - EE_Error::doing_it_wrong( |
|
257 | - __CLASS__ . '::' . __FILE__, |
|
258 | - esc_html__( |
|
259 | - 'Can not call update_reg_step() on the Finalize Registration reg step.', |
|
260 | - 'event_espresso' |
|
261 | - ), |
|
262 | - '4.6.0' |
|
263 | - ); |
|
264 | - } |
|
251 | + /** |
|
252 | + * @return void |
|
253 | + */ |
|
254 | + public function update_reg_step() |
|
255 | + { |
|
256 | + EE_Error::doing_it_wrong( |
|
257 | + __CLASS__ . '::' . __FILE__, |
|
258 | + esc_html__( |
|
259 | + 'Can not call update_reg_step() on the Finalize Registration reg step.', |
|
260 | + 'event_espresso' |
|
261 | + ), |
|
262 | + '4.6.0' |
|
263 | + ); |
|
264 | + } |
|
265 | 265 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text"> |
2 | 2 | <?php echo apply_filters( |
3 | - 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', |
|
4 | - esc_html__( |
|
5 | - 'The above information will be used for any additional tickets/attendees.', |
|
6 | - 'event_espresso' |
|
7 | - ) |
|
8 | - ); ?> |
|
3 | + 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', |
|
4 | + esc_html__( |
|
5 | + 'The above information will be used for any additional tickets/attendees.', |
|
6 | + 'event_espresso' |
|
7 | + ) |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | \ No newline at end of file |
@@ -20,198 +20,198 @@ |
||
20 | 20 | */ |
21 | 21 | class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper |
22 | 22 | { |
23 | - /** |
|
24 | - * |
|
25 | - * @var EE_Registration |
|
26 | - */ |
|
27 | - protected $_registration = null; |
|
23 | + /** |
|
24 | + * |
|
25 | + * @var EE_Registration |
|
26 | + */ |
|
27 | + protected $_registration = null; |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * |
|
32 | - * @param EE_Registration $reg |
|
33 | - * @param array $options |
|
34 | - * @throws EE_Error |
|
35 | - * @throws ReflectionException |
|
36 | - */ |
|
37 | - public function __construct(EE_Registration $reg, $options = array()) |
|
38 | - { |
|
39 | - $this->_registration = $reg; |
|
40 | - if (! isset($options['layout_strategy'])) { |
|
41 | - $options['layout_strategy'] = new EE_Admin_Two_Column_Layout(); |
|
42 | - } |
|
43 | - if (! isset($options['html_id'])) { |
|
44 | - $options['html_id'] = 'reg-admin-attendee-questions-frm'; |
|
45 | - } |
|
46 | - $this->build_form_from_registration(); |
|
47 | - parent::__construct($options); |
|
48 | - } |
|
30 | + /** |
|
31 | + * |
|
32 | + * @param EE_Registration $reg |
|
33 | + * @param array $options |
|
34 | + * @throws EE_Error |
|
35 | + * @throws ReflectionException |
|
36 | + */ |
|
37 | + public function __construct(EE_Registration $reg, $options = array()) |
|
38 | + { |
|
39 | + $this->_registration = $reg; |
|
40 | + if (! isset($options['layout_strategy'])) { |
|
41 | + $options['layout_strategy'] = new EE_Admin_Two_Column_Layout(); |
|
42 | + } |
|
43 | + if (! isset($options['html_id'])) { |
|
44 | + $options['html_id'] = 'reg-admin-attendee-questions-frm'; |
|
45 | + } |
|
46 | + $this->build_form_from_registration(); |
|
47 | + parent::__construct($options); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * Gets the registration object this form is about |
|
53 | - * @return EE_Registration |
|
54 | - */ |
|
55 | - public function get_registration() |
|
56 | - { |
|
57 | - return $this->_registration; |
|
58 | - } |
|
51 | + /** |
|
52 | + * Gets the registration object this form is about |
|
53 | + * @return EE_Registration |
|
54 | + */ |
|
55 | + public function get_registration() |
|
56 | + { |
|
57 | + return $this->_registration; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @since 4.10.0.p |
|
62 | - * @throws EE_Error |
|
63 | - * @throws InvalidArgumentException |
|
64 | - * @throws ReflectionException |
|
65 | - * @throws InvalidDataTypeException |
|
66 | - * @throws InvalidInterfaceException |
|
67 | - */ |
|
68 | - public function build_form_from_registration() |
|
69 | - { |
|
70 | - $reg = $this->get_registration(); |
|
71 | - if (! $reg instanceof EE_Registration) { |
|
72 | - throw new EE_Error(esc_html__('We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso')); |
|
73 | - } |
|
74 | - // we want to get all their question groups |
|
75 | - $question_groups = EEM_Question_Group::instance()->get_all( |
|
76 | - [ |
|
77 | - [ |
|
78 | - 'Event_Question_Group.EVT_ID' => $reg->event_ID(), |
|
79 | - 'OR' => [ |
|
80 | - 'Question.QST_system*blank' => '', |
|
81 | - 'Question.QST_system*null' => ['IS_NULL'] |
|
82 | - ], |
|
83 | - 'Event_Question_Group.' |
|
84 | - . EEM_Event_Question_Group::instance()->fieldNameForContext( |
|
85 | - $reg->is_primary_registrant() |
|
86 | - ) => true |
|
87 | - ], |
|
88 | - 'order_by' => ['QSG_order' => 'ASC'] |
|
89 | - ] |
|
90 | - ); |
|
91 | - // get each question groups questions |
|
92 | - foreach ($question_groups as $question_group) { |
|
93 | - if ($question_group instanceof EE_Question_Group) { |
|
94 | - $this->_subsections[ $question_group->ID() ] = $this->build_subform_from_question_group( |
|
95 | - $question_group, |
|
96 | - $reg |
|
97 | - ); |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
60 | + /** |
|
61 | + * @since 4.10.0.p |
|
62 | + * @throws EE_Error |
|
63 | + * @throws InvalidArgumentException |
|
64 | + * @throws ReflectionException |
|
65 | + * @throws InvalidDataTypeException |
|
66 | + * @throws InvalidInterfaceException |
|
67 | + */ |
|
68 | + public function build_form_from_registration() |
|
69 | + { |
|
70 | + $reg = $this->get_registration(); |
|
71 | + if (! $reg instanceof EE_Registration) { |
|
72 | + throw new EE_Error(esc_html__('We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso')); |
|
73 | + } |
|
74 | + // we want to get all their question groups |
|
75 | + $question_groups = EEM_Question_Group::instance()->get_all( |
|
76 | + [ |
|
77 | + [ |
|
78 | + 'Event_Question_Group.EVT_ID' => $reg->event_ID(), |
|
79 | + 'OR' => [ |
|
80 | + 'Question.QST_system*blank' => '', |
|
81 | + 'Question.QST_system*null' => ['IS_NULL'] |
|
82 | + ], |
|
83 | + 'Event_Question_Group.' |
|
84 | + . EEM_Event_Question_Group::instance()->fieldNameForContext( |
|
85 | + $reg->is_primary_registrant() |
|
86 | + ) => true |
|
87 | + ], |
|
88 | + 'order_by' => ['QSG_order' => 'ASC'] |
|
89 | + ] |
|
90 | + ); |
|
91 | + // get each question groups questions |
|
92 | + foreach ($question_groups as $question_group) { |
|
93 | + if ($question_group instanceof EE_Question_Group) { |
|
94 | + $this->_subsections[ $question_group->ID() ] = $this->build_subform_from_question_group( |
|
95 | + $question_group, |
|
96 | + $reg |
|
97 | + ); |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | 102 | |
103 | - /** |
|
104 | - * |
|
105 | - * @param EE_Question_Group $question_group |
|
106 | - * @param EE_Registration $registration |
|
107 | - * @return EE_Form_Section_Proper |
|
108 | - * @throws EE_Error |
|
109 | - * @throws ReflectionException |
|
110 | - */ |
|
111 | - public function build_subform_from_question_group($question_group, $registration) |
|
112 | - { |
|
113 | - if ( |
|
114 | - ! $question_group instanceof EE_Question_Group || |
|
115 | - ! $registration instanceof EE_Registration |
|
116 | - ) { |
|
117 | - throw new EE_Error(esc_html__('A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso')); |
|
118 | - } |
|
119 | - $parts_of_subsection = array( |
|
120 | - 'title' => new EE_Form_Section_HTML( |
|
121 | - EEH_HTML::h5( |
|
122 | - $question_group->name(), |
|
123 | - $question_group->identifier(), |
|
124 | - 'espresso-question-group-title-h5 section-title' |
|
125 | - ) |
|
126 | - ) |
|
127 | - ); |
|
128 | - $questions = $question_group->questions( |
|
129 | - array( |
|
130 | - array( |
|
131 | - 'OR' => array( |
|
132 | - 'QST_system*blank' => '', |
|
133 | - 'QST_system*null' => array( 'IS_NULL' ) |
|
134 | - ) |
|
135 | - ) |
|
136 | - ) |
|
137 | - ); |
|
138 | - foreach ($questions as $question) { |
|
139 | - $parts_of_subsection[ $question->ID() ] = $question->generate_form_input($registration); |
|
140 | - } |
|
141 | - if ( |
|
142 | - EE_Registry::instance()->CAP->current_user_can( |
|
143 | - 'ee_edit_registration', |
|
144 | - 'edit-reg-questions-mbox', |
|
145 | - $this->_registration->ID() |
|
146 | - ) |
|
147 | - ) { |
|
148 | - $parts_of_subsection['edit_link'] = new EE_Form_Section_HTML( |
|
149 | - EEH_HTML::table( |
|
150 | - EEH_HTML::tr( |
|
151 | - '<th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" aria-label="' . esc_attr__('click to edit question', 'event_espresso') . '"> |
|
103 | + /** |
|
104 | + * |
|
105 | + * @param EE_Question_Group $question_group |
|
106 | + * @param EE_Registration $registration |
|
107 | + * @return EE_Form_Section_Proper |
|
108 | + * @throws EE_Error |
|
109 | + * @throws ReflectionException |
|
110 | + */ |
|
111 | + public function build_subform_from_question_group($question_group, $registration) |
|
112 | + { |
|
113 | + if ( |
|
114 | + ! $question_group instanceof EE_Question_Group || |
|
115 | + ! $registration instanceof EE_Registration |
|
116 | + ) { |
|
117 | + throw new EE_Error(esc_html__('A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso')); |
|
118 | + } |
|
119 | + $parts_of_subsection = array( |
|
120 | + 'title' => new EE_Form_Section_HTML( |
|
121 | + EEH_HTML::h5( |
|
122 | + $question_group->name(), |
|
123 | + $question_group->identifier(), |
|
124 | + 'espresso-question-group-title-h5 section-title' |
|
125 | + ) |
|
126 | + ) |
|
127 | + ); |
|
128 | + $questions = $question_group->questions( |
|
129 | + array( |
|
130 | + array( |
|
131 | + 'OR' => array( |
|
132 | + 'QST_system*blank' => '', |
|
133 | + 'QST_system*null' => array( 'IS_NULL' ) |
|
134 | + ) |
|
135 | + ) |
|
136 | + ) |
|
137 | + ); |
|
138 | + foreach ($questions as $question) { |
|
139 | + $parts_of_subsection[ $question->ID() ] = $question->generate_form_input($registration); |
|
140 | + } |
|
141 | + if ( |
|
142 | + EE_Registry::instance()->CAP->current_user_can( |
|
143 | + 'ee_edit_registration', |
|
144 | + 'edit-reg-questions-mbox', |
|
145 | + $this->_registration->ID() |
|
146 | + ) |
|
147 | + ) { |
|
148 | + $parts_of_subsection['edit_link'] = new EE_Form_Section_HTML( |
|
149 | + EEH_HTML::table( |
|
150 | + EEH_HTML::tr( |
|
151 | + '<th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" aria-label="' . esc_attr__('click to edit question', 'event_espresso') . '"> |
|
152 | 152 | <span class="reg-admin-edit-question-group-spn">' . esc_html__('edit the above question group', 'event_espresso') . '</span> |
153 | 153 | <div class="dashicons dashicons-edit"></div> |
154 | 154 | </a></td>' |
155 | - ) . |
|
156 | - EEH_HTML::no_row() |
|
157 | - ) |
|
158 | - ); |
|
159 | - } |
|
160 | - return new EE_Form_Section_Proper( |
|
161 | - array( |
|
162 | - 'subsections' => $parts_of_subsection, |
|
163 | - 'html_class' => 'question-group-questions', |
|
164 | - ) |
|
165 | - ); |
|
166 | - } |
|
155 | + ) . |
|
156 | + EEH_HTML::no_row() |
|
157 | + ) |
|
158 | + ); |
|
159 | + } |
|
160 | + return new EE_Form_Section_Proper( |
|
161 | + array( |
|
162 | + 'subsections' => $parts_of_subsection, |
|
163 | + 'html_class' => 'question-group-questions', |
|
164 | + ) |
|
165 | + ); |
|
166 | + } |
|
167 | 167 | |
168 | 168 | |
169 | - /** |
|
170 | - * Overrides parent so if inputs were disabled, we leave those with their defaults |
|
171 | - * from the answers in the DB |
|
172 | - * |
|
173 | - * @param array $req_data like $_POST |
|
174 | - * @return void |
|
175 | - * @throws EE_Error |
|
176 | - */ |
|
177 | - protected function _normalize($req_data) |
|
178 | - { |
|
179 | - $this->_received_submission = true; |
|
180 | - $this->_validation_errors = array(); |
|
181 | - foreach ($this->get_validatable_subsections() as $subsection) { |
|
182 | - if ($subsection->form_data_present_in($req_data)) { |
|
183 | - try { |
|
184 | - $subsection->_normalize($req_data); |
|
185 | - } catch (EE_Validation_Error $e) { |
|
186 | - $subsection->add_validation_error($e); |
|
187 | - } |
|
188 | - } |
|
189 | - } |
|
190 | - } |
|
169 | + /** |
|
170 | + * Overrides parent so if inputs were disabled, we leave those with their defaults |
|
171 | + * from the answers in the DB |
|
172 | + * |
|
173 | + * @param array $req_data like $_POST |
|
174 | + * @return void |
|
175 | + * @throws EE_Error |
|
176 | + */ |
|
177 | + protected function _normalize($req_data) |
|
178 | + { |
|
179 | + $this->_received_submission = true; |
|
180 | + $this->_validation_errors = array(); |
|
181 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
182 | + if ($subsection->form_data_present_in($req_data)) { |
|
183 | + try { |
|
184 | + $subsection->_normalize($req_data); |
|
185 | + } catch (EE_Validation_Error $e) { |
|
186 | + $subsection->add_validation_error($e); |
|
187 | + } |
|
188 | + } |
|
189 | + } |
|
190 | + } |
|
191 | 191 | |
192 | 192 | |
193 | - /** |
|
194 | - * Performs validation on this form section and its subsections. For each subsection, |
|
195 | - * calls _validate_{subsection_name} on THIS form (if the function exists) and passes it the subsection, then calls |
|
196 | - * _validate on that subsection. If you need to perform validation on the form as a whole (considering multiple) |
|
197 | - * you would be best to override this _validate method, calling parent::_validate() first. |
|
198 | - * |
|
199 | - * @throws EE_Error |
|
200 | - */ |
|
201 | - protected function _validate() |
|
202 | - { |
|
203 | - /** @var RequestInterface $request */ |
|
204 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
205 | - $form_data = $request->requestParams(); |
|
206 | - foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) { |
|
207 | - if ($subsection->form_data_present_in($form_data)) { |
|
208 | - if (method_exists($this, '_validate_' . $subsection_name)) { |
|
209 | - call_user_func_array(array($this,'_validate_' . $subsection_name), array($subsection)); |
|
210 | - } |
|
211 | - $subsection->_validate(); |
|
212 | - } elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
213 | - $subsection->_received_submission = true; |
|
214 | - } |
|
215 | - } |
|
216 | - } |
|
193 | + /** |
|
194 | + * Performs validation on this form section and its subsections. For each subsection, |
|
195 | + * calls _validate_{subsection_name} on THIS form (if the function exists) and passes it the subsection, then calls |
|
196 | + * _validate on that subsection. If you need to perform validation on the form as a whole (considering multiple) |
|
197 | + * you would be best to override this _validate method, calling parent::_validate() first. |
|
198 | + * |
|
199 | + * @throws EE_Error |
|
200 | + */ |
|
201 | + protected function _validate() |
|
202 | + { |
|
203 | + /** @var RequestInterface $request */ |
|
204 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
205 | + $form_data = $request->requestParams(); |
|
206 | + foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) { |
|
207 | + if ($subsection->form_data_present_in($form_data)) { |
|
208 | + if (method_exists($this, '_validate_' . $subsection_name)) { |
|
209 | + call_user_func_array(array($this,'_validate_' . $subsection_name), array($subsection)); |
|
210 | + } |
|
211 | + $subsection->_validate(); |
|
212 | + } elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
213 | + $subsection->_received_submission = true; |
|
214 | + } |
|
215 | + } |
|
216 | + } |
|
217 | 217 | } |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | public function __construct(EE_Registration $reg, $options = array()) |
38 | 38 | { |
39 | 39 | $this->_registration = $reg; |
40 | - if (! isset($options['layout_strategy'])) { |
|
40 | + if ( ! isset($options['layout_strategy'])) { |
|
41 | 41 | $options['layout_strategy'] = new EE_Admin_Two_Column_Layout(); |
42 | 42 | } |
43 | - if (! isset($options['html_id'])) { |
|
43 | + if ( ! isset($options['html_id'])) { |
|
44 | 44 | $options['html_id'] = 'reg-admin-attendee-questions-frm'; |
45 | 45 | } |
46 | 46 | $this->build_form_from_registration(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function build_form_from_registration() |
69 | 69 | { |
70 | 70 | $reg = $this->get_registration(); |
71 | - if (! $reg instanceof EE_Registration) { |
|
71 | + if ( ! $reg instanceof EE_Registration) { |
|
72 | 72 | throw new EE_Error(esc_html__('We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso')); |
73 | 73 | } |
74 | 74 | // we want to get all their question groups |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // get each question groups questions |
92 | 92 | foreach ($question_groups as $question_group) { |
93 | 93 | if ($question_group instanceof EE_Question_Group) { |
94 | - $this->_subsections[ $question_group->ID() ] = $this->build_subform_from_question_group( |
|
94 | + $this->_subsections[$question_group->ID()] = $this->build_subform_from_question_group( |
|
95 | 95 | $question_group, |
96 | 96 | $reg |
97 | 97 | ); |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | array( |
131 | 131 | 'OR' => array( |
132 | 132 | 'QST_system*blank' => '', |
133 | - 'QST_system*null' => array( 'IS_NULL' ) |
|
133 | + 'QST_system*null' => array('IS_NULL') |
|
134 | 134 | ) |
135 | 135 | ) |
136 | 136 | ) |
137 | 137 | ); |
138 | 138 | foreach ($questions as $question) { |
139 | - $parts_of_subsection[ $question->ID() ] = $question->generate_form_input($registration); |
|
139 | + $parts_of_subsection[$question->ID()] = $question->generate_form_input($registration); |
|
140 | 140 | } |
141 | 141 | if ( |
142 | 142 | EE_Registry::instance()->CAP->current_user_can( |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | $parts_of_subsection['edit_link'] = new EE_Form_Section_HTML( |
149 | 149 | EEH_HTML::table( |
150 | 150 | EEH_HTML::tr( |
151 | - '<th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" aria-label="' . esc_attr__('click to edit question', 'event_espresso') . '"> |
|
152 | - <span class="reg-admin-edit-question-group-spn">' . esc_html__('edit the above question group', 'event_espresso') . '</span> |
|
151 | + '<th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" aria-label="'.esc_attr__('click to edit question', 'event_espresso').'"> |
|
152 | + <span class="reg-admin-edit-question-group-spn">' . esc_html__('edit the above question group', 'event_espresso').'</span> |
|
153 | 153 | <div class="dashicons dashicons-edit"></div> |
154 | 154 | </a></td>' |
155 | - ) . |
|
155 | + ). |
|
156 | 156 | EEH_HTML::no_row() |
157 | 157 | ) |
158 | 158 | ); |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | $form_data = $request->requestParams(); |
206 | 206 | foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) { |
207 | 207 | if ($subsection->form_data_present_in($form_data)) { |
208 | - if (method_exists($this, '_validate_' . $subsection_name)) { |
|
209 | - call_user_func_array(array($this,'_validate_' . $subsection_name), array($subsection)); |
|
208 | + if (method_exists($this, '_validate_'.$subsection_name)) { |
|
209 | + call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection)); |
|
210 | 210 | } |
211 | 211 | $subsection->_validate(); |
212 | 212 | } elseif ($subsection instanceof EE_Form_Section_Proper) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct($pm_instance = null) |
31 | 31 | { |
32 | - require_once($this->file_folder() . 'EEG_Paypal_Standard.gateway.php'); |
|
32 | + require_once($this->file_folder().'EEG_Paypal_Standard.gateway.php'); |
|
33 | 33 | $this->_gateway = new EEG_Paypal_Standard(); |
34 | 34 | $this->_pretty_name = esc_html__("PayPal Standard", 'event_espresso'); |
35 | 35 | $this->_default_description = sprintf( |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | '</strong>' |
42 | 42 | ); |
43 | 43 | parent::__construct($pm_instance); |
44 | - $this->_default_button_url = $this->file_url() . 'lib/paypal-logo.png'; |
|
44 | + $this->_default_button_url = $this->file_url().'lib/paypal-logo.png'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function generate_new_settings_form() |
67 | 67 | { |
68 | - require_once($this->file_folder() . 'EE_Paypal_Standard_Form.form.php'); |
|
68 | + require_once($this->file_folder().'EE_Paypal_Standard_Form.form.php'); |
|
69 | 69 | $form = new EE_Paypal_Standard_Form($this); |
70 | 70 | $form->get_input('PMD_debug_mode')->set_html_label_text( |
71 | 71 | sprintf(esc_html__("Use PayPal Sandbox %s", 'event_espresso'), $this->get_help_tab_link()) |
@@ -15,106 +15,106 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_PMT_Paypal_Standard extends EE_PMT_Base |
17 | 17 | { |
18 | - const shipping_info_none = 1; |
|
18 | + const shipping_info_none = 1; |
|
19 | 19 | |
20 | - const shipping_info_optional = 0; |
|
20 | + const shipping_info_optional = 0; |
|
21 | 21 | |
22 | - const shipping_info_required = 2; |
|
22 | + const shipping_info_required = 2; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * @param EE_Payment_Method|null $pm_instance |
|
27 | - * @throws ReflectionException |
|
28 | - * @throws EE_Error |
|
29 | - */ |
|
30 | - public function __construct($pm_instance = null) |
|
31 | - { |
|
32 | - require_once($this->file_folder() . 'EEG_Paypal_Standard.gateway.php'); |
|
33 | - $this->_gateway = new EEG_Paypal_Standard(); |
|
34 | - $this->_pretty_name = esc_html__("PayPal Standard", 'event_espresso'); |
|
35 | - $this->_default_description = sprintf( |
|
36 | - esc_html__( |
|
37 | - 'Upon submitting this form, you will be forwarded to PayPal to make your payment. %1$sMake sure you return to this site in order to properly finalize your registration.%2$s', |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - '<strong>', |
|
41 | - '</strong>' |
|
42 | - ); |
|
43 | - parent::__construct($pm_instance); |
|
44 | - $this->_default_button_url = $this->file_url() . 'lib/paypal-logo.png'; |
|
45 | - } |
|
25 | + /** |
|
26 | + * @param EE_Payment_Method|null $pm_instance |
|
27 | + * @throws ReflectionException |
|
28 | + * @throws EE_Error |
|
29 | + */ |
|
30 | + public function __construct($pm_instance = null) |
|
31 | + { |
|
32 | + require_once($this->file_folder() . 'EEG_Paypal_Standard.gateway.php'); |
|
33 | + $this->_gateway = new EEG_Paypal_Standard(); |
|
34 | + $this->_pretty_name = esc_html__("PayPal Standard", 'event_espresso'); |
|
35 | + $this->_default_description = sprintf( |
|
36 | + esc_html__( |
|
37 | + 'Upon submitting this form, you will be forwarded to PayPal to make your payment. %1$sMake sure you return to this site in order to properly finalize your registration.%2$s', |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + '<strong>', |
|
41 | + '</strong>' |
|
42 | + ); |
|
43 | + parent::__construct($pm_instance); |
|
44 | + $this->_default_button_url = $this->file_url() . 'lib/paypal-logo.png'; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * Creates the billing form for this payment method type |
|
50 | - * @param EE_Transaction|null $transaction |
|
51 | - * @return EE_Billing_Info_Form|null |
|
52 | - */ |
|
53 | - public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
54 | - { |
|
55 | - return null; |
|
56 | - } |
|
48 | + /** |
|
49 | + * Creates the billing form for this payment method type |
|
50 | + * @param EE_Transaction|null $transaction |
|
51 | + * @return EE_Billing_Info_Form|null |
|
52 | + */ |
|
53 | + public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
54 | + { |
|
55 | + return null; |
|
56 | + } |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Gets the form for all the settings related to this payment method type |
|
61 | - * |
|
62 | - * @return EE_Payment_Method_Form |
|
63 | - * @throws EE_Error |
|
64 | - * @throws ReflectionException |
|
65 | - */ |
|
66 | - public function generate_new_settings_form() |
|
67 | - { |
|
68 | - require_once($this->file_folder() . 'EE_Paypal_Standard_Form.form.php'); |
|
69 | - $form = new EE_Paypal_Standard_Form($this); |
|
70 | - $form->get_input('PMD_debug_mode')->set_html_label_text( |
|
71 | - sprintf(esc_html__("Use PayPal Sandbox %s", 'event_espresso'), $this->get_help_tab_link()) |
|
72 | - ); |
|
73 | - $form->get_input('shipping_details')->set_html_label_text( |
|
74 | - sprintf(esc_html__("Shipping Address Options %s", "event_espresso"), $this->get_help_tab_link()) |
|
75 | - ); |
|
76 | - return $form; |
|
77 | - } |
|
59 | + /** |
|
60 | + * Gets the form for all the settings related to this payment method type |
|
61 | + * |
|
62 | + * @return EE_Payment_Method_Form |
|
63 | + * @throws EE_Error |
|
64 | + * @throws ReflectionException |
|
65 | + */ |
|
66 | + public function generate_new_settings_form() |
|
67 | + { |
|
68 | + require_once($this->file_folder() . 'EE_Paypal_Standard_Form.form.php'); |
|
69 | + $form = new EE_Paypal_Standard_Form($this); |
|
70 | + $form->get_input('PMD_debug_mode')->set_html_label_text( |
|
71 | + sprintf(esc_html__("Use PayPal Sandbox %s", 'event_espresso'), $this->get_help_tab_link()) |
|
72 | + ); |
|
73 | + $form->get_input('shipping_details')->set_html_label_text( |
|
74 | + sprintf(esc_html__("Shipping Address Options %s", "event_espresso"), $this->get_help_tab_link()) |
|
75 | + ); |
|
76 | + return $form; |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | - /** |
|
81 | - * Adds the help tab |
|
82 | - * |
|
83 | - * @return array |
|
84 | - * @see EE_PMT_Base::help_tabs_config() |
|
85 | - */ |
|
86 | - public function help_tabs_config() |
|
87 | - { |
|
88 | - return [ |
|
89 | - $this->get_help_tab_name() => [ |
|
90 | - 'title' => esc_html__("PayPal Standard Settings", 'event_espresso'), |
|
91 | - 'filename' => 'payment_methods_overview_paypalstandard', |
|
92 | - ], |
|
93 | - ]; |
|
94 | - } |
|
80 | + /** |
|
81 | + * Adds the help tab |
|
82 | + * |
|
83 | + * @return array |
|
84 | + * @see EE_PMT_Base::help_tabs_config() |
|
85 | + */ |
|
86 | + public function help_tabs_config() |
|
87 | + { |
|
88 | + return [ |
|
89 | + $this->get_help_tab_name() => [ |
|
90 | + 'title' => esc_html__("PayPal Standard Settings", 'event_espresso'), |
|
91 | + 'filename' => 'payment_methods_overview_paypalstandard', |
|
92 | + ], |
|
93 | + ]; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | - /** |
|
98 | - * Logic to be accomplished when the payment attempt is complete. |
|
99 | - * Most payment methods don't need to do anything at this point; but some, like Mijireh, do. |
|
100 | - * (Mijireh was an offsite gateway which doesn't send an IPN. So when the user returns to EE from |
|
101 | - * Mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status |
|
102 | - * of the payment). Fed a transaction because it's always assumed to be the last payment that |
|
103 | - * |
|
104 | - * @param EE_Transaction $transaction |
|
105 | - * @return EE_Payment |
|
106 | - * @throws EE_Error |
|
107 | - * @throws ReflectionException |
|
108 | - */ |
|
109 | - public function finalize_payment_for(EE_Transaction $transaction): ?EE_Payment |
|
110 | - { |
|
111 | - /** @var RequestInterface $request */ |
|
112 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
113 | - // PayPal standard actually sends the IPN info along with the user when they return to our site |
|
114 | - // so in case the IPN is arriving later, let's try to process an IPN! |
|
115 | - if ($request->getServerParam('REQUEST_METHOD') === 'POST') { |
|
116 | - return $this->handle_ipn($request->postParams(), $transaction); |
|
117 | - } |
|
118 | - return parent::finalize_payment_for($transaction); |
|
119 | - } |
|
97 | + /** |
|
98 | + * Logic to be accomplished when the payment attempt is complete. |
|
99 | + * Most payment methods don't need to do anything at this point; but some, like Mijireh, do. |
|
100 | + * (Mijireh was an offsite gateway which doesn't send an IPN. So when the user returns to EE from |
|
101 | + * Mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status |
|
102 | + * of the payment). Fed a transaction because it's always assumed to be the last payment that |
|
103 | + * |
|
104 | + * @param EE_Transaction $transaction |
|
105 | + * @return EE_Payment |
|
106 | + * @throws EE_Error |
|
107 | + * @throws ReflectionException |
|
108 | + */ |
|
109 | + public function finalize_payment_for(EE_Transaction $transaction): ?EE_Payment |
|
110 | + { |
|
111 | + /** @var RequestInterface $request */ |
|
112 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
113 | + // PayPal standard actually sends the IPN info along with the user when they return to our site |
|
114 | + // so in case the IPN is arriving later, let's try to process an IPN! |
|
115 | + if ($request->getServerParam('REQUEST_METHOD') === 'POST') { |
|
116 | + return $this->handle_ipn($request->postParams(), $transaction); |
|
117 | + } |
|
118 | + return parent::finalize_payment_for($transaction); |
|
119 | + } |
|
120 | 120 | } |
@@ -59,14 +59,14 @@ |
||
59 | 59 | $ee_bot_checkout = array(); |
60 | 60 | add_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false); |
61 | 61 | } |
62 | - if (! isset($ee_bot_checkout[ $ip_address ])) { |
|
63 | - $ee_bot_checkout[ $ip_address ] = array(); |
|
62 | + if ( ! isset($ee_bot_checkout[$ip_address])) { |
|
63 | + $ee_bot_checkout[$ip_address] = array(); |
|
64 | 64 | } |
65 | 65 | $http_referer = esc_attr($request->getServerParam('HTTP_REFERER', 0)); |
66 | - if (! isset($ee_bot_checkout[ $ip_address ][ $http_referer ])) { |
|
67 | - $ee_bot_checkout[ $ip_address ][ $http_referer ] = 0; |
|
66 | + if ( ! isset($ee_bot_checkout[$ip_address][$http_referer])) { |
|
67 | + $ee_bot_checkout[$ip_address][$http_referer] = 0; |
|
68 | 68 | } |
69 | - $ee_bot_checkout[ $ip_address ][ $http_referer ]++; |
|
69 | + $ee_bot_checkout[$ip_address][$http_referer]++; |
|
70 | 70 | update_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout); |
71 | 71 | if (WP_DEBUG) { |
72 | 72 | EE_Error::add_error( |
@@ -26,181 +26,181 @@ |
||
26 | 26 | */ |
27 | 27 | class InvalidCheckoutAccess |
28 | 28 | { |
29 | - /** |
|
30 | - * key used for saving invalid checkout access data to the wp_options table |
|
31 | - */ |
|
32 | - const OPTION_KEY = 'ee_invalid_checkout_access'; |
|
29 | + /** |
|
30 | + * key used for saving invalid checkout access data to the wp_options table |
|
31 | + */ |
|
32 | + const OPTION_KEY = 'ee_invalid_checkout_access'; |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * _block_bots |
|
37 | - * checks that the incoming request has either of the following set: |
|
38 | - * a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector |
|
39 | - * a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN |
|
40 | - * so if you're not coming from the Ticket Selector nor returning for a valid IP... |
|
41 | - * then where you coming from man? |
|
42 | - * |
|
43 | - * @param EE_Checkout $checkout |
|
44 | - * @return bool true if access to registration checkout appears to be invalid |
|
45 | - */ |
|
46 | - public function checkoutAccessIsInvalid(EE_Checkout $checkout) |
|
47 | - { |
|
48 | - if ( |
|
49 | - ! ($checkout->uts || $checkout->reg_url_link) |
|
50 | - && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
51 | - && EE_Config::instance()->registration->track_invalid_checkout_access() |
|
52 | - ) { |
|
53 | - /** @var RequestInterface $request */ |
|
54 | - $request = LoaderFactory::getLoader()->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
55 | - $ip_address = $request->ipAddress(); |
|
56 | - $ee_bot_checkout = get_option(InvalidCheckoutAccess::OPTION_KEY); |
|
57 | - if ($ee_bot_checkout === false) { |
|
58 | - $ee_bot_checkout = array(); |
|
59 | - add_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false); |
|
60 | - } |
|
61 | - if (! isset($ee_bot_checkout[ $ip_address ])) { |
|
62 | - $ee_bot_checkout[ $ip_address ] = array(); |
|
63 | - } |
|
64 | - $http_referer = esc_attr($request->getServerParam('HTTP_REFERER', 0)); |
|
65 | - if (! isset($ee_bot_checkout[ $ip_address ][ $http_referer ])) { |
|
66 | - $ee_bot_checkout[ $ip_address ][ $http_referer ] = 0; |
|
67 | - } |
|
68 | - $ee_bot_checkout[ $ip_address ][ $http_referer ]++; |
|
69 | - update_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout); |
|
70 | - if (WP_DEBUG) { |
|
71 | - EE_Error::add_error( |
|
72 | - esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'), |
|
73 | - __FILE__, |
|
74 | - __FUNCTION__, |
|
75 | - __LINE__ |
|
76 | - ); |
|
77 | - } |
|
78 | - return true; |
|
79 | - } |
|
80 | - return false; |
|
81 | - } |
|
35 | + /** |
|
36 | + * _block_bots |
|
37 | + * checks that the incoming request has either of the following set: |
|
38 | + * a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector |
|
39 | + * a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN |
|
40 | + * so if you're not coming from the Ticket Selector nor returning for a valid IP... |
|
41 | + * then where you coming from man? |
|
42 | + * |
|
43 | + * @param EE_Checkout $checkout |
|
44 | + * @return bool true if access to registration checkout appears to be invalid |
|
45 | + */ |
|
46 | + public function checkoutAccessIsInvalid(EE_Checkout $checkout) |
|
47 | + { |
|
48 | + if ( |
|
49 | + ! ($checkout->uts || $checkout->reg_url_link) |
|
50 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
51 | + && EE_Config::instance()->registration->track_invalid_checkout_access() |
|
52 | + ) { |
|
53 | + /** @var RequestInterface $request */ |
|
54 | + $request = LoaderFactory::getLoader()->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
55 | + $ip_address = $request->ipAddress(); |
|
56 | + $ee_bot_checkout = get_option(InvalidCheckoutAccess::OPTION_KEY); |
|
57 | + if ($ee_bot_checkout === false) { |
|
58 | + $ee_bot_checkout = array(); |
|
59 | + add_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout, '', false); |
|
60 | + } |
|
61 | + if (! isset($ee_bot_checkout[ $ip_address ])) { |
|
62 | + $ee_bot_checkout[ $ip_address ] = array(); |
|
63 | + } |
|
64 | + $http_referer = esc_attr($request->getServerParam('HTTP_REFERER', 0)); |
|
65 | + if (! isset($ee_bot_checkout[ $ip_address ][ $http_referer ])) { |
|
66 | + $ee_bot_checkout[ $ip_address ][ $http_referer ] = 0; |
|
67 | + } |
|
68 | + $ee_bot_checkout[ $ip_address ][ $http_referer ]++; |
|
69 | + update_option(InvalidCheckoutAccess::OPTION_KEY, $ee_bot_checkout); |
|
70 | + if (WP_DEBUG) { |
|
71 | + EE_Error::add_error( |
|
72 | + esc_html__('Direct access to the registration checkout page is not allowed.', 'event_espresso'), |
|
73 | + __FILE__, |
|
74 | + __FUNCTION__, |
|
75 | + __LINE__ |
|
76 | + ); |
|
77 | + } |
|
78 | + return true; |
|
79 | + } |
|
80 | + return false; |
|
81 | + } |
|
82 | 82 | |
83 | 83 | |
84 | - /** |
|
85 | - * _invalid_checkout_access_form |
|
86 | - * |
|
87 | - * @return EE_Form_Section_Proper |
|
88 | - * @throws EE_Error |
|
89 | - */ |
|
90 | - public function getForm() |
|
91 | - { |
|
92 | - return new EE_Form_Section_Proper( |
|
93 | - array( |
|
94 | - 'name' => 'invalid_checkout_access', |
|
95 | - 'html_id' => 'invalid_checkout_access', |
|
96 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
97 | - 'subsections' => array( |
|
98 | - 'invalid_checkout_access_hdr' => new EE_Form_Section_HTML( |
|
99 | - EEH_HTML::h2(esc_html__('Invalid Checkout Access', 'event_espresso')) |
|
100 | - ), |
|
101 | - 'ee_bot_checkout_data' => new EE_Text_Area_Input( |
|
102 | - array( |
|
103 | - 'html_label_text' => esc_html__('Invalid Checkout Data', 'event_espresso'), |
|
104 | - 'default' => var_export( |
|
105 | - get_option(InvalidCheckoutAccess::OPTION_KEY, array()), |
|
106 | - true |
|
107 | - ), |
|
108 | - 'required' => false, |
|
109 | - 'html_help_text' => esc_html__( |
|
110 | - 'Event Espresso blocks any attempt to directly access the registration checkout page, that is NOT from a Ticket Selector or for a return visit for a valid transaction. These are not valid requests accessing your checkout page, so we track the IP addresses, what web page they just came from, and the number of times that they have attempted to access your registration page. This information may help you with protecting your site by other means, such as firewalls, etc, but please note that IP addresses are almost guaranteed to be spoofed by malicious agents.', |
|
111 | - 'event_espresso' |
|
112 | - ), |
|
113 | - ) |
|
114 | - ), |
|
115 | - 'track_invalid_checkout_access' => new EE_Yes_No_Input( |
|
116 | - array( |
|
117 | - 'html_label_text' => esc_html__('Track Invalid Checkout Access?', 'event_espresso'), |
|
118 | - 'html_help_text' => esc_html__( |
|
119 | - 'Controls whether or not invalid attempts to directly access the registration checkout page should be tracked. Setting this to "No" means that the above data will no longer be collected.', |
|
120 | - 'event_espresso' |
|
121 | - ), |
|
122 | - 'default' => EE_Config::instance() |
|
123 | - ->registration |
|
124 | - ->track_invalid_checkout_access(), |
|
125 | - 'display_html_label_text' => false, |
|
126 | - ) |
|
127 | - ), |
|
128 | - 'delete_invalid_checkout_data' => new EE_Yes_No_Input( |
|
129 | - array( |
|
130 | - 'html_label_text' => esc_html__('Reset Invalid Checkout Data', 'event_espresso'), |
|
131 | - 'html_help_text' => esc_html__( |
|
132 | - 'Setting this to "Yes" will delete all existing invalid checkout access data.', |
|
133 | - 'event_espresso' |
|
134 | - ), |
|
135 | - 'default' => false, |
|
136 | - 'display_html_label_text' => false, |
|
137 | - ) |
|
138 | - ), |
|
139 | - ), |
|
140 | - ) |
|
141 | - ); |
|
142 | - } |
|
84 | + /** |
|
85 | + * _invalid_checkout_access_form |
|
86 | + * |
|
87 | + * @return EE_Form_Section_Proper |
|
88 | + * @throws EE_Error |
|
89 | + */ |
|
90 | + public function getForm() |
|
91 | + { |
|
92 | + return new EE_Form_Section_Proper( |
|
93 | + array( |
|
94 | + 'name' => 'invalid_checkout_access', |
|
95 | + 'html_id' => 'invalid_checkout_access', |
|
96 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
97 | + 'subsections' => array( |
|
98 | + 'invalid_checkout_access_hdr' => new EE_Form_Section_HTML( |
|
99 | + EEH_HTML::h2(esc_html__('Invalid Checkout Access', 'event_espresso')) |
|
100 | + ), |
|
101 | + 'ee_bot_checkout_data' => new EE_Text_Area_Input( |
|
102 | + array( |
|
103 | + 'html_label_text' => esc_html__('Invalid Checkout Data', 'event_espresso'), |
|
104 | + 'default' => var_export( |
|
105 | + get_option(InvalidCheckoutAccess::OPTION_KEY, array()), |
|
106 | + true |
|
107 | + ), |
|
108 | + 'required' => false, |
|
109 | + 'html_help_text' => esc_html__( |
|
110 | + 'Event Espresso blocks any attempt to directly access the registration checkout page, that is NOT from a Ticket Selector or for a return visit for a valid transaction. These are not valid requests accessing your checkout page, so we track the IP addresses, what web page they just came from, and the number of times that they have attempted to access your registration page. This information may help you with protecting your site by other means, such as firewalls, etc, but please note that IP addresses are almost guaranteed to be spoofed by malicious agents.', |
|
111 | + 'event_espresso' |
|
112 | + ), |
|
113 | + ) |
|
114 | + ), |
|
115 | + 'track_invalid_checkout_access' => new EE_Yes_No_Input( |
|
116 | + array( |
|
117 | + 'html_label_text' => esc_html__('Track Invalid Checkout Access?', 'event_espresso'), |
|
118 | + 'html_help_text' => esc_html__( |
|
119 | + 'Controls whether or not invalid attempts to directly access the registration checkout page should be tracked. Setting this to "No" means that the above data will no longer be collected.', |
|
120 | + 'event_espresso' |
|
121 | + ), |
|
122 | + 'default' => EE_Config::instance() |
|
123 | + ->registration |
|
124 | + ->track_invalid_checkout_access(), |
|
125 | + 'display_html_label_text' => false, |
|
126 | + ) |
|
127 | + ), |
|
128 | + 'delete_invalid_checkout_data' => new EE_Yes_No_Input( |
|
129 | + array( |
|
130 | + 'html_label_text' => esc_html__('Reset Invalid Checkout Data', 'event_espresso'), |
|
131 | + 'html_help_text' => esc_html__( |
|
132 | + 'Setting this to "Yes" will delete all existing invalid checkout access data.', |
|
133 | + 'event_espresso' |
|
134 | + ), |
|
135 | + 'default' => false, |
|
136 | + 'display_html_label_text' => false, |
|
137 | + ) |
|
138 | + ), |
|
139 | + ), |
|
140 | + ) |
|
141 | + ); |
|
142 | + } |
|
143 | 143 | |
144 | 144 | |
145 | - /** |
|
146 | - * update_invalid_checkout_access_form |
|
147 | - * |
|
148 | - * @param EE_Registration_Config $EE_Registration_Config |
|
149 | - * @return EE_Registration_Config |
|
150 | - * @throws EE_Error |
|
151 | - * @throws ReflectionException |
|
152 | - */ |
|
153 | - public function processForm(EE_Registration_Config $EE_Registration_Config) |
|
154 | - { |
|
155 | - try { |
|
156 | - $invalid_checkout_access_form = $this->getForm(); |
|
157 | - // if not displaying a form, then check for form submission |
|
158 | - if ($invalid_checkout_access_form->was_submitted()) { |
|
159 | - // capture form data |
|
160 | - $invalid_checkout_access_form->receive_form_submission(); |
|
161 | - // validate form data |
|
162 | - if ($invalid_checkout_access_form->is_valid()) { |
|
163 | - // grab validated data from form |
|
164 | - $valid_data = $invalid_checkout_access_form->valid_data(); |
|
165 | - // ensure form inputs we want are set |
|
166 | - if ( |
|
167 | - isset( |
|
168 | - $valid_data['track_invalid_checkout_access'], |
|
169 | - $valid_data['delete_invalid_checkout_data'] |
|
170 | - ) |
|
171 | - ) { |
|
172 | - $EE_Registration_Config->set_track_invalid_checkout_access( |
|
173 | - $valid_data['track_invalid_checkout_access'] |
|
174 | - ); |
|
175 | - // if deleting, then update option with empty array |
|
176 | - if (filter_var($valid_data['delete_invalid_checkout_data'], FILTER_VALIDATE_BOOLEAN)) { |
|
177 | - update_option(InvalidCheckoutAccess::OPTION_KEY, array()); |
|
178 | - } |
|
179 | - } else { |
|
180 | - EE_Error::add_error( |
|
181 | - esc_html__( |
|
182 | - 'Invalid or missing Invalid Checkout Access form data. Please refresh the form and try again.', |
|
183 | - 'event_espresso' |
|
184 | - ), |
|
185 | - __FILE__, |
|
186 | - __FUNCTION__, |
|
187 | - __LINE__ |
|
188 | - ); |
|
189 | - } |
|
190 | - } else { |
|
191 | - if ($invalid_checkout_access_form->submission_error_message() !== '') { |
|
192 | - EE_Error::add_error( |
|
193 | - $invalid_checkout_access_form->submission_error_message(), |
|
194 | - __FILE__, |
|
195 | - __FUNCTION__, |
|
196 | - __LINE__ |
|
197 | - ); |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
201 | - } catch (EE_Error $e) { |
|
202 | - $e->get_error(); |
|
203 | - } |
|
204 | - return $EE_Registration_Config; |
|
205 | - } |
|
145 | + /** |
|
146 | + * update_invalid_checkout_access_form |
|
147 | + * |
|
148 | + * @param EE_Registration_Config $EE_Registration_Config |
|
149 | + * @return EE_Registration_Config |
|
150 | + * @throws EE_Error |
|
151 | + * @throws ReflectionException |
|
152 | + */ |
|
153 | + public function processForm(EE_Registration_Config $EE_Registration_Config) |
|
154 | + { |
|
155 | + try { |
|
156 | + $invalid_checkout_access_form = $this->getForm(); |
|
157 | + // if not displaying a form, then check for form submission |
|
158 | + if ($invalid_checkout_access_form->was_submitted()) { |
|
159 | + // capture form data |
|
160 | + $invalid_checkout_access_form->receive_form_submission(); |
|
161 | + // validate form data |
|
162 | + if ($invalid_checkout_access_form->is_valid()) { |
|
163 | + // grab validated data from form |
|
164 | + $valid_data = $invalid_checkout_access_form->valid_data(); |
|
165 | + // ensure form inputs we want are set |
|
166 | + if ( |
|
167 | + isset( |
|
168 | + $valid_data['track_invalid_checkout_access'], |
|
169 | + $valid_data['delete_invalid_checkout_data'] |
|
170 | + ) |
|
171 | + ) { |
|
172 | + $EE_Registration_Config->set_track_invalid_checkout_access( |
|
173 | + $valid_data['track_invalid_checkout_access'] |
|
174 | + ); |
|
175 | + // if deleting, then update option with empty array |
|
176 | + if (filter_var($valid_data['delete_invalid_checkout_data'], FILTER_VALIDATE_BOOLEAN)) { |
|
177 | + update_option(InvalidCheckoutAccess::OPTION_KEY, array()); |
|
178 | + } |
|
179 | + } else { |
|
180 | + EE_Error::add_error( |
|
181 | + esc_html__( |
|
182 | + 'Invalid or missing Invalid Checkout Access form data. Please refresh the form and try again.', |
|
183 | + 'event_espresso' |
|
184 | + ), |
|
185 | + __FILE__, |
|
186 | + __FUNCTION__, |
|
187 | + __LINE__ |
|
188 | + ); |
|
189 | + } |
|
190 | + } else { |
|
191 | + if ($invalid_checkout_access_form->submission_error_message() !== '') { |
|
192 | + EE_Error::add_error( |
|
193 | + $invalid_checkout_access_form->submission_error_message(), |
|
194 | + __FILE__, |
|
195 | + __FUNCTION__, |
|
196 | + __LINE__ |
|
197 | + ); |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + } catch (EE_Error $e) { |
|
202 | + $e->get_error(); |
|
203 | + } |
|
204 | + return $EE_Registration_Config; |
|
205 | + } |
|
206 | 206 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | <tr class="item"> |
9 | 9 | <td>[LINE_ITEM_NAME][LINE_ITEM_TAXABLE_*]</td> |
10 | 10 | <td colspan="2">[LINE_ITEM_DESCRIPTION] |
11 | - <p class="ticket-note"><?php echo sprintf(esc_html__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), '[TKT_USES_* schema=' . esc_html__('any', 'event_espresso') . ']'); ?></p> |
|
11 | + <p class="ticket-note"><?php echo sprintf(esc_html__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), '[TKT_USES_* schema='.esc_html__('any', 'event_espresso').']'); ?></p> |
|
12 | 12 | </td> |
13 | 13 | <td class="item_c">[LINE_ITEM_QUANTITY]</td> |
14 | 14 | <td class="item_c">[LINE_ITEM_AMOUNT]</td> |