@@ -161,7 +161,7 @@ |
||
161 | 161 | * @param EE_Transaction $transaction |
162 | 162 | * @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved). |
163 | 163 | * By default, searches for approved payments |
164 | - * @return float|false float on success, false on fail |
|
164 | + * @return double float on success, false on fail |
|
165 | 165 | * @throws \EE_Error |
166 | 166 | */ |
167 | 167 | public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Payments |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function instance() { |
44 | 44 | // check if class object is instantiated |
45 | - if ( ! self::$_instance instanceof EE_Transaction_Payments ) { |
|
45 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
46 | 46 | self::$_instance = new self(); |
47 | 47 | } |
48 | 48 | return self::$_instance; |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | * @return bool true if TXN total was updated, false if not |
60 | 60 | * @throws \EE_Error |
61 | 61 | */ |
62 | - public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) { |
|
62 | + public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) { |
|
63 | 63 | $total_line_item = $transaction->total_line_item(); |
64 | - if ( ! $total_line_item instanceof EE_Line_Item ) { |
|
64 | + if ( ! $total_line_item instanceof EE_Line_Item) { |
|
65 | 65 | EE_Error::add_error( |
66 | - sprintf( __( 'The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso' ), $transaction->ID() ), |
|
66 | + sprintf(__('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), $transaction->ID()), |
|
67 | 67 | __FILE__, __FUNCTION__, __LINE__ |
68 | 68 | ); |
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | $new_total = $total_line_item->recalculate_total_including_taxes(); |
72 | - $transaction->set_total( $new_total ); |
|
73 | - if ( $update_txn ) { |
|
72 | + $transaction->set_total($new_total); |
|
73 | + if ($update_txn) { |
|
74 | 74 | return $transaction->save() ? true : false; |
75 | 75 | } |
76 | 76 | return false; |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | * @return boolean whether the TXN was saved |
94 | 94 | * @throws \EE_Error |
95 | 95 | */ |
96 | - public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
96 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) { |
|
97 | 97 | // verify transaction |
98 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
99 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
98 | + if ( ! $transaction instanceof EE_Transaction) { |
|
99 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | // calculate total paid |
103 | - $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
103 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
104 | 104 | // if total paid has changed |
105 | - if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) { |
|
106 | - $transaction->set_paid( $total_paid ); |
|
105 | + if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
|
106 | + $transaction->set_paid($total_paid); |
|
107 | 107 | // maybe update status, and make sure to save transaction if not done already |
108 | - if ( ! $transaction->update_status_based_on_total_paid( $update_txn ) ) { |
|
109 | - if ( $update_txn ) { |
|
108 | + if ( ! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
109 | + if ($update_txn) { |
|
110 | 110 | return $transaction->save() ? true : false; |
111 | 111 | } |
112 | 112 | } else { |
@@ -130,18 +130,18 @@ discard block |
||
130 | 130 | * @return float|false float on success, false on fail |
131 | 131 | * @throws \EE_Error |
132 | 132 | */ |
133 | - public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
133 | + public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) { |
|
134 | 134 | // verify transaction |
135 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
136 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
135 | + if ( ! $transaction instanceof EE_Transaction) { |
|
136 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | // ensure Payment model is loaded |
140 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
140 | + EE_Registry::instance()->load_model('Payment'); |
|
141 | 141 | // calls EEM_Base::sum() |
142 | 142 | return EEM_Payment::instance()->sum( |
143 | 143 | // query params |
144 | - array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )), |
|
144 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
145 | 145 | // field to sum |
146 | 146 | 'PAY_amount' |
147 | 147 | ); |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | * @return boolean |
160 | 160 | * @throws \EE_Error |
161 | 161 | */ |
162 | - public function delete_payment_and_update_transaction( EE_Payment $payment ) { |
|
162 | + public function delete_payment_and_update_transaction(EE_Payment $payment) { |
|
163 | 163 | // verify payment |
164 | - if ( ! $payment instanceof EE_Payment ) { |
|
165 | - EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
164 | + if ( ! $payment instanceof EE_Payment) { |
|
165 | + EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
166 | 166 | return false; |
167 | 167 | } |
168 | - if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) { |
|
168 | + if ( ! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
169 | 169 | return false; |
170 | 170 | } |
171 | - if ( ! $payment->delete() ) { |
|
172 | - EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
171 | + if ( ! $payment->delete()) { |
|
172 | + EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | || $TXN_status === EEM_Transaction::failed_status_code |
181 | 181 | || $payment->amount() === 0 |
182 | 182 | ) { |
183 | - EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) ); |
|
183 | + EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
184 | 184 | return true; |
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | 188 | //if this fails, that just means that the transaction didn't get its status changed and/or updated. |
189 | 189 | //however the payment was still deleted. |
190 | - if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) { |
|
190 | + if ( ! $this->calculate_total_payments_and_update_status($transaction)) { |
|
191 | 191 | |
192 | 192 | EE_Error::add_attention( |
193 | 193 | __( |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * @return bool |
222 | 222 | * @throws \EE_Error |
223 | 223 | */ |
224 | - public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) { |
|
224 | + public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) { |
|
225 | 225 | $save_payment = false; |
226 | - $reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) ); |
|
227 | - $registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params ); |
|
228 | - if ( ! empty( $registration_payments )) { |
|
229 | - foreach ( $registration_payments as $registration_payment ) { |
|
230 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
226 | + $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID())); |
|
227 | + $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
228 | + if ( ! empty($registration_payments)) { |
|
229 | + foreach ($registration_payments as $registration_payment) { |
|
230 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
231 | 231 | $amount_paid = $registration_payment->amount(); |
232 | 232 | $registration = $registration_payment->registration(); |
233 | - if ( $registration instanceof EE_Registration ) { |
|
234 | - $registration->set_paid( $registration->paid() - $amount_paid ); |
|
235 | - if ( $registration->save() ) { |
|
236 | - if ( $registration_payment->delete() ) { |
|
237 | - $registration->_remove_relation_to( $payment, 'Payment' ); |
|
238 | - $payment->_remove_relation_to( $registration, 'Registration' ); |
|
233 | + if ($registration instanceof EE_Registration) { |
|
234 | + $registration->set_paid($registration->paid() - $amount_paid); |
|
235 | + if ($registration->save()) { |
|
236 | + if ($registration_payment->delete()) { |
|
237 | + $registration->_remove_relation_to($payment, 'Payment'); |
|
238 | + $payment->_remove_relation_to($registration, 'Registration'); |
|
239 | 239 | } |
240 | 240 | $save_payment = true; |
241 | 241 | } |
242 | 242 | } else { |
243 | 243 | EE_Error::add_error( |
244 | 244 | sprintf( |
245 | - __( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ), |
|
245 | + __('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'), |
|
246 | 246 | $registration_payment->ID() |
247 | 247 | ), |
248 | 248 | __FILE__, __FUNCTION__, __LINE__ |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | } else { |
253 | 253 | EE_Error::add_error( |
254 | 254 | sprintf( |
255 | - __( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ), |
|
255 | + __('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'), |
|
256 | 256 | $payment->ID() |
257 | 257 | ), |
258 | 258 | __FILE__, __FUNCTION__, __LINE__ |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | } |
263 | 263 | } |
264 | - if ( $save_payment ) { |
|
264 | + if ($save_payment) { |
|
265 | 265 | $payment->save(); |
266 | 266 | } |
267 | 267 | return true; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true) |
286 | 286 | { |
287 | 287 | EE_Error::doing_it_wrong( |
288 | - __CLASS__ . '::' . __FUNCTION__, |
|
288 | + __CLASS__.'::'.__FUNCTION__, |
|
289 | 289 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
290 | 290 | 'EE_Transaction::update_status_based_on_total_paid()'), |
291 | 291 | '4.9.1', |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @deprecated 4.9.12 |
328 | 328 | * @param string $old_txn_status |
329 | 329 | */ |
330 | - public function set_old_txn_status( $old_txn_status ) { |
|
330 | + public function set_old_txn_status($old_txn_status) { |
|
331 | 331 | EE_Error::doing_it_wrong( |
332 | 332 | __METHOD__, |
333 | 333 | esc_html__( |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | '4.9.12' |
338 | 338 | ); |
339 | 339 | // only set the first time |
340 | - if ( $this->_old_txn_status === null ) { |
|
340 | + if ($this->_old_txn_status === null) { |
|
341 | 341 | $this->_old_txn_status = $old_txn_status; |
342 | 342 | } |
343 | 343 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * @deprecated 4.9.12 |
367 | 367 | * @param string $new_txn_status |
368 | 368 | */ |
369 | - public function set_new_txn_status( $new_txn_status ) { |
|
369 | + public function set_new_txn_status($new_txn_status) { |
|
370 | 370 | EE_Error::doing_it_wrong( |
371 | 371 | __METHOD__, |
372 | 372 | esc_html__( |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param int $PAY_ID |
171 | 171 | */ |
172 | 172 | public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) { |
173 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' ); |
|
173 | + do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' ); |
|
174 | 174 | if ( absint( $TXN_ID )) { |
175 | 175 | self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID; |
176 | 176 | add_action( |
@@ -303,7 +303,6 @@ discard block |
||
303 | 303 | |
304 | 304 | /** |
305 | 305 | * finalize_abandoned_transactions |
306 | - |
|
307 | 306 | * loops through the self::$_abandoned_transactions array |
308 | 307 | * and attempts to finalize any TXNs that have not been completed |
309 | 308 | * but have had their sessions expired, most likely due to a user not |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EE_Cron_Tasks |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - if ( ! self::$_instance instanceof EE_Cron_Tasks ) { |
|
31 | + if ( ! self::$_instance instanceof EE_Cron_Tasks) { |
|
32 | 32 | self::$_instance = new self(); |
33 | 33 | } |
34 | 34 | return self::$_instance; |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * @return EE_Cron_Tasks |
42 | 42 | */ |
43 | 43 | private function __construct() { |
44 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
44 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
45 | 45 | // verify that WP Cron is enabled |
46 | - if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && is_admin() ) { |
|
46 | + if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && is_admin()) { |
|
47 | 47 | EE_Error::add_persistent_admin_notice( |
48 | 48 | 'wp_cron_disabled', |
49 | 49 | sprintf( |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | // UPDATE TRANSACTION WITH PAYMENT |
59 | 59 | add_action( |
60 | 60 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2', |
61 | - array( 'EE_Cron_Tasks', 'setup_update_for_transaction_with_payment' ), |
|
61 | + array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'), |
|
62 | 62 | 10, 2 |
63 | 63 | ); |
64 | 64 | // FINALIZE ABANDONED TRANSACTIONS |
65 | 65 | add_action( |
66 | 66 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', |
67 | - array( 'EE_Cron_Tasks', 'check_for_abandoned_transactions' ), |
|
67 | + array('EE_Cron_Tasks', 'check_for_abandoned_transactions'), |
|
68 | 68 | 10, 1 |
69 | 69 | ); |
70 | 70 | // CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA |
71 | 71 | add_action( |
72 | 72 | 'AHEE__EE_Cron_Tasks__clean_up_junk_transactions', |
73 | - array( 'EE_Cron_Tasks', 'clean_out_junk_transactions' ) |
|
73 | + array('EE_Cron_Tasks', 'clean_out_junk_transactions') |
|
74 | 74 | ); |
75 | 75 | // logging |
76 | 76 | add_action( |
77 | 77 | 'AHEE__EE_System__load_core_configuration__complete', |
78 | - array( 'EE_Cron_Tasks', 'log_scheduled_ee_crons' ) |
|
78 | + array('EE_Cron_Tasks', 'log_scheduled_ee_crons') |
|
79 | 79 | ); |
80 | - EE_Registry::instance()->load_lib( 'Messages_Scheduler' ); |
|
80 | + EE_Registry::instance()->load_lib('Messages_Scheduler'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', |
93 | 93 | 'AHEE__EE_Cron_Tasks__clean_up_junk_transactions', |
94 | 94 | ); |
95 | - $crons = get_option( 'cron' ); |
|
96 | - if ( ! is_array( $crons ) ) { |
|
95 | + $crons = get_option('cron'); |
|
96 | + if ( ! is_array($crons)) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | - foreach ( $crons as $timestamp => $cron ) { |
|
100 | - foreach ( $ee_crons as $ee_cron ) { |
|
101 | - if ( isset( $cron[ $ee_cron ] ) ) { |
|
102 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron' ); |
|
103 | - foreach ( $cron[ $ee_cron ] as $ee_cron_details ) { |
|
104 | - if ( ! empty( $ee_cron_details[ 'args' ] )) { |
|
105 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, print_r( $ee_cron_details[ 'args' ], true ), "$ee_cron args" ); |
|
99 | + foreach ($crons as $timestamp => $cron) { |
|
100 | + foreach ($ee_crons as $ee_cron) { |
|
101 | + if (isset($cron[$ee_cron])) { |
|
102 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron'); |
|
103 | + foreach ($cron[$ee_cron] as $ee_cron_details) { |
|
104 | + if ( ! empty($ee_cron_details['args'])) { |
|
105 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, print_r($ee_cron_details['args'], true), "$ee_cron args"); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | $TXN_ID, |
140 | 140 | $PAY_ID |
141 | 141 | ) { |
142 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
142 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
143 | 143 | // validate $TXN_ID and $timestamp |
144 | - $TXN_ID = absint( $TXN_ID ); |
|
145 | - $timestamp = absint( $timestamp ); |
|
146 | - if ( $TXN_ID && $timestamp ) { |
|
144 | + $TXN_ID = absint($TXN_ID); |
|
145 | + $timestamp = absint($timestamp); |
|
146 | + if ($TXN_ID && $timestamp) { |
|
147 | 147 | wp_schedule_single_event( |
148 | 148 | $timestamp, |
149 | 149 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2', |
150 | - array( $TXN_ID, $PAY_ID ) |
|
150 | + array($TXN_ID, $PAY_ID) |
|
151 | 151 | ); |
152 | 152 | } |
153 | 153 | } |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | * @param int $TXN_ID |
170 | 170 | * @param int $PAY_ID |
171 | 171 | */ |
172 | - public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) { |
|
173 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' ); |
|
174 | - if ( absint( $TXN_ID )) { |
|
175 | - self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID; |
|
172 | + public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $PAY_ID = 0) { |
|
173 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID'); |
|
174 | + if (absint($TXN_ID)) { |
|
175 | + self::$_update_transactions_with_payment[$TXN_ID] = $PAY_ID; |
|
176 | 176 | add_action( |
177 | 177 | 'shutdown', |
178 | - array( 'EE_Cron_Tasks', 'update_transaction_with_payment' ), |
|
178 | + array('EE_Cron_Tasks', 'update_transaction_with_payment'), |
|
179 | 179 | 5 |
180 | 180 | ); |
181 | 181 | } |
@@ -194,18 +194,18 @@ discard block |
||
194 | 194 | * @throws \EE_Error |
195 | 195 | */ |
196 | 196 | public static function update_transaction_with_payment() { |
197 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
197 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
198 | 198 | // are there any TXNs that need cleaning up ? |
199 | - if ( ! empty( self::$_update_transactions_with_payment ) ) { |
|
199 | + if ( ! empty(self::$_update_transactions_with_payment)) { |
|
200 | 200 | /** @type EE_Payment_Processor $payment_processor */ |
201 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
201 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
202 | 202 | // set revisit flag for payment processor |
203 | - $payment_processor->set_revisit( false ); |
|
203 | + $payment_processor->set_revisit(false); |
|
204 | 204 | // load EEM_Transaction |
205 | - EE_Registry::instance()->load_model( 'Transaction' ); |
|
206 | - foreach ( self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID ) { |
|
205 | + EE_Registry::instance()->load_model('Transaction'); |
|
206 | + foreach (self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID) { |
|
207 | 207 | // reschedule the cron if we can't hit the db right now |
208 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
208 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
209 | 209 | // reset cron job for updating the TXN |
210 | 210 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
211 | 211 | time() + EE_Cron_Tasks::reschedule_timeout, |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | ); |
215 | 215 | continue; |
216 | 216 | } |
217 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
218 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
217 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
218 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
219 | 219 | // verify transaction |
220 | - if ( $transaction instanceof EE_Transaction && $payment instanceof EE_Payment ) { |
|
220 | + if ($transaction instanceof EE_Transaction && $payment instanceof EE_Payment) { |
|
221 | 221 | // now try to update the TXN with any payments |
222 | - $payment_processor->update_txn_based_on_payment( $transaction, $payment, true, true ); |
|
222 | + $payment_processor->update_txn_based_on_payment($transaction, $payment, true, true); |
|
223 | 223 | } |
224 | - unset( self::$_update_transactions_with_payment[ $TXN_ID ] ); |
|
224 | + unset(self::$_update_transactions_with_payment[$TXN_ID]); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | $TXN_ID |
259 | 259 | ) { |
260 | 260 | // validate $TXN_ID and $timestamp |
261 | - $TXN_ID = absint( $TXN_ID ); |
|
262 | - $timestamp = absint( $timestamp ); |
|
263 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' ); |
|
264 | - if ( $TXN_ID && $timestamp ) { |
|
261 | + $TXN_ID = absint($TXN_ID); |
|
262 | + $timestamp = absint($timestamp); |
|
263 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID'); |
|
264 | + if ($TXN_ID && $timestamp) { |
|
265 | 265 | wp_schedule_single_event( |
266 | 266 | $timestamp, |
267 | 267 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions', |
268 | - array( $TXN_ID ) |
|
268 | + array($TXN_ID) |
|
269 | 269 | ); |
270 | 270 | } |
271 | 271 | } |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @param int $TXN_ID |
289 | 289 | */ |
290 | - public static function check_for_abandoned_transactions( $TXN_ID = 0 ) { |
|
291 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' ); |
|
292 | - if ( absint( $TXN_ID )) { |
|
293 | - self::$_abandoned_transactions[] = $TXN_ID; |
|
290 | + public static function check_for_abandoned_transactions($TXN_ID = 0) { |
|
291 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID'); |
|
292 | + if (absint($TXN_ID)) { |
|
293 | + self::$_abandoned_transactions[] = $TXN_ID; |
|
294 | 294 | add_action( |
295 | 295 | 'shutdown', |
296 | - array( 'EE_Cron_Tasks', 'finalize_abandoned_transactions' ), |
|
296 | + array('EE_Cron_Tasks', 'finalize_abandoned_transactions'), |
|
297 | 297 | 5 |
298 | 298 | ); |
299 | 299 | } |
@@ -312,21 +312,21 @@ discard block |
||
312 | 312 | * @throws \EE_Error |
313 | 313 | */ |
314 | 314 | public static function finalize_abandoned_transactions() { |
315 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__ ); |
|
315 | + do_action('AHEE_log', __CLASS__, __FUNCTION__); |
|
316 | 316 | // are there any TXNs that need cleaning up ? |
317 | - if ( ! empty( self::$_abandoned_transactions ) ) { |
|
317 | + if ( ! empty(self::$_abandoned_transactions)) { |
|
318 | 318 | /** @type EE_Transaction_Processor $transaction_processor */ |
319 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
319 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
320 | 320 | // set revisit flag for txn processor |
321 | - $transaction_processor->set_revisit( false ); |
|
321 | + $transaction_processor->set_revisit(false); |
|
322 | 322 | /** @type EE_Payment_Processor $payment_processor */ |
323 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
323 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
324 | 324 | // load EEM_Transaction |
325 | - EE_Registry::instance()->load_model( 'Transaction' ); |
|
326 | - foreach ( self::$_abandoned_transactions as $TXN_ID ) { |
|
327 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' ); |
|
325 | + EE_Registry::instance()->load_model('Transaction'); |
|
326 | + foreach (self::$_abandoned_transactions as $TXN_ID) { |
|
327 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID'); |
|
328 | 328 | // reschedule the cron if we can't hit the db right now |
329 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
329 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query()) { |
|
330 | 330 | // reset cron job for finalizing the TXN |
331 | 331 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
332 | 332 | time() + EE_Cron_Tasks::reschedule_timeout, |
@@ -334,17 +334,17 @@ discard block |
||
334 | 334 | ); |
335 | 335 | continue; |
336 | 336 | } |
337 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
337 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
338 | 338 | // verify transaction |
339 | - if ( $transaction instanceof EE_Transaction ) { |
|
339 | + if ($transaction instanceof EE_Transaction) { |
|
340 | 340 | // don't finalize the TXN if it has already been completed |
341 | - if ( $transaction->all_reg_steps_completed() === true ) { |
|
341 | + if ($transaction->all_reg_steps_completed() === true) { |
|
342 | 342 | continue; |
343 | 343 | } |
344 | 344 | // let's simulate an IPN here which will trigger any notifications that need to go out |
345 | - $payment_processor->update_txn_based_on_payment( $transaction, $transaction->last_payment(), true, true ); |
|
345 | + $payment_processor->update_txn_based_on_payment($transaction, $transaction->last_payment(), true, true); |
|
346 | 346 | } |
347 | - unset( self::$_abandoned_transactions[ $TXN_ID ] ); |
|
347 | + unset(self::$_abandoned_transactions[$TXN_ID]); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | //when a transaction is initially made, schedule this check. |
361 | 361 | //if it has NO REG data by the time it has expired, forget about it |
362 | 362 | public static function clean_out_junk_transactions() { |
363 | - if( EE_Maintenance_Mode::instance()->models_can_query() ) { |
|
363 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
364 | 364 | EEM_Transaction::instance('')->delete_junk_transactions(); |
365 | 365 | EEM_Registration::instance('')->delete_registrations_with_no_transaction(); |
366 | 366 | EEM_Line_Item::instance('')->delete_line_items_with_no_transaction(); |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | //(all other times it gets resurrected from a wordpress option) |
14 | 14 | $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*'); |
15 | 15 | $class_to_filepath = array(); |
16 | -foreach($stages as $filepath){ |
|
16 | +foreach ($stages as $filepath) { |
|
17 | 17 | $matches = array(); |
18 | - preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches); |
|
18 | + preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
19 | 19 | $class_to_filepath[$matches[1]] = $filepath; |
20 | 20 | } |
21 | 21 | //give addons a chance to autoload their stages too |
22 | -$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath); |
|
22 | +$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath); |
|
23 | 23 | EEH_Autoloader::register_autoloader($class_to_filepath); |
24 | 24 | |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @since 4.6.0 |
36 | 36 | * |
37 | 37 | */ |
38 | -class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{ |
|
38 | +class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base { |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * return EE_DMS_Core_4_8_0 |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function can_migrate_from_version($version_array) { |
64 | 64 | $version_string = $version_array['Core']; |
65 | - if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){ |
|
65 | + if ($version_string <= '4.8.0' && $version_string >= '4.7.0') { |
|
66 | 66 | // echo "$version_string can be migrated from"; |
67 | 67 | return true; |
68 | - }elseif( ! $version_string ){ |
|
68 | + }elseif ( ! $version_string) { |
|
69 | 69 | // echo "no version string provided: $version_string"; |
70 | 70 | //no version string provided... this must be pre 4.3 |
71 | - return false;//changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | - }else{ |
|
71 | + return false; //changed mind. dont want people thinking they should migrate yet because they cant |
|
72 | + } else { |
|
73 | 73 | // echo "$version_string doesnt apply"; |
74 | 74 | return false; |
75 | 75 | } |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | * @return bool |
91 | 91 | */ |
92 | 92 | public function schema_changes_before_migration() { |
93 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
94 | - $now_in_mysql = current_time( 'mysql', true ); |
|
93 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
94 | + $now_in_mysql = current_time('mysql', true); |
|
95 | 95 | |
96 | - require_once( EE_HELPERS . 'EEH_Activation.helper.php' ); |
|
97 | - $table_name='esp_answer'; |
|
98 | - $sql=" ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
96 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
97 | + $table_name = 'esp_answer'; |
|
98 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
99 | 99 | REG_ID int(10) unsigned NOT NULL, |
100 | 100 | QST_ID int(10) unsigned NOT NULL, |
101 | 101 | ANS_value text NOT NULL, |
102 | 102 | PRIMARY KEY (ANS_ID), |
103 | 103 | KEY REG_ID (REG_ID), |
104 | 104 | KEY QST_ID (QST_ID)"; |
105 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
105 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
106 | 106 | |
107 | 107 | $table_name = 'esp_attendee_meta'; |
108 | 108 | $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | CNT_is_EU tinyint(1) DEFAULT '0', |
143 | 143 | CNT_active tinyint(1) DEFAULT '0', |
144 | 144 | PRIMARY KEY (CNT_ISO)"; |
145 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
145 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
146 | 146 | |
147 | 147 | $table_name = 'esp_currency'; |
148 | 148 | $sql = "CUR_code varchar(6) collate utf8_bin NOT NULL, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | CUR_dec_plc varchar(1) collate utf8_bin NOT NULL DEFAULT '2', |
153 | 153 | CUR_active tinyint(1) DEFAULT '0', |
154 | 154 | PRIMARY KEY (CUR_code)"; |
155 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' ); |
|
155 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | $table_name = 'esp_currency_payment_method'; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | KEY EVT_ID (EVT_ID), |
183 | 183 | KEY DTT_is_primary (DTT_is_primary)"; |
184 | 184 | |
185 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
185 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
186 | 186 | |
187 | 187 | $table_name = 'esp_event_meta'; |
188 | 188 | $sql = " |
@@ -201,41 +201,41 @@ discard block |
||
201 | 201 | EVT_donations tinyint(1) NULL, |
202 | 202 | PRIMARY KEY (EVTM_ID), |
203 | 203 | KEY EVT_ID (EVT_ID)"; |
204 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
204 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
205 | 205 | |
206 | 206 | |
207 | 207 | |
208 | - $table_name='esp_event_question_group'; |
|
209 | - $sql="EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
208 | + $table_name = 'esp_event_question_group'; |
|
209 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
210 | 210 | EVT_ID bigint(20) unsigned NOT NULL, |
211 | 211 | QSG_ID int(10) unsigned NOT NULL, |
212 | 212 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
213 | 213 | PRIMARY KEY (EQG_ID), |
214 | 214 | KEY EVT_ID (EVT_ID), |
215 | 215 | KEY QSG_ID (QSG_ID)"; |
216 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
216 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
217 | 217 | |
218 | 218 | |
219 | 219 | |
220 | - $table_name='esp_event_venue'; |
|
221 | - $sql="EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
220 | + $table_name = 'esp_event_venue'; |
|
221 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
222 | 222 | EVT_ID bigint(20) unsigned NOT NULL, |
223 | 223 | VNU_ID bigint(20) unsigned NOT NULL, |
224 | 224 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
225 | 225 | PRIMARY KEY (EVV_ID)"; |
226 | - $this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB'); |
|
226 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
227 | 227 | |
228 | 228 | |
229 | 229 | |
230 | - $table_name='esp_extra_meta'; |
|
231 | - $sql="EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
230 | + $table_name = 'esp_extra_meta'; |
|
231 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
232 | 232 | OBJ_ID int(11) DEFAULT NULL, |
233 | 233 | EXM_type varchar(45) DEFAULT NULL, |
234 | 234 | EXM_key varchar(45) DEFAULT NULL, |
235 | 235 | EXM_value text, |
236 | 236 | PRIMARY KEY (EXM_ID), |
237 | 237 | KEY EXM_type (EXM_type,OBJ_ID,EXM_key)"; |
238 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
238 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
239 | 239 | |
240 | 240 | $table_name = 'esp_extra_join'; |
241 | 241 | $sql = "EXJ_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | KEY second_model (EXJ_second_model_name,EXJ_second_model_id)"; |
249 | 249 | $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
250 | 250 | |
251 | - $table_name='esp_line_item'; |
|
252 | - $sql="LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
251 | + $table_name = 'esp_line_item'; |
|
252 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
253 | 253 | LIN_code varchar(245) NOT NULL DEFAULT '', |
254 | 254 | TXN_ID int(11) DEFAULT NULL, |
255 | 255 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | PRIMARY KEY (LIN_ID), |
269 | 269 | KEY LIN_code (LIN_code(191)), |
270 | 270 | KEY TXN_ID (TXN_ID)"; |
271 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' ); |
|
271 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
272 | 272 | |
273 | 273 | $table_name = 'esp_log'; |
274 | 274 | $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
308 | 308 | PRIMARY KEY (GRP_ID), |
309 | 309 | KEY MTP_user_id (MTP_user_id)"; |
310 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
310 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
311 | 311 | |
312 | 312 | $table_name = 'esp_event_message_template'; |
313 | 313 | $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | PRIMARY KEY (EMT_ID), |
317 | 317 | KEY EVT_ID (EVT_ID), |
318 | 318 | KEY GRP_ID (GRP_ID)"; |
319 | - $this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB'); |
|
319 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
320 | 320 | |
321 | 321 | |
322 | 322 | $table_name = 'esp_payment'; |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | PRIMARY KEY (TTM_ID)"; |
390 | 390 | $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
391 | 391 | |
392 | - $table_name='esp_question'; |
|
393 | - $sql='QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
392 | + $table_name = 'esp_question'; |
|
393 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
394 | 394 | QST_display_text text NOT NULL, |
395 | 395 | QST_admin_label varchar(255) NOT NULL, |
396 | 396 | QST_system varchar(25) NOT NULL DEFAULT "", |
@@ -404,22 +404,22 @@ discard block |
||
404 | 404 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
405 | 405 | PRIMARY KEY (QST_ID), |
406 | 406 | KEY QST_order (QST_order)'; |
407 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
407 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
408 | 408 | |
409 | - $table_name='esp_question_group_question'; |
|
410 | - $sql="QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
409 | + $table_name = 'esp_question_group_question'; |
|
410 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
411 | 411 | QSG_ID int(10) unsigned NOT NULL, |
412 | 412 | QST_ID int(10) unsigned NOT NULL, |
413 | 413 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
414 | 414 | PRIMARY KEY (QGQ_ID), |
415 | 415 | KEY QST_ID (QST_ID), |
416 | 416 | KEY QSG_ID_order (QSG_ID,QGQ_order)"; |
417 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
417 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
418 | 418 | |
419 | 419 | |
420 | 420 | |
421 | - $table_name='esp_question_option'; |
|
422 | - $sql="QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
421 | + $table_name = 'esp_question_option'; |
|
422 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
423 | 423 | QSO_value varchar(255) NOT NULL, |
424 | 424 | QSO_desc text NOT NULL, |
425 | 425 | QST_ID int(10) unsigned NOT NULL, |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | PRIMARY KEY (QSO_ID), |
430 | 430 | KEY QST_ID (QST_ID), |
431 | 431 | KEY QSO_order (QSO_order)"; |
432 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
432 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
433 | 433 | |
434 | 434 | |
435 | 435 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | |
476 | 476 | |
477 | 477 | |
478 | - $table_name='esp_checkin'; |
|
479 | - $sql="CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
478 | + $table_name = 'esp_checkin'; |
|
479 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
480 | 480 | REG_ID int(10) unsigned NOT NULL, |
481 | 481 | DTT_ID int(10) unsigned NOT NULL, |
482 | 482 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | PRC_parent int(10) unsigned DEFAULT 0, |
572 | 572 | PRIMARY KEY (PRC_ID), |
573 | 573 | KEY PRT_ID (PRT_ID)"; |
574 | - $this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB'); |
|
574 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
575 | 575 | |
576 | 576 | $table_name = "esp_price_type"; |
577 | 577 | $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
610 | 610 | PRIMARY KEY (TKT_ID), |
611 | 611 | KEY TKT_start_date (TKT_start_date)"; |
612 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
612 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
613 | 613 | |
614 | 614 | $table_name = 'esp_question_group'; |
615 | - $sql='QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
615 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
616 | 616 | QSG_name varchar(255) NOT NULL, |
617 | 617 | QSG_identifier varchar(100) NOT NULL, |
618 | 618 | QSG_desc text NULL, |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | PRIMARY KEY (QSG_ID), |
626 | 626 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
627 | 627 | KEY QSG_order (QSG_order)'; |
628 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' ); |
|
628 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
629 | 629 | |
630 | 630 | /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
631 | 631 | $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | return $script_4_7_defaults->schema_changes_after_migration(); |
662 | 662 | } |
663 | 663 | |
664 | - public function migration_page_hooks(){ |
|
664 | + public function migration_page_hooks() { |
|
665 | 665 | |
666 | 666 | } |
667 | 667 | |
@@ -675,19 +675,19 @@ discard block |
||
675 | 675 | //CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active |
676 | 676 | //('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0), |
677 | 677 | $newer_countries = array( |
678 | - array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ), |
|
679 | - array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
680 | - array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ), |
|
681 | - array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ), |
|
682 | - array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
683 | - array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ), |
|
684 | - array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ), |
|
685 | - array( 'ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0 ), |
|
686 | - array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ), |
|
687 | - array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ), |
|
688 | - array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ), |
|
689 | - array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ), |
|
690 | - array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ), |
|
678 | + array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0), |
|
679 | + array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
680 | + array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0), |
|
681 | + array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0), |
|
682 | + array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
683 | + array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0), |
|
684 | + array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0), |
|
685 | + array('ME', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0), |
|
686 | + array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0), |
|
687 | + array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0), |
|
688 | + array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0), |
|
689 | + array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0), |
|
690 | + array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0), |
|
691 | 691 | ); |
692 | 692 | global $wpdb; |
693 | 693 | $country_table = $wpdb->prefix."esp_country"; |
@@ -706,14 +706,14 @@ discard block |
||
706 | 706 | "CNT_is_EU" => '%d', |
707 | 707 | "CNT_active" => '%d', |
708 | 708 | ); |
709 | - if ( EEH_Activation::table_exists( $country_table ) ) { |
|
710 | - foreach( $newer_countries as $country ) { |
|
711 | - $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ; |
|
709 | + if (EEH_Activation::table_exists($country_table)) { |
|
710 | + foreach ($newer_countries as $country) { |
|
711 | + $SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1"; |
|
712 | 712 | $countries = $wpdb->get_var($SQL); |
713 | - if ( ! $countries ) { |
|
713 | + if ( ! $countries) { |
|
714 | 714 | |
715 | - $wpdb->insert( $country_table, |
|
716 | - array_combine( array_keys( $country_format), $country ), |
|
715 | + $wpdb->insert($country_table, |
|
716 | + array_combine(array_keys($country_format), $country), |
|
717 | 717 | $country_format |
718 | 718 | ); |
719 | 719 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | // CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active |
732 | 732 | //( 'EUR', 'Euro', 'Euros', '€', 2,1), |
733 | 733 | $newer_currencies = array( |
734 | - array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ), |
|
734 | + array('RSD', 'Dinar', 'Dinars', '', 3, 1), |
|
735 | 735 | ); |
736 | 736 | global $wpdb; |
737 | 737 | $currency_table = $wpdb->prefix."esp_currency"; |
@@ -743,14 +743,14 @@ discard block |
||
743 | 743 | "CUR_dec_plc" => '%d', |
744 | 744 | "CUR_active" => '%d', |
745 | 745 | ); |
746 | - if ( EEH_Activation::table_exists( $currency_table ) ) { |
|
747 | - foreach( $newer_currencies as $currency ) { |
|
748 | - $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ; |
|
746 | + if (EEH_Activation::table_exists($currency_table)) { |
|
747 | + foreach ($newer_currencies as $currency) { |
|
748 | + $SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1"; |
|
749 | 749 | $countries = $wpdb->get_var($SQL); |
750 | - if ( ! $countries ) { |
|
750 | + if ( ! $countries) { |
|
751 | 751 | |
752 | - $wpdb->insert( $currency_table, |
|
753 | - array_combine( array_keys( $currency_format), $currency ), |
|
752 | + $wpdb->insert($currency_table, |
|
753 | + array_combine(array_keys($currency_format), $currency), |
|
754 | 754 | $currency_format |
755 | 755 | ); |
756 | 756 | } |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | * which should just be a temporary issue for folks who installed 4.8.0-4.8.5; |
763 | 763 | * we should be able to stop doing this in 4.9 |
764 | 764 | */ |
765 | - public function fix_non_default_taxes(){ |
|
765 | + public function fix_non_default_taxes() { |
|
766 | 766 | global $wpdb; |
767 | - $query = $wpdb->prepare( "UPDATE |
|
767 | + $query = $wpdb->prepare("UPDATE |
|
768 | 768 | {$wpdb->prefix}esp_price p INNER JOIN |
769 | 769 | {$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID |
770 | 770 | SET |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | WHERE |
773 | 773 | p.PRC_is_default = 0 AND |
774 | 774 | pt.PBT_ID = %d |
775 | - ", EEM_Price_Type::base_type_tax ); |
|
776 | - $wpdb->query( $query ); |
|
775 | + ", EEM_Price_Type::base_type_tax); |
|
776 | + $wpdb->query($query); |
|
777 | 777 | } |
778 | 778 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | protected function _init_props() { |
40 | - $this->label = esc_html__( 'Recipient Details Shortcodes', 'event_espresso' ); |
|
41 | - $this->description = esc_html__( 'All shortcodes specific to recipient registration data', 'event_espresso' ); |
|
40 | + $this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso'); |
|
41 | + $this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso'); |
|
42 | 42 | $this->_shortcodes = array( |
43 | - '[RECIPIENT_FNAME]' => esc_html__( 'Parses to the first name of the recipient for the message.', 'event_espresso' ), |
|
44 | - '[RECIPIENT_LNAME]' => esc_html__( 'Parses to the last name of the recipient for the message.', 'event_espresso' ), |
|
45 | - '[RECIPIENT_EMAIL]' => esc_html__( 'Parses to the email address of the recipient for the message.', 'event_espresso' ), |
|
46 | - '[RECIPIENT_REGISTRATION_ID]' => esc_html__( 'Parses to the registration ID of the recipient for the message.', 'event_espresso' ), |
|
47 | - '[RECIPIENT_REGISTRATION_CODE]' => esc_html__( 'Parses to the registration code of the recipient for the message.', 'event_espresso' ), |
|
48 | - '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( 'Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso' ), |
|
49 | - '[RECIPIENT_PHONE_NUMBER]' => esc_html__( 'The Phone Number for the recipient of the message.', 'event_espresso' ), |
|
50 | - '[RECIPIENT_ADDRESS]' => esc_html__( 'The Address for the recipient of the message.', 'event_espresso' ), |
|
51 | - '[RECIPIENT_ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the recipient of the message.', 'event_espresso' ), |
|
52 | - '[RECIPIENT_CITY]' => esc_html__( 'The city for the recipient of the message.', 'event_espresso' ), |
|
53 | - '[RECIPIENT_ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso' ), |
|
54 | - '[RECIPIENT_ADDRESS_STATE]' => esc_html__( 'The state/province for the recipient of the message.', 'event_espresso' ), |
|
55 | - '[RECIPIENT_COUNTRY]' => esc_html__( 'The country for the recipient of the message.', 'event_espresso' ), |
|
56 | - '[RECIPIENT_ANSWER_*]' => esc_html__( 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ), |
|
57 | - '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso' ) |
|
43 | + '[RECIPIENT_FNAME]' => esc_html__('Parses to the first name of the recipient for the message.', 'event_espresso'), |
|
44 | + '[RECIPIENT_LNAME]' => esc_html__('Parses to the last name of the recipient for the message.', 'event_espresso'), |
|
45 | + '[RECIPIENT_EMAIL]' => esc_html__('Parses to the email address of the recipient for the message.', 'event_espresso'), |
|
46 | + '[RECIPIENT_REGISTRATION_ID]' => esc_html__('Parses to the registration ID of the recipient for the message.', 'event_espresso'), |
|
47 | + '[RECIPIENT_REGISTRATION_CODE]' => esc_html__('Parses to the registration code of the recipient for the message.', 'event_espresso'), |
|
48 | + '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__('Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso'), |
|
49 | + '[RECIPIENT_PHONE_NUMBER]' => esc_html__('The Phone Number for the recipient of the message.', 'event_espresso'), |
|
50 | + '[RECIPIENT_ADDRESS]' => esc_html__('The Address for the recipient of the message.', 'event_espresso'), |
|
51 | + '[RECIPIENT_ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'), |
|
52 | + '[RECIPIENT_CITY]' => esc_html__('The city for the recipient of the message.', 'event_espresso'), |
|
53 | + '[RECIPIENT_ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'), |
|
54 | + '[RECIPIENT_ADDRESS_STATE]' => esc_html__('The state/province for the recipient of the message.', 'event_espresso'), |
|
55 | + '[RECIPIENT_COUNTRY]' => esc_html__('The country for the recipient of the message.', 'event_espresso'), |
|
56 | + '[RECIPIENT_ANSWER_*]' => esc_html__('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso'), |
|
57 | + '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__('If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso') |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
@@ -65,36 +65,35 @@ discard block |
||
65 | 65 | * @param string $shortcode the shortcode to be parsed. |
66 | 66 | * @return string parsed shortcode |
67 | 67 | */ |
68 | - protected function _parser( $shortcode ) { |
|
68 | + protected function _parser($shortcode) { |
|
69 | 69 | |
70 | 70 | //make sure we end up with a copy of the EE_Messages_Addressee object |
71 | 71 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
72 | 72 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
73 | - && is_array( $this->_data ) |
|
74 | - && isset( $this->_data['data'] ) |
|
73 | + && is_array($this->_data) |
|
74 | + && isset($this->_data['data']) |
|
75 | 75 | && $this->_data['data'] instanceof EE_Messages_Addressee |
76 | - ? $this->_data['data'] : |
|
77 | - $this->_recipient; |
|
76 | + ? $this->_data['data'] : $this->_recipient; |
|
78 | 77 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
79 | - && ! empty( $this->_extra_data['data'] ) |
|
78 | + && ! empty($this->_extra_data['data']) |
|
80 | 79 | && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
81 | 80 | ? $this->_extra_data['data'] |
82 | 81 | : $this->_recipient; |
83 | 82 | |
84 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) { |
|
83 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) { |
|
85 | 84 | return ''; |
86 | 85 | } |
87 | 86 | |
88 | 87 | $attendee = $this->_recipient->att_obj; |
89 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
88 | + if ( ! $attendee instanceof EE_Attendee) { |
|
90 | 89 | return ''; |
91 | 90 | } |
92 | 91 | |
93 | - $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
94 | - ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
92 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) |
|
93 | + ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] |
|
95 | 94 | : array(); |
96 | 95 | |
97 | - switch ( $shortcode ) { |
|
96 | + switch ($shortcode) { |
|
98 | 97 | case '[RECIPIENT_FNAME]' : |
99 | 98 | return $attendee->fname(); |
100 | 99 | break; |
@@ -108,21 +107,21 @@ discard block |
||
108 | 107 | break; |
109 | 108 | |
110 | 109 | case '[RECIPIENT_REGISTRATION_ID]' : |
111 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
110 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
112 | 111 | return ''; |
113 | 112 | } |
114 | 113 | return $this->_get_reg_id(); |
115 | 114 | break; |
116 | 115 | |
117 | 116 | case '[RECIPIENT_REGISTRATION_CODE]' : |
118 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
117 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
119 | 118 | return ''; |
120 | 119 | } |
121 | 120 | return $this->_get_reg_code(); |
122 | 121 | break; |
123 | 122 | |
124 | 123 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
125 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
124 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
126 | 125 | return ''; |
127 | 126 | } |
128 | 127 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
@@ -164,23 +163,23 @@ discard block |
||
164 | 163 | break; |
165 | 164 | } |
166 | 165 | |
167 | - if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) { |
|
168 | - $shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode ); |
|
169 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
166 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
167 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
168 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
170 | 169 | |
171 | 170 | |
172 | 171 | //now let's figure out what question has this text |
173 | - if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
172 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
174 | 173 | return ''; |
175 | 174 | } |
176 | 175 | |
177 | - foreach ( $this->_recipient->questions as $ansid => $question ) { |
|
176 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
178 | 177 | if ( |
179 | 178 | $question instanceof EE_Question |
180 | 179 | && $question->display_text() == $shortcode |
181 | - && isset( $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ] ) |
|
180 | + && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]) |
|
182 | 181 | ) { |
183 | - return $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
182 | + return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
184 | 183 | } |
185 | 184 | } |
186 | 185 | } |
@@ -211,53 +210,53 @@ discard block |
||
211 | 210 | protected function _get_reg_code() { |
212 | 211 | |
213 | 212 | //if only one related registration for the recipient then just return that reg code. |
214 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
213 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
215 | 214 | return $this->_recipient->reg_obj->reg_code(); |
216 | 215 | } |
217 | 216 | |
218 | 217 | //k more than one registration so let's see if we can get specific to context |
219 | 218 | //are we parsing event_list? |
220 | - if ( $this->_data instanceof EE_Event ) { |
|
219 | + if ($this->_data instanceof EE_Event) { |
|
221 | 220 | $reg_code = array(); |
222 | 221 | //loop through registrations for recipient and see if there is a match for this event |
223 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
224 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
222 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
223 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
225 | 224 | $reg_code[] = $reg->reg_code(); |
226 | 225 | } |
227 | 226 | } |
228 | - return implode( ', ', $reg_code ); |
|
227 | + return implode(', ', $reg_code); |
|
229 | 228 | } |
230 | 229 | |
231 | 230 | //are we parsing ticket list? |
232 | - if ( $this->_data instanceof EE_Ticket ) { |
|
231 | + if ($this->_data instanceof EE_Ticket) { |
|
233 | 232 | $reg_code = array(); |
234 | 233 | //loop through each registration for recipient and see if there is a match for this ticket |
235 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
236 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
234 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
235 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
237 | 236 | $reg_code = $reg->reg_code(); |
238 | 237 | } |
239 | 238 | } |
240 | - return implode( ', ', $reg_code ); |
|
239 | + return implode(', ', $reg_code); |
|
241 | 240 | } |
242 | 241 | |
243 | 242 | //do we have a specific reg_obj? Let's use it |
244 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
243 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
245 | 244 | return $this->_data->reg_obj->reg_code(); |
246 | 245 | } |
247 | 246 | |
248 | 247 | //do we have a specific reg_obj? Let's use it |
249 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
248 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
250 | 249 | return $this->_data->reg_obj->reg_code(); |
251 | 250 | } |
252 | 251 | |
253 | 252 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
254 | 253 | $reg_code = array(); |
255 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
256 | - if ( $reg instanceof EE_Registration ) { |
|
254 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
255 | + if ($reg instanceof EE_Registration) { |
|
257 | 256 | $reg_code[] = $reg->reg_code(); |
258 | 257 | } |
259 | 258 | } |
260 | - return implode( ', ', $reg_code ); |
|
259 | + return implode(', ', $reg_code); |
|
261 | 260 | } |
262 | 261 | |
263 | 262 | |
@@ -270,48 +269,48 @@ discard block |
||
270 | 269 | protected function _get_reg_id() { |
271 | 270 | |
272 | 271 | //if only one related registration for the recipient then just return that reg code. |
273 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
272 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
274 | 273 | return $this->_recipient->reg_obj->ID(); |
275 | 274 | } |
276 | 275 | |
277 | 276 | //k more than one registration so let's see if we can get specific to context |
278 | 277 | //are we parsing event_list? |
279 | - if ( $this->_data instanceof EE_Event ) { |
|
278 | + if ($this->_data instanceof EE_Event) { |
|
280 | 279 | $registration_ids = array(); |
281 | 280 | //loop through registrations for recipient and see if there is a match for this event |
282 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
283 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
281 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
282 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
284 | 283 | $registration_ids[] = $reg->ID(); |
285 | 284 | } |
286 | 285 | } |
287 | - return implode( ', ', $registration_ids ); |
|
286 | + return implode(', ', $registration_ids); |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | //are we parsing ticket list? |
291 | - if ( $this->_data instanceof EE_Ticket ) { |
|
290 | + if ($this->_data instanceof EE_Ticket) { |
|
292 | 291 | $registration_ids = array(); |
293 | 292 | //loop through each registration for recipient and see if there is a match for this ticket |
294 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
295 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
293 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
294 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
296 | 295 | $registration_ids = $reg->ID(); |
297 | 296 | } |
298 | 297 | } |
299 | - return implode( ', ', $registration_ids ); |
|
298 | + return implode(', ', $registration_ids); |
|
300 | 299 | } |
301 | 300 | |
302 | 301 | //do we have a specific reg_obj? Let's use it |
303 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
302 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
304 | 303 | return $this->_data->reg_obj->ID(); |
305 | 304 | } |
306 | 305 | |
307 | 306 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
308 | 307 | $registration_ids = array(); |
309 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
310 | - if ( $reg instanceof EE_Registration ) { |
|
308 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
309 | + if ($reg instanceof EE_Registration) { |
|
311 | 310 | $registration_ids[] = $reg->ID(); |
312 | 311 | } |
313 | 312 | } |
314 | - return implode( ', ', $registration_ids ); |
|
313 | + return implode(', ', $registration_ids); |
|
315 | 314 | } |
316 | 315 | |
317 | 316 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _init_props() { |
52 | - $this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' ); |
|
53 | - $this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' ); |
|
52 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
53 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
54 | 54 | $this->_shortcodes = array( |
55 | - '[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ), |
|
56 | - '[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ), |
|
57 | - '[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ), |
|
58 | - '[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ), |
|
59 | - '[REGISTRATION_ID]' => esc_html__( 'Unique Registration ID for the registration', 'event_espresso' ), |
|
60 | - '[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ), |
|
61 | - '[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ), |
|
62 | - '[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ), |
|
63 | - '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ), |
|
64 | - '[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ), |
|
65 | - '[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ), |
|
66 | - '[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ), |
|
67 | - '[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ), |
|
68 | - '[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ), |
|
69 | - '[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ), |
|
70 | - '[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ), |
|
71 | - '[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' ) |
|
55 | + '[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'), |
|
56 | + '[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'), |
|
57 | + '[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'), |
|
58 | + '[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'), |
|
59 | + '[REGISTRATION_ID]' => esc_html__('Unique Registration ID for the registration', 'event_espresso'), |
|
60 | + '[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'), |
|
61 | + '[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'), |
|
62 | + '[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'), |
|
63 | + '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'), |
|
64 | + '[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'), |
|
65 | + '[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'), |
|
66 | + '[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'), |
|
67 | + '[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'), |
|
68 | + '[CITY]' => esc_html__('The city for the registration.', 'event_espresso'), |
|
69 | + '[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'), |
|
70 | + '[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'), |
|
71 | + '[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return string |
83 | 83 | * @throws \EE_Error |
84 | 84 | */ |
85 | - protected function _parser( $shortcode ) { |
|
85 | + protected function _parser($shortcode) { |
|
86 | 86 | |
87 | 87 | |
88 | - $this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
88 | + $this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
89 | 89 | ? $this->_extra_data['data'] |
90 | 90 | : null; |
91 | 91 | |
@@ -94,34 +94,34 @@ discard block |
||
94 | 94 | ? null |
95 | 95 | : $this->_data; |
96 | 96 | |
97 | - if ( ! $registration instanceof EE_Registration ) { |
|
97 | + if ( ! $registration instanceof EE_Registration) { |
|
98 | 98 | //let's attempt to get the txn_id for the error message. |
99 | - $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction |
|
99 | + $txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction |
|
100 | 100 | ? $this->_xtra->txn->ID() |
101 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
102 | - $msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' ); |
|
101 | + : esc_html__('Unknown', 'event_espresso'); |
|
102 | + $msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso'); |
|
103 | 103 | $dev_msg = sprintf( |
104 | - esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ), |
|
104 | + esc_html__('The transaction ID for this request is: %s', 'event_espresso'), |
|
105 | 105 | $txn_id |
106 | 106 | ); |
107 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
107 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //attendee obj for this registration |
111 | - $attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] ) |
|
112 | - ? $this->_xtra->registrations[ $registration->ID() ]['att_obj'] |
|
113 | - : null ; |
|
111 | + $attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) |
|
112 | + ? $this->_xtra->registrations[$registration->ID()]['att_obj'] |
|
113 | + : null; |
|
114 | 114 | |
115 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
116 | - $msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' ); |
|
115 | + if ( ! $attendee instanceof EE_Attendee) { |
|
116 | + $msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso'); |
|
117 | 117 | $dev_msg = sprintf( |
118 | - esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ), |
|
118 | + esc_html__('The registration ID for this request is: %s', 'event_espresso'), |
|
119 | 119 | $registration->ID() |
120 | 120 | ); |
121 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
121 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
122 | 122 | } |
123 | 123 | |
124 | - switch ( $shortcode ) { |
|
124 | + switch ($shortcode) { |
|
125 | 125 | |
126 | 126 | case '[FNAME]' : |
127 | 127 | return $attendee->fname(); |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | protected static $_event = NULL; |
36 | 36 | |
37 | 37 | /** |
38 | - * array of datetimes and the spaces available for them |
|
39 | - * |
|
40 | - * @access private |
|
41 | - * @var array |
|
42 | - */ |
|
38 | + * array of datetimes and the spaces available for them |
|
39 | + * |
|
40 | + * @access private |
|
41 | + * @var array |
|
42 | + */ |
|
43 | 43 | private static $_available_spaces = array(); |
44 | 44 | |
45 | 45 | /** |
46 | - * max attendees that can register for event at one time |
|
47 | - * |
|
48 | - * @access private |
|
49 | - * @var int |
|
50 | - */ |
|
46 | + * max attendees that can register for event at one time |
|
47 | + * |
|
48 | + * @access private |
|
49 | + * @var int |
|
50 | + */ |
|
51 | 51 | private static $_max_atndz = EE_INF; |
52 | 52 | |
53 | 53 | |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | return $permalink_string; |
217 | 217 | } |
218 | 218 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
219 | - . __( 'Embed', 'event_espresso' ) |
|
220 | - . '</a> '; |
|
219 | + . __( 'Embed', 'event_espresso' ) |
|
220 | + . '</a> '; |
|
221 | 221 | $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
222 | 222 | $iframe_string = esc_html( |
223 | 223 | '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return array|boolean |
528 | 528 | */ |
529 | 529 | public function process_ticket_selections() { |
530 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
530 | + do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
531 | 531 | // check nonce |
532 | 532 | if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
533 | 533 | EE_Error::add_error( |
@@ -921,11 +921,11 @@ discard block |
||
921 | 921 | |
922 | 922 | |
923 | 923 | /** |
924 | - * load js |
|
925 | - * |
|
926 | - * @access public |
|
927 | - * @return void |
|
928 | - */ |
|
924 | + * load js |
|
925 | + * |
|
926 | + * @access public |
|
927 | + * @return void |
|
928 | + */ |
|
929 | 929 | public static function load_tckt_slctr_assets() { |
930 | 930 | // add some style |
931 | 931 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | * @return EED_Ticket_Selector |
66 | 66 | */ |
67 | 67 | public static function instance() { |
68 | - return parent::get_instance( __CLASS__ ); |
|
68 | + return parent::get_instance(__CLASS__); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | - protected function set_config(){ |
|
74 | - $this->set_config_section( 'template_settings' ); |
|
75 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
76 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
73 | + protected function set_config() { |
|
74 | + $this->set_config_section('template_settings'); |
|
75 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
76 | + $this->set_config_name('EED_Ticket_Selector'); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public static function set_hooks() { |
90 | 90 | // routing |
91 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
92 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
93 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
91 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
92 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
93 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
94 | 94 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
95 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
95 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
96 | 96 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
97 | 97 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
98 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
98 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | * @return void |
108 | 108 | */ |
109 | 109 | public static function set_hooks_admin() { |
110 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
110 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
111 | 111 | //add button for iframe code to event editor. |
112 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
113 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
112 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
113 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | * @return void |
123 | 123 | */ |
124 | 124 | public static function set_definitions() { |
125 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
126 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
125 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
126 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
127 | 127 | |
128 | 128 | //if config is not set, initialize |
129 | 129 | //If config is not set, set it. |
130 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
130 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
131 | 131 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
132 | 132 | } |
133 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
133 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param object $WP |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - public function run( $WP ) {} |
|
144 | + public function run($WP) {} |
|
145 | 145 | |
146 | 146 | |
147 | 147 | /** |
@@ -153,23 +153,23 @@ discard block |
||
153 | 153 | public function ticket_selector_iframe() { |
154 | 154 | self::$_in_iframe = true; |
155 | 155 | /** @type EEM_Event $EEM_Event */ |
156 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
156 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
157 | 157 | $event = $EEM_Event->get_one_by_ID( |
158 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
158 | + EE_Registry::instance()->REQ->get('event', 0) |
|
159 | 159 | ); |
160 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
161 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
160 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
161 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
162 | 162 | $template_args['css'] = apply_filters( |
163 | 163 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
164 | 164 | array( |
165 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
166 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
167 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
168 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
165 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
166 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
167 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
168 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
169 | 169 | ) |
170 | 170 | ); |
171 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
172 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
171 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
172 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
173 | 173 | $template_args['eei18n'] = apply_filters( |
174 | 174 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
175 | 175 | EE_Registry::localize_i18n_js_strings() |
@@ -177,18 +177,18 @@ discard block |
||
177 | 177 | $template_args['js'] = apply_filters( |
178 | 178 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
179 | 179 | array( |
180 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
181 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
182 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
180 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
181 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
182 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
183 | 183 | ) |
184 | 184 | ); |
185 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
186 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
185 | + $template_args['notices'] = EEH_Template::display_template( |
|
186 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
187 | 187 | array(), |
188 | 188 | true |
189 | 189 | ); |
190 | 190 | EEH_Template::display_template( |
191 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
191 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
192 | 192 | $template_args |
193 | 193 | ); |
194 | 194 | exit; |
@@ -207,25 +207,25 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return string The new html string for the permalink area. |
209 | 209 | */ |
210 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
210 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
211 | 211 | //make sure this is ONLY when editing and the event id has been set. |
212 | - if ( ! empty( $id ) ) { |
|
213 | - $post = get_post( $id ); |
|
212 | + if ( ! empty($id)) { |
|
213 | + $post = get_post($id); |
|
214 | 214 | //if NOT event then let's get out. |
215 | - if ( $post->post_type !== 'espresso_events' ) { |
|
215 | + if ($post->post_type !== 'espresso_events') { |
|
216 | 216 | return $permalink_string; |
217 | 217 | } |
218 | 218 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
219 | - . __( 'Embed', 'event_espresso' ) |
|
219 | + . __('Embed', 'event_espresso') |
|
220 | 220 | . '</a> '; |
221 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
221 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
222 | 222 | $iframe_string = esc_html( |
223 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
223 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
224 | 224 | ); |
225 | 225 | $permalink_string .= ' |
226 | 226 | <div id="js-ts-iframe" style="display:none"> |
227 | 227 | <div style="width:100%; height: 500px;"> |
228 | - ' . $iframe_string . ' |
|
228 | + ' . $iframe_string.' |
|
229 | 229 | </div> |
230 | 230 | </div>'; |
231 | 231 | } |
@@ -244,22 +244,22 @@ discard block |
||
244 | 244 | * @param mixed $event |
245 | 245 | * @return bool |
246 | 246 | */ |
247 | - protected static function set_event( $event = null ) { |
|
248 | - if( $event === null ) { |
|
247 | + protected static function set_event($event = null) { |
|
248 | + if ($event === null) { |
|
249 | 249 | global $post; |
250 | 250 | $event = $post; |
251 | 251 | } |
252 | - if ( $event instanceof EE_Event ) { |
|
252 | + if ($event instanceof EE_Event) { |
|
253 | 253 | self::$_event = $event; |
254 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
254 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
255 | 255 | self::$_event = $event->EE_Event; |
256 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
257 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
256 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
257 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
258 | 258 | self::$_event = $event->EE_Event; |
259 | 259 | } else { |
260 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
261 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
262 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
260 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
261 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
262 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | return true; |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | * @param bool $view_details |
279 | 279 | * @return string |
280 | 280 | */ |
281 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
281 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
282 | 282 | // reset filter for displaying submit button |
283 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
283 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
284 | 284 | // poke and prod incoming event till it tells us what it is |
285 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
285 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | && ( |
294 | 294 | ! self::$_event->display_ticket_selector() |
295 | 295 | || $view_details |
296 | - || post_password_required( $event_post ) |
|
296 | + || post_password_required($event_post) |
|
297 | 297 | || ( |
298 | 298 | $_event_active_status != EE_Datetime::active |
299 | 299 | && $_event_active_status != EE_Datetime::upcoming |
@@ -311,34 +311,34 @@ discard block |
||
311 | 311 | $template_args = array(); |
312 | 312 | $template_args['event_status'] = $_event_active_status; |
313 | 313 | |
314 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
315 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
314 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
315 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
316 | 316 | |
317 | 317 | $template_args['EVT_ID'] = self::$_event->ID(); |
318 | 318 | $template_args['event'] = self::$_event; |
319 | 319 | |
320 | 320 | // is the event expired ? |
321 | 321 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
322 | - if ( $template_args['event_is_expired'] ) { |
|
323 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
322 | + if ($template_args['event_is_expired']) { |
|
323 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | $ticket_query_args = array( |
327 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
328 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
327 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
328 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
329 | 329 | ); |
330 | 330 | |
331 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
331 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
332 | 332 | //use the correct applicable time query depending on what version of core is being run. |
333 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
334 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
333 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
334 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // get all tickets for this event ordered by the datetime |
338 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
338 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
339 | 339 | |
340 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
341 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
340 | + if (count($template_args['tickets']) < 1) { |
|
341 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
@@ -347,36 +347,36 @@ discard block |
||
347 | 347 | self::$_event->additional_limit() |
348 | 348 | ); |
349 | 349 | $template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz; |
350 | - if ( $template_args['max_atndz'] < 1 ) { |
|
351 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
352 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
353 | - $sales_closed_msg .= sprintf( |
|
354 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
350 | + if ($template_args['max_atndz'] < 1) { |
|
351 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
352 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
353 | + $sales_closed_msg .= sprintf( |
|
354 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
355 | 355 | '<div class="ee-attention" style="text-align: left;"><b>', |
356 | 356 | '</b><br />', |
357 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
357 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
358 | 358 | '</a></span></div>' |
359 | 359 | ); |
360 | 360 | } |
361 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
361 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
362 | 362 | } |
363 | 363 | |
364 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
365 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
364 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
365 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
366 | 366 | |
367 | 367 | // redirecting to another site for registration ?? |
368 | 368 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
369 | 369 | // set up the form (but not for the admin) |
370 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
370 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
371 | 371 | // if not redirecting to another site for registration |
372 | - if ( ! $external_url ) { |
|
372 | + if ( ! $external_url) { |
|
373 | 373 | // then display the ticket selector |
374 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
374 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
375 | 375 | } else { |
376 | 376 | // if not we still need to trigger the display of the submit button |
377 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
377 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
378 | 378 | //display notice to admin that registration is external |
379 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
379 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
380 | 380 | } |
381 | 381 | // submit button and form close tag |
382 | 382 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -396,25 +396,25 @@ discard block |
||
396 | 396 | * @param string $external_url |
397 | 397 | * @return string |
398 | 398 | */ |
399 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
399 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
400 | 400 | // if redirecting, we don't need any anything else |
401 | - if ( $external_url ) { |
|
402 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
403 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
404 | - foreach ( $query_args as $query_arg => $value ) { |
|
405 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
401 | + if ($external_url) { |
|
402 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
403 | + $query_args = EEH_URL::get_query_string($external_url); |
|
404 | + foreach ($query_args as $query_arg => $value) { |
|
405 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
406 | 406 | } |
407 | 407 | return $html; |
408 | 408 | } |
409 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
410 | - if ( ! $checkout_url ) { |
|
411 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
409 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
410 | + if ( ! $checkout_url) { |
|
411 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
412 | 412 | } |
413 | 413 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
414 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
415 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
414 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
415 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
416 | 416 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
417 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
417 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
418 | 418 | return $html; |
419 | 419 | } |
420 | 420 | |
@@ -429,18 +429,18 @@ discard block |
||
429 | 429 | * @return string |
430 | 430 | */ |
431 | 431 | public static function display_ticket_selector_submit() { |
432 | - if ( ! is_admin() ) { |
|
433 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
432 | + if ( ! is_admin()) { |
|
433 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
434 | 434 | $btn_text = apply_filters( |
435 | 435 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
436 | - __('Register Now', 'event_espresso' ), |
|
436 | + __('Register Now', 'event_espresso'), |
|
437 | 437 | EED_Ticket_Selector::$_event |
438 | 438 | ); |
439 | 439 | $external_url = EED_Ticket_Selector::$_event->external_url(); |
440 | - $html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"'; |
|
440 | + $html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"'; |
|
441 | 441 | $html .= ' class="ticket-selector-submit-btn '; |
442 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
443 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
442 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
443 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
444 | 444 | $html .= apply_filters( |
445 | 445 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
446 | 446 | '', |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | ); |
449 | 449 | $html .= '<div class="clear"><br/></div></form>'; |
450 | 450 | return $html; |
451 | - } else if ( is_archive() ) { |
|
452 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
451 | + } else if (is_archive()) { |
|
452 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
453 | 453 | } else if ( |
454 | 454 | EED_Ticket_Selector::$_event instanceof EE_Event |
455 | 455 | // if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event) |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | $html = apply_filters( |
462 | 462 | 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', |
463 | 463 | sprintf( |
464 | - __( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ), |
|
464 | + __('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'), |
|
465 | 465 | '<p class="no-ticket-selector-msg important-notice">', |
466 | 466 | EED_Ticket_Selector::$_event->name(), |
467 | 467 | '</p>' |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | * @return string |
504 | 504 | */ |
505 | 505 | public static function display_view_details_btn() { |
506 | - if ( ! self::$_event->get_permalink() ) { |
|
507 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
506 | + if ( ! self::$_event->get_permalink()) { |
|
507 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
508 | 508 | } |
509 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
510 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
511 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
512 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
509 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
510 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
511 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
512 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
513 | 513 | $view_details_btn .= '<div class="clear"><br/></div>'; |
514 | 514 | $view_details_btn .= '</form>'; |
515 | 515 | return $view_details_btn; |
@@ -527,11 +527,11 @@ discard block |
||
527 | 527 | * @return array|boolean |
528 | 528 | */ |
529 | 529 | public function process_ticket_selections() { |
530 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
530 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
531 | 531 | // check nonce |
532 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
532 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
533 | 533 | EE_Error::add_error( |
534 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
534 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
535 | 535 | __FILE__, __FUNCTION__, __LINE__ |
536 | 536 | ); |
537 | 537 | return FALSE; |
@@ -545,16 +545,16 @@ discard block |
||
545 | 545 | |
546 | 546 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
547 | 547 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
548 | - EE_Registry::instance()->load_core( 'Session' ); |
|
548 | + EE_Registry::instance()->load_core('Session'); |
|
549 | 549 | // unless otherwise requested, clear the session |
550 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
551 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
550 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
551 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
552 | 552 | } |
553 | 553 | //d( EE_Registry::instance()->SSN ); |
554 | 554 | |
555 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
555 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
556 | 556 | // do we have an event id? |
557 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
557 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
558 | 558 | // validate/sanitize data |
559 | 559 | $valid = self::_validate_post_data(); |
560 | 560 | |
@@ -564,41 +564,41 @@ discard block |
||
564 | 564 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
565 | 565 | |
566 | 566 | //check total tickets ordered vs max number of attendees that can register |
567 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
567 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
568 | 568 | |
569 | 569 | // ordering too many tickets !!! |
570 | 570 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
571 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
571 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
572 | 572 | // dev only message |
573 | 573 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
574 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
575 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
574 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
575 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
576 | 576 | } else { |
577 | 577 | |
578 | 578 | // all data appears to be valid |
579 | 579 | $tckts_slctd = FALSE; |
580 | 580 | $success = TRUE; |
581 | 581 | // load cart |
582 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
582 | + EE_Registry::instance()->load_core('Cart'); |
|
583 | 583 | |
584 | 584 | // cycle thru the number of data rows sent from the event listing |
585 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
585 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
586 | 586 | // does this row actually contain a ticket quantity? |
587 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
587 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
588 | 588 | // YES we have a ticket quantity |
589 | 589 | $tckts_slctd = TRUE; |
590 | 590 | // d( $valid['ticket_obj'][$x] ); |
591 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
591 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
592 | 592 | // then add ticket to cart |
593 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
593 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
594 | 594 | $success = ! $ticket_added ? FALSE : $success; |
595 | - if ( EE_Error::has_error() ) { |
|
595 | + if (EE_Error::has_error()) { |
|
596 | 596 | break; |
597 | 597 | } |
598 | 598 | } else { |
599 | 599 | // nothing added to cart retrieved |
600 | 600 | EE_Error::add_error( |
601 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
601 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
602 | 602 | __FILE__, __FUNCTION__, __LINE__ |
603 | 603 | ); |
604 | 604 | } |
@@ -607,45 +607,45 @@ discard block |
||
607 | 607 | //d( EE_Registry::instance()->CART ); |
608 | 608 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
609 | 609 | |
610 | - if ( $tckts_slctd ) { |
|
611 | - if ( $success ) { |
|
612 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
610 | + if ($tckts_slctd) { |
|
611 | + if ($success) { |
|
612 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
613 | 613 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
614 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
614 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
615 | 615 | EE_Registry::instance()->SSN->update(); |
616 | 616 | //d( EE_Registry::instance()->CART ); |
617 | 617 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
618 | 618 | // just return TRUE for registrations being made from admin |
619 | - if ( is_admin() ) { |
|
619 | + if (is_admin()) { |
|
620 | 620 | return TRUE; |
621 | 621 | } |
622 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
622 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
623 | 623 | exit(); |
624 | 624 | |
625 | 625 | } else { |
626 | - if ( ! EE_Error::has_error() ) { |
|
626 | + if ( ! EE_Error::has_error()) { |
|
627 | 627 | // nothing added to cart |
628 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
628 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | |
632 | 632 | } else { |
633 | 633 | // no ticket quantities were selected |
634 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
634 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
635 | 635 | } |
636 | 636 | } |
637 | 637 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
638 | 638 | // at this point, just return if registration is being made from admin |
639 | - if ( is_admin() ) { |
|
639 | + if (is_admin()) { |
|
640 | 640 | return FALSE; |
641 | 641 | } |
642 | - if ( $valid['return_url'] ) { |
|
643 | - EE_Error::get_notices( FALSE, TRUE ); |
|
644 | - wp_safe_redirect( $valid['return_url'] ); |
|
642 | + if ($valid['return_url']) { |
|
643 | + EE_Error::get_notices(FALSE, TRUE); |
|
644 | + wp_safe_redirect($valid['return_url']); |
|
645 | 645 | exit(); |
646 | - } elseif ( isset( $event_to_add['id'] )) { |
|
647 | - EE_Error::get_notices( FALSE, TRUE ); |
|
648 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
646 | + } elseif (isset($event_to_add['id'])) { |
|
647 | + EE_Error::get_notices(FALSE, TRUE); |
|
648 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
649 | 649 | exit(); |
650 | 650 | } else { |
651 | 651 | echo EE_Error::get_notices(); |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | } else { |
655 | 655 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
656 | 656 | EE_Error::add_error( |
657 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
657 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
658 | 658 | __FILE__, __FUNCTION__, __LINE__ |
659 | 659 | ); |
660 | 660 | } |
@@ -672,18 +672,18 @@ discard block |
||
672 | 672 | * @return array or FALSE |
673 | 673 | */ |
674 | 674 | private static function _validate_post_data() { |
675 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
675 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
676 | 676 | |
677 | 677 | // start with an empty array() |
678 | 678 | $valid_data = array(); |
679 | 679 | // d( $_POST ); |
680 | 680 | //if event id is valid |
681 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
682 | - if ( $id ) { |
|
681 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
682 | + if ($id) { |
|
683 | 683 | // grab valid id |
684 | 684 | $valid_data['id'] = $id; |
685 | 685 | // grab and sanitize return-url |
686 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
686 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
687 | 687 | // array of other form names |
688 | 688 | $inputs_to_clean = array( |
689 | 689 | 'event_id' => 'tkt-slctr-event-id', |
@@ -696,22 +696,22 @@ discard block |
||
696 | 696 | // let's track the total number of tickets ordered.' |
697 | 697 | $valid_data['total_tickets'] = 0; |
698 | 698 | // cycle through $inputs_to_clean array |
699 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
699 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
700 | 700 | // check for POST data |
701 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
701 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
702 | 702 | // grab value |
703 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
703 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
704 | 704 | switch ($what) { |
705 | 705 | |
706 | 706 | // integers |
707 | 707 | case 'event_id': |
708 | - $valid_data[$what] = absint( $input_value ); |
|
708 | + $valid_data[$what] = absint($input_value); |
|
709 | 709 | // get event via the event id we put in the form |
710 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
710 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
711 | 711 | break; |
712 | 712 | case 'rows': |
713 | 713 | case 'max_atndz': |
714 | - $valid_data[$what] = absint( $input_value ); |
|
714 | + $valid_data[$what] = absint($input_value); |
|
715 | 715 | break; |
716 | 716 | |
717 | 717 | // arrays of integers |
@@ -719,27 +719,27 @@ discard block |
||
719 | 719 | // d( $input_value ); |
720 | 720 | $row_qty = $input_value; |
721 | 721 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
722 | - if( ! is_array( $row_qty )) { |
|
722 | + if ( ! is_array($row_qty)) { |
|
723 | 723 | // get number of rows |
724 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
724 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
725 | 725 | // d( $rows ); |
726 | 726 | // explode ints by the dash |
727 | - $row_qty = explode( '-', $row_qty ); |
|
728 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
729 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
730 | - $row_qty = array( $row => $qty ); |
|
727 | + $row_qty = explode('-', $row_qty); |
|
728 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
729 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
730 | + $row_qty = array($row => $qty); |
|
731 | 731 | // d( $row_qty ); |
732 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
733 | - if ( ! isset( $row_qty[$x] )) { |
|
732 | + for ($x = 1; $x <= $rows; $x++) { |
|
733 | + if ( ! isset($row_qty[$x])) { |
|
734 | 734 | $row_qty[$x] = 0; |
735 | 735 | } |
736 | 736 | } |
737 | 737 | } |
738 | - ksort( $row_qty ); |
|
738 | + ksort($row_qty); |
|
739 | 739 | // d( $row_qty ); |
740 | 740 | // cycle thru values |
741 | - foreach ( $row_qty as $qty ) { |
|
742 | - $qty = absint( $qty ); |
|
741 | + foreach ($row_qty as $qty) { |
|
742 | + $qty = absint($qty); |
|
743 | 743 | // sanitize as integers |
744 | 744 | $valid_data[$what][] = $qty; |
745 | 745 | $valid_data['total_tickets'] += $qty; |
@@ -750,19 +750,19 @@ discard block |
||
750 | 750 | case 'ticket_id': |
751 | 751 | $value_array = array(); |
752 | 752 | // cycle thru values |
753 | - foreach ( $input_value as $key=>$value ) { |
|
753 | + foreach ($input_value as $key=>$value) { |
|
754 | 754 | // allow only numbers, letters, spaces, commas and dashes |
755 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
755 | + $value_array[$key] = wp_strip_all_tags($value); |
|
756 | 756 | // get ticket via the ticket id we put in the form |
757 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
758 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
757 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
758 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
759 | 759 | } |
760 | - $valid_data[ $what ] = $value_array; |
|
760 | + $valid_data[$what] = $value_array; |
|
761 | 761 | break; |
762 | 762 | |
763 | 763 | case 'return_url' : |
764 | 764 | // grab and sanitize return-url |
765 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
765 | + $valid_data[$what] = esc_url_raw($input_value); |
|
766 | 766 | break; |
767 | 767 | |
768 | 768 | } // end switch $what |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | } // end foreach $inputs_to_clean |
771 | 771 | |
772 | 772 | } else { |
773 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
773 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
774 | 774 | return FALSE; |
775 | 775 | } |
776 | 776 | |
@@ -788,28 +788,28 @@ discard block |
||
788 | 788 | * @param int $qty |
789 | 789 | * @return TRUE on success, FALSE on fail |
790 | 790 | */ |
791 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
792 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
791 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
792 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
793 | 793 | // get the number of spaces left for this datetime ticket |
794 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
794 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
795 | 795 | // compare available spaces against the number of tickets being purchased |
796 | - if ( $available_spaces >= $qty ) { |
|
796 | + if ($available_spaces >= $qty) { |
|
797 | 797 | // allow addons to prevent a ticket from being added to cart |
798 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
798 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
799 | 799 | return false; |
800 | 800 | } |
801 | 801 | // add event to cart |
802 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
803 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
802 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
803 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
804 | 804 | return true; |
805 | 805 | } else { |
806 | 806 | return false; |
807 | 807 | } |
808 | 808 | } else { |
809 | 809 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
810 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
810 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
811 | 811 | // greedy greedy greedy eh? |
812 | - if ( $available_spaces > 0 ) { |
|
812 | + if ($available_spaces > 0) { |
|
813 | 813 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
814 | 814 | EE_Error::add_error( |
815 | 815 | sprintf( |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | __FILE__, __FUNCTION__, __LINE__ |
826 | 826 | ); |
827 | 827 | } else { |
828 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
828 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
829 | 829 | } |
830 | 830 | return false; |
831 | 831 | } |
@@ -843,22 +843,22 @@ discard block |
||
843 | 843 | * @param bool $get_original_ticket_spaces |
844 | 844 | * @return int |
845 | 845 | */ |
846 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
846 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
847 | 847 | // if the $_available_spaces array has not been set up yet... |
848 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
849 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
848 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
849 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
850 | 850 | } |
851 | 851 | $available_spaces = $ticket->qty() - $ticket->sold(); |
852 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
852 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
853 | 853 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
854 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
854 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
855 | 855 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
856 | - if ( $get_original_ticket_spaces ) { |
|
856 | + if ($get_original_ticket_spaces) { |
|
857 | 857 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
858 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
858 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
859 | 859 | } else { |
860 | 860 | // we want the updated ticket availability as stored in the "datetimes" array |
861 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
861 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | } |
@@ -874,23 +874,23 @@ discard block |
||
874 | 874 | * @param EE_Ticket $ticket |
875 | 875 | * @return int |
876 | 876 | */ |
877 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
877 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
878 | 878 | // first, get all of the datetimes that are available to this ticket |
879 | 879 | $datetimes = $ticket->get_many_related( |
880 | 880 | 'Datetime', |
881 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
881 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
882 | 882 | ); |
883 | - if ( ! empty( $datetimes )) { |
|
883 | + if ( ! empty($datetimes)) { |
|
884 | 884 | // now loop thru all of the datetimes |
885 | - foreach ( $datetimes as $datetime ) { |
|
886 | - if ( $datetime instanceof EE_Datetime ) { |
|
885 | + foreach ($datetimes as $datetime) { |
|
886 | + if ($datetime instanceof EE_Datetime) { |
|
887 | 887 | // the number of spaces available for the datetime without considering individual ticket quantities |
888 | 888 | $spaces_remaining = $datetime->spaces_remaining(); |
889 | 889 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
890 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
890 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
891 | 891 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
892 | 892 | // else just take the datetime spaces remaining, and assign to the datetimes array |
893 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
893 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
894 | 894 | } |
895 | 895 | } |
896 | 896 | } |
@@ -906,12 +906,12 @@ discard block |
||
906 | 906 | * @param int $qty |
907 | 907 | * @return int |
908 | 908 | */ |
909 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
910 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
909 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
910 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
911 | 911 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
912 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
912 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
913 | 913 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
914 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
914 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
915 | 915 | } |
916 | 916 | } |
917 | 917 | } |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | */ |
929 | 929 | public static function load_tckt_slctr_assets() { |
930 | 930 | // add some style |
931 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
932 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
931 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
932 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
933 | 933 | wp_enqueue_style('ticket_selector'); |
934 | 934 | // make it dance |
935 | 935 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -943,9 +943,9 @@ discard block |
||
943 | 943 | |
944 | 944 | public static function load_tckt_slctr_assets_admin() { |
945 | 945 | //iframe button js on admin event editor page |
946 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
947 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
948 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
946 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
947 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
948 | + wp_enqueue_script('ticket_selector_embed'); |
|
949 | 949 | } |
950 | 950 | } |
951 | 951 |
@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | |
9 | 9 | $row = 1; |
10 | 10 | $max = 1; |
11 | -$ticket_count = count( $tickets ); |
|
11 | +$ticket_count = count($tickets); |
|
12 | 12 | |
13 | -if ( ! $ticket_count ) { |
|
13 | +if ( ! $ticket_count) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $required_ticket_sold_out = FALSE; |
18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
19 | 19 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
20 | 20 | : new EE_Ticket_Selector_Config(); |
21 | 21 | |
22 | 22 | ob_start(); |
23 | 23 | |
24 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
25 | - if ( $ticket instanceof EE_Ticket ) { |
|
24 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
25 | + if ($ticket instanceof EE_Ticket) { |
|
26 | 26 | $max = $ticket->max(); |
27 | 27 | $min = 0; |
28 | 28 | $remaining = $ticket->remaining(); |
29 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
29 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
30 | 30 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
31 | - $max = min( $remaining, $max_atndz ); |
|
31 | + $max = min($remaining, $max_atndz); |
|
32 | 32 | // but... we also want to restrict the number of tickets by the ticket max setting, |
33 | 33 | // however, the max still can't be higher than what was just set above |
34 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
34 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
35 | 35 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
36 | 36 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
37 | 37 | // and if the ticket is required, then make sure that min qty is at least 1 |
38 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
38 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
39 | 39 | } else { |
40 | 40 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
41 | 41 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -44,41 +44,41 @@ discard block |
||
44 | 44 | $ticket_price = $ticket->get_ticket_total_with_taxes(); |
45 | 45 | $ticket_bundle = FALSE; |
46 | 46 | // for ticket bundles, set min and max qty the same |
47 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
47 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
48 | 48 | $ticket_price = $ticket_price * $ticket->min(); |
49 | 49 | $ticket_bundle = TRUE; |
50 | 50 | } |
51 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
51 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
52 | 52 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
53 | 53 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
54 | 54 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
55 | 55 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
56 | 56 | // check ticket status |
57 | - switch ( $tkt_status ) { |
|
57 | + switch ($tkt_status) { |
|
58 | 58 | // sold_out |
59 | 59 | case EE_Ticket::sold_out : |
60 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
60 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
61 | 61 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
62 | 62 | break; |
63 | 63 | // expired |
64 | 64 | case EE_Ticket::expired : |
65 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
65 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
66 | 66 | $status_class = 'ticket-sales-expired lt-grey-text'; |
67 | 67 | break; |
68 | 68 | // archived |
69 | 69 | case EE_Ticket::archived : |
70 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
70 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
71 | 71 | $status_class = 'archived-ticket hidden'; |
72 | 72 | break; |
73 | 73 | // pending |
74 | 74 | case EE_Ticket::pending : |
75 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
75 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
76 | 76 | $status_class = 'ticket-pending'; |
77 | 77 | break; |
78 | 78 | // onsale |
79 | 79 | case EE_Ticket::onsale : |
80 | 80 | default : |
81 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
81 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
82 | 82 | $status_class = 'ticket-on-sale'; |
83 | 83 | break; |
84 | 84 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
119 | 119 | ); |
120 | 120 | ?> |
121 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
121 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
122 | 122 | <?php |
123 | 123 | /** |
124 | 124 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @var string|bool |
132 | 132 | */ |
133 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
133 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
134 | 134 | echo $new_row_cells_content; |
135 | 135 | echo '</tr>'; |
136 | 136 | continue; |
137 | 137 | } |
138 | 138 | ?> |
139 | 139 | <td class="tckt-slctr-tbl-td-name"> |
140 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
141 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
142 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
143 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
140 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
141 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
142 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
143 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
144 | 144 | </a> |
145 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
146 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
145 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
146 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
147 | 147 | </a> |
148 | 148 | <?php endif; //end show details check ?> |
149 | - <?php if ( $ticket->required() ) { ?> |
|
150 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
149 | + <?php if ($ticket->required()) { ?> |
|
150 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
151 | 151 | <?php } ?> |
152 | 152 | <?php |
153 | 153 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -161,63 +161,63 @@ discard block |
||
161 | 161 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
162 | 162 | ?> |
163 | 163 | </td> |
164 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
165 | - <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?> <span class="smaller-text no-bold"><?php |
|
166 | - if ( $ticket_bundle ) { |
|
167 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
164 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
165 | + <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?> <span class="smaller-text no-bold"><?php |
|
166 | + if ($ticket_bundle) { |
|
167 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
168 | 168 | } else { |
169 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
169 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
170 | 170 | }?></span> </td> |
171 | 171 | <?php } ?> |
172 | 172 | <td class="tckt-slctr-tbl-td-qty cntr"> |
173 | 173 | <?php |
174 | 174 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
175 | 175 | // sold out or other status ? |
176 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
176 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
177 | 177 | ?> |
178 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
178 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
179 | 179 | <?php |
180 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
180 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
181 | 181 | echo $ticket_status; |
182 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
182 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
183 | 183 | ?> |
184 | 184 | <div class="ticket-pending-pg"> |
185 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
186 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
185 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
186 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
187 | 187 | </div> |
188 | 188 | <?php |
189 | 189 | // min qty purchasable is less than tickets available |
190 | - } else if ( $ticket->min() > $remaining ) { |
|
190 | + } else if ($ticket->min() > $remaining) { |
|
191 | 191 | ?> |
192 | 192 | <div class="archived-ticket-pg"> |
193 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
193 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
194 | 194 | </div> |
195 | 195 | <?php |
196 | 196 | // if only one attendee is allowed to register at a time |
197 | - } else if ( $max_atndz == 1 ) { |
|
197 | + } else if ($max_atndz == 1) { |
|
198 | 198 | // display submit button since we have tickets available |
199 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
199 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
200 | 200 | ?> |
201 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
201 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
202 | 202 | <?php |
203 | 203 | $hidden_input_qty = FALSE; |
204 | 204 | |
205 | - } else if ( $max_atndz == 0 ) { |
|
206 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
207 | - } elseif ( $max > 0 ) { |
|
205 | + } else if ($max_atndz == 0) { |
|
206 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
207 | + } elseif ($max > 0) { |
|
208 | 208 | // display submit button since we have tickets available |
209 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
209 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
210 | 210 | |
211 | 211 | ?> |
212 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
212 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
213 | 213 | <?php |
214 | 214 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
215 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
215 | + if ( ! $ticket->required() && $min !== 0) { |
|
216 | 216 | ?> |
217 | 217 | <option value="0"> 0 </option> |
218 | 218 | <?php } |
219 | 219 | // offer ticket quantities from the min to the max |
220 | - for ( $i = $min; $i <= $max; $i++) { |
|
220 | + for ($i = $min; $i <= $max; $i++) { |
|
221 | 221 | ?> |
222 | 222 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
223 | 223 | <?php } ?> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | // depending on group reg we need to change the format for qty |
230 | - if ( $hidden_input_qty ) { |
|
230 | + if ($hidden_input_qty) { |
|
231 | 231 | ?> |
232 | 232 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
233 | 233 | <?php |
@@ -237,33 +237,33 @@ discard block |
||
237 | 237 | |
238 | 238 | </td> |
239 | 239 | </tr> |
240 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
241 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
240 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
241 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
242 | 242 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
243 | 243 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
244 | 244 | |
245 | 245 | <section class="tckt-slctr-tkt-details-sctn"> |
246 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
246 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
247 | 247 | <p><?php echo $ticket->description(); ?></p> |
248 | 248 | |
249 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
249 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
250 | 250 | <section class="tckt-slctr-tkt-price-sctn"> |
251 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
251 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
252 | 252 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
253 | 253 | <table class="tckt-slctr-tkt-details-tbl"> |
254 | 254 | <thead> |
255 | 255 | <tr> |
256 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
257 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
258 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
256 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
257 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
258 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
259 | 259 | </tr> |
260 | 260 | </thead> |
261 | 261 | <tbody> |
262 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
262 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
263 | 263 | <tr> |
264 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
265 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
266 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
264 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
265 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
266 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
267 | 267 | </tr> |
268 | 268 | <?php |
269 | 269 | $running_total = $ticket->base_price()->amount(); |
@@ -271,44 +271,44 @@ discard block |
||
271 | 271 | $running_total = 0; |
272 | 272 | } |
273 | 273 | // now add price modifiers |
274 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
274 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
275 | 275 | <tr> |
276 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
277 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
278 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
276 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
277 | + <?php if ($price_mod->is_percent()) { ?> |
|
278 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
279 | 279 | <?php |
280 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
280 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
281 | 281 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
282 | 282 | ?> |
283 | 283 | <?php } else { ?> |
284 | 284 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
285 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
285 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
286 | 286 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
287 | 287 | <?php } ?> |
288 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
288 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
289 | 289 | <?php $running_total += $new_sub_total; ?> |
290 | 290 | </tr> |
291 | 291 | <?php } ?> |
292 | - <?php if ( $ticket->taxable() ) { ?> |
|
292 | + <?php if ($ticket->taxable()) { ?> |
|
293 | 293 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
294 | 294 | <tr> |
295 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
296 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
295 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
296 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
297 | 297 | </tr> |
298 | 298 | |
299 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
299 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
300 | 300 | <tr> |
301 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
302 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
303 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
304 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
301 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
302 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
303 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
304 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
305 | 305 | <?php $running_total += $tax_amount; ?> |
306 | 306 | </tr> |
307 | 307 | <?php } ?> |
308 | 308 | <?php } ?> |
309 | 309 | <tr> |
310 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
311 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
310 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
311 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
312 | 312 | </tr> |
313 | 313 | </tbody> |
314 | 314 | </table> |
@@ -318,106 +318,106 @@ discard block |
||
318 | 318 | <?php } ?> |
319 | 319 | |
320 | 320 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
321 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
322 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
323 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
324 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
321 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
322 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
323 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
324 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
325 | 325 | </section> |
326 | 326 | <br/> |
327 | 327 | |
328 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
328 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
329 | 329 | |
330 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
330 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
331 | 331 | <section class="tckt-slctr-tkt-quantities-sctn"> |
332 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
333 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
334 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
335 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
332 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
333 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
334 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
335 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
336 | 336 | <?php //$max = min( $max, $max_atndz );?> |
337 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
337 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
338 | 338 | </section> |
339 | 339 | <br/> |
340 | 340 | <?php } ?> |
341 | 341 | |
342 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
342 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
343 | 343 | <section class="tckt-slctr-tkt-uses-sctn"> |
344 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
344 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
345 | 345 | <span class="drk-grey-text small-text no-bold"> - <?php |
346 | 346 | echo apply_filters( |
347 | 347 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
348 | 348 | sprintf( |
349 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
349 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
350 | 350 | '<br/>', |
351 | 351 | '<strong>', |
352 | 352 | '</strong>' |
353 | 353 | ) |
354 | 354 | ); |
355 | 355 | ?></span><br/> |
356 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
356 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
357 | 357 | </section> |
358 | 358 | <?php } ?> |
359 | 359 | |
360 | 360 | <?php |
361 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
361 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
362 | 362 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
363 | - if ( ! empty( $datetimes )) { ?> |
|
363 | + if ( ! empty($datetimes)) { ?> |
|
364 | 364 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
365 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
366 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
365 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
366 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
367 | 367 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
368 | 368 | <table class="tckt-slctr-tkt-details-tbl"> |
369 | 369 | <thead> |
370 | 370 | <tr> |
371 | 371 | <th class="tckt-slctr-tkt-details-date-th"> |
372 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
372 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
373 | 373 | </th> |
374 | 374 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
375 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
375 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
376 | 376 | </th> |
377 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
377 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
378 | 378 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
379 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
379 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
380 | 380 | </th> |
381 | 381 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
382 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
382 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
383 | 383 | </th> |
384 | 384 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
385 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
385 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
386 | 386 | </th> |
387 | 387 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
388 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
388 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
389 | 389 | </th> |
390 | 390 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
391 | 391 | </tr> |
392 | 392 | </thead> |
393 | 393 | <tbody> |
394 | 394 | <?php |
395 | - foreach ( $datetimes as $datetime ) { |
|
396 | - if ( $datetime instanceof EE_Datetime ) { |
|
395 | + foreach ($datetimes as $datetime) { |
|
396 | + if ($datetime instanceof EE_Datetime) { |
|
397 | 397 | ?> |
398 | 398 | |
399 | 399 | <tr> |
400 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
400 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
401 | 401 | <?php $datetime_name = $datetime->name(); ?> |
402 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
403 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
402 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
403 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
404 | 404 | </td> |
405 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
406 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
405 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
406 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
407 | 407 | </td> |
408 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
409 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
408 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
409 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
410 | 410 | <?php echo $ticket->sold(); ?> |
411 | 411 | </td> |
412 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
413 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
412 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
413 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
414 | 414 | </td> |
415 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
415 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
416 | 416 | <?php echo $datetime->sold(); ?> |
417 | 417 | </td> |
418 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
419 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
420 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
418 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
419 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
420 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
421 | 421 | </td> |
422 | 422 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
423 | 423 | </tr> |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | </div> |
436 | 436 | </td> |
437 | 437 | </tr> |
438 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
438 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
439 | 439 | <?php |
440 | 440 | $row++; |
441 | 441 | } |
@@ -444,32 +444,32 @@ discard block |
||
444 | 444 | $ticket_row_html = ob_get_clean(); |
445 | 445 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
446 | 446 | $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false; |
447 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
447 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
448 | 448 | // EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
449 | 449 | // EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
450 | 450 | // EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
451 | 451 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
452 | 452 | remove_filter( |
453 | 453 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
454 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
454 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
455 | 455 | ); |
456 | 456 | remove_filter( |
457 | 457 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
458 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
458 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
459 | 459 | ); |
460 | -if ( ! $hide_ticket_selector ) { |
|
460 | +if ( ! $hide_ticket_selector) { |
|
461 | 461 | ?> |
462 | 462 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
463 | 463 | |
464 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
464 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
465 | 465 | |
466 | 466 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
467 | 467 | <thead> |
468 | 468 | <tr> |
469 | 469 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
470 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
470 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
471 | 471 | </th> |
472 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
472 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
473 | 473 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
474 | 474 | <?php |
475 | 475 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @param string 'Price' The translatable text to display in the table header for price |
481 | 481 | * @param int $EVT_ID The Event ID |
482 | 482 | */ |
483 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
483 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
484 | 484 | ?> |
485 | 485 | </th> |
486 | 486 | <?php } ?> |
@@ -494,24 +494,24 @@ discard block |
||
494 | 494 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
495 | 495 | * @param int $EVT_ID The Event ID |
496 | 496 | */ |
497 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
497 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
498 | 498 | ?> |
499 | 499 | </th> |
500 | 500 | </tr> |
501 | 501 | </thead> |
502 | 502 | <tbody> |
503 | - <?php echo $ticket_row_html;?> |
|
503 | + <?php echo $ticket_row_html; ?> |
|
504 | 504 | </tbody> |
505 | 505 | </table> |
506 | 506 | |
507 | 507 | <input type="hidden" name="noheader" value="true" /> |
508 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" /> |
|
508 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" /> |
|
509 | 509 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
510 | 510 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
511 | 511 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
512 | 512 | |
513 | 513 | <?php |
514 | -if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
514 | +if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
515 | 515 | echo apply_filters( |
516 | 516 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
517 | 517 | '' |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | } |
520 | 520 | ?> |
521 | 521 | |
522 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
522 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
523 | 523 | |
524 | 524 | </div> |
525 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
525 | +<?php } else if (isset($TKT_ID)) { ?> |
|
526 | 526 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
527 | 527 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
528 | 528 | <input type="hidden" name="noheader" value="true"/> |
@@ -531,27 +531,27 @@ discard block |
||
531 | 531 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
532 | 532 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
533 | 533 | <?php |
534 | - if ( $ticket instanceof EE_Ticket ) { |
|
535 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
534 | + if ($ticket instanceof EE_Ticket) { |
|
535 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
536 | 536 | $ticket_description = $ticket->description(); |
537 | 537 | ?> |
538 | 538 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
539 | 539 | <div class="no-tkt-slctr-ticket-content-dv"> |
540 | 540 | <h5><?php echo $ticket->name(); ?></h5> |
541 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
541 | + <?php if ( ! empty($ticket_description)) { ?> |
|
542 | 542 | <p><?php echo $ticket_description; ?></p> |
543 | 543 | <?php } ?> |
544 | 544 | </div> |
545 | 545 | <?php |
546 | 546 | add_filter( |
547 | 547 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
548 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
548 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
549 | 549 | ); |
550 | 550 | add_filter( |
551 | 551 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
552 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
552 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
553 | 553 | ); |
554 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
554 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
555 | 555 | } |
556 | 556 | } |
557 | 557 | ?> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\exceptions; |
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 | |
@@ -15,5 +15,5 @@ discard block |
||
15 | 15 | * @author Darren Ethier |
16 | 16 | * @since 4.9.11.rc.001 |
17 | 17 | */ |
18 | -class SendMessageException extends \RuntimeException {} |
|
18 | +class SendMessageException extends \RuntimeException {} |
|
19 | 19 | // End of file SendMessageException.php |
20 | 20 | \ No newline at end of file |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | use EventEspresso\core\domain\entities\RegUrlLink; |
4 | 4 | use EventEspresso\core\domain\services\registration\CreateRegistrationService; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
7 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
7 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class EE_Registration_Processor |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function instance() { |
68 | 68 | // check if class object is instantiated |
69 | - if ( ! self::$_instance instanceof EE_Registration_Processor ) { |
|
69 | + if ( ! self::$_instance instanceof EE_Registration_Processor) { |
|
70 | 70 | self::$_instance = new self(); |
71 | 71 | } |
72 | 72 | return self::$_instance; |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @param int $REG_ID |
87 | 87 | * @return string |
88 | 88 | */ |
89 | - public function old_reg_status( $REG_ID ) { |
|
90 | - return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null; |
|
89 | + public function old_reg_status($REG_ID) { |
|
90 | + return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | * @param int $REG_ID |
97 | 97 | * @param string $old_reg_status |
98 | 98 | */ |
99 | - public function set_old_reg_status( $REG_ID, $old_reg_status ) { |
|
99 | + public function set_old_reg_status($REG_ID, $old_reg_status) { |
|
100 | 100 | // only set the first time |
101 | - if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) { |
|
102 | - $this->_old_reg_status[ $REG_ID ] = $old_reg_status; |
|
101 | + if ( ! isset($this->_old_reg_status[$REG_ID])) { |
|
102 | + $this->_old_reg_status[$REG_ID] = $old_reg_status; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @param int $REG_ID |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function new_reg_status( $REG_ID ) { |
|
113 | - return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null; |
|
112 | + public function new_reg_status($REG_ID) { |
|
113 | + return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param int $REG_ID |
120 | 120 | * @param string $new_reg_status |
121 | 121 | */ |
122 | - public function set_new_reg_status( $REG_ID, $new_reg_status ) { |
|
123 | - $this->_new_reg_status[ $REG_ID ] = $new_reg_status; |
|
122 | + public function set_new_reg_status($REG_ID, $new_reg_status) { |
|
123 | + $this->_new_reg_status[$REG_ID] = $new_reg_status; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param int $REG_ID |
132 | 132 | * @return bool |
133 | 133 | */ |
134 | - public function reg_status_updated( $REG_ID ) { |
|
135 | - return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false; |
|
134 | + public function reg_status_updated($REG_ID) { |
|
135 | + return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | * @param \EE_Registration $registration |
142 | 142 | * @throws \EE_Error |
143 | 143 | */ |
144 | - public function update_registration_status_and_trigger_notifications( \EE_Registration $registration ) { |
|
145 | - $this->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
146 | - $this->toggle_registration_status_for_default_approved_events( $registration, false ); |
|
147 | - $this->toggle_registration_status_if_no_monies_owing( $registration, false ); |
|
144 | + public function update_registration_status_and_trigger_notifications(\EE_Registration $registration) { |
|
145 | + $this->toggle_incomplete_registration_status_to_default($registration, false); |
|
146 | + $this->toggle_registration_status_for_default_approved_events($registration, false); |
|
147 | + $this->toggle_registration_status_if_no_monies_owing($registration, false); |
|
148 | 148 | $registration->save(); |
149 | 149 | // trigger notifications |
150 | - $this->trigger_registration_update_notifications( $registration ); |
|
150 | + $this->trigger_registration_update_notifications($registration); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | * @return boolean |
163 | 163 | * @throws \EE_Error |
164 | 164 | */ |
165 | - public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) { |
|
165 | + public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) { |
|
166 | 166 | // set initial REG_Status |
167 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
167 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
168 | 168 | // set incoming REG_Status |
169 | - $this->set_new_reg_status( $registration->ID(), $new_reg_status ); |
|
169 | + $this->set_new_reg_status($registration->ID(), $new_reg_status); |
|
170 | 170 | // toggle reg status but only if it has changed and the user can do so |
171 | 171 | if ( |
172 | - $this->reg_status_updated( $registration->ID() ) && |
|
173 | - EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registration', 'toggle_registration_status', $registration->ID() ) |
|
172 | + $this->reg_status_updated($registration->ID()) && |
|
173 | + EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'toggle_registration_status', $registration->ID()) |
|
174 | 174 | ) { |
175 | 175 | // change status to new value |
176 | - if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) ) && $save ) { |
|
176 | + if ($registration->set_status($this->new_reg_status($registration->ID())) && $save) { |
|
177 | 177 | $registration->save(); |
178 | 178 | } |
179 | 179 | return TRUE; |
@@ -193,30 +193,30 @@ discard block |
||
193 | 193 | * @return void |
194 | 194 | * @throws \EE_Error |
195 | 195 | */ |
196 | - public function toggle_incomplete_registration_status_to_default( EE_Registration $registration, $save = TRUE ) { |
|
196 | + public function toggle_incomplete_registration_status_to_default(EE_Registration $registration, $save = TRUE) { |
|
197 | 197 | $existing_reg_status = $registration->status_ID(); |
198 | 198 | // set initial REG_Status |
199 | - $this->set_old_reg_status( $registration->ID(), $existing_reg_status ); |
|
199 | + $this->set_old_reg_status($registration->ID(), $existing_reg_status); |
|
200 | 200 | // is the registration currently incomplete ? |
201 | - if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) { |
|
201 | + if ($registration->status_ID() === EEM_Registration::status_id_incomplete) { |
|
202 | 202 | // grab default reg status for the event, if set |
203 | 203 | $event_default_registration_status = $registration->event()->default_registration_status(); |
204 | 204 | // if no default reg status is set for the event, then use the global value |
205 | - $STS_ID = ! empty( $event_default_registration_status ) |
|
205 | + $STS_ID = ! empty($event_default_registration_status) |
|
206 | 206 | ? $event_default_registration_status |
207 | 207 | : EE_Registry::instance()->CFG->registration->default_STS_ID; |
208 | 208 | // if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered |
209 | 209 | $STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID; |
210 | 210 | // set incoming REG_Status |
211 | - $this->set_new_reg_status( $registration->ID(), $STS_ID ); |
|
212 | - $registration->set_status( $STS_ID ); |
|
213 | - if ( $save ) { |
|
211 | + $this->set_new_reg_status($registration->ID(), $STS_ID); |
|
212 | + $registration->set_status($STS_ID); |
|
213 | + if ($save) { |
|
214 | 214 | $registration->save(); |
215 | 215 | } |
216 | 216 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
217 | - if ( ! EE_Processor_Base::$IPN ) { |
|
217 | + if ( ! EE_Processor_Base::$IPN) { |
|
218 | 218 | // otherwise, send out notifications |
219 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
219 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
220 | 220 | } |
221 | 221 | // DEBUG LOG |
222 | 222 | //$this->log( |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | * @return boolean |
242 | 242 | * @throws \EE_Error |
243 | 243 | */ |
244 | - public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) { |
|
244 | + public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) { |
|
245 | 245 | $reg_status = $registration->status_ID(); |
246 | 246 | // set initial REG_Status |
247 | - $this->set_old_reg_status( $registration->ID(), $reg_status ); |
|
247 | + $this->set_old_reg_status($registration->ID(), $reg_status); |
|
248 | 248 | // if not already, toggle reg status to approved IF the event default reg status is approved |
249 | 249 | // ( as long as the registration wasn't cancelled or declined at some point ) |
250 | 250 | if ( |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | $registration->event()->default_registration_status() === EEM_Registration::status_id_approved |
255 | 255 | ) { |
256 | 256 | // set incoming REG_Status |
257 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
257 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
258 | 258 | // toggle status to approved |
259 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
260 | - if ( $save ) { |
|
259 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
260 | + if ($save) { |
|
261 | 261 | $registration->save(); |
262 | 262 | } |
263 | 263 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
264 | - if ( ! EE_Processor_Base::$IPN ) { |
|
264 | + if ( ! EE_Processor_Base::$IPN) { |
|
265 | 265 | // otherwise, send out notifications |
266 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
266 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
267 | 267 | } |
268 | 268 | // DEBUG LOG |
269 | 269 | //$this->log( |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | * @return bool |
292 | 292 | * @throws \EE_Error |
293 | 293 | */ |
294 | - public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE, $additional_details = array() ) { |
|
294 | + public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE, $additional_details = array()) { |
|
295 | 295 | // set initial REG_Status |
296 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
296 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
297 | 297 | //EEH_Debug_Tools::printr( $additional_details, '$additional_details', __FILE__, __LINE__ ); |
298 | 298 | // was a payment just made ? |
299 | 299 | if ( |
300 | - isset( $additional_details[ 'payment_updates' ], $additional_details[ 'last_payment' ] ) && |
|
301 | - $additional_details[ 'payment_updates' ] && |
|
302 | - $additional_details[ 'last_payment' ] instanceof EE_Payment |
|
300 | + isset($additional_details['payment_updates'], $additional_details['last_payment']) && |
|
301 | + $additional_details['payment_updates'] && |
|
302 | + $additional_details['last_payment'] instanceof EE_Payment |
|
303 | 303 | ) { |
304 | - $payment = $additional_details[ 'last_payment' ]; |
|
304 | + $payment = $additional_details['last_payment']; |
|
305 | 305 | $total_paid = 0; |
306 | - foreach ( self::$_amount_paid as $reg => $amount_paid ) { |
|
306 | + foreach (self::$_amount_paid as $reg => $amount_paid) { |
|
307 | 307 | $total_paid += $amount_paid; |
308 | 308 | } |
309 | 309 | } else { |
@@ -327,30 +327,30 @@ discard block |
||
327 | 327 | $registration->transaction()->is_completed() || |
328 | 328 | $registration->transaction()->is_overpaid() || |
329 | 329 | $registration->transaction()->is_free() || |
330 | - apply_filters( 'FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration ) |
|
330 | + apply_filters('FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration) |
|
331 | 331 | ) || ( |
332 | 332 | $payment instanceof EE_Payment && |
333 | 333 | $payment->is_approved() && |
334 | 334 | // this specific registration has not yet been paid for |
335 | - ! isset( self::$_amount_paid[ $registration->ID() ] ) && |
|
335 | + ! isset(self::$_amount_paid[$registration->ID()]) && |
|
336 | 336 | // payment amount, less what we have already attributed to other registrations, is greater than this reg's final price |
337 | 337 | $payment->amount() - $total_paid >= $registration->final_price() |
338 | 338 | ) |
339 | 339 | ) |
340 | 340 | ) { |
341 | 341 | // mark as paid |
342 | - self::$_amount_paid[ $registration->ID() ] = $registration->final_price(); |
|
342 | + self::$_amount_paid[$registration->ID()] = $registration->final_price(); |
|
343 | 343 | // track new REG_Status |
344 | - $this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved ); |
|
344 | + $this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved); |
|
345 | 345 | // toggle status to approved |
346 | - $registration->set_status( EEM_Registration::status_id_approved ); |
|
347 | - if ( $save ) { |
|
346 | + $registration->set_status(EEM_Registration::status_id_approved); |
|
347 | + if ($save) { |
|
348 | 348 | $registration->save(); |
349 | 349 | } |
350 | 350 | // don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor |
351 | - if ( ! EE_Processor_Base::$IPN ) { |
|
351 | + if ( ! EE_Processor_Base::$IPN) { |
|
352 | 352 | // otherwise, send out notifications |
353 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 ); |
|
353 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10); |
|
354 | 354 | } |
355 | 355 | // DEBUG LOG |
356 | 356 | //$this->log( |
@@ -376,27 +376,27 @@ discard block |
||
376 | 376 | * @param array $additional_details |
377 | 377 | * @return void |
378 | 378 | */ |
379 | - public function trigger_registration_update_notifications( $registration, $additional_details = array() ) { |
|
379 | + public function trigger_registration_update_notifications($registration, $additional_details = array()) { |
|
380 | 380 | try { |
381 | - if ( ! $registration instanceof EE_Registration ) { |
|
382 | - throw new EE_Error( __( 'An invalid registration was received.', 'event_espresso' ) ); |
|
381 | + if ( ! $registration instanceof EE_Registration) { |
|
382 | + throw new EE_Error(__('An invalid registration was received.', 'event_espresso')); |
|
383 | 383 | } |
384 | - EE_Registry::instance()->load_helper( 'Debug_Tools' ); |
|
384 | + EE_Registry::instance()->load_helper('Debug_Tools'); |
|
385 | 385 | EEH_Debug_Tools::log( |
386 | 386 | __CLASS__, |
387 | 387 | __FUNCTION__, |
388 | 388 | __LINE__, |
389 | - array( $registration->transaction(), $additional_details ), |
|
389 | + array($registration->transaction(), $additional_details), |
|
390 | 390 | false, |
391 | - 'EE_Transaction: ' . $registration->transaction()->ID() |
|
391 | + 'EE_Transaction: '.$registration->transaction()->ID() |
|
392 | 392 | ); |
393 | 393 | do_action( |
394 | 394 | 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', |
395 | 395 | $registration, |
396 | 396 | $additional_details |
397 | 397 | ); |
398 | - } catch( Exception $e ) { |
|
399 | - EE_Error::add_error( $e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine() ); |
|
398 | + } catch (Exception $e) { |
|
399 | + EE_Error::add_error($e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine()); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -410,22 +410,22 @@ discard block |
||
410 | 410 | * @return bool |
411 | 411 | * @throws \EE_Error |
412 | 412 | */ |
413 | - public function update_registration_after_checkout_or_payment( EE_Registration $registration, $additional_details = array() ) { |
|
413 | + public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) { |
|
414 | 414 | // set initial REG_Status |
415 | - $this->set_old_reg_status( $registration->ID(), $registration->status_ID() ); |
|
415 | + $this->set_old_reg_status($registration->ID(), $registration->status_ID()); |
|
416 | 416 | |
417 | 417 | // if the registration status gets updated, then save the registration |
418 | 418 | if ( |
419 | - $this->toggle_registration_status_for_default_approved_events( $registration, false ) |
|
420 | - || $this->toggle_registration_status_if_no_monies_owing( $registration, false, $additional_details ) |
|
419 | + $this->toggle_registration_status_for_default_approved_events($registration, false) |
|
420 | + || $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details) |
|
421 | 421 | ) { |
422 | 422 | $registration->save(); |
423 | 423 | } |
424 | 424 | |
425 | 425 | // set new REG_Status |
426 | - $this->set_new_reg_status( $registration->ID(), $registration->status_ID() ); |
|
427 | - return $this->reg_status_updated( $registration->ID() ) |
|
428 | - && $this->new_reg_status( $registration->ID() ) === EEM_Registration::status_id_approved |
|
426 | + $this->set_new_reg_status($registration->ID(), $registration->status_ID()); |
|
427 | + return $this->reg_status_updated($registration->ID()) |
|
428 | + && $this->new_reg_status($registration->ID()) === EEM_Registration::status_id_approved |
|
429 | 429 | ? true |
430 | 430 | : false; |
431 | 431 | } |
@@ -441,20 +441,20 @@ discard block |
||
441 | 441 | * @return void |
442 | 442 | * @throws \EE_Error |
443 | 443 | */ |
444 | - public function update_registration_final_prices( $transaction, $save_regs = true ) { |
|
445 | - $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() ); |
|
446 | - foreach( $transaction->registrations() as $registration ) { |
|
444 | + public function update_registration_final_prices($transaction, $save_regs = true) { |
|
445 | + $reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item()); |
|
446 | + foreach ($transaction->registrations() as $registration) { |
|
447 | 447 | /** @var EE_Line_Item $line_item */ |
448 | - $line_item = EEM_Line_Item::instance()->get_line_item_for_registration( $registration ); |
|
449 | - if( isset( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ) ) { |
|
450 | - $registration->set_final_price( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ); |
|
451 | - if( $save_regs ) { |
|
448 | + $line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration); |
|
449 | + if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) { |
|
450 | + $registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]); |
|
451 | + if ($save_regs) { |
|
452 | 452 | $registration->save(); |
453 | 453 | } |
454 | 454 | } |
455 | 455 | } |
456 | 456 | //and make sure there's no rounding problem |
457 | - $this->fix_reg_final_price_rounding_issue( $transaction ); |
|
457 | + $this->fix_reg_final_price_rounding_issue($transaction); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @return boolean success verifying that there is NO difference after this method is done |
475 | 475 | * @throws \EE_Error |
476 | 476 | */ |
477 | - public function fix_reg_final_price_rounding_issue( $transaction ) { |
|
477 | + public function fix_reg_final_price_rounding_issue($transaction) { |
|
478 | 478 | $reg_final_price_sum = EEM_Registration::instance()->sum( |
479 | 479 | array( |
480 | 480 | array( |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | ), |
484 | 484 | 'REG_final_price' |
485 | 485 | ); |
486 | - $diff = $transaction->total() - (float) $reg_final_price_sum; |
|
486 | + $diff = $transaction->total() - (float) $reg_final_price_sum; |
|
487 | 487 | //ok then, just grab one of the registrations |
488 | - if( $diff !== 0 ) { |
|
488 | + if ($diff !== 0) { |
|
489 | 489 | $a_reg = EEM_Registration::instance()->get_one( |
490 | 490 | array( |
491 | 491 | array( |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | )); |
495 | 495 | $success = $a_reg instanceof EE_Registration |
496 | 496 | ? $a_reg->save( |
497 | - array( 'REG_final_price' => $a_reg->final_price() + $diff ) |
|
497 | + array('REG_final_price' => $a_reg->final_price() + $diff) |
|
498 | 498 | ) |
499 | 499 | : false; |
500 | 500 | return $success ? true : false; |
@@ -519,13 +519,13 @@ discard block |
||
519 | 519 | $update_reg = true |
520 | 520 | ) { |
521 | 521 | // these reg statuses should not be considered in any calculations involving monies owing |
522 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
522 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
523 | 523 | : EEM_Registration::closed_reg_statuses(); |
524 | - if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
524 | + if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
525 | 525 | return false; |
526 | 526 | } |
527 | 527 | $registration->set_final_price(0); |
528 | - if ( $update_reg ) { |
|
528 | + if ($update_reg) { |
|
529 | 529 | $registration->save(); |
530 | 530 | } |
531 | 531 | return true; |
@@ -548,23 +548,23 @@ discard block |
||
548 | 548 | $update_reg = true |
549 | 549 | ) { |
550 | 550 | // these reg statuses should not be considered in any calculations involving monies owing |
551 | - $closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses |
|
551 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
552 | 552 | : EEM_Registration::closed_reg_statuses(); |
553 | - if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) { |
|
553 | + if (in_array($registration->status_ID(), $closed_reg_statuses)) { |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | $ticket = $registration->ticket(); |
557 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
557 | + if ( ! $ticket instanceof EE_Ticket) { |
|
558 | 558 | throw new EE_Error( |
559 | 559 | sprintf( |
560 | - __( 'The Ticket for Registration %1$d was not found or is invalid.', |
|
561 | - 'event_espresso' ), |
|
560 | + __('The Ticket for Registration %1$d was not found or is invalid.', |
|
561 | + 'event_espresso'), |
|
562 | 562 | $registration->ticket_ID() |
563 | 563 | ) |
564 | 564 | ); |
565 | 565 | } |
566 | - $registration->set_final_price( $ticket->price() ); |
|
567 | - if ( $update_reg ) { |
|
566 | + $registration->set_final_price($ticket->price()); |
|
567 | + if ($update_reg) { |
|
568 | 568 | $registration->save(); |
569 | 569 | } |
570 | 570 | return true; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $total_ticket_count = 1 |
603 | 603 | ) { |
604 | 604 | EE_Error::doing_it_wrong( |
605 | - __CLASS__ . '::' . __FUNCTION__, |
|
605 | + __CLASS__.'::'.__FUNCTION__, |
|
606 | 606 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
607 | 607 | '\EventEspresso\core\domain\services\registration\CreateRegistrationService::create()'), |
608 | 608 | '4.9.1', |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | public function generate_reg_url_link($att_nmbr, $item) |
646 | 646 | { |
647 | 647 | EE_Error::doing_it_wrong( |
648 | - __CLASS__ . '::' . __FUNCTION__, |
|
648 | + __CLASS__.'::'.__FUNCTION__, |
|
649 | 649 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
650 | 650 | 'EventEspresso\core\domain\entities\RegUrlLink'), |
651 | 651 | '4.9.1', |
@@ -665,11 +665,11 @@ discard block |
||
665 | 665 | * @return string |
666 | 666 | * @throws \EE_Error |
667 | 667 | */ |
668 | - public function generate_reg_code( EE_Registration $registration ) { |
|
668 | + public function generate_reg_code(EE_Registration $registration) { |
|
669 | 669 | EE_Error::doing_it_wrong( |
670 | - __CLASS__ . '::' . __FUNCTION__, |
|
670 | + __CLASS__.'::'.__FUNCTION__, |
|
671 | 671 | sprintf( |
672 | - __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), |
|
672 | + __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
673 | 673 | 'EventEspresso\core\domain\entities\RegCode' |
674 | 674 | ), |
675 | 675 | '4.9.1', |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | return apply_filters( |
679 | 679 | 'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code', |
680 | 680 | new RegCode( |
681 | - RegUrlLink::fromRegistration( $registration ), |
|
681 | + RegUrlLink::fromRegistration($registration), |
|
682 | 682 | $registration->transaction(), |
683 | 683 | $registration->ticket() |
684 | 684 | ), |