@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @since $VID:$ |
15 | 15 | * |
16 | 16 | */ |
17 | -abstract class EE_PMT_Base{ |
|
17 | +abstract class EE_PMT_Base { |
|
18 | 18 | |
19 | 19 | const onsite = 'on-site'; |
20 | 20 | const offsite = 'off-site'; |
@@ -95,31 +95,31 @@ discard block |
||
95 | 95 | * @return EE_PMT_Base |
96 | 96 | */ |
97 | 97 | function __construct($pm_instance = NULL) { |
98 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
98 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
99 | 99 | $this->set_instance($pm_instance); |
100 | 100 | } |
101 | - if($this->_gateway){ |
|
102 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
103 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
104 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
105 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
106 | - $this->_gateway->set_money_helper( new EEH_Money() ); |
|
101 | + if ($this->_gateway) { |
|
102 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
103 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
104 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
105 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
106 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
107 | 107 | } |
108 | - if ( ! isset( $this->_has_billing_form ) ) { |
|
108 | + if ( ! isset($this->_has_billing_form)) { |
|
109 | 109 | // by default, On Site gateways have a billing form |
110 | - if ( $this->payment_occurs() == EE_PMT_Base::onsite ) { |
|
111 | - $this->set_has_billing_form( true ); |
|
110 | + if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
111 | + $this->set_has_billing_form(true); |
|
112 | 112 | } else { |
113 | - $this->set_has_billing_form( false ); |
|
113 | + $this->set_has_billing_form(false); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - if( ! $this->_pretty_name){ |
|
117 | + if ( ! $this->_pretty_name) { |
|
118 | 118 | throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso"))); |
119 | 119 | } |
120 | 120 | //if the child didn't specify a default button, use the credit card one |
121 | - if( $this->_default_button_url === NULL){ |
|
122 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png'; |
|
121 | + if ($this->_default_button_url === NULL) { |
|
122 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png'; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @param boolean $has_billing_form |
130 | 130 | */ |
131 | - public function set_has_billing_form( $has_billing_form ) { |
|
132 | - $this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN ); |
|
131 | + public function set_has_billing_form($has_billing_form) { |
|
132 | + $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * sets the file_folder property |
139 | 139 | */ |
140 | - protected function _set_file_folder(){ |
|
140 | + protected function _set_file_folder() { |
|
141 | 141 | $reflector = new ReflectionClass(get_class($this)); |
142 | 142 | $fn = $reflector->getFileName(); |
143 | - $this->_file_folder = dirname($fn).DS; |
|
143 | + $this->_file_folder = dirname($fn).DS; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | /** |
149 | 149 | * sets the file URL with a trailing slash for this PMT |
150 | 150 | */ |
151 | - protected function _set_file_url(){ |
|
152 | - $plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR); |
|
153 | - $file_folder_fixed = str_replace('\\',DS,$this->file_folder()); |
|
154 | - $file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed); |
|
151 | + protected function _set_file_url() { |
|
152 | + $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR); |
|
153 | + $file_folder_fixed = str_replace('\\', DS, $this->file_folder()); |
|
154 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
155 | 155 | $this->_file_url = $file_path; |
156 | 156 | } |
157 | 157 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * Gets the default description on all payment methods of this type |
160 | 160 | * @return string |
161 | 161 | */ |
162 | - public function default_description(){ |
|
162 | + public function default_description() { |
|
163 | 163 | return $this->_default_description; |
164 | 164 | } |
165 | 165 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * Returns the folder containing the PMT child class, with a trailing slash |
170 | 170 | * @return string |
171 | 171 | */ |
172 | - public function file_folder(){ |
|
173 | - if( ! $this->_file_folder ) { |
|
172 | + public function file_folder() { |
|
173 | + if ( ! $this->_file_folder) { |
|
174 | 174 | $this->_set_file_folder(); |
175 | 175 | } |
176 | 176 | return $this->_file_folder; |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | /** |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - public function file_url(){ |
|
185 | - if( ! $this->_file_url ) { |
|
184 | + public function file_url() { |
|
185 | + if ( ! $this->_file_url) { |
|
186 | 186 | $this->_set_file_url(); |
187 | 187 | } |
188 | 188 | return $this->_file_url; |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | * Its important teh payment method instance is set before |
196 | 196 | * @param EE_Payment_Method $payment_method_instance |
197 | 197 | */ |
198 | - function set_instance($payment_method_instance){ |
|
198 | + function set_instance($payment_method_instance) { |
|
199 | 199 | $this->_pm_instance = $payment_method_instance; |
200 | 200 | //if they have already requested the settings form, make sure its |
201 | 201 | //data matches this model object |
202 | - if($this->_settings_form){ |
|
202 | + if ($this->_settings_form) { |
|
203 | 203 | $this->settings_form()->populate_model_obj($payment_method_instance); |
204 | 204 | } |
205 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
205 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
206 | 206 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
207 | 207 | } |
208 | 208 | } |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | * Gets teh form for displaying to admins where they setup the payment method |
214 | 214 | * @return EE_Payment_Method_Form |
215 | 215 | */ |
216 | - function settings_form(){ |
|
217 | - if( ! $this->_settings_form){ |
|
216 | + function settings_form() { |
|
217 | + if ( ! $this->_settings_form) { |
|
218 | 218 | $this->_settings_form = $this->generate_new_settings_form(); |
219 | - $this->_settings_form->set_payment_method_type( $this ); |
|
220 | - $this->_settings_form->_construct_finalize(NULL, NULL ); |
|
219 | + $this->_settings_form->set_payment_method_type($this); |
|
220 | + $this->_settings_form->_construct_finalize(NULL, NULL); |
|
221 | 221 | //if we have already assigned a model object to this pmt, make |
222 | 222 | //sure its reflected in teh form we just generated |
223 | - if($this->_pm_instance){ |
|
223 | + if ($this->_pm_instance) { |
|
224 | 224 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
225 | 225 | } |
226 | 226 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | * this payment method type's settings form later in the request |
247 | 247 | * @param EE_Payment_Method_Form $form |
248 | 248 | */ |
249 | - public function set_settings_form($form){ |
|
249 | + public function set_settings_form($form) { |
|
250 | 250 | $this->_settings_form = $form; |
251 | 251 | } |
252 | 252 | |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | * @param array $extra_args |
270 | 270 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
271 | 271 | */ |
272 | - public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){ |
|
272 | + public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) { |
|
273 | 273 | // has billing form already been regenerated ? or overwrite cache? |
274 | - if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){ |
|
275 | - $this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args ); |
|
274 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
275 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
276 | 276 | } |
277 | 277 | //if we know who the attendee is, and this is a billing form |
278 | 278 | //that uses attendee info, populate it |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | $transaction instanceof EE_Transaction && |
282 | 282 | $transaction->primary_registration() instanceof EE_Registration && |
283 | 283 | $transaction->primary_registration()->attendee() instanceof EE_Attendee |
284 | - ){ |
|
285 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
284 | + ) { |
|
285 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
286 | 286 | } |
287 | 287 | return $this->_billing_form; |
288 | 288 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @param \EE_Transaction $transaction |
294 | 294 | * @return \EE_Billing_Info_Form |
295 | 295 | */ |
296 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
296 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
297 | 297 | |
298 | 298 | |
299 | 299 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param \EE_Billing_Info_Form $billing_form |
305 | 305 | * @return \EE_Billing_Info_Form |
306 | 306 | */ |
307 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
307 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
308 | 308 | return $billing_form; |
309 | 309 | } |
310 | 310 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * if you have form |
316 | 316 | * @param EE_Payment_Method $form |
317 | 317 | */ |
318 | - public function set_billing_form($form){ |
|
318 | + public function set_billing_form($form) { |
|
319 | 319 | $this->_billing_form = $form; |
320 | 320 | } |
321 | 321 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * Returns whether or not this payment method requires HTTPS to be used |
326 | 326 | * @return boolean |
327 | 327 | */ |
328 | - function requires_https(){ |
|
328 | + function requires_https() { |
|
329 | 329 | return $this->_requires_https; |
330 | 330 | } |
331 | 331 | |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | * @return EE_Payment |
344 | 344 | * @throws EE_Error |
345 | 345 | */ |
346 | - function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){ |
|
346 | + function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) { |
|
347 | 347 | // @todo: add surcharge for the payment method, if any |
348 | - if ( $this->_gateway ) { |
|
348 | + if ($this->_gateway) { |
|
349 | 349 | //there is a gateway, so we're going to make a payment object |
350 | 350 | //but wait! do they already have a payment in progress that we thought was failed? |
351 | 351 | $duplicate_properties = array( |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
357 | 357 | 'PAY_gateway_response' => null, |
358 | 358 | ); |
359 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
359 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
360 | 360 | //if we didn't already have a payment in progress for the same thing, |
361 | 361 | //then we actually want to make a new payment |
362 | - if ( ! $payment instanceof EE_Payment ){ |
|
362 | + if ( ! $payment instanceof EE_Payment) { |
|
363 | 363 | $payment = EE_Payment::new_instance( |
364 | 364 | array_merge( |
365 | 365 | $duplicate_properties, |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | } |
376 | 376 | //make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it |
377 | 377 | $payment->save(); |
378 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
378 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
379 | 379 | |
380 | 380 | // Offsite Gateway |
381 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
381 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
382 | 382 | |
383 | 383 | $payment = $this->_gateway->set_redirection_info( |
384 | 384 | $payment, |
@@ -394,17 +394,17 @@ discard block |
||
394 | 394 | ); |
395 | 395 | $payment->save(); |
396 | 396 | // Onsite Gateway |
397 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
397 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
398 | 398 | |
399 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
399 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
400 | 400 | $payment->save(); |
401 | 401 | |
402 | 402 | } else { |
403 | 403 | throw new EE_Error( |
404 | 404 | sprintf( |
405 | - __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ), |
|
405 | + __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'), |
|
406 | 406 | get_class($this), |
407 | - gettype( $this->_gateway ) |
|
407 | + gettype($this->_gateway) |
|
408 | 408 | ) |
409 | 409 | ); |
410 | 410 | } |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // if there is billing info, clean it and save it now |
429 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
430 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
429 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
430 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | return $payment; |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | * @param EE_Billing_Info_Form $billing_form |
441 | 441 | * @return array |
442 | 442 | */ |
443 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
444 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
445 | - return $billing_form->input_pretty_values( true ); |
|
446 | - }else{ |
|
443 | + protected function _get_billing_values_from_form($billing_form) { |
|
444 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
445 | + return $billing_form->input_pretty_values(true); |
|
446 | + } else { |
|
447 | 447 | return NULL; |
448 | 448 | } |
449 | 449 | } |
@@ -457,13 +457,13 @@ discard block |
||
457 | 457 | * @return EE_Payment |
458 | 458 | * @throws EE_Error |
459 | 459 | */ |
460 | - public function handle_ipn($req_data,$transaction){ |
|
460 | + public function handle_ipn($req_data, $transaction) { |
|
461 | 461 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
462 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
463 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
462 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
463 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
464 | 464 | |
465 | 465 | } |
466 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
466 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
467 | 467 | return $payment; |
468 | 468 | } |
469 | 469 | |
@@ -476,22 +476,22 @@ discard block |
||
476 | 476 | * @param EE_Transaction $transaction |
477 | 477 | * @return boolean success |
478 | 478 | */ |
479 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
480 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
479 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
480 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
481 | 481 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
482 | 482 | return false; |
483 | 483 | } |
484 | 484 | $primary_reg = $transaction->primary_registration(); |
485 | - if( ! $primary_reg ){ |
|
485 | + if ( ! $primary_reg) { |
|
486 | 486 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
487 | 487 | return false; |
488 | 488 | } |
489 | 489 | $attendee = $primary_reg->attendee(); |
490 | - if( ! $attendee ){ |
|
490 | + if ( ! $attendee) { |
|
491 | 491 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
492 | 492 | return false; |
493 | 493 | } |
494 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
494 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
495 | 495 | |
496 | 496 | } |
497 | 497 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | * @param array $req_data |
505 | 505 | * @return EE_Payment |
506 | 506 | */ |
507 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
507 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
508 | 508 | return $transaction->last_payment(); |
509 | 509 | } |
510 | 510 | |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
522 | 522 | * @throws EE_Error |
523 | 523 | */ |
524 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
525 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
524 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
525 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * @param EE_Transaction $transaction |
539 | 539 | * @return EE_Payment |
540 | 540 | */ |
541 | - public function finalize_payment_for($transaction){ |
|
541 | + public function finalize_payment_for($transaction) { |
|
542 | 542 | return $transaction->last_payment(); |
543 | 543 | } |
544 | 544 | |
@@ -548,10 +548,10 @@ discard block |
||
548 | 548 | * Whether or not this payment method's gateway supports sending refund requests |
549 | 549 | * @return boolean |
550 | 550 | */ |
551 | - public function supports_sending_refunds(){ |
|
552 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
551 | + public function supports_sending_refunds() { |
|
552 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
553 | 553 | return $this->_gateway->supports_sending_refunds(); |
554 | - }else{ |
|
554 | + } else { |
|
555 | 555 | return false; |
556 | 556 | } |
557 | 557 | } |
@@ -565,14 +565,14 @@ discard block |
||
565 | 565 | * @throws EE_Error |
566 | 566 | * @return EE_Payment |
567 | 567 | */ |
568 | - public function process_refund( EE_Payment $payment, $refund_info = array()){ |
|
569 | - if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) { |
|
570 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
568 | + public function process_refund(EE_Payment $payment, $refund_info = array()) { |
|
569 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
570 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
571 | 571 | } else { |
572 | 572 | throw new EE_Error( |
573 | 573 | sprintf( |
574 | - __( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ), |
|
575 | - get_class( $this ) |
|
574 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
575 | + get_class($this) |
|
576 | 576 | ) |
577 | 577 | ); |
578 | 578 | } |
@@ -586,15 +586,15 @@ discard block |
||
586 | 586 | * @return string |
587 | 587 | * @throws EE_Error |
588 | 588 | */ |
589 | - public function payment_occurs(){ |
|
590 | - if( ! $this->_gateway){ |
|
589 | + public function payment_occurs() { |
|
590 | + if ( ! $this->_gateway) { |
|
591 | 591 | return EE_PMT_Base::offline; |
592 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
592 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
593 | 593 | return EE_PMT_Base::onsite; |
594 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
594 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
595 | 595 | return EE_PMT_Base::offsite; |
596 | - }else{ |
|
597 | - throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
|
596 | + } else { |
|
597 | + throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this))); |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | |
@@ -607,8 +607,8 @@ discard block |
||
607 | 607 | * @param EE_Payment $payment |
608 | 608 | * @return string |
609 | 609 | */ |
610 | - public function payment_overview_content(EE_Payment $payment){ |
|
611 | - return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true); |
|
610 | + public function payment_overview_content(EE_Payment $payment) { |
|
611 | + return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * @type array $template_args any arguments you want passed to the template file while rendering. |
622 | 622 | * Keys will be variable names and values with be their values. |
623 | 623 | */ |
624 | - public function help_tabs_config(){ |
|
624 | + public function help_tabs_config() { |
|
625 | 625 | return array(); |
626 | 626 | } |
627 | 627 | |
@@ -632,9 +632,9 @@ discard block |
||
632 | 632 | * the payment method's table's PMT_type column) |
633 | 633 | * @return string |
634 | 634 | */ |
635 | - public function system_name(){ |
|
635 | + public function system_name() { |
|
636 | 636 | $classname = get_class($this); |
637 | - return str_replace("EE_PMT_",'',$classname); |
|
637 | + return str_replace("EE_PMT_", '', $classname); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | * A pretty i18n version of the PMT name |
644 | 644 | * @return string |
645 | 645 | */ |
646 | - public function pretty_name(){ |
|
646 | + public function pretty_name() { |
|
647 | 647 | return $this->_pretty_name; |
648 | 648 | } |
649 | 649 | |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * Gets the default absolute URL to the payment method type's button |
654 | 654 | * @return string |
655 | 655 | */ |
656 | - public function default_button_url(){ |
|
656 | + public function default_button_url() { |
|
657 | 657 | return $this->_default_button_url; |
658 | 658 | } |
659 | 659 | |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | * Gets the gateway used by this payment method (if any) |
664 | 664 | * @return EE_Gateway |
665 | 665 | */ |
666 | - public function get_gateway(){ |
|
666 | + public function get_gateway() { |
|
667 | 667 | return $this->_gateway; |
668 | 668 | } |
669 | 669 | |
@@ -672,8 +672,8 @@ discard block |
||
672 | 672 | /** |
673 | 673 | * @return string html for the link to a help tab |
674 | 674 | */ |
675 | - public function get_help_tab_link(){ |
|
676 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
675 | + public function get_help_tab_link() { |
|
676 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | * Returns the name of the help tab for this PMT |
683 | 683 | * @return string |
684 | 684 | */ |
685 | - public function get_help_tab_name(){ |
|
686 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
685 | + public function get_help_tab_name() { |
|
686 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | /** |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | * this PMT by an admin |
692 | 692 | * @return string |
693 | 693 | */ |
694 | - public function cap_name(){ |
|
695 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
694 | + public function cap_name() { |
|
695 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | /** |
@@ -704,9 +704,9 @@ discard block |
||
704 | 704 | * @param EE_Payment $payment |
705 | 705 | * @return void |
706 | 706 | */ |
707 | - public function update_txn_based_on_payment( $payment ){ |
|
708 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
709 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
707 | + public function update_txn_based_on_payment($payment) { |
|
708 | + if ($this->_gateway instanceof EE_Gateway) { |
|
709 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | * @return string |
722 | 722 | */ |
723 | 723 | public function introductory_html() { |
724 | - return EEH_Template::locate_template( $this->file_folder() . 'templates' . DS . strtolower( $this->system_name() ) . '_intro.template.php', array( 'pmt_obj' => $this, 'pm_instance' => $this->_pm_instance ) ); |
|
724 | + return EEH_Template::locate_template($this->file_folder().'templates'.DS.strtolower($this->system_name()).'_intro.template.php', array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance)); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | protected function _setup_data() { |
29 | - $this->_data = $this->_get_messages( $this->_per_page, $this->_view ); |
|
30 | - $this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true ); |
|
29 | + $this->_data = $this->_get_messages($this->_per_page, $this->_view); |
|
30 | + $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,32 +35,32 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function _set_properties() { |
37 | 37 | $this->_wp_list_args = array( |
38 | - 'singular' => __( 'Message', 'event_espresso' ), |
|
39 | - 'plural' => __( 'Messages', 'event_espresso' ), |
|
38 | + 'singular' => __('Message', 'event_espresso'), |
|
39 | + 'plural' => __('Messages', 'event_espresso'), |
|
40 | 40 | 'ajax' => true, |
41 | 41 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
42 | 42 | ); |
43 | 43 | |
44 | 44 | $this->_columns = array( |
45 | 45 | 'cb' => '<input type="checkbox" />', |
46 | - 'to' => __( 'To', 'event_espresso' ), |
|
47 | - 'from' => __( 'From', 'event_espresso' ), |
|
48 | - 'messenger' => __( 'Messenger', 'event_espresso' ), |
|
49 | - 'message_type' => __( 'Message Type', 'event_espresso' ), |
|
50 | - 'context' => __( 'Context', 'event_espresso' ), |
|
51 | - 'modified' => __( 'Modified', 'event_espresso' ), |
|
52 | - 'action' => __( 'Actions', 'event_espresso' ), |
|
53 | - 'msg_id' => __( 'ID', 'event_espresso' ), |
|
46 | + 'to' => __('To', 'event_espresso'), |
|
47 | + 'from' => __('From', 'event_espresso'), |
|
48 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
49 | + 'message_type' => __('Message Type', 'event_espresso'), |
|
50 | + 'context' => __('Context', 'event_espresso'), |
|
51 | + 'modified' => __('Modified', 'event_espresso'), |
|
52 | + 'action' => __('Actions', 'event_espresso'), |
|
53 | + 'msg_id' => __('ID', 'event_espresso'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->_sortable_columns = array( |
57 | - 'modified' => array( 'MSG_modified' => true ), |
|
58 | - 'message_type' => array( 'MSG_message_type' => false ), |
|
59 | - 'messenger' => array( 'MSG_messenger' => false ), |
|
60 | - 'to' => array( 'MSG_to' => false ), |
|
61 | - 'from' => array( 'MSG_from' => false ), |
|
62 | - 'context' => array( 'MSG_context' => false ), |
|
63 | - 'msg_id' => array( 'MSG_ID', false ), |
|
57 | + 'modified' => array('MSG_modified' => true), |
|
58 | + 'message_type' => array('MSG_message_type' => false), |
|
59 | + 'messenger' => array('MSG_messenger' => false), |
|
60 | + 'to' => array('MSG_to' => false), |
|
61 | + 'from' => array('MSG_from' => false), |
|
62 | + 'context' => array('MSG_context' => false), |
|
63 | + 'msg_id' => array('MSG_ID', false), |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_primary_column = 'to'; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param object $item the current item |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - protected function _get_row_class( $item ) { |
|
82 | - $class = parent::_get_row_class( $item ); |
|
81 | + protected function _get_row_class($item) { |
|
82 | + $class = parent::_get_row_class($item); |
|
83 | 83 | //add status class |
84 | - $class .= ' ee-status-strip msg-status-' . $item->STS_ID(); |
|
85 | - if ( $this->_has_checkbox_column ) { |
|
84 | + $class .= ' ee-status-strip msg-status-'.$item->STS_ID(); |
|
85 | + if ($this->_has_checkbox_column) { |
|
86 | 86 | $class .= ' has-checkbox-column'; |
87 | 87 | } |
88 | 88 | return $class; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function _get_table_filters() { |
103 | 103 | $filters = array(); |
104 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
104 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
105 | 105 | //setup messengers for selects |
106 | 106 | $m_values = $this->get_admin_page()->get_messengers_for_list_table(); |
107 | 107 | //lets do the same for message types |
@@ -110,88 +110,88 @@ discard block |
||
110 | 110 | $contexts = $this->get_admin_page()->get_contexts_for_message_types_for_list_table(); |
111 | 111 | $i = 1; |
112 | 112 | $labels = $c_values = array(); |
113 | - foreach ( $contexts as $context => $label ) { |
|
113 | + foreach ($contexts as $context => $label) { |
|
114 | 114 | //some message types may have the same label for a different context, so we're grouping these together so the end user |
115 | 115 | //doesn't get confused. |
116 | - if ( isset( $labels[ $label ] ) ) { |
|
117 | - $c_values[ $labels[ $label ] ]['id'] .= ',' . $context; |
|
116 | + if (isset($labels[$label])) { |
|
117 | + $c_values[$labels[$label]]['id'] .= ','.$context; |
|
118 | 118 | continue; |
119 | 119 | } |
120 | - $c_values[ $i ]['id'] = $context; |
|
121 | - $c_values[ $i ]['text'] = $label; |
|
122 | - $labels[ $label ] = $i; |
|
120 | + $c_values[$i]['id'] = $context; |
|
121 | + $c_values[$i]['text'] = $label; |
|
122 | + $labels[$label] = $i; |
|
123 | 123 | $i++; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $msgr_default[0] = array( |
127 | 127 | 'id' => 'none_selected', |
128 | - 'text' => __( 'All Messengers', 'event_espresso' ) |
|
128 | + 'text' => __('All Messengers', 'event_espresso') |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $mt_default[0] = array( |
132 | 132 | 'id' => 'none_selected', |
133 | - 'text' => __( 'All Message Types', 'event_espresso' ) |
|
133 | + 'text' => __('All Message Types', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | $c_default[0] = array( |
137 | 137 | 'id' => 'none_selected', |
138 | - 'text' => __( 'All Contexts', 'event_espresso' ) |
|
138 | + 'text' => __('All Contexts', 'event_espresso') |
|
139 | 139 | ); |
140 | 140 | |
141 | - $msgr_filters = count( $m_values ) > 1 |
|
142 | - ? array_merge( $msgr_default, $m_values ) |
|
141 | + $msgr_filters = count($m_values) > 1 |
|
142 | + ? array_merge($msgr_default, $m_values) |
|
143 | 143 | : $m_values; |
144 | - $mt_filters = ! empty( $mt_values ) && count( $mt_values ) > 1 |
|
145 | - ? array_merge( $mt_default, $mt_values ) |
|
144 | + $mt_filters = ! empty($mt_values) && count($mt_values) > 1 |
|
145 | + ? array_merge($mt_default, $mt_values) |
|
146 | 146 | : (array) $mt_values; |
147 | - $c_filters = ! empty( $c_values ) && count( $c_values ) > 1 |
|
148 | - ? array_merge( $c_default, $c_values ) |
|
147 | + $c_filters = ! empty($c_values) && count($c_values) > 1 |
|
148 | + ? array_merge($c_default, $c_values) |
|
149 | 149 | : (array) $c_values; |
150 | 150 | |
151 | - if ( empty( $msgr_filters ) ) { |
|
151 | + if (empty($msgr_filters)) { |
|
152 | 152 | $msgr_filters[0] = array( |
153 | 153 | 'id' => 'none_selected', |
154 | - 'text' => __( 'No Messengers active', 'event_espresso' ) |
|
154 | + 'text' => __('No Messengers active', 'event_espresso') |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | - if ( empty( $mt_filters ) ) { |
|
158 | + if (empty($mt_filters)) { |
|
159 | 159 | $mt_filters[0] = array( |
160 | 160 | 'id' => 'none_selected', |
161 | - 'text' => __( 'No Message Types active', 'event_espresso' ) |
|
161 | + 'text' => __('No Message Types active', 'event_espresso') |
|
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - if ( empty( $c_filters ) ) { |
|
165 | + if (empty($c_filters)) { |
|
166 | 166 | $c_filters[0] = array( |
167 | 167 | 'id' => 'none_selected', |
168 | - 'text' => __( 'No Contexts (because no message types active)', 'event_espresso' ) |
|
168 | + 'text' => __('No Contexts (because no message types active)', 'event_espresso') |
|
169 | 169 | ); |
170 | 170 | } |
171 | 171 | |
172 | - if ( count ( $msgr_filters ) > 1 ) { |
|
172 | + if (count($msgr_filters) > 1) { |
|
173 | 173 | $filters[] = EEH_Form_Fields::select_input( |
174 | 174 | 'ee_messenger_filter_by', |
175 | - array_values( $msgr_filters ), |
|
176 | - isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
177 | - ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) |
|
175 | + array_values($msgr_filters), |
|
176 | + isset($this->_req_data['ee_messenger_filter_by']) |
|
177 | + ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
178 | 178 | : '' |
179 | 179 | ); |
180 | 180 | } |
181 | - if ( count( $mt_filters ) > 1 ) { |
|
181 | + if (count($mt_filters) > 1) { |
|
182 | 182 | $filters[] = EEH_Form_Fields::select_input( |
183 | 183 | 'ee_message_type_filter_by', |
184 | - array_values( $mt_filters ), |
|
185 | - isset( $this->_req_data['ee_message_type_filter_by'] ) ? sanitize_title( |
|
184 | + array_values($mt_filters), |
|
185 | + isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_title( |
|
186 | 186 | $this->_req_data['ee_message_type_filter_by'] |
187 | 187 | ) : '' |
188 | 188 | ); |
189 | 189 | } |
190 | - if ( count( $c_filters ) > 1 ) { |
|
190 | + if (count($c_filters) > 1) { |
|
191 | 191 | $filters[] = EEH_Form_Fields::select_input( |
192 | 192 | 'ee_context_filter_by', |
193 | - array_values( $c_filters ), |
|
194 | - isset( $this->_req_data['ee_context_filter_by'] ) ? sanitize_text_field( |
|
193 | + array_values($c_filters), |
|
194 | + isset($this->_req_data['ee_context_filter_by']) ? sanitize_text_field( |
|
195 | 195 | $this->_req_data['ee_context_filter_by'] |
196 | 196 | ) : '' |
197 | 197 | ); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | |
204 | 204 | protected function _add_view_counts() { |
205 | - foreach ( $this->_views as $view => $args ) { |
|
206 | - $this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true ); |
|
205 | + foreach ($this->_views as $view => $args) { |
|
206 | + $this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return string checkbox |
215 | 215 | * @throws \EE_Error |
216 | 216 | */ |
217 | - public function column_cb( $message ) { |
|
218 | - return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() ); |
|
217 | + public function column_cb($message) { |
|
218 | + return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @return string |
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | - public function column_msg_id( EE_Message $message ) { |
|
228 | + public function column_msg_id(EE_Message $message) { |
|
229 | 229 | return $message->ID(); |
230 | 230 | } |
231 | 231 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @return string The recipient of the message |
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | - public function column_to( EE_Message $message ) { |
|
240 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
239 | + public function column_to(EE_Message $message) { |
|
240 | + EE_Registry::instance()->load_helper('URL'); |
|
241 | 241 | $actions = array(); |
242 | 242 | $actions['delete'] = '<a href="' |
243 | 243 | . EEH_URL::add_query_args_and_nonce( |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | 'action' => 'delete_ee_message', |
247 | 247 | 'MSG_ID' => $message->ID() |
248 | 248 | ), |
249 | - admin_url( 'admin.php' ) |
|
249 | + admin_url('admin.php') |
|
250 | 250 | ) |
251 | - . '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
252 | - return $message->to() . $this->row_actions( $actions ); |
|
251 | + . '">'.__('Delete', 'event_espresso').'</a>'; |
|
252 | + return $message->to().$this->row_actions($actions); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param EE_Message $message |
258 | 258 | * @return string The sender of the message |
259 | 259 | */ |
260 | - public function column_from( EE_Message $message ) { |
|
260 | + public function column_from(EE_Message $message) { |
|
261 | 261 | return $message->from(); |
262 | 262 | } |
263 | 263 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param EE_Message $message |
268 | 268 | * @return string The messenger used to send the message. |
269 | 269 | */ |
270 | - public function column_messenger( EE_Message $message ) { |
|
271 | - return ucwords( $message->messenger_label() ); |
|
270 | + public function column_messenger(EE_Message $message) { |
|
271 | + return ucwords($message->messenger_label()); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | * @param EE_Message $message |
277 | 277 | * @return string The message type used to generate the message. |
278 | 278 | */ |
279 | - public function column_message_type( EE_Message $message ) { |
|
280 | - return ucwords( $message->message_type_label() ); |
|
279 | + public function column_message_type(EE_Message $message) { |
|
280 | + return ucwords($message->message_type_label()); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param EE_Message $message |
286 | 286 | * @return string The context the message was generated for. |
287 | 287 | */ |
288 | - public function column_context( EE_Message $message ) { |
|
288 | + public function column_context(EE_Message $message) { |
|
289 | 289 | return $message->context_label(); |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param EE_Message $message |
295 | 295 | * @return string The timestamp when this message was last modified. |
296 | 296 | */ |
297 | - public function column_modified( EE_Message $message ) { |
|
297 | + public function column_modified(EE_Message $message) { |
|
298 | 298 | return $message->modified(); |
299 | 299 | } |
300 | 300 | |
@@ -303,36 +303,36 @@ discard block |
||
303 | 303 | * @param EE_Message $message |
304 | 304 | * @return string Actions that can be done on the current message. |
305 | 305 | */ |
306 | - public function column_action( EE_Message $message ) { |
|
307 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
306 | + public function column_action(EE_Message $message) { |
|
307 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
308 | 308 | $action_links = array( |
309 | - 'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ), |
|
310 | - 'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ), |
|
311 | - 'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ), |
|
312 | - 'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ), |
|
313 | - 'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ), |
|
314 | - 'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ), |
|
309 | + 'view' => EEH_MSG_Template::get_message_action_link('view', $message), |
|
310 | + 'error' => EEH_MSG_Template::get_message_action_link('error', $message), |
|
311 | + 'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message), |
|
312 | + 'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message), |
|
313 | + 'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message), |
|
314 | + 'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message), |
|
315 | 315 | ); |
316 | 316 | $content = ''; |
317 | - switch ( $message->STS_ID() ) { |
|
317 | + switch ($message->STS_ID()) { |
|
318 | 318 | case EEM_Message::status_sent : |
319 | - $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction']; |
|
319 | + $content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction']; |
|
320 | 320 | break; |
321 | 321 | case EEM_Message::status_resend : |
322 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
322 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
323 | 323 | break; |
324 | 324 | case EEM_Message::status_retry : |
325 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction']; |
|
325 | + $content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction']; |
|
326 | 326 | break; |
327 | 327 | case EEM_Message::status_failed : |
328 | 328 | case EEM_Message::status_debug_only : |
329 | - $content = $action_links['error'] . $action_links['view_transaction']; |
|
329 | + $content = $action_links['error'].$action_links['view_transaction']; |
|
330 | 330 | break; |
331 | 331 | case EEM_Message::status_idle : |
332 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
332 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
333 | 333 | break; |
334 | 334 | case EEM_Message::status_incomplete; |
335 | - $content = $action_links['generate_now'] . $action_links['view_transaction']; |
|
335 | + $content = $action_links['generate_now'].$action_links['view_transaction']; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | return $content; |
@@ -350,54 +350,54 @@ discard block |
||
350 | 350 | * @return int | EE_Message[] |
351 | 351 | * @throws \EE_Error |
352 | 352 | */ |
353 | - protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) { |
|
353 | + protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) { |
|
354 | 354 | |
355 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
355 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
356 | 356 | ? $this->_req_data['paged'] |
357 | 357 | : 1; |
358 | 358 | |
359 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
359 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
360 | 360 | ? $this->_req_data['perpage'] |
361 | 361 | : $perpage; |
362 | 362 | |
363 | - $offset = ( $current_page - 1 ) * $per_page; |
|
364 | - $limit = $all || $count ? null : array( $offset, $per_page ); |
|
363 | + $offset = ($current_page - 1) * $per_page; |
|
364 | + $limit = $all || $count ? null : array($offset, $per_page); |
|
365 | 365 | $query_params = array( |
366 | - 'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ], |
|
367 | - 'order' => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ], |
|
366 | + 'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'], |
|
367 | + 'order' => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'], |
|
368 | 368 | 'limit' => $limit, |
369 | 369 | ); |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Any filters coming in from other routes? |
373 | 373 | */ |
374 | - if ( isset( $this->_req_data['filterby'] ) ) { |
|
375 | - $query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() ); |
|
376 | - if ( ! $count ) { |
|
374 | + if (isset($this->_req_data['filterby'])) { |
|
375 | + $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params()); |
|
376 | + if ( ! $count) { |
|
377 | 377 | $query_params['group_by'] = 'MSG_ID'; |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | 381 | //view conditionals |
382 | - if ( $view !== 'all' && $count && $all ) { |
|
382 | + if ($view !== 'all' && $count && $all) { |
|
383 | 383 | $query_params[0]['AND*view_conditional'] = array( |
384 | - 'STS_ID' => strtoupper( $view ), |
|
384 | + 'STS_ID' => strtoupper($view), |
|
385 | 385 | ); |
386 | 386 | } |
387 | 387 | |
388 | - if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) { |
|
388 | + if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') { |
|
389 | 389 | $query_params[0]['AND*view_conditional'] = array( |
390 | - 'STS_ID' => strtoupper( $this->_req_data['status'] ), |
|
390 | + 'STS_ID' => strtoupper($this->_req_data['status']), |
|
391 | 391 | ); |
392 | 392 | } |
393 | 393 | |
394 | - if ( ! $all && ! empty( $this->_req_data['s'] ) ) { |
|
395 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
394 | + if ( ! $all && ! empty($this->_req_data['s'])) { |
|
395 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
396 | 396 | $query_params[0]['OR'] = array( |
397 | - 'MSG_to' => array( 'LIKE', $search_string ), |
|
398 | - 'MSG_from' => array( 'LIKE', $search_string ), |
|
399 | - 'MSG_subject' => array( 'LIKE', $search_string ), |
|
400 | - 'MSG_content' => array( 'LIKE', $search_string ), |
|
397 | + 'MSG_to' => array('LIKE', $search_string), |
|
398 | + 'MSG_from' => array('LIKE', $search_string), |
|
399 | + 'MSG_subject' => array('LIKE', $search_string), |
|
400 | + 'MSG_content' => array('LIKE', $search_string), |
|
401 | 401 | ); |
402 | 402 | } |
403 | 403 | |
@@ -405,16 +405,16 @@ discard block |
||
405 | 405 | //the messages system is in debug mode. |
406 | 406 | //Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only |
407 | 407 | //messages in the database. |
408 | - if ( ! EEM_Message::debug() ) { |
|
408 | + if ( ! EEM_Message::debug()) { |
|
409 | 409 | $query_params[0]['AND*debug_only_conditional'] = array( |
410 | - 'STS_ID' => array( '!=', EEM_Message::status_debug_only ) |
|
410 | + 'STS_ID' => array('!=', EEM_Message::status_debug_only) |
|
411 | 411 | ); |
412 | 412 | } |
413 | 413 | |
414 | 414 | //account for filters |
415 | 415 | if ( |
416 | 416 | ! $all |
417 | - && isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
417 | + && isset($this->_req_data['ee_messenger_filter_by']) |
|
418 | 418 | && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected' |
419 | 419 | ) { |
420 | 420 | $query_params[0]['AND*messenger_filter'] = array( |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | } |
424 | 424 | if ( |
425 | 425 | ! $all |
426 | - && ! empty( $this->_req_data['ee_message_type_filter_by'] ) |
|
426 | + && ! empty($this->_req_data['ee_message_type_filter_by']) |
|
427 | 427 | && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected' |
428 | 428 | ) { |
429 | 429 | $query_params[0]['AND*message_type_filter'] = array( |
@@ -433,17 +433,17 @@ discard block |
||
433 | 433 | |
434 | 434 | if ( |
435 | 435 | ! $all |
436 | - && ! empty( $this->_req_data['ee_context_filter_by'] ) |
|
436 | + && ! empty($this->_req_data['ee_context_filter_by']) |
|
437 | 437 | && $this->_req_data['ee_context_filter_by'] !== 'none_selected' |
438 | 438 | ) { |
439 | 439 | $query_params[0]['AND*context_filter'] = array( |
440 | - 'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) ) |
|
440 | + 'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])) |
|
441 | 441 | ); |
442 | 442 | } |
443 | 443 | |
444 | 444 | return $count |
445 | - ? EEM_Message::instance()->count( $query_params, null, true ) |
|
446 | - : EEM_Message::instance()->get_all( $query_params ); |
|
445 | + ? EEM_Message::instance()->count($query_params, null, true) |
|
446 | + : EEM_Message::instance()->get_all($query_params); |
|
447 | 447 | |
448 | 448 | } |
449 | 449 | } //end EE_Message_List_Table class |
450 | 450 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
45 | 45 | * @return \Payments_Admin_Page |
46 | 46 | */ |
47 | - public function __construct( $routing = TRUE ) { |
|
48 | - parent::__construct( $routing ); |
|
47 | + public function __construct($routing = TRUE) { |
|
48 | + parent::__construct($routing); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | protected function _set_page_config() { |
131 | 131 | $payment_method_list_config = array( |
132 | 132 | 'nav' => array( |
133 | - 'label' => __( 'Payment Methods', 'event_espresso' ), |
|
133 | + 'label' => __('Payment Methods', 'event_espresso'), |
|
134 | 134 | 'order' => 10 |
135 | 135 | ), |
136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes, |
137 | 137 | 'help_tabs' => array_merge( |
138 | 138 | array( |
139 | 139 | 'payment_methods_overview_help_tab' => array( |
140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ), |
|
140 | + 'title' => __('Payment Methods Overview', 'event_espresso'), |
|
141 | 141 | 'filename' => 'payment_methods_overview' |
142 | 142 | ) |
143 | 143 | ), |
144 | 144 | $this->_add_payment_method_help_tabs() ), |
145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ), |
|
145 | + 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
146 | 146 | 'require_nonce' => false |
147 | 147 | ); |
148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ) |
161 | 161 | ), |
162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'payment_log'=>array( |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _add_payment_method_help_tabs(){ |
|
182 | + protected function _add_payment_method_help_tabs() { |
|
183 | 183 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
185 | 185 | $all_pmt_help_tabs_config = array(); |
186 | - foreach( $payment_method_types as $payment_method_type ){ |
|
187 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
186 | + foreach ($payment_method_types as $payment_method_type) { |
|
187 | + if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { |
|
188 | 188 | continue; |
189 | 189 | } |
190 | - foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ |
|
191 | - $template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array(); |
|
192 | - $template_args[ 'admin_page_obj' ] = $this; |
|
190 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
191 | + $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
|
192 | + $template_args['admin_page_obj'] = $this; |
|
193 | 193 | $all_pmt_help_tabs_config[$help_tab_name] = array( |
194 | 194 | 'title'=>$config['title'], |
195 | 195 | 'content'=>EEH_Template::display_template( |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | public function load_scripts_styles() { |
219 | - wp_enqueue_script( 'ee_admin_js' ); |
|
220 | - wp_enqueue_script( 'ee-text-links' ); |
|
221 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
219 | + wp_enqueue_script('ee_admin_js'); |
|
220 | + wp_enqueue_script('ee-text-links'); |
|
221 | + wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | |
228 | 228 | public function load_scripts_styles_default() { |
229 | 229 | //styles |
230 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION ); |
|
231 | - wp_enqueue_style( 'espresso_payments' ); |
|
232 | - wp_enqueue_style( 'ee-text-links' ); |
|
230 | + wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); |
|
231 | + wp_enqueue_style('espresso_payments'); |
|
232 | + wp_enqueue_style('ee-text-links'); |
|
233 | 233 | //scripts |
234 | 234 | } |
235 | 235 | |
@@ -243,44 +243,44 @@ discard block |
||
243 | 243 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a |
244 | 244 | * recheck here. |
245 | 245 | */ |
246 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
246 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
247 | 247 | EEM_Payment_Method::instance()->verify_button_urls(); |
248 | 248 | //setup tabs, one for each payment method type |
249 | 249 | $tabs = array(); |
250 | 250 | $payment_methods = array(); |
251 | - foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { |
|
251 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
252 | 252 | // we don't want to show admin-only PMTs for now |
253 | - if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { |
|
253 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | //check access |
257 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
257 | + if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { |
|
258 | 258 | continue; |
259 | 259 | } |
260 | 260 | //check for any active pms of that type |
261 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() ); |
|
262 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
261 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
262 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
263 | 263 | $payment_method = EE_Payment_Method::new_instance( |
264 | 264 | array( |
265 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ), |
|
265 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()), |
|
266 | 266 | 'PMD_type' =>$pmt_obj->system_name(), |
267 | 267 | 'PMD_name' =>$pmt_obj->pretty_name(), |
268 | 268 | 'PMD_admin_name' =>$pmt_obj->pretty_name() |
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | } |
272 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
272 | + $payment_methods[$payment_method->slug()] = $payment_method; |
|
273 | 273 | } |
274 | - $payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods ); |
|
275 | - foreach( $payment_methods as $payment_method ) { |
|
276 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
274 | + $payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods); |
|
275 | + foreach ($payment_methods as $payment_method) { |
|
276 | + if ($payment_method instanceof EE_Payment_Method) { |
|
277 | 277 | add_meta_box( |
278 | 278 | //html id |
279 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
279 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
280 | 280 | //title |
281 | - sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
281 | + sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
282 | 282 | //callback |
283 | - array( $this, 'payment_method_settings_meta_box' ), |
|
283 | + array($this, 'payment_method_settings_meta_box'), |
|
284 | 284 | //post type |
285 | 285 | null, |
286 | 286 | //context |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | //priority |
289 | 289 | 'default', |
290 | 290 | //callback args |
291 | - array( 'payment_method' => $payment_method ) |
|
291 | + array('payment_method' => $payment_method) |
|
292 | 292 | ); |
293 | 293 | //setup for tabbed content |
294 | - $tabs[ $payment_method->slug() ] = array( |
|
294 | + $tabs[$payment_method->slug()] = array( |
|
295 | 295 | 'label' => $payment_method->admin_name(), |
296 | 296 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
297 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
298 | - 'title' => __( 'Modify this Payment Method', 'event_espresso' ), |
|
297 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
298 | + 'title' => __('Modify this Payment Method', 'event_espresso'), |
|
299 | 299 | 'slug' => $payment_method->slug() |
300 | 300 | ); |
301 | 301 | } |
302 | 302 | } |
303 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() ); |
|
303 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); |
|
304 | 304 | $this->display_admin_page_with_sidebar(); |
305 | 305 | |
306 | 306 | } |
@@ -311,20 +311,20 @@ discard block |
||
311 | 311 | * _get_active_payment_method_slug |
312 | 312 | * @return string |
313 | 313 | */ |
314 | - protected function _get_active_payment_method_slug(){ |
|
314 | + protected function _get_active_payment_method_slug() { |
|
315 | 315 | $payment_method_slug = FALSE; |
316 | 316 | //decide which payment method tab to open first, as dictated by the request's 'payment_method' |
317 | - if ( isset( $this->_req_data['payment_method'] )) { |
|
317 | + if (isset($this->_req_data['payment_method'])) { |
|
318 | 318 | // if they provided the current payment method, use it |
319 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] ); |
|
319 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
320 | 320 | } |
321 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug ))); |
|
321 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
322 | 322 | // if that didn't work or wasn't provided, find another way to select the current pm |
323 | - if ( ! $this->_verify_payment_method( $payment_method )) { |
|
323 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
324 | 324 | // like, looking for an active one |
325 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' ); |
|
325 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
326 | 326 | // test that one as well |
327 | - if ( $this->_verify_payment_method( $payment_method )) { |
|
327 | + if ($this->_verify_payment_method($payment_method)) { |
|
328 | 328 | $payment_method_slug = $payment_method->slug(); |
329 | 329 | } else { |
330 | 330 | $payment_method_slug = 'paypal_standard'; |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | * @param \EE_Payment_Method $payment_method |
343 | 343 | * @return boolean |
344 | 344 | */ |
345 | - protected function _verify_payment_method( $payment_method ){ |
|
345 | + protected function _verify_payment_method($payment_method) { |
|
346 | 346 | if ( |
347 | 347 | $payment_method instanceof EE_Payment_Method && |
348 | 348 | $payment_method->type_obj() instanceof EE_PMT_Base && |
349 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' ) |
|
349 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access') |
|
350 | 350 | ) { |
351 | 351 | return TRUE; |
352 | 352 | } |
@@ -363,21 +363,21 @@ discard block |
||
363 | 363 | * @return string |
364 | 364 | * @throws EE_Error |
365 | 365 | */ |
366 | - public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ |
|
367 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL; |
|
368 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
369 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' ))); |
|
366 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { |
|
367 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL; |
|
368 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
369 | + throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); |
|
370 | 370 | } |
371 | 371 | $payment_method_scopes = $payment_method->active(); |
372 | 372 | // if the payment method really exists show its form, otherwise the activation template |
373 | - if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { |
|
374 | - $form = $this->_generate_payment_method_settings_form( $payment_method ); |
|
375 | - if ( $form->form_data_present_in( $this->_req_data )) { |
|
376 | - $form->receive_form_submission( $this->_req_data ); |
|
373 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
374 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
375 | + if ($form->form_data_present_in($this->_req_data)) { |
|
376 | + $form->receive_form_submission($this->_req_data); |
|
377 | 377 | } |
378 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); |
|
378 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); |
|
379 | 379 | } else { |
380 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js(); |
|
380 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
@@ -390,14 +390,14 @@ discard block |
||
390 | 390 | * @param \EE_Payment_Method $payment_method |
391 | 391 | * @return \EE_Form_Section_Proper |
392 | 392 | */ |
393 | - protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { |
|
394 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
393 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { |
|
394 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
395 | 395 | return new EE_Form_Section_Proper(); |
396 | 396 | } |
397 | 397 | return new EE_Form_Section_Proper( |
398 | 398 | array( |
399 | - 'name' => $payment_method->slug() . '_settings_form', |
|
400 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
399 | + 'name' => $payment_method->slug().'_settings_form', |
|
400 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
401 | 401 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
402 | 402 | array( |
403 | 403 | 'action' => 'update_payment_method', |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | 'subsections' => apply_filters( |
410 | 410 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
411 | 411 | array( |
412 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ), |
|
413 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ), |
|
414 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ), |
|
415 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ), |
|
416 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ), |
|
417 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print() |
|
412 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method), |
|
413 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method), |
|
414 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method), |
|
415 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method), |
|
416 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method), |
|
417 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print() |
|
418 | 418 | ), |
419 | 419 | $payment_method |
420 | 420 | ) |
@@ -431,19 +431,19 @@ discard block |
||
431 | 431 | * @param \EE_Payment_Method $payment_method |
432 | 432 | * @return \EE_Form_Section_Proper |
433 | 433 | */ |
434 | - protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
|
435 | - if ( $payment_method->type_obj()->requires_https() ) { |
|
434 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { |
|
435 | + if ($payment_method->type_obj()->requires_https()) { |
|
436 | 436 | return new EE_Form_Section_HTML( |
437 | 437 | EEH_HTML::tr( |
438 | 438 | EEH_HTML::th( |
439 | 439 | EEH_HTML::label( |
440 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
440 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
441 | 441 | ) |
442 | - ) . |
|
442 | + ). |
|
443 | 443 | EEH_HTML::td( |
444 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) . |
|
445 | - EEH_HTML::br() . |
|
446 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' )) |
|
444 | + EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). |
|
445 | + EEH_HTML::br(). |
|
446 | + __('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) |
|
447 | 447 | ) |
448 | 448 | ) |
449 | 449 | ); |
@@ -461,19 +461,19 @@ discard block |
||
461 | 461 | * @param \EE_Payment_Method $payment_method |
462 | 462 | * @return \EE_Form_Section_Proper |
463 | 463 | */ |
464 | - protected function _currency_support( EE_Payment_Method $payment_method ) { |
|
465 | - if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
|
464 | + protected function _currency_support(EE_Payment_Method $payment_method) { |
|
465 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
466 | 466 | return new EE_Form_Section_HTML( |
467 | 467 | EEH_HTML::tr( |
468 | 468 | EEH_HTML::th( |
469 | 469 | EEH_HTML::label( |
470 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
470 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
471 | 471 | ) |
472 | - ) . |
|
472 | + ). |
|
473 | 473 | EEH_HTML::td( |
474 | 474 | EEH_HTML::strong( |
475 | 475 | sprintf( |
476 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
476 | + __('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
477 | 477 | EE_Config::instance()->currency->code |
478 | 478 | ) |
479 | 479 | ) |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | * @param \EE_Payment_Method $payment_method |
494 | 494 | * @return \EE_Form_Section_HTML |
495 | 495 | */ |
496 | - protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
|
496 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) { |
|
497 | 497 | //modify the form so we only have/show fields that will be implemented for this version |
498 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() ); |
|
498 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * @return \EE_Payment_Method_Form |
509 | 509 | * @throws \EE_Error |
510 | 510 | */ |
511 | - protected function _simplify_form( $form_section, $payment_method_name = '' ){ |
|
512 | - if ( $form_section instanceof EE_Payment_Method_Form ) { |
|
511 | + protected function _simplify_form($form_section, $payment_method_name = '') { |
|
512 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
513 | 513 | $form_section->exclude( |
514 | 514 | array( |
515 | 515 | 'PMD_type', //dont want them changing the type |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | ); |
521 | 521 | return $form_section; |
522 | 522 | } else { |
523 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name )); |
|
523 | + throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
@@ -533,18 +533,18 @@ discard block |
||
533 | 533 | * @param \EE_Payment_Method $payment_method |
534 | 534 | * @return \EE_Form_Section_HTML |
535 | 535 | */ |
536 | - protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { |
|
536 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) { |
|
537 | 537 | $update_button = new EE_Submit_Input( |
538 | 538 | array( |
539 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
540 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
539 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
540 | + 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), |
|
541 | 541 | 'html_label' => EEH_HTML::nbsp() |
542 | 542 | ) |
543 | 543 | ); |
544 | 544 | return new EE_Form_Section_HTML( |
545 | - EEH_HTML::no_row( EEH_HTML::br(2) ) . |
|
545 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
546 | 546 | EEH_HTML::tr( |
547 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) . |
|
547 | + EEH_HTML::th(__('Update Settings', 'event_espresso')). |
|
548 | 548 | EEH_HTML::td( |
549 | 549 | $update_button->get_html_for_input() |
550 | 550 | ) |
@@ -561,11 +561,11 @@ discard block |
||
561 | 561 | * @param \EE_Payment_Method $payment_method |
562 | 562 | * @return \EE_Form_Section_Proper |
563 | 563 | */ |
564 | - protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
565 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
|
564 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { |
|
565 | + $link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); |
|
566 | 566 | return new EE_Form_Section_HTML( |
567 | 567 | EEH_HTML::tr( |
568 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) . |
|
568 | + EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). |
|
569 | 569 | EEH_HTML::td( |
570 | 570 | EEH_HTML::link( |
571 | 571 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | ), |
578 | 578 | $link_text_and_title, |
579 | 579 | $link_text_and_title, |
580 | - 'deactivate_' . $payment_method->slug(), |
|
580 | + 'deactivate_'.$payment_method->slug(), |
|
581 | 581 | 'espresso-button button-secondary' |
582 | 582 | ) |
583 | 583 | ) |
@@ -593,12 +593,12 @@ discard block |
||
593 | 593 | * @param \EE_Payment_Method $payment_method |
594 | 594 | * @return \EE_Form_Section_Proper |
595 | 595 | */ |
596 | - protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
597 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() ); |
|
596 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { |
|
597 | + $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); |
|
598 | 598 | return new EE_Form_Section_Proper( |
599 | 599 | array( |
600 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
601 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
600 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
601 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
602 | 602 | 'action' => '#', |
603 | 603 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
604 | 604 | 'subsections' => apply_filters( |
@@ -606,17 +606,17 @@ discard block |
||
606 | 606 | array( |
607 | 607 | new EE_Form_Section_HTML( |
608 | 608 | EEH_HTML::tr( |
609 | - EEH_HTML::td( $payment_method->type_obj()->introductory_html(), |
|
609 | + EEH_HTML::td($payment_method->type_obj()->introductory_html(), |
|
610 | 610 | '', |
611 | 611 | '', |
612 | 612 | '', |
613 | 613 | 'colspan="2"' |
614 | 614 | ) |
615 | - ) . |
|
615 | + ). |
|
616 | 616 | EEH_HTML::tr( |
617 | 617 | EEH_HTML::th( |
618 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' )) |
|
619 | - ) . |
|
618 | + EEH_HTML::label(__('Click to Activate ', 'event_espresso')) |
|
619 | + ). |
|
620 | 620 | EEH_HTML::td( |
621 | 621 | EEH_HTML::link( |
622 | 622 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | ), |
629 | 629 | $link_text_and_title, |
630 | 630 | $link_text_and_title, |
631 | - 'activate_' . $payment_method->slug(), |
|
631 | + 'activate_'.$payment_method->slug(), |
|
632 | 632 | 'espresso-button-green button-primary' |
633 | 633 | ) |
634 | 634 | ) |
@@ -650,9 +650,9 @@ discard block |
||
650 | 650 | protected function _fine_print() { |
651 | 651 | return new EE_Form_Section_HTML( |
652 | 652 | EEH_HTML::tr( |
653 | - EEH_HTML::th() . |
|
653 | + EEH_HTML::th(). |
|
654 | 654 | EEH_HTML::td( |
655 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ) |
|
655 | + EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
656 | 656 | ) |
657 | 657 | ) |
658 | 658 | ); |
@@ -664,15 +664,15 @@ discard block |
||
664 | 664 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
665 | 665 | * @global WP_User $current_user |
666 | 666 | */ |
667 | - protected function _activate_payment_method(){ |
|
668 | - if(isset($this->_req_data['payment_method_type'])){ |
|
667 | + protected function _activate_payment_method() { |
|
668 | + if (isset($this->_req_data['payment_method_type'])) { |
|
669 | 669 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
670 | 670 | //see if one exists |
671 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
672 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
|
671 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
672 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type); |
|
673 | 673 | |
674 | - $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
|
675 | - }else{ |
|
674 | + $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); |
|
675 | + } else { |
|
676 | 676 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
677 | 677 | } |
678 | 678 | } |
@@ -680,14 +680,14 @@ discard block |
||
680 | 680 | /** |
681 | 681 | * Deactivates the payment method with the specified slug, and redirects. |
682 | 682 | */ |
683 | - protected function _deactivate_payment_method(){ |
|
684 | - if(isset($this->_req_data['payment_method'])){ |
|
683 | + protected function _deactivate_payment_method() { |
|
684 | + if (isset($this->_req_data['payment_method'])) { |
|
685 | 685 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
686 | 686 | //deactivate it |
687 | 687 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
688 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
|
689 | - $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
|
690 | - }else{ |
|
688 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
689 | + $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); |
|
690 | + } else { |
|
691 | 691 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
692 | 692 | } |
693 | 693 | } |
@@ -701,39 +701,39 @@ discard block |
||
701 | 701 | * subsequently called 'headers_sent_func' which is _payment_methods_list) |
702 | 702 | * @return void |
703 | 703 | */ |
704 | - protected function _update_payment_method(){ |
|
705 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
704 | + protected function _update_payment_method() { |
|
705 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
706 | 706 | //ok let's find which gateway form to use based on the form input |
707 | 707 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
708 | 708 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
709 | 709 | $correct_pmt_form_to_use = NULL; |
710 | 710 | $pmt_obj = NULL; |
711 | - foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ |
|
711 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
712 | 712 | /** @var $pmt_obj EE_PMT_Base */ |
713 | 713 | //get the form and simplify it, like what we do when we display it |
714 | 714 | $pmt_form = $pmt_obj->settings_form(); |
715 | 715 | $this->_simplify_form($pmt_form); |
716 | - if($pmt_form->form_data_present_in($this->_req_data)){ |
|
716 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
717 | 717 | $correct_pmt_form_to_use = $pmt_form; |
718 | 718 | break; |
719 | 719 | } |
720 | 720 | } |
721 | 721 | //if we couldn't find the correct payment method type... |
722 | - if( ! $correct_pmt_form_to_use ){ |
|
722 | + if ( ! $correct_pmt_form_to_use) { |
|
723 | 723 | EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
724 | 724 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
725 | 725 | } |
726 | 726 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
727 | - if($correct_pmt_form_to_use->is_valid()){ |
|
727 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
728 | 728 | $correct_pmt_form_to_use->save(); |
729 | 729 | $pm = $correct_pmt_form_to_use->get_model_object(); |
730 | 730 | /** @var $pm EE_Payment_Method */ |
731 | - $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
|
732 | - }else{ |
|
731 | + $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); |
|
732 | + } else { |
|
733 | 733 | EE_Error::add_error( |
734 | 734 | sprintf( |
735 | 735 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
736 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' ) |
|
736 | + $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') |
|
737 | 737 | ), |
738 | 738 | __FILE__, |
739 | 739 | __FUNCTION__, |
@@ -750,11 +750,11 @@ discard block |
||
750 | 750 | protected function _payment_settings() { |
751 | 751 | |
752 | 752 | $this->_template_args['values'] = $this->_yes_no_values; |
753 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE; |
|
753 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE; |
|
754 | 754 | |
755 | - $this->_set_add_edit_form_tags( 'update_payment_settings' ); |
|
756 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
757 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE ); |
|
755 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
756 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
757 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE); |
|
758 | 758 | $this->display_admin_page_with_sidebar(); |
759 | 759 | |
760 | 760 | } |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | * @return array |
769 | 769 | */ |
770 | 770 | protected function _update_payment_settings() { |
771 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
772 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
|
771 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
772 | + EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); |
|
773 | 773 | |
774 | 774 | |
775 | - $what = __('Payment Settings','event_espresso'); |
|
776 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
777 | - $this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); |
|
775 | + $what = __('Payment Settings', 'event_espresso'); |
|
776 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
777 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | protected function _payment_log_overview_list_table() { |
@@ -800,18 +800,18 @@ discard block |
||
800 | 800 | * @param bool $count |
801 | 801 | * @return array |
802 | 802 | */ |
803 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ |
|
804 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
803 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { |
|
804 | + EE_Registry::instance()->load_model('Change_Log'); |
|
805 | 805 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params |
806 | - $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
806 | + $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
807 | 807 | //check if they've selected a specific payment method |
808 | - if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ |
|
808 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
809 | 809 | $query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], |
810 | 810 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']); |
811 | 811 | } |
812 | 812 | //take into account search |
813 | - if(isset($this->_req_data['s']) && $this->_req_data['s']){ |
|
814 | - $similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); |
|
813 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
814 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
815 | 815 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
816 | 816 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
817 | 817 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -826,48 +826,48 @@ discard block |
||
826 | 826 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
827 | 827 | |
828 | 828 | } |
829 | - if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ |
|
829 | + if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { |
|
830 | 830 | //add date |
831 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ); |
|
832 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ); |
|
831 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
832 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
833 | 833 | //make sure our timestamps start and end right at the boundaries for each day |
834 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
835 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
834 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
835 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
836 | 836 | |
837 | 837 | //convert to timestamps |
838 | - $start_date = strtotime( $start_date ); |
|
839 | - $end_date = strtotime( $end_date ); |
|
838 | + $start_date = strtotime($start_date); |
|
839 | + $end_date = strtotime($end_date); |
|
840 | 840 | |
841 | 841 | //makes sure start date is the lowest value and vice versa |
842 | - $start_date = min( $start_date, $end_date ); |
|
843 | - $end_date = max( $start_date, $end_date ); |
|
842 | + $start_date = min($start_date, $end_date); |
|
843 | + $end_date = max($start_date, $end_date); |
|
844 | 844 | |
845 | 845 | //convert for query |
846 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
847 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
846 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
847 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
848 | 848 | |
849 | - $query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); |
|
849 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
850 | 850 | |
851 | 851 | } |
852 | - if($count){ |
|
852 | + if ($count) { |
|
853 | 853 | return EEM_Change_Log::instance()->count($query_params); |
854 | 854 | } |
855 | - if(isset($this->_req_data['order'])){ |
|
856 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
855 | + if (isset($this->_req_data['order'])) { |
|
856 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
857 | 857 | $query_params['order_by'] = array('LOG_time' => $sort); |
858 | - }else{ |
|
858 | + } else { |
|
859 | 859 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
860 | 860 | } |
861 | - $offset = ($current_page-1)*$per_page; |
|
861 | + $offset = ($current_page - 1) * $per_page; |
|
862 | 862 | |
863 | - if( ! isset($this->_req_data['download_results'])){ |
|
864 | - $query_params['limit'] = array( $offset, $per_page ); |
|
863 | + if ( ! isset($this->_req_data['download_results'])) { |
|
864 | + $query_params['limit'] = array($offset, $per_page); |
|
865 | 865 | } |
866 | 866 | |
867 | 867 | |
868 | 868 | |
869 | 869 | //now they've requested to instead just download the file instead of viewing it. |
870 | - if(isset($this->_req_data['download_results'])){ |
|
870 | + if (isset($this->_req_data['download_results'])) { |
|
871 | 871 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
872 | 872 | header('Content-Disposition: attachment'); |
873 | 873 | header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
@@ -889,36 +889,36 @@ discard block |
||
889 | 889 | * @param EE_Change_Log $logB |
890 | 890 | * @return int |
891 | 891 | */ |
892 | - protected function _sort_logs_again($logA,$logB){ |
|
892 | + protected function _sort_logs_again($logA, $logB) { |
|
893 | 893 | $timeA = $logA->get_raw('LOG_time'); |
894 | 894 | $timeB = $logB->get_raw('LOG_time'); |
895 | - if($timeA == $timeB){ |
|
895 | + if ($timeA == $timeB) { |
|
896 | 896 | return 0; |
897 | 897 | } |
898 | 898 | $comparison = $timeA < $timeB ? -1 : 1; |
899 | - if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
|
899 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
900 | 900 | return $comparison * -1; |
901 | - }else{ |
|
901 | + } else { |
|
902 | 902 | return $comparison; |
903 | 903 | } |
904 | 904 | } |
905 | 905 | |
906 | 906 | protected function _payment_log_details() { |
907 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
907 | + EE_Registry::instance()->load_model('Change_Log'); |
|
908 | 908 | /** @var $payment_log EE_Change_Log */ |
909 | 909 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
910 | 910 | $payment_method = NULL; |
911 | 911 | $transaction = NULL; |
912 | - if( $payment_log instanceof EE_Change_Log ){ |
|
913 | - if( $payment_log->object() instanceof EE_Payment ){ |
|
912 | + if ($payment_log instanceof EE_Change_Log) { |
|
913 | + if ($payment_log->object() instanceof EE_Payment) { |
|
914 | 914 | $payment_method = $payment_log->object()->payment_method(); |
915 | 915 | $transaction = $payment_log->object()->transaction(); |
916 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
916 | + }elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
917 | 917 | $payment_method = $payment_log->object(); |
918 | 918 | } |
919 | 919 | } |
920 | 920 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
921 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
921 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
922 | 922 | array( |
923 | 923 | 'payment_log'=>$payment_log, |
924 | 924 | 'payment_method'=>$payment_method, |
@@ -25,32 +25,32 @@ discard block |
||
25 | 25 | * ------------------------------------------------------------------------ |
26 | 26 | */ |
27 | 27 | // defined some new constants related to caffeinated folder |
28 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
29 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
30 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
31 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
28 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
29 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
30 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
31 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
32 | 32 | class EE_Brewing_Regular extends EE_Base { |
33 | 33 | |
34 | 34 | public function __construct() { |
35 | - if ( defined( 'EE_CAFF_PATH' )) { |
|
35 | + if (defined('EE_CAFF_PATH')) { |
|
36 | 36 | // activation |
37 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' )); |
|
37 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
38 | 38 | // load caff init |
39 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' )); |
|
39 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
40 | 40 | // make it so the PDF receipt doesn't show our shameless plug |
41 | - add_filter( 'FHEE_Invoice__send_invoice__shameless_plug', '__return_false' ); |
|
41 | + add_filter('FHEE_Invoice__send_invoice__shameless_plug', '__return_false'); |
|
42 | 42 | // add caffeinated modules |
43 | - add_filter( 'FHEE__EE_Config__register_modules__modules_to_register', array( $this, 'caffeinated_modules_to_register' )); |
|
43 | + add_filter('FHEE__EE_Config__register_modules__modules_to_register', array($this, 'caffeinated_modules_to_register')); |
|
44 | 44 | // load caff scripts |
45 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts'), 10 ); |
|
45 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
46 | 46 | |
47 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
47 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
48 | 48 | |
49 | - add_filter( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array( $this, 'caf_payment_methods' ) ); |
|
49 | + add_filter('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', array($this, 'caf_payment_methods')); |
|
50 | 50 | // caffeinated constructed |
51 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
51 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
52 | 52 | //seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
53 | - add_filter( 'FHEE__ee_show_affiliate_links', '__return_false' ); |
|
53 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param array $paths original helper paths array |
61 | 61 | * @return array new array of paths |
62 | 62 | */ |
63 | - public function caf_helper_paths( $paths ) { |
|
64 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
63 | + public function caf_helper_paths($paths) { |
|
64 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
65 | 65 | return $paths; |
66 | 66 | } |
67 | 67 | |
@@ -77,22 +77,22 @@ discard block |
||
77 | 77 | * Right now, we ASSUME the only price types in the system are default ones |
78 | 78 | * @global type $wpdb |
79 | 79 | */ |
80 | - function initialize_caf_db_content(){ |
|
80 | + function initialize_caf_db_content() { |
|
81 | 81 | // echo "initialize caf db content!"; |
82 | 82 | global $wpdb; |
83 | 83 | |
84 | 84 | //use same method of getting creator id as the version introducing the change |
85 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
85 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
86 | 86 | |
87 | 87 | $price_type_table = $wpdb->prefix."esp_price_type"; |
88 | 88 | $price_table = $wpdb->prefix."esp_price"; |
89 | 89 | |
90 | - if ( EEH_Activation::table_exists( $price_type_table ) ) { |
|
90 | + if (EEH_Activation::table_exists($price_type_table)) { |
|
91 | 91 | |
92 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
93 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
92 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
93 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
94 | 94 | |
95 | - if ( $tax_price_type_count <= 1) { |
|
95 | + if ($tax_price_type_count <= 1) { |
|
96 | 96 | $result = $wpdb->insert($price_type_table, |
97 | 97 | array( |
98 | 98 | 'PRT_name'=> __("Regional Tax", "event_espresso"), |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | 'PRT_wp_user' => $default_creator_id |
104 | 104 | ), |
105 | 105 | array( |
106 | - '%s',//PRT_name |
|
107 | - '%d',//PBT_id |
|
108 | - '%d',//PRT_is_percent |
|
109 | - '%d',//PRT_order |
|
110 | - '%d',//PRT_deleted |
|
106 | + '%s', //PRT_name |
|
107 | + '%d', //PBT_id |
|
108 | + '%d', //PRT_is_percent |
|
109 | + '%d', //PRT_order |
|
110 | + '%d', //PRT_deleted |
|
111 | 111 | '%d', //PRT_wp_user |
112 | 112 | )); |
113 | 113 | //federal tax |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | 'PRT_wp_user' => $default_creator_id, |
122 | 122 | ), |
123 | 123 | array( |
124 | - '%s',//PRT_name |
|
125 | - '%d',//PBT_id |
|
126 | - '%d',//PRT_is_percent |
|
127 | - '%d',//PRT_order |
|
128 | - '%d',//PRT_deleted |
|
124 | + '%s', //PRT_name |
|
125 | + '%d', //PBT_id |
|
126 | + '%d', //PRT_is_percent |
|
127 | + '%d', //PRT_order |
|
128 | + '%d', //PRT_deleted |
|
129 | 129 | '%d' //PRT_wp_user |
130 | 130 | )); |
131 | - if( $result){ |
|
131 | + if ($result) { |
|
132 | 132 | $wpdb->insert($price_table, |
133 | 133 | array( |
134 | 134 | 'PRT_ID'=>$wpdb->insert_id, |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | 'PRC_wp_user' => $default_creator_id |
144 | 144 | ), |
145 | 145 | array( |
146 | - '%d',//PRT_id |
|
147 | - '%f',//PRC_amount |
|
148 | - '%s',//PRC_name |
|
149 | - '%s',//PRC_desc |
|
150 | - '%d',//PRC_is_default |
|
151 | - '%d',//PRC_overrides |
|
152 | - '%d',//PRC_deleted |
|
153 | - '%d',//PRC_order |
|
154 | - '%d',//PRC_parent |
|
146 | + '%d', //PRT_id |
|
147 | + '%f', //PRC_amount |
|
148 | + '%s', //PRC_name |
|
149 | + '%s', //PRC_desc |
|
150 | + '%d', //PRC_is_default |
|
151 | + '%d', //PRC_overrides |
|
152 | + '%d', //PRC_deleted |
|
153 | + '%d', //PRC_order |
|
154 | + '%d', //PRC_parent |
|
155 | 155 | '%d' //PRC_wp_user |
156 | 156 | )); |
157 | 157 | } |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @param array $modules_to_register |
172 | 172 | * @return array |
173 | 173 | */ |
174 | - public function caffeinated_modules_to_register( $modules_to_register = array() ){ |
|
175 | - if ( is_readable( EE_CAFF_PATH . 'modules' )) { |
|
176 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
177 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register )) { |
|
178 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
174 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
175 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
176 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
177 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
178 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | return $modules_to_register; |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | - public function caffeinated_init(){ |
|
186 | + public function caffeinated_init() { |
|
187 | 187 | // EE_Register_CPTs hooks |
188 | - add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
189 | - add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
190 | - add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
191 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE ); |
|
188 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
189 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
190 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
191 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), FALSE); |
|
192 | 192 | // caffeinated_init__complete hook |
193 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
193 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | 197 | |
198 | - public function enqueue_caffeinated_scripts(){ |
|
198 | + public function enqueue_caffeinated_scripts() { |
|
199 | 199 | // sound of crickets... |
200 | 200 | } |
201 | 201 | |
@@ -204,23 +204,23 @@ discard block |
||
204 | 204 | * callbacks below here |
205 | 205 | */ |
206 | 206 | |
207 | - public function filter_taxonomies( $taxonomy_array ) { |
|
207 | + public function filter_taxonomies($taxonomy_array) { |
|
208 | 208 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = TRUE; |
209 | 209 | return $taxonomy_array; |
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | 213 | |
214 | - public function filter_cpts( $cpt_array ) { |
|
214 | + public function filter_cpts($cpt_array) { |
|
215 | 215 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = TRUE; |
216 | 216 | return $cpt_array; |
217 | 217 | } |
218 | 218 | |
219 | 219 | |
220 | - public function nav_metabox_items( $menuitems ) { |
|
220 | + public function nav_metabox_items($menuitems) { |
|
221 | 221 | $menuitems[] = array( |
222 | 222 | 'title' => __('Venue List', 'event_espresso'), |
223 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
223 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
224 | 224 | 'description' => __('Archive page for all venues.', 'event_espresso') |
225 | 225 | ); |
226 | 226 | return $menuitems; |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param array $payment_method_paths |
232 | 232 | * @return array values are folder paths to payment method folders |
233 | 233 | */ |
234 | - public function caf_payment_methods( $payment_method_paths ) { |
|
235 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
236 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
234 | + public function caf_payment_methods($payment_method_paths) { |
|
235 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
236 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
237 | 237 | return $payment_method_paths; |
238 | 238 | } |
239 | 239 | } |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('Authorize.Net AIM is an on-site payment method for accepting credit and debit card payments and is available to event organizers in the United States, Canada, United Kingdom, and Australia. An account with Authorize.Net is required to accept payments. Need an Authorize.Net account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/authorizenetaim/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('Authorize.Net AIM is an on-site payment method for accepting credit and debit card payments and is available to event organizers in the United States, Canada, United Kingdom, and Australia. An account with Authorize.Net is required to accept payments. Need an Authorize.Net account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/authorizenetaim/" target="_blank">', '</a>'); |
|
3 | 3 | \ No newline at end of file |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('Mijireh is an off-site payment method for accepting payments online through over 80+ payment gateways and is available to event organizers in many countries. An account with Mijireh is required to accept payments. Need a Mijireh account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/mijireh/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('Mijireh is an off-site payment method for accepting payments online through over 80+ payment gateways and is available to event organizers in many countries. An account with Mijireh is required to accept payments. Need a Mijireh account? %1$sClick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/mijireh/" target="_blank">', '</a>'); |
|
3 | 3 | \ No newline at end of file |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( esc_html__('PayPal Pro (Website Payments Pro) is an on-site payment method for accepting credit and debit cards and is available to event organizers in the United States, United Kingdom, and Canada. An account with PayPal is required to accept payments. Need a PayPal Pro account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalpro/" target="_blank">','</a>' ); |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(esc_html__('PayPal Pro (Website Payments Pro) is an on-site payment method for accepting credit and debit cards and is available to event organizers in the United States, United Kingdom, and Canada. An account with PayPal is required to accept payments. Need a PayPal Pro account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalpro/" target="_blank">', '</a>'); |
|
3 | 3 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | class Extend_Events_Admin_Page extends Events_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
35 | - define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
36 | - define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
37 | - define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
36 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
37 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _extend_page_config() { |
42 | 42 | |
43 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
43 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
44 | 44 | $default_espresso_boxes = $this->_default_espresso_metaboxes; |
45 | 45 | |
46 | 46 | //is there a evt_id in the request? |
47 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
47 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
49 | 49 | |
50 | 50 | //tkt_id? |
51 | - $tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
51 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
52 | 52 | |
53 | 53 | $new_page_routes = array( |
54 | 54 | 'duplicate_event' => array( |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'capability' => 'ee_delete_default_ticket', |
67 | 67 | 'obj_id' => $tkt_id, |
68 | 68 | 'noheader' => TRUE, |
69 | - 'args' => array( 'trash' => TRUE ) |
|
69 | + 'args' => array('trash' => TRUE) |
|
70 | 70 | ), |
71 | 71 | 'trash_tickets' => array( |
72 | 72 | 'func' => '_trash_or_restore_ticket', |
73 | 73 | 'capability' => 'ee_delete_default_tickets', |
74 | 74 | 'noheader' => TRUE, |
75 | - 'args' => array( 'trash' => TRUE ) |
|
75 | + 'args' => array('trash' => TRUE) |
|
76 | 76 | ), |
77 | 77 | 'restore_ticket' => array( |
78 | 78 | 'func' => '_trash_or_restore_ticket', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | ); |
134 | 134 | |
135 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
135 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //partial route/config override |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
145 | 145 | |
146 | 146 | //add tickets tab but only if there are more than one default ticket! |
147 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ); |
|
148 | - if ( $tkt_count > 1 ) { |
|
147 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE); |
|
148 | + if ($tkt_count > 1) { |
|
149 | 149 | $new_page_config = array( |
150 | 150 | 'ticket_list_table' => array( |
151 | 151 | 'nav' => array( |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | 'label' => esc_html__('Templates', 'event_espresso'), |
165 | 165 | 'order' => 30 |
166 | 166 | ), |
167 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
167 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
168 | 168 | 'help_tabs' => array( |
169 | 169 | 'general_settings_templates_help_tab' => array( |
170 | 170 | 'title' => __('Templates', 'event_espresso'), |
171 | 171 | 'filename' => 'general_settings_templates' |
172 | 172 | ) |
173 | 173 | ), |
174 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
174 | + 'help_tour' => array('Templates_Help_Tour'), |
|
175 | 175 | 'require_nonce' => FALSE |
176 | 176 | ); |
177 | 177 | |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | // 'metaboxes' => $default_espresso_boxes, |
191 | 191 | // 'require_nonce' => FALSE |
192 | 192 | // ); |
193 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
193 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
194 | 194 | |
195 | 195 | //add filters and actions |
196 | 196 | //modifying _views |
197 | - add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 ); |
|
198 | - add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 ); |
|
199 | - add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 ); |
|
197 | + add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2); |
|
198 | + add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2); |
|
199 | + add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | //filters for event list table |
203 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2); |
|
204 | - add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 ); |
|
203 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
204 | + add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2); |
|
205 | 205 | |
206 | 206 | //legend item |
207 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') ); |
|
207 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
208 | 208 | |
209 | - add_action('admin_init', array( $this, 'admin_init') ); |
|
209 | + add_action('admin_init', array($this, 'admin_init')); |
|
210 | 210 | |
211 | 211 | //heartbeat stuff |
212 | - add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 ); |
|
212 | + add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | EE_Registry::$i18n_js_strings = array_merge( |
223 | 223 | EE_Registry::$i18n_js_strings, |
224 | 224 | array( |
225 | - 'image_confirm' => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ), |
|
226 | - 'event_starts_on' => __( 'Event Starts on', 'event_espresso' ), |
|
227 | - 'event_ends_on' => __( 'Event Ends on', 'event_espresso' ), |
|
228 | - 'event_datetime_actions' => __( 'Actions', 'event_espresso' ), |
|
229 | - 'event_clone_dt_msg' => __( 'Clone this Event Date and Time', 'event_espresso' ), |
|
230 | - 'remove_event_dt_msg' => __( 'Remove this Event Time', 'event_espresso' ) |
|
225 | + 'image_confirm' => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'), |
|
226 | + 'event_starts_on' => __('Event Starts on', 'event_espresso'), |
|
227 | + 'event_ends_on' => __('Event Ends on', 'event_espresso'), |
|
228 | + 'event_datetime_actions' => __('Actions', 'event_espresso'), |
|
229 | + 'event_clone_dt_msg' => __('Clone this Event Date and Time', 'event_espresso'), |
|
230 | + 'remove_event_dt_msg' => __('Remove this Event Time', 'event_espresso') |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return array possibly appended response. |
244 | 244 | */ |
245 | - public function heartbeat_response( $response, $data ) { |
|
245 | + public function heartbeat_response($response, $data) { |
|
246 | 246 | /** |
247 | 247 | * check whether count of tickets is approaching the potential |
248 | 248 | * limits for the server. |
249 | 249 | */ |
250 | - if ( ! empty( $data['input_count'] ) ) { |
|
250 | + if ( ! empty($data['input_count'])) { |
|
251 | 251 | $response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']); |
252 | 252 | } |
253 | 253 | |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
266 | - $return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ); |
|
265 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
266 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
267 | 267 | //make sure this is only when editing |
268 | - if ( !empty( $id ) ) { |
|
269 | - $href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url ); |
|
268 | + if ( ! empty($id)) { |
|
269 | + $href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url); |
|
270 | 270 | $title = esc_attr__('Duplicate Event', 'event_espresso'); |
271 | - $return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' . $title . '</button>'; |
|
271 | + $return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">'.$title.'</button>'; |
|
272 | 272 | } |
273 | 273 | return $return; |
274 | 274 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'label' => __('Trash', 'event_espresso'), |
292 | 292 | 'count' => 0, |
293 | 293 | 'bulk_action' => array( |
294 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
294 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
295 | 295 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
296 | 296 | ) |
297 | 297 | ) |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | |
303 | 303 | public function load_scripts_styles_edit() { |
304 | - wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
304 | + wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * load accounting js. |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - public function add_additional_datetime_button( $template, $template_args ) { |
|
324 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
323 | + public function add_additional_datetime_button($template, $template_args) { |
|
324 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | - public function add_datetime_clone_button( $template, $template_args ) { |
|
330 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE ); |
|
329 | + public function add_datetime_clone_button($template, $template_args) { |
|
330 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | - public function datetime_timezones_template( $template, $template_args ) { |
|
336 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE ); |
|
335 | + public function datetime_timezones_template($template, $template_args) { |
|
336 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | protected function _set_list_table_views_default() { |
343 | 343 | parent::_set_list_table_views_default(); |
344 | 344 | $export_label = __('Export Events', 'event_espresso'); |
345 | - if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) { |
|
345 | + if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) { |
|
346 | 346 | // $this->_views['all']['bulk_action']['export_events'] = $export_label; |
347 | 347 | // $this->_views['draft']['bulk_action']['export_events'] = $export_label; |
348 | 348 | |
349 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
349 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
350 | 350 | // $this->_views['trash']['bulk_action']['export_events'] = $export_label; |
351 | 351 | } |
352 | 352 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ) |
373 | 373 | ); |
374 | 374 | |
375 | - $this->_views = array_merge( $this->_views, $new_views); |
|
375 | + $this->_views = array_merge($this->_views, $new_views); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function extra_list_table_actions( $actionlinks, $event ) { |
|
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) { |
|
389 | + public function extra_list_table_actions($actionlinks, $event) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) { |
|
391 | 391 | $reports_query_args = array( |
392 | 392 | 'action' => 'reports', |
393 | 393 | 'EVT_ID' => $event->ID() |
394 | 394 | ); |
395 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
|
396 | - $actionlinks[] = '<a href="' . $reports_link . '" title="' . esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t"; |
|
395 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
396 | + $actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t"; |
|
397 | 397 | } |
398 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
399 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
398 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
399 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
400 | 400 | $actionlinks[] = EEH_MSG_Template::get_message_action_link( |
401 | 401 | 'see_notifications_for', |
402 | 402 | null, |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | |
412 | 412 | |
413 | 413 | public function additional_legend_items($items) { |
414 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) { |
|
414 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) { |
|
415 | 415 | $items['reports'] = array( |
416 | 416 | 'class' => 'dashicons dashicons-chart-bar', |
417 | 417 | 'desc' => __('Event Reports', 'event_espresso') |
418 | 418 | ); |
419 | 419 | } |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
421 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
422 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
421 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
422 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
423 | 423 | $items['view_related_messages'] = array( |
424 | 424 | 'class' => $related_for_icon['css_class'], |
425 | 425 | 'desc' => $related_for_icon['label'], |
@@ -444,17 +444,17 @@ discard block |
||
444 | 444 | */ |
445 | 445 | protected function _duplicate_event() { |
446 | 446 | //first make sure the ID for the event is in the request. If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?) |
447 | - if ( !isset( $this->_req_data['EVT_ID'] ) ) { |
|
448 | - EE_Error::add_error( __('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
449 | - $this->_redirect_after_action( FALSE, '', '', array(), TRUE ); |
|
447 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
448 | + EE_Error::add_error(__('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
449 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
450 | 450 | return; |
451 | 451 | } |
452 | 452 | |
453 | 453 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
454 | - $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
|
454 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
455 | 455 | |
456 | - if ( ! $orig_event instanceof EE_Event ) |
|
457 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
456 | + if ( ! $orig_event instanceof EE_Event) |
|
457 | + throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'])); |
|
458 | 458 | |
459 | 459 | //k now let's clone the $orig_event before getting relations |
460 | 460 | $new_event = clone $orig_event; |
@@ -467,43 +467,43 @@ discard block |
||
467 | 467 | |
468 | 468 | |
469 | 469 | //reset the ID and modify other details to make it clear this is a dupe |
470 | - $new_event->set( 'EVT_ID', 0 ); |
|
471 | - $new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso'); |
|
472 | - $new_event->set( 'EVT_name', $new_name ); |
|
473 | - $new_event->set( 'EVT_slug', wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) ); |
|
474 | - $new_event->set( 'status', 'draft' ); |
|
470 | + $new_event->set('EVT_ID', 0); |
|
471 | + $new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso'); |
|
472 | + $new_event->set('EVT_name', $new_name); |
|
473 | + $new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0)); |
|
474 | + $new_event->set('status', 'draft'); |
|
475 | 475 | |
476 | 476 | //duplicate discussion settings |
477 | - $new_event->set( 'comment_status', $orig_event->get('comment_status') ); |
|
478 | - $new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) ); |
|
477 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
478 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
479 | 479 | |
480 | 480 | //save the new event |
481 | 481 | $new_event->save(); |
482 | 482 | |
483 | 483 | //venues |
484 | - foreach( $orig_ven as $ven ) { |
|
485 | - $new_event->_add_relation_to( $ven, 'Venue' ); |
|
484 | + foreach ($orig_ven as $ven) { |
|
485 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
486 | 486 | } |
487 | 487 | $new_event->save(); |
488 | 488 | |
489 | 489 | |
490 | 490 | //now we need to get the question group relations and handle that |
491 | 491 | //first primary question groups |
492 | - $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) ); |
|
493 | - if ( !empty( $orig_primary_qgs ) ) { |
|
494 | - foreach ( $orig_primary_qgs as $id => $obj ) { |
|
495 | - if ( $obj instanceof EE_Question_Group ) { |
|
496 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) ); |
|
492 | + $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))); |
|
493 | + if ( ! empty($orig_primary_qgs)) { |
|
494 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
495 | + if ($obj instanceof EE_Question_Group) { |
|
496 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1)); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | 501 | //next additional attendee question groups |
502 | - $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
503 | - if ( !empty( $orig_additional_qgs ) ) { |
|
504 | - foreach ( $orig_additional_qgs as $id => $obj ) { |
|
505 | - if ( $obj instanceof EE_Question_Group ) { |
|
506 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) ); |
|
502 | + $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
503 | + if ( ! empty($orig_additional_qgs)) { |
|
504 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
505 | + if ($obj instanceof EE_Question_Group) { |
|
506 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0)); |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | //k now that we have the new event saved we can loop through the datetimes and start adding relations. |
516 | 516 | $cloned_tickets = array(); |
517 | - foreach ( $orig_datetimes as $orig_dtt ) { |
|
517 | + foreach ($orig_datetimes as $orig_dtt) { |
|
518 | 518 | $new_dtt = clone $orig_dtt; |
519 | 519 | $orig_tkts = $orig_dtt->tickets(); |
520 | 520 | |
@@ -522,22 +522,22 @@ discard block |
||
522 | 522 | $new_dtt->set('DTT_ID', 0); |
523 | 523 | $new_dtt->set('DTT_sold', 0); |
524 | 524 | $new_dtt->save(); |
525 | - $new_event->_add_relation_to( $new_dtt, 'Datetime'); |
|
525 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
526 | 526 | $new_event->save(); |
527 | 527 | |
528 | 528 | //now let's get the ticket relations setup. |
529 | - foreach ( (array) $orig_tkts as $orig_tkt ) { |
|
529 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
530 | 530 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
531 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
531 | + if ( ! $orig_tkt instanceof EE_Ticket) |
|
532 | 532 | continue; |
533 | 533 | |
534 | 534 | //is this ticket archived? If it is then let's skip |
535 | - if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
|
535 | + if ($orig_tkt->get('TKT_deleted')) { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | 538 | |
539 | 539 | //does this original ticket already exist in the clone_tickets cache? If so we'll just use the new ticket from it. |
540 | - if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) { |
|
540 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
541 | 541 | $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
542 | 542 | } else { |
543 | 543 | $new_tkt = clone $orig_tkt; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $new_tkt->save(); //make sure new ticket has ID. |
550 | 550 | |
551 | 551 | //price relations on new ticket need to be setup. |
552 | - foreach ( $orig_prices as $orig_price ) { |
|
552 | + foreach ($orig_prices as $orig_price) { |
|
553 | 553 | $new_price = clone $orig_price; |
554 | 554 | $new_price->set('PRC_ID', 0); |
555 | 555 | $new_price->save(); |
@@ -566,39 +566,39 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | //clone taxonomy information |
569 | - $taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) ); |
|
569 | + $taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag')); |
|
570 | 570 | |
571 | 571 | //get terms for original event (notice) |
572 | - $orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with ); |
|
572 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
573 | 573 | |
574 | 574 | //loop through terms and add them to new event. |
575 | - foreach ( $orig_terms as $term ) { |
|
576 | - wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true ); |
|
575 | + foreach ($orig_terms as $term) { |
|
576 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
580 | - do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event ); |
|
580 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
581 | 581 | |
582 | 582 | //now let's redirect to the edit page for this duplicated event if we have a new event id. |
583 | - if ( $new_event->ID() ) { |
|
583 | + if ($new_event->ID()) { |
|
584 | 584 | $redirect_args = array( |
585 | 585 | 'post' => $new_event->ID(), |
586 | 586 | 'action' => 'edit' |
587 | 587 | ); |
588 | - EE_Error::add_success( __('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso') ); |
|
588 | + EE_Error::add_success(__('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso')); |
|
589 | 589 | } else { |
590 | 590 | $redirect_args = array( |
591 | 591 | 'action' => 'default' |
592 | 592 | ); |
593 | - EE_Error::add_error( __('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
593 | + EE_Error::add_error(__('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
594 | 594 | } |
595 | 595 | |
596 | - $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE ); |
|
596 | + $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | |
600 | 600 | |
601 | - protected function _import_page(){ |
|
601 | + protected function _import_page() { |
|
602 | 602 | |
603 | 603 | $title = __('Import', 'event_espresso'); |
604 | 604 | $intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso'); |
@@ -606,8 +606,8 @@ discard block |
||
606 | 606 | $action = 'import_events'; |
607 | 607 | $type = 'csv'; |
608 | 608 | $this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type); |
609 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url); |
|
610 | - $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true); |
|
609 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url); |
|
610 | + $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true); |
|
611 | 611 | |
612 | 612 | |
613 | 613 | $this->_template_args['admin_page_content'] = $content; |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | * @return string html |
621 | 621 | */ |
622 | 622 | protected function _import_events() { |
623 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
623 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
624 | 624 | $success = EE_Import::instance()->import(); |
625 | - $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true); |
|
625 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -636,23 +636,23 @@ discard block |
||
636 | 636 | * @return file |
637 | 637 | */ |
638 | 638 | protected function _events_export() { |
639 | - if(isset($this->_req_data['EVT_ID'])){ |
|
639 | + if (isset($this->_req_data['EVT_ID'])) { |
|
640 | 640 | $event_ids = $this->_req_data['EVT_ID']; |
641 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
641 | + }elseif (isset($this->_req_data['EVT_IDs'])) { |
|
642 | 642 | $event_ids = $this->_req_data['EVT_IDs']; |
643 | - }else{ |
|
643 | + } else { |
|
644 | 644 | $event_ids = NULL; |
645 | 645 | } |
646 | 646 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
647 | 647 | $new_request_args = array( |
648 | 648 | 'export' => 'report', |
649 | 649 | 'action' => 'all_event_data', |
650 | - 'EVT_ID' => $event_ids , |
|
650 | + 'EVT_ID' => $event_ids, |
|
651 | 651 | ); |
652 | 652 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
653 | 653 | |
654 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
655 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
654 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
655 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
656 | 656 | $EE_Export = EE_Export::instance($this->_req_data); |
657 | 657 | $EE_Export->export(); |
658 | 658 | } |
@@ -674,11 +674,11 @@ discard block |
||
674 | 674 | 'category_ids' => $this->_req_data['EVT_CAT_ID'] |
675 | 675 | ); |
676 | 676 | |
677 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
677 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
678 | 678 | |
679 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
680 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
681 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
679 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
680 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
681 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
682 | 682 | $EE_Export->export(); |
683 | 683 | } |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | /** |
690 | 690 | * Creates a sample CSV file for importing |
691 | 691 | */ |
692 | - protected function _sample_export_file(){ |
|
692 | + protected function _sample_export_file() { |
|
693 | 693 | // require_once(EE_CLASSES . 'EE_Export.class.php'); |
694 | 694 | EE_Export::instance()->export_sample(); |
695 | 695 | } |
@@ -706,10 +706,10 @@ discard block |
||
706 | 706 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
707 | 707 | * from General_Settings_Admin_Page to here. |
708 | 708 | */ |
709 | - $this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args ); |
|
710 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
711 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
712 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE ); |
|
709 | + $this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args); |
|
710 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
711 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
712 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE); |
|
713 | 713 | $this->display_admin_page_with_sidebar(); |
714 | 714 | } |
715 | 715 | |
@@ -721,24 +721,24 @@ discard block |
||
721 | 721 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
722 | 722 | * from General_Settings_Admin_Page to here. |
723 | 723 | */ |
724 | - EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data ); |
|
724 | + EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data); |
|
725 | 725 | |
726 | 726 | |
727 | 727 | //update custom post type slugs and detect if we need to flush rewrite rules |
728 | 728 | $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
729 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] ); |
|
729 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']); |
|
730 | 730 | |
731 | 731 | |
732 | 732 | $what = 'Template Settings'; |
733 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
733 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__); |
|
734 | 734 | |
735 | 735 | |
736 | - if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) { |
|
737 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
736 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) { |
|
737 | + update_option('ee_flush_rewrite_rules', true); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
741 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
741 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
742 | 742 | |
743 | 743 | } |
744 | 744 | |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | $this->verify_cpt_object(); |
758 | 758 | |
759 | - add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core'); |
|
759 | + add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core'); |
|
760 | 760 | //add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready. |
761 | 761 | |
762 | 762 | //todo feature in progress |
@@ -780,16 +780,16 @@ discard block |
||
780 | 780 | array('id' => true, 'text' => __('Yes', 'event_espresso')), |
781 | 781 | array('id' => false, 'text' => __('No', 'event_espresso')) |
782 | 782 | ); |
783 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
783 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
784 | 784 | $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE); |
785 | 785 | $template_args['_event'] = $this->_cpt_model_obj; |
786 | 786 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
787 | 787 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
788 | 788 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
789 | 789 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
790 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() ); |
|
791 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
792 | - $templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
790 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
|
791 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
792 | + $templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
793 | 793 | EEH_Template::display_template($templatepath, $template_args); |
794 | 794 | } |
795 | 795 | |
@@ -802,9 +802,9 @@ discard block |
||
802 | 802 | * @param array $box metabox args |
803 | 803 | * @return string metabox contents |
804 | 804 | */ |
805 | - public function event_type_meta_box( $post, $box ) { |
|
806 | - $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) ); |
|
807 | - $template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php'; |
|
805 | + public function event_type_meta_box($post, $box) { |
|
806 | + $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type')); |
|
807 | + $template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php'; |
|
808 | 808 | EEH_Template::display_template($template, $template_args); |
809 | 809 | } |
810 | 810 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | |
816 | 816 | |
817 | - public function wp_terms_radio( $post_id = 0, $args = array() ) { |
|
817 | + public function wp_terms_radio($post_id = 0, $args = array()) { |
|
818 | 818 | $defaults = array( |
819 | 819 | 'descendants_and_self' => 0, |
820 | 820 | 'selected_cats' => false, |
@@ -823,11 +823,11 @@ discard block |
||
823 | 823 | 'taxonomy' => 'category', |
824 | 824 | 'checked_ontop' => true |
825 | 825 | ); |
826 | - $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
|
826 | + $args = apply_filters('wp_terms_checklist_args', $args, $post_id); |
|
827 | 827 | |
828 | - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
|
828 | + extract(wp_parse_args($args, $defaults), EXTR_SKIP); |
|
829 | 829 | |
830 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
830 | + if (empty($walker) || ! is_a($walker, 'Walker')) |
|
831 | 831 | $walker = new Walker_Radio_Checklist; |
832 | 832 | |
833 | 833 | $descendants_and_self = (int) $descendants_and_self; |
@@ -835,37 +835,37 @@ discard block |
||
835 | 835 | $args = array('taxonomy' => $taxonomy); |
836 | 836 | |
837 | 837 | $tax = get_taxonomy($taxonomy); |
838 | - $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
|
838 | + $args['disabled'] = ! current_user_can($tax->cap->assign_terms); |
|
839 | 839 | |
840 | - if ( is_array( $selected_cats ) ) |
|
840 | + if (is_array($selected_cats)) |
|
841 | 841 | $args['selected_cats'] = $selected_cats; |
842 | - elseif ( $post_id ) |
|
842 | + elseif ($post_id) |
|
843 | 843 | $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
844 | 844 | else |
845 | 845 | $args['selected_cats'] = array(); |
846 | 846 | |
847 | - if ( is_array( $popular_cats ) ) |
|
847 | + if (is_array($popular_cats)) |
|
848 | 848 | $args['popular_cats'] = $popular_cats; |
849 | 849 | else |
850 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
850 | + $args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false)); |
|
851 | 851 | |
852 | - if ( $descendants_and_self ) { |
|
853 | - $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
|
854 | - $self = get_term( $descendants_and_self, $taxonomy ); |
|
855 | - array_unshift( $categories, $self ); |
|
852 | + if ($descendants_and_self) { |
|
853 | + $categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0)); |
|
854 | + $self = get_term($descendants_and_self, $taxonomy); |
|
855 | + array_unshift($categories, $self); |
|
856 | 856 | } else { |
857 | 857 | $categories = (array) get_terms($taxonomy, array('get' => 'all')); |
858 | 858 | } |
859 | 859 | |
860 | - if ( $checked_ontop ) { |
|
860 | + if ($checked_ontop) { |
|
861 | 861 | // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) |
862 | 862 | $checked_categories = array(); |
863 | - $keys = array_keys( $categories ); |
|
863 | + $keys = array_keys($categories); |
|
864 | 864 | |
865 | - foreach( $keys as $k ) { |
|
866 | - if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
|
865 | + foreach ($keys as $k) { |
|
866 | + if (in_array($categories[$k]->term_id, $args['selected_cats'])) { |
|
867 | 867 | $checked_categories[] = $categories[$k]; |
868 | - unset( $categories[$k] ); |
|
868 | + unset($categories[$k]); |
|
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
@@ -890,18 +890,18 @@ discard block |
||
890 | 890 | * @param array $list_table_obj the list table object |
891 | 891 | * @return array new filters |
892 | 892 | */ |
893 | - public function list_table_filters( $oldfilters, $list_table_obj ) { |
|
893 | + public function list_table_filters($oldfilters, $list_table_obj) { |
|
894 | 894 | $filters = array(); |
895 | 895 | |
896 | 896 | //first month/year filters |
897 | 897 | $filters[] = $this->espresso_event_months_dropdown(); |
898 | 898 | |
899 | 899 | |
900 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
900 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
901 | 901 | |
902 | 902 | //active status dropdown |
903 | - if ( $status !== 'draft' ) |
|
904 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
903 | + if ($status !== 'draft') |
|
904 | + $filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''); |
|
905 | 905 | |
906 | 906 | //category filter |
907 | 907 | $filters[] = $this->category_dropdown(); |
@@ -923,17 +923,17 @@ discard block |
||
923 | 923 | */ |
924 | 924 | public function espresso_event_months_dropdown() { |
925 | 925 | //what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set! |
926 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
926 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
927 | 927 | |
928 | 928 | //categories? |
929 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
929 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
930 | 930 | |
931 | 931 | //active status? |
932 | - $active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL; |
|
932 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL; |
|
933 | 933 | |
934 | 934 | $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
935 | 935 | |
936 | - return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status ); |
|
936 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | * @param string $current_value whatever the ucrrent active status is |
945 | 945 | * @return string html dropdown. |
946 | 946 | */ |
947 | - public function active_status_dropdown( $current_value = '' ) { |
|
947 | + public function active_status_dropdown($current_value = '') { |
|
948 | 948 | $select_name = 'active_status'; |
949 | - $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') ); |
|
949 | + $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso')); |
|
950 | 950 | $id = 'id="espresso-active-status-dropdown-filter"'; |
951 | 951 | $class = 'wide'; |
952 | - echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class ); |
|
952 | + echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -961,9 +961,9 @@ discard block |
||
961 | 961 | * @return string html |
962 | 962 | */ |
963 | 963 | public function category_dropdown() { |
964 | - $cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
964 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
965 | 965 | |
966 | - return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat ); |
|
966 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | * @return int |
976 | 976 | */ |
977 | 977 | public function total_events_today() { |
978 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
979 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
978 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
979 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
980 | 980 | |
981 | 981 | $where = array( |
982 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
982 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
983 | 983 | ); |
984 | 984 | |
985 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
985 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
986 | 986 | return $count; |
987 | 987 | } |
988 | 988 | |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | $this_year_r = date('Y'); |
998 | 998 | $this_month_r = date('m'); |
999 | 999 | $days_this_month = date('t'); |
1000 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
1001 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
1000 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
1001 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
1002 | 1002 | |
1003 | 1003 | $where = array( |
1004 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
1004 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
1005 | 1005 | ); |
1006 | 1006 | |
1007 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1007 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1008 | 1008 | return $count; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1021,53 +1021,53 @@ discard block |
||
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | |
1024 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
1024 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
1025 | 1025 | |
1026 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order']; |
|
1026 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1028 | 1028 | |
1029 | - switch ( $orderby ) { |
|
1029 | + switch ($orderby) { |
|
1030 | 1030 | case 'TKT_name' : |
1031 | - $orderby = array( 'TKT_name' => $order ); |
|
1031 | + $orderby = array('TKT_name' => $order); |
|
1032 | 1032 | break; |
1033 | 1033 | |
1034 | 1034 | case 'TKT_price' : |
1035 | - $orderby = array( 'TKT_price' => $order ); |
|
1035 | + $orderby = array('TKT_price' => $order); |
|
1036 | 1036 | break; |
1037 | 1037 | |
1038 | 1038 | case 'TKT_uses' : |
1039 | - $orderby = array( 'TKT_uses' => $order ); |
|
1039 | + $orderby = array('TKT_uses' => $order); |
|
1040 | 1040 | break; |
1041 | 1041 | |
1042 | 1042 | case 'TKT_min' : |
1043 | - $orderby = array( 'TKT_min' => $order ); |
|
1043 | + $orderby = array('TKT_min' => $order); |
|
1044 | 1044 | break; |
1045 | 1045 | |
1046 | 1046 | case 'TKT_max' : |
1047 | - $orderby = array( 'TKT_max' => $order ); |
|
1047 | + $orderby = array('TKT_max' => $order); |
|
1048 | 1048 | break; |
1049 | 1049 | |
1050 | 1050 | case 'TKT_qty' : |
1051 | - $orderby = array( 'TKT_qty' => $order ); |
|
1051 | + $orderby = array('TKT_qty' => $order); |
|
1052 | 1052 | break; |
1053 | 1053 | } |
1054 | 1054 | |
1055 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1056 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1055 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1056 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1057 | 1057 | |
1058 | 1058 | $_where = array( |
1059 | 1059 | 'TKT_is_default' => 1, |
1060 | 1060 | 'TKT_deleted' => $trashed |
1061 | 1061 | ); |
1062 | 1062 | |
1063 | - $offset = ($current_page-1)*$per_page; |
|
1064 | - $limit = array( $offset, $per_page ); |
|
1063 | + $offset = ($current_page - 1) * $per_page; |
|
1064 | + $limit = array($offset, $per_page); |
|
1065 | 1065 | |
1066 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1067 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1066 | + if (isset($this->_req_data['s'])) { |
|
1067 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1068 | 1068 | $_where['OR'] = array( |
1069 | - 'TKT_name' => array('LIKE',$sstr ), |
|
1070 | - 'TKT_description' => array('LIKE',$sstr ) |
|
1069 | + 'TKT_name' => array('LIKE', $sstr), |
|
1070 | + 'TKT_description' => array('LIKE', $sstr) |
|
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1078,9 +1078,9 @@ discard block |
||
1078 | 1078 | 'group_by'=>'TKT_ID' |
1079 | 1079 | ); |
1080 | 1080 | |
1081 | - if($count){ |
|
1081 | + if ($count) { |
|
1082 | 1082 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1083 | - }else{ |
|
1083 | + } else { |
|
1084 | 1084 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1090,35 +1090,35 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | |
1092 | 1092 | |
1093 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
1093 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
1094 | 1094 | $success = 1; |
1095 | 1095 | |
1096 | 1096 | $TKT = EEM_Ticket::instance(); |
1097 | 1097 | |
1098 | 1098 | //checkboxes? |
1099 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1099 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1100 | 1100 | //if array has more than one element then success message should be plural |
1101 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1101 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1102 | 1102 | |
1103 | 1103 | //cycle thru the boxes |
1104 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1105 | - if ( $trash ) { |
|
1106 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1104 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1105 | + if ($trash) { |
|
1106 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1107 | 1107 | $success = 0; |
1108 | 1108 | } else { |
1109 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1109 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1110 | 1110 | $success = 0; |
1111 | 1111 | } |
1112 | 1112 | } |
1113 | 1113 | } else { |
1114 | 1114 | //grab single id and trash |
1115 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1115 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1116 | 1116 | |
1117 | - if ( $trash ) { |
|
1118 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1117 | + if ($trash) { |
|
1118 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1119 | 1119 | $success = 0; |
1120 | 1120 | } else { |
1121 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1121 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1122 | 1122 | $success = 0; |
1123 | 1123 | } |
1124 | 1124 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | 'action' => 'ticket_list_table', |
1129 | 1129 | 'status' => $trash ? '' : 'trashed' |
1130 | 1130 | ); |
1131 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1131 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
@@ -1141,21 +1141,21 @@ discard block |
||
1141 | 1141 | $TKT = EEM_Ticket::instance(); |
1142 | 1142 | |
1143 | 1143 | //checkboxes? |
1144 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1144 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1145 | 1145 | //if array has more than one element then success message should be plural |
1146 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1146 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1147 | 1147 | |
1148 | 1148 | //cycle thru the boxes |
1149 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1149 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1150 | 1150 | //delete |
1151 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1151 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1152 | 1152 | $success = 0; |
1153 | 1153 | } |
1154 | 1154 | } |
1155 | 1155 | } else { |
1156 | 1156 | //grab single id and trash |
1157 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1158 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1157 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1158 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
@@ -1167,16 +1167,16 @@ discard block |
||
1167 | 1167 | ); |
1168 | 1168 | |
1169 | 1169 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1170 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1170 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE)) |
|
1171 | 1171 | $query_args = array(); |
1172 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1172 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | 1176 | |
1177 | 1177 | |
1178 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
1179 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
1178 | + protected function _delete_the_ticket($TKT_ID) { |
|
1179 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1180 | 1180 | $tkt->_remove_relations('Datetime'); |
1181 | 1181 | //delete all related prices first |
1182 | 1182 | $tkt->delete_related_permanently('Price'); |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -453,8 +454,9 @@ discard block |
||
453 | 454 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
454 | 455 | $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
455 | 456 | |
456 | - if ( ! $orig_event instanceof EE_Event ) |
|
457 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
457 | + if ( ! $orig_event instanceof EE_Event ) { |
|
458 | + throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
459 | + } |
|
458 | 460 | |
459 | 461 | //k now let's clone the $orig_event before getting relations |
460 | 462 | $new_event = clone $orig_event; |
@@ -528,8 +530,9 @@ discard block |
||
528 | 530 | //now let's get the ticket relations setup. |
529 | 531 | foreach ( (array) $orig_tkts as $orig_tkt ) { |
530 | 532 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
531 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
532 | - continue; |
|
533 | + if ( ! $orig_tkt instanceof EE_Ticket ) { |
|
534 | + continue; |
|
535 | + } |
|
533 | 536 | |
534 | 537 | //is this ticket archived? If it is then let's skip |
535 | 538 | if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
@@ -638,9 +641,9 @@ discard block |
||
638 | 641 | protected function _events_export() { |
639 | 642 | if(isset($this->_req_data['EVT_ID'])){ |
640 | 643 | $event_ids = $this->_req_data['EVT_ID']; |
641 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
644 | + } elseif(isset($this->_req_data['EVT_IDs'])){ |
|
642 | 645 | $event_ids = $this->_req_data['EVT_IDs']; |
643 | - }else{ |
|
646 | + } else{ |
|
644 | 647 | $event_ids = NULL; |
645 | 648 | } |
646 | 649 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
@@ -827,8 +830,9 @@ discard block |
||
827 | 830 | |
828 | 831 | extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
829 | 832 | |
830 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
831 | - $walker = new Walker_Radio_Checklist; |
|
833 | + if ( empty($walker) || !is_a($walker, 'Walker') ) { |
|
834 | + $walker = new Walker_Radio_Checklist; |
|
835 | + } |
|
832 | 836 | |
833 | 837 | $descendants_and_self = (int) $descendants_and_self; |
834 | 838 | |
@@ -837,17 +841,19 @@ discard block |
||
837 | 841 | $tax = get_taxonomy($taxonomy); |
838 | 842 | $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
839 | 843 | |
840 | - if ( is_array( $selected_cats ) ) |
|
841 | - $args['selected_cats'] = $selected_cats; |
|
842 | - elseif ( $post_id ) |
|
843 | - $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
844 | - else |
|
845 | - $args['selected_cats'] = array(); |
|
844 | + if ( is_array( $selected_cats ) ) { |
|
845 | + $args['selected_cats'] = $selected_cats; |
|
846 | + } elseif ( $post_id ) { |
|
847 | + $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
848 | + } else { |
|
849 | + $args['selected_cats'] = array(); |
|
850 | + } |
|
846 | 851 | |
847 | - if ( is_array( $popular_cats ) ) |
|
848 | - $args['popular_cats'] = $popular_cats; |
|
849 | - else |
|
850 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
852 | + if ( is_array( $popular_cats ) ) { |
|
853 | + $args['popular_cats'] = $popular_cats; |
|
854 | + } else { |
|
855 | + $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
856 | + } |
|
851 | 857 | |
852 | 858 | if ( $descendants_and_self ) { |
853 | 859 | $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
@@ -900,8 +906,9 @@ discard block |
||
900 | 906 | $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
901 | 907 | |
902 | 908 | //active status dropdown |
903 | - if ( $status !== 'draft' ) |
|
904 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
909 | + if ( $status !== 'draft' ) { |
|
910 | + $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
911 | + } |
|
905 | 912 | |
906 | 913 | //category filter |
907 | 914 | $filters[] = $this->category_dropdown(); |
@@ -1080,7 +1087,7 @@ discard block |
||
1080 | 1087 | |
1081 | 1088 | if($count){ |
1082 | 1089 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1083 | - }else{ |
|
1090 | + } else{ |
|
1084 | 1091 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1085 | 1092 | } |
1086 | 1093 | |
@@ -1103,11 +1110,13 @@ discard block |
||
1103 | 1110 | //cycle thru the boxes |
1104 | 1111 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
1105 | 1112 | if ( $trash ) { |
1106 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1107 | - $success = 0; |
|
1113 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1114 | + $success = 0; |
|
1115 | + } |
|
1108 | 1116 | } else { |
1109 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1110 | - $success = 0; |
|
1117 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1118 | + $success = 0; |
|
1119 | + } |
|
1111 | 1120 | } |
1112 | 1121 | } |
1113 | 1122 | } else { |
@@ -1115,11 +1124,13 @@ discard block |
||
1115 | 1124 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
1116 | 1125 | |
1117 | 1126 | if ( $trash ) { |
1118 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1119 | - $success = 0; |
|
1127 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1128 | + $success = 0; |
|
1129 | + } |
|
1120 | 1130 | } else { |
1121 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1122 | - $success = 0; |
|
1131 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1132 | + $success = 0; |
|
1133 | + } |
|
1123 | 1134 | } |
1124 | 1135 | } |
1125 | 1136 | |
@@ -1167,8 +1178,9 @@ discard block |
||
1167 | 1178 | ); |
1168 | 1179 | |
1169 | 1180 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1170 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1171 | - $query_args = array(); |
|
1181 | + if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) { |
|
1182 | + $query_args = array(); |
|
1183 | + } |
|
1172 | 1184 | $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
1173 | 1185 | } |
1174 | 1186 |
@@ -1,69 +1,69 @@ |
||
1 | 1 | <?php |
2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
3 | 3 | if ( |
4 | - ( is_single() && espresso_display_venue_in_event_details() ) |
|
5 | - || ( is_archive() && espresso_display_venue_in_event_list() ) |
|
4 | + (is_single() && espresso_display_venue_in_event_details()) |
|
5 | + || (is_archive() && espresso_display_venue_in_event_list()) |
|
6 | 6 | ) : |
7 | 7 | global $post; |
8 | - do_action( 'AHEE_event_details_before_venue_details', $post ); |
|
9 | - $venue_name = espresso_venue_name( 0, 'details', FALSE ); |
|
10 | - if ( empty( $venue_name ) && espresso_is_venue_private() ) { |
|
11 | - do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
8 | + do_action('AHEE_event_details_before_venue_details', $post); |
|
9 | + $venue_name = espresso_venue_name(0, 'details', FALSE); |
|
10 | + if (empty($venue_name) && espresso_is_venue_private()) { |
|
11 | + do_action('AHEE_event_details_after_venue_details', $post); |
|
12 | 12 | return ''; |
13 | 13 | } |
14 | 14 | ?> |
15 | 15 | |
16 | 16 | <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>"> |
17 | 17 | <h3 class="event-venues-h3 ee-event-h3"> |
18 | - <?php _e( 'Location', 'event_espresso' ); ?> |
|
18 | + <?php _e('Location', 'event_espresso'); ?> |
|
19 | 19 | </h3> |
20 | - <h4><strong><?php _e( 'Venue:', 'event_espresso' ); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
20 | + <h4><strong><?php _e('Venue:', 'event_espresso'); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
21 | 21 | <p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p> |
22 | -<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
22 | +<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
23 | 23 | <p> |
24 | - <span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?></strong></span> <?php echo $venue_phone; ?> |
|
24 | + <span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?></strong></span> <?php echo $venue_phone; ?> |
|
25 | 25 | </p> |
26 | -<?php endif; ?> |
|
27 | -<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?> |
|
26 | +<?php endif; ?> |
|
27 | +<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?> |
|
28 | 28 | <p> |
29 | - <span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?></strong></span> <?php echo $venue_website; ?> |
|
29 | + <span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?></strong></span> <?php echo $venue_website; ?> |
|
30 | 30 | </p> |
31 | 31 | <?php endif; ?> |
32 | -<?php if ( espresso_venue_has_address( $post->ID )) : ?> |
|
33 | - <strong><span class="dashicons dashicons-location-alt"></span><?php _e( 'Address:', 'event_espresso' ); ?></strong> |
|
34 | - <?php espresso_venue_address( 'inline' ); ?> |
|
35 | - <?php espresso_venue_gmap( $post->ID ); ?> |
|
32 | +<?php if (espresso_venue_has_address($post->ID)) : ?> |
|
33 | + <strong><span class="dashicons dashicons-location-alt"></span><?php _e('Address:', 'event_espresso'); ?></strong> |
|
34 | + <?php espresso_venue_address('inline'); ?> |
|
35 | + <?php espresso_venue_gmap($post->ID); ?> |
|
36 | 36 | <div class="clear"><br/></div> |
37 | -<?php endif; ?> |
|
37 | +<?php endif; ?> |
|
38 | 38 | |
39 | - <?php $VNU_ID = espresso_venue_id( $post->ID ); ?> |
|
40 | - <?php if ( is_single() ) : ?> |
|
41 | - <?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?> |
|
42 | - <?php if ( $venue_description ) : ?> |
|
39 | + <?php $VNU_ID = espresso_venue_id($post->ID); ?> |
|
40 | + <?php if (is_single()) : ?> |
|
41 | + <?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?> |
|
42 | + <?php if ($venue_description) : ?> |
|
43 | 43 | <p> |
44 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
45 | - <?php echo do_shortcode( $venue_description ); ?> |
|
44 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
45 | + <?php echo do_shortcode($venue_description); ?> |
|
46 | 46 | </p> |
47 | - <?php endif; ?> |
|
47 | + <?php endif; ?> |
|
48 | 48 | <?php else : ?> |
49 | - <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?> |
|
50 | - <?php if ( $venue_excerpt ) : ?> |
|
49 | + <?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?> |
|
50 | + <?php if ($venue_excerpt) : ?> |
|
51 | 51 | <p> |
52 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
52 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
53 | 53 | <?php echo $venue_excerpt; ?> |
54 | 54 | </p> |
55 | - <?php endif; ?> |
|
56 | - <?php endif; ?> |
|
55 | + <?php endif; ?> |
|
56 | + <?php endif; ?> |
|
57 | 57 | </div> |
58 | 58 | <!-- .espresso-venue-dv --> |
59 | 59 | <?php |
60 | -do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
60 | +do_action('AHEE_event_details_after_venue_details', $post); |
|
61 | 61 | else : |
62 | - if ( espresso_venue_is_password_protected() ) : |
|
62 | + if (espresso_venue_is_password_protected()) : |
|
63 | 63 | ?> |
64 | 64 | <div class="espresso-venue-dv espresso-password-protected-venue-dv" > |
65 | 65 | <h3 class="event-venues-h3 ee-event-h3"> |
66 | - <?php _e( 'Location', 'event_espresso' );?> |
|
66 | + <?php _e('Location', 'event_espresso'); ?> |
|
67 | 67 | </h3> |
68 | 68 | <?php echo espresso_password_protected_venue_form(); ?> |
69 | 69 | </div> |