@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | |
146 | 146 | /** |
147 | - * @return null |
|
147 | + * @return EE_Line_Item_Display |
|
148 | 148 | */ |
149 | 149 | public function line_item_display() { |
150 | 150 | return $this->line_item_display; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | |
155 | 155 | /** |
156 | - * @param null $line_item_display |
|
156 | + * @param EE_Line_Item_Display $line_item_display |
|
157 | 157 | */ |
158 | 158 | public function set_line_item_display( $line_item_display ) { |
159 | 159 | $this->line_item_display = $line_item_display; |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | * _apply_registration_payments_to_amount_owing |
840 | 840 | * |
841 | 841 | * @access protected |
842 | - * @param array $registrations |
|
842 | + * @param EE_Base_Class[] $registrations |
|
843 | 843 | */ |
844 | 844 | protected function _apply_registration_payments_to_amount_owing( array $registrations ) { |
845 | 845 | $payments = array(); |
@@ -1112,7 +1112,7 @@ discard block |
||
1112 | 1112 | * get_billing_form_html_for_payment_method |
1113 | 1113 | * |
1114 | 1114 | * @access public |
1115 | - * @return string |
|
1115 | + * @return boolean |
|
1116 | 1116 | * @throws \EE_Error |
1117 | 1117 | */ |
1118 | 1118 | public function get_billing_form_html_for_payment_method() { |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | * |
1177 | 1177 | * @access private |
1178 | 1178 | * @param EE_Payment_Method $payment_method |
1179 | - * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML |
|
1179 | + * @return EE_Billing_Info_Form |
|
1180 | 1180 | * @throws \EE_Error |
1181 | 1181 | */ |
1182 | 1182 | private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | * switch_payment_method |
1281 | 1281 | * |
1282 | 1282 | * @access public |
1283 | - * @return string |
|
1283 | + * @return boolean |
|
1284 | 1284 | * @throws \EE_Error |
1285 | 1285 | */ |
1286 | 1286 | public function switch_payment_method() { |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | /** |
1488 | 1488 | * process_reg_step |
1489 | 1489 | * |
1490 | - * @return boolean |
|
1490 | + * @return null|boolean |
|
1491 | 1491 | * @throws \EE_Error |
1492 | 1492 | */ |
1493 | 1493 | public function process_reg_step() { |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | * update_reg_step |
1614 | 1614 | * this is the final step after a user revisits the site to retry a payment |
1615 | 1615 | * |
1616 | - * @return boolean |
|
1616 | + * @return null|boolean |
|
1617 | 1617 | * @throws \EE_Error |
1618 | 1618 | */ |
1619 | 1619 | public function update_reg_step() { |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | * |
1982 | 1982 | * @access private |
1983 | 1983 | * @type EE_Payment_Method $payment_method |
1984 | - * @return mixed EE_Payment | boolean |
|
1984 | + * @return EE_Payment|null EE_Payment | boolean |
|
1985 | 1985 | * @throws \EE_Error |
1986 | 1986 | */ |
1987 | 1987 | private function _attempt_payment( EE_Payment_Method $payment_method ) { |
@@ -2112,7 +2112,7 @@ discard block |
||
2112 | 2112 | * _post_payment_processing |
2113 | 2113 | * |
2114 | 2114 | * @access private |
2115 | - * @param EE_Payment|bool $payment |
|
2115 | + * @param EE_Payment $payment |
|
2116 | 2116 | * @return bool |
2117 | 2117 | * @throws \EE_Error |
2118 | 2118 | */ |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | * or present the payment options again |
2302 | 2302 | * |
2303 | 2303 | * @access private |
2304 | - * @return EE_Payment | FALSE |
|
2304 | + * @return boolean | FALSE |
|
2305 | 2305 | * @throws \EE_Error |
2306 | 2306 | */ |
2307 | 2307 | public function process_gateway_response() { |
@@ -2434,8 +2434,8 @@ discard block |
||
2434 | 2434 | * _redirect_wayward_request |
2435 | 2435 | * |
2436 | 2436 | * @access private |
2437 | - * @param \EE_Registration|null $primary_registrant |
|
2438 | - * @return bool |
|
2437 | + * @param EE_Registration $primary_registrant |
|
2438 | + * @return false|null |
|
2439 | 2439 | * @throws \EE_Error |
2440 | 2440 | */ |
2441 | 2441 | private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
@@ -467,38 +467,38 @@ discard block |
||
467 | 467 | * @throws \EE_Error |
468 | 468 | */ |
469 | 469 | public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) { |
470 | - // registrations per event |
|
470 | + // registrations per event |
|
471 | 471 | $event_reg_count = array(); |
472 | 472 | // spaces left per event |
473 | 473 | $event_spaces_remaining = array(); |
474 | - // tickets left sorted by ID |
|
475 | - $tickets_remaining = array(); |
|
476 | - // registrations that have lost their space |
|
474 | + // tickets left sorted by ID |
|
475 | + $tickets_remaining = array(); |
|
476 | + // registrations that have lost their space |
|
477 | 477 | $ejected_registrations = array(); |
478 | 478 | foreach ( $registrations as $REG_ID => $registration ) { |
479 | 479 | if ( $registration->status_ID() === EEM_Registration::status_id_approved ) { |
480 | 480 | continue; |
481 | 481 | } |
482 | 482 | $EVT_ID = $registration->event_ID(); |
483 | - $ticket = $registration->ticket(); |
|
484 | - if ( ! isset($tickets_remaining[$ticket->ID()])) { |
|
485 | - $tickets_remaining[$ticket->ID()] = $ticket->remaining(); |
|
486 | - } |
|
487 | - if ($tickets_remaining[$ticket->ID()] > 0) { |
|
488 | - if ( ! isset($event_reg_count[$EVT_ID])) { |
|
489 | - $event_reg_count[$EVT_ID] = 0; |
|
490 | - } |
|
491 | - $event_reg_count[$EVT_ID]++; |
|
492 | - if ( ! isset($event_spaces_remaining[$EVT_ID])) { |
|
493 | - $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale(); |
|
494 | - } |
|
495 | - } |
|
483 | + $ticket = $registration->ticket(); |
|
484 | + if ( ! isset($tickets_remaining[$ticket->ID()])) { |
|
485 | + $tickets_remaining[$ticket->ID()] = $ticket->remaining(); |
|
486 | + } |
|
487 | + if ($tickets_remaining[$ticket->ID()] > 0) { |
|
488 | + if ( ! isset($event_reg_count[$EVT_ID])) { |
|
489 | + $event_reg_count[$EVT_ID] = 0; |
|
490 | + } |
|
491 | + $event_reg_count[$EVT_ID]++; |
|
492 | + if ( ! isset($event_spaces_remaining[$EVT_ID])) { |
|
493 | + $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale(); |
|
494 | + } |
|
495 | + } |
|
496 | 496 | if ( |
497 | 497 | $revisit |
498 | 498 | && ( |
499 | - $tickets_remaining[$ticket->ID()] === 0 |
|
500 | - || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ] |
|
501 | - ) |
|
499 | + $tickets_remaining[$ticket->ID()] === 0 |
|
500 | + || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ] |
|
501 | + ) |
|
502 | 502 | ) { |
503 | 503 | $ejected_registrations[ $REG_ID ] = $registration->event(); |
504 | 504 | if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) { |
@@ -573,9 +573,9 @@ discard block |
||
573 | 573 | 'layout_strategy' => new EE_Template_Layout( |
574 | 574 | array( |
575 | 575 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
576 | - . $this->_slug |
|
577 | - . DS |
|
578 | - . 'sold_out_events.template.php', |
|
576 | + . $this->_slug |
|
577 | + . DS |
|
578 | + . 'sold_out_events.template.php', |
|
579 | 579 | 'template_args' => apply_filters( |
580 | 580 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
581 | 581 | array( |
@@ -626,9 +626,9 @@ discard block |
||
626 | 626 | 'layout_strategy' => new EE_Template_Layout( |
627 | 627 | array( |
628 | 628 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
629 | - . $this->_slug |
|
630 | - . DS |
|
631 | - . 'sold_out_events.template.php', |
|
629 | + . $this->_slug |
|
630 | + . DS |
|
631 | + . 'sold_out_events.template.php', |
|
632 | 632 | 'template_args' => apply_filters( |
633 | 633 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args', |
634 | 634 | array( |
@@ -680,9 +680,9 @@ discard block |
||
680 | 680 | 'layout_strategy' => new EE_Template_Layout( |
681 | 681 | array( |
682 | 682 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
683 | - . $this->_slug |
|
684 | - . DS |
|
685 | - . 'events_requiring_pre_approval.template.php', // layout_template |
|
683 | + . $this->_slug |
|
684 | + . DS |
|
685 | + . 'events_requiring_pre_approval.template.php', // layout_template |
|
686 | 686 | 'template_args' => apply_filters( |
687 | 687 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
688 | 688 | array( |
@@ -724,9 +724,9 @@ discard block |
||
724 | 724 | 'layout_strategy' => new EE_Template_Layout( |
725 | 725 | array( |
726 | 726 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
727 | - . $this->_slug |
|
728 | - . DS |
|
729 | - . 'no_payment_required.template.php', // layout_template |
|
727 | + . $this->_slug |
|
728 | + . DS |
|
729 | + . 'no_payment_required.template.php', // layout_template |
|
730 | 730 | 'template_args' => apply_filters( |
731 | 731 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
732 | 732 | array( |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
957 | 957 | } |
958 | 958 | $payment_methods_billing_info[ $payment_method->slug() |
959 | - . '-info' ] = $this->_payment_method_billing_info( |
|
959 | + . '-info' ] = $this->_payment_method_billing_info( |
|
960 | 960 | $payment_method |
961 | 961 | ); |
962 | 962 | } |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | // fill form with attendee info if applicable |
1145 | 1145 | if ( |
1146 | 1146 | $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form |
1147 | - && $this->checkout->transaction_has_primary_registrant() |
|
1147 | + && $this->checkout->transaction_has_primary_registrant() |
|
1148 | 1148 | ) { |
1149 | 1149 | $payment_method_billing_form->populate_from_attendee( |
1150 | 1150 | $this->checkout->transaction->primary_registration()->attendee() |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | // and debug content |
1154 | 1154 | if ( |
1155 | 1155 | $payment_method_billing_form instanceof EE_Billing_Info_Form |
1156 | - && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1156 | + && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1157 | 1157 | ) { |
1158 | 1158 | $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
1159 | 1159 | $payment_method_billing_form |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | } |
1313 | 1313 | // fill form with attendee info if applicable |
1314 | 1314 | if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
1315 | - && $this->checkout->transaction_has_primary_registrant() |
|
1315 | + && $this->checkout->transaction_has_primary_registrant() |
|
1316 | 1316 | ) { |
1317 | 1317 | $this->checkout->billing_form->populate_from_attendee( |
1318 | 1318 | $this->checkout->transaction->primary_registration()->attendee() |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | } |
1321 | 1321 | // and debug content |
1322 | 1322 | if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form |
1323 | - && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1323 | + && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1324 | 1324 | ) { |
1325 | 1325 | $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
1326 | 1326 | $this->checkout->billing_form |
@@ -1454,8 +1454,8 @@ discard block |
||
1454 | 1454 | } |
1455 | 1455 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1456 | 1456 | if ( ! empty( $attendee_data['ATT_fname'] ) |
1457 | - && ! empty( $attendee_data['ATT_lname'] ) |
|
1458 | - && ! empty( $attendee_data['ATT_email'] ) |
|
1457 | + && ! empty( $attendee_data['ATT_lname'] ) |
|
1458 | + && ! empty( $attendee_data['ATT_email'] ) |
|
1459 | 1459 | ) { |
1460 | 1460 | $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( |
1461 | 1461 | array( |
@@ -1697,7 +1697,7 @@ discard block |
||
1697 | 1697 | $payment_status = $payment->status(); |
1698 | 1698 | if ( |
1699 | 1699 | $payment_status === EEM_Payment::status_id_approved |
1700 | - || $payment_status === EEM_Payment::status_id_pending |
|
1700 | + || $payment_status === EEM_Payment::status_id_pending |
|
1701 | 1701 | ) { |
1702 | 1702 | return true; |
1703 | 1703 | } else { |
@@ -1885,8 +1885,8 @@ discard block |
||
1885 | 1885 | return false; |
1886 | 1886 | } |
1887 | 1887 | if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) |
1888 | - instanceof |
|
1889 | - EE_Attendee |
|
1888 | + instanceof |
|
1889 | + EE_Attendee |
|
1890 | 1890 | ) { |
1891 | 1891 | EE_Error::add_error( |
1892 | 1892 | sprintf( |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,32 +38,32 @@ discard block |
||
38 | 38 | public static function set_hooks() { |
39 | 39 | add_filter( |
40 | 40 | 'FHEE__SPCO__EE_Line_Item_Filter_Collection', |
41 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) |
|
41 | + array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters') |
|
42 | 42 | ); |
43 | 43 | add_action( |
44 | 44 | 'wp_ajax_switch_spco_billing_form', |
45 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
45 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
46 | 46 | ); |
47 | 47 | add_action( |
48 | 48 | 'wp_ajax_nopriv_switch_spco_billing_form', |
49 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
49 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
50 | 50 | ); |
51 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) ); |
|
51 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
52 | 52 | add_action( |
53 | 53 | 'wp_ajax_nopriv_save_payer_details', |
54 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) |
|
54 | + array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details') |
|
55 | 55 | ); |
56 | 56 | add_action( |
57 | 57 | 'wp_ajax_get_transaction_details_for_gateways', |
58 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
58 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
59 | 59 | ); |
60 | 60 | add_action( |
61 | 61 | 'wp_ajax_nopriv_get_transaction_details_for_gateways', |
62 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
62 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
63 | 63 | ); |
64 | 64 | add_filter( |
65 | 65 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
66 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), |
|
66 | + array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), |
|
67 | 67 | 10, |
68 | 68 | 1 |
69 | 69 | ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @throws \EE_Error |
78 | 78 | */ |
79 | 79 | public static function switch_spco_billing_form() { |
80 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
80 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @throws \EE_Error |
89 | 89 | */ |
90 | 90 | public static function save_payer_details() { |
91 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
91 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @throws \EE_Error |
100 | 100 | */ |
101 | 101 | public static function get_transaction_details() { |
102 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
102 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | * @param EE_Checkout $checkout |
128 | 128 | * @return \EE_SPCO_Reg_Step_Payment_Options |
129 | 129 | */ |
130 | - public function __construct( EE_Checkout $checkout ) { |
|
130 | + public function __construct(EE_Checkout $checkout) { |
|
131 | 131 | $this->_slug = 'payment_options'; |
132 | - $this->_name = __( 'Payment Options', 'event_espresso' ); |
|
133 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
132 | + $this->_name = __('Payment Options', 'event_espresso'); |
|
133 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
134 | 134 | $this->checkout = $checkout; |
135 | 135 | $this->_reset_success_message(); |
136 | 136 | $this->set_instructions( |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @param null $line_item_display |
157 | 157 | */ |
158 | - public function set_line_item_display( $line_item_display ) { |
|
158 | + public function set_line_item_display($line_item_display) { |
|
159 | 159 | $this->line_item_display = $line_item_display; |
160 | 160 | } |
161 | 161 | |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * @param boolean $handle_IPN_in_this_request |
175 | 175 | */ |
176 | - public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) { |
|
177 | - $this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN ); |
|
176 | + public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) { |
|
177 | + $this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | public function enqueue_styles_and_scripts() { |
210 | 210 | $transaction = $this->checkout->transaction; |
211 | 211 | //if the transaction isn't set or nothing is owed on it, don't enqueue any JS |
212 | - if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) { |
|
212 | + if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | - foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) { |
|
215 | + foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) { |
|
216 | 216 | $type_obj = $payment_method->type_obj(); |
217 | - if( $type_obj instanceof EE_PMT_Base ) { |
|
218 | - $billing_form = $type_obj->generate_new_billing_form( $transaction ); |
|
219 | - if( $billing_form instanceof EE_Form_Section_Proper ) { |
|
217 | + if ($type_obj instanceof EE_PMT_Base) { |
|
218 | + $billing_form = $type_obj->generate_new_billing_form($transaction); |
|
219 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
220 | 220 | $billing_form->enqueue_js(); |
221 | 221 | } |
222 | 222 | } |
@@ -241,20 +241,20 @@ discard block |
||
241 | 241 | // $ 0.00 transactions (no payment required) |
242 | 242 | ! $this->checkout->payment_required() |
243 | 243 | // but do NOT remove if current action being called belongs to this reg step |
244 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
244 | + && ! is_callable(array($this, $this->checkout->action)) |
|
245 | 245 | && ! $this->completed() |
246 | 246 | ) { |
247 | 247 | // and if so, then we no longer need the Payment Options step |
248 | - if ( $this->is_current_step() ) { |
|
248 | + if ($this->is_current_step()) { |
|
249 | 249 | $this->checkout->generate_reg_form = false; |
250 | 250 | } |
251 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
251 | + $this->checkout->remove_reg_step($this->_slug); |
|
252 | 252 | // DEBUG LOG |
253 | 253 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | // load EEM_Payment_Method |
257 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
257 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
258 | 258 | // get all active payment methods |
259 | 259 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
260 | 260 | $this->checkout->transaction, |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | $insufficient_spaces_available = array(); |
282 | 282 | $reg_count = 0; |
283 | 283 | // loop thru registrations to gather info |
284 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
284 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
285 | 285 | $ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space( |
286 | 286 | $registrations, |
287 | 287 | $this->checkout->revisit |
288 | 288 | ); |
289 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
289 | + foreach ($registrations as $REG_ID => $registration) { |
|
290 | 290 | // has this registration lost it's space ? |
291 | - if ( isset( $ejected_registrations[ $REG_ID ] ) ) { |
|
292 | - $insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event(); |
|
291 | + if (isset($ejected_registrations[$REG_ID])) { |
|
292 | + $insufficient_spaces_available[$registration->event()->ID()] = $registration->event(); |
|
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | /** @var $registration EE_Registration */ |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | && $registration->status_ID() === EEM_Registration::status_id_approved |
302 | 302 | ) |
303 | 303 | ) { |
304 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) { |
|
304 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
305 | 305 | // add event to list of events that are sold out |
306 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
306 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
307 | 307 | do_action( |
308 | 308 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
309 | 309 | $registration->event(), |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | continue; |
313 | 313 | } |
314 | 314 | // event requires admin approval |
315 | - if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) { |
|
315 | + if ($registration->status_ID() === EEM_Registration::status_id_not_approved) { |
|
316 | 316 | // add event to list of events with pre-approval reg status |
317 | - $registrations_requiring_pre_approval[ $REG_ID ] = $registration; |
|
317 | + $registrations_requiring_pre_approval[$REG_ID] = $registration; |
|
318 | 318 | do_action( |
319 | 319 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
320 | 320 | $registration->event(), |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | } |
324 | 324 | } |
325 | 325 | // are they allowed to pay now and is there monies owing? |
326 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
327 | - $registrations_requiring_payment[ $REG_ID ] = $registration; |
|
326 | + if ($registration->owes_monies_and_can_pay()) { |
|
327 | + $registrations_requiring_payment[$REG_ID] = $registration; |
|
328 | 328 | do_action( |
329 | 329 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
330 | 330 | $registration->event(), |
@@ -335,29 +335,29 @@ discard block |
||
335 | 335 | && $registration->status_ID() !== EEM_Registration::status_id_not_approved |
336 | 336 | && $registration->ticket()->is_free() |
337 | 337 | ) { |
338 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
338 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | $subsections = array(); |
342 | 342 | // now decide which template to load |
343 | - if ( ! empty( $sold_out_events ) ) { |
|
344 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
343 | + if ( ! empty($sold_out_events)) { |
|
344 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
345 | 345 | } |
346 | - if ( ! empty( $insufficient_spaces_available ) ) { |
|
346 | + if ( ! empty($insufficient_spaces_available)) { |
|
347 | 347 | $subsections['insufficient_space'] = $this->_insufficient_spaces_available( |
348 | 348 | $insufficient_spaces_available |
349 | 349 | ); |
350 | 350 | } |
351 | - if ( ! empty( $registrations_requiring_pre_approval ) ) { |
|
351 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
352 | 352 | $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( |
353 | 353 | $registrations_requiring_pre_approval |
354 | 354 | ); |
355 | 355 | } |
356 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
357 | - $subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events ); |
|
356 | + if ( ! empty($registrations_for_free_events)) { |
|
357 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
358 | 358 | } |
359 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
360 | - if ( $this->checkout->amount_owing > 0 ) { |
|
359 | + if ( ! empty($registrations_requiring_payment)) { |
|
360 | + if ($this->checkout->amount_owing > 0) { |
|
361 | 361 | // autoload Line_Item_Display classes |
362 | 362 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
363 | 363 | $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
@@ -370,15 +370,15 @@ discard block |
||
370 | 370 | /** @var EE_Line_Item $filtered_line_item_tree */ |
371 | 371 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
372 | 372 | EEH_Autoloader::register_line_item_display_autoloaders(); |
373 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
373 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
374 | 374 | $subsections['payment_options'] = $this->_display_payment_options( |
375 | 375 | $this->line_item_display->display_line_item( |
376 | 376 | $filtered_line_item_tree, |
377 | - array( 'registrations' => $registrations ) |
|
377 | + array('registrations' => $registrations) |
|
378 | 378 | ) |
379 | 379 | ); |
380 | 380 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
381 | - $this->_apply_registration_payments_to_amount_owing( $registrations ); |
|
381 | + $this->_apply_registration_payments_to_amount_owing($registrations); |
|
382 | 382 | } |
383 | 383 | } else { |
384 | 384 | $this->_hide_reg_step_submit_button_if_revisit(); |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * @return \EE_Line_Item_Filter_Collection |
410 | 410 | * @throws \EE_Error |
411 | 411 | */ |
412 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
412 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
413 | 413 | $line_item_filter_collection->add( |
414 | 414 | new EE_Billable_Line_Item_Filter( |
415 | 415 | EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations( |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | ) |
420 | 420 | ) |
421 | 421 | ); |
422 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
422 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
423 | 423 | return $line_item_filter_collection; |
424 | 424 | } |
425 | 425 | |
@@ -435,15 +435,15 @@ discard block |
||
435 | 435 | * @return \EE_Registration[] |
436 | 436 | * @throws \EE_Error |
437 | 437 | */ |
438 | - public static function remove_ejected_registrations( array $registrations ) { |
|
438 | + public static function remove_ejected_registrations(array $registrations) { |
|
439 | 439 | $ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space( |
440 | 440 | $registrations, |
441 | 441 | EE_Registry::instance()->SSN->checkout()->revisit |
442 | 442 | ); |
443 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
443 | + foreach ($registrations as $REG_ID => $registration) { |
|
444 | 444 | // has this registration lost it's space ? |
445 | - if ( isset( $ejected_registrations[ $REG_ID ] ) ) { |
|
446 | - unset( $registrations[ $REG_ID ] ); |
|
445 | + if (isset($ejected_registrations[$REG_ID])) { |
|
446 | + unset($registrations[$REG_ID]); |
|
447 | 447 | continue; |
448 | 448 | } |
449 | 449 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | * @return array |
467 | 467 | * @throws \EE_Error |
468 | 468 | */ |
469 | - public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) { |
|
469 | + public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) { |
|
470 | 470 | // registrations per event |
471 | 471 | $event_reg_count = array(); |
472 | 472 | // spaces left per event |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | $tickets_remaining = array(); |
476 | 476 | // registrations that have lost their space |
477 | 477 | $ejected_registrations = array(); |
478 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
479 | - if ( $registration->status_ID() === EEM_Registration::status_id_approved ) { |
|
478 | + foreach ($registrations as $REG_ID => $registration) { |
|
479 | + if ($registration->status_ID() === EEM_Registration::status_id_approved) { |
|
480 | 480 | continue; |
481 | 481 | } |
482 | 482 | $EVT_ID = $registration->event_ID(); |
@@ -497,13 +497,13 @@ discard block |
||
497 | 497 | $revisit |
498 | 498 | && ( |
499 | 499 | $tickets_remaining[$ticket->ID()] === 0 |
500 | - || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ] |
|
500 | + || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID] |
|
501 | 501 | ) |
502 | 502 | ) { |
503 | - $ejected_registrations[ $REG_ID ] = $registration->event(); |
|
504 | - if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) { |
|
503 | + $ejected_registrations[$REG_ID] = $registration->event(); |
|
504 | + if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) { |
|
505 | 505 | /** @type EE_Registration_Processor $registration_processor */ |
506 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
506 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
507 | 507 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
508 | 508 | $registration_processor->manually_update_registration_status( |
509 | 509 | $registration, |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | * @return void |
539 | 539 | */ |
540 | 540 | protected function _hide_reg_step_submit_button_if_revisit() { |
541 | - if ( $this->checkout->revisit ) { |
|
542 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
541 | + if ($this->checkout->revisit) { |
|
542 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
543 | 543 | } |
544 | 544 | } |
545 | 545 | |
@@ -553,13 +553,13 @@ discard block |
||
553 | 553 | * @return \EE_Form_Section_Proper |
554 | 554 | * @throws \EE_Error |
555 | 555 | */ |
556 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
556 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
557 | 557 | // set some defaults |
558 | 558 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
559 | 559 | $sold_out_events = ''; |
560 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
560 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
561 | 561 | $sold_out_events .= EEH_HTML::li( |
562 | - EEH_HTML::span( ' ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ) |
|
562 | + EEH_HTML::span(' '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text') |
|
563 | 563 | ); |
564 | 564 | } |
565 | 565 | return new EE_Form_Section_Proper( |
@@ -606,14 +606,14 @@ discard block |
||
606 | 606 | * @return \EE_Form_Section_Proper |
607 | 607 | * @throws \EE_Error |
608 | 608 | */ |
609 | - private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) { |
|
609 | + private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) { |
|
610 | 610 | // set some defaults |
611 | 611 | $this->checkout->selected_method_of_payment = 'invoice'; |
612 | 612 | $insufficient_space_events = ''; |
613 | - foreach ( $insufficient_spaces_events_array as $event ) { |
|
614 | - if ( $event instanceof EE_Event ) { |
|
613 | + foreach ($insufficient_spaces_events_array as $event) { |
|
614 | + if ($event instanceof EE_Event) { |
|
615 | 615 | $insufficient_space_events .= EEH_HTML::li( |
616 | - EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ) |
|
616 | + EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text') |
|
617 | 617 | ); |
618 | 618 | } |
619 | 619 | } |
@@ -657,17 +657,17 @@ discard block |
||
657 | 657 | * @return \EE_Form_Section_Proper |
658 | 658 | * @throws \EE_Error |
659 | 659 | */ |
660 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) { |
|
660 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
661 | 661 | $events_requiring_pre_approval = ''; |
662 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
663 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
664 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
662 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
663 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
664 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
665 | 665 | EEH_HTML::span( |
666 | 666 | '', |
667 | 667 | '', |
668 | 668 | 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
669 | 669 | ) |
670 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
670 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
671 | 671 | ); |
672 | 672 | } |
673 | 673 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | 'template_args' => apply_filters( |
687 | 687 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
688 | 688 | array( |
689 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
689 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
690 | 690 | 'events_requiring_pre_approval_msg' => apply_filters( |
691 | 691 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
692 | 692 | __( |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | * @return \EE_Form_Section_Proper |
712 | 712 | * @throws \EE_Error |
713 | 713 | */ |
714 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
714 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
715 | 715 | // set some defaults |
716 | 716 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
717 | 717 | // generate no_payment_required form |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | 'ticket_count' => array(), |
736 | 736 | 'registrations_for_free_events' => $registrations_for_free_events, |
737 | 737 | 'no_payment_required_msg' => EEH_HTML::p( |
738 | - __( 'This is a free event, so no billing will occur.', 'event_espresso' ) |
|
738 | + __('This is a free event, so no billing will occur.', 'event_espresso') |
|
739 | 739 | ) |
740 | 740 | ) |
741 | 741 | ), |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | * @return \EE_Form_Section_Proper |
755 | 755 | * @throws \EE_Error |
756 | 756 | */ |
757 | - private function _display_payment_options( $transaction_details = '' ) { |
|
757 | + private function _display_payment_options($transaction_details = '') { |
|
758 | 758 | // has method_of_payment been set by no-js user? |
759 | 759 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
760 | 760 | // build payment options form |
@@ -766,18 +766,18 @@ discard block |
||
766 | 766 | 'before_payment_options' => apply_filters( |
767 | 767 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
768 | 768 | new EE_Form_Section_Proper( |
769 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
769 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
770 | 770 | ) |
771 | 771 | ), |
772 | 772 | 'payment_options' => $this->_setup_payment_options(), |
773 | 773 | 'after_payment_options' => apply_filters( |
774 | 774 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
775 | 775 | new EE_Form_Section_Proper( |
776 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
776 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
777 | 777 | ) |
778 | 778 | ), |
779 | 779 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
780 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( false ) |
|
780 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(false) |
|
781 | 781 | ), |
782 | 782 | 'layout_strategy' => new EE_Template_Layout( |
783 | 783 | array( |
@@ -806,10 +806,10 @@ discard block |
||
806 | 806 | * @return \EE_Form_Section_Proper |
807 | 807 | * @throws \EE_Error |
808 | 808 | */ |
809 | - private function _extra_hidden_inputs( $no_payment_required = true ) { |
|
809 | + private function _extra_hidden_inputs($no_payment_required = true) { |
|
810 | 810 | return new EE_Form_Section_Proper( |
811 | 811 | array( |
812 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
812 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
813 | 813 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
814 | 814 | 'subsections' => array( |
815 | 815 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -841,16 +841,16 @@ discard block |
||
841 | 841 | * @access protected |
842 | 842 | * @param array $registrations |
843 | 843 | */ |
844 | - protected function _apply_registration_payments_to_amount_owing( array $registrations ) { |
|
844 | + protected function _apply_registration_payments_to_amount_owing(array $registrations) { |
|
845 | 845 | $payments = array(); |
846 | - foreach ( $registrations as $registration ) { |
|
847 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
846 | + foreach ($registrations as $registration) { |
|
847 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
848 | 848 | $payments += $registration->registration_payments(); |
849 | 849 | } |
850 | 850 | } |
851 | - if ( ! empty( $payments ) ) { |
|
852 | - foreach ( $payments as $payment ) { |
|
853 | - if ( $payment instanceof EE_Registration_Payment ) { |
|
851 | + if ( ! empty($payments)) { |
|
852 | + foreach ($payments as $payment) { |
|
853 | + if ($payment instanceof EE_Registration_Payment) { |
|
854 | 854 | $this->checkout->amount_owing -= $payment->amount(); |
855 | 855 | } |
856 | 856 | } |
@@ -866,11 +866,11 @@ discard block |
||
866 | 866 | * @param bool $force_reset |
867 | 867 | * @return void |
868 | 868 | */ |
869 | - private function _reset_selected_method_of_payment( $force_reset = false ) { |
|
869 | + private function _reset_selected_method_of_payment($force_reset = false) { |
|
870 | 870 | $reset_payment_method = $force_reset |
871 | 871 | ? true |
872 | - : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) ); |
|
873 | - if ( $reset_payment_method ) { |
|
872 | + : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false)); |
|
873 | + if ($reset_payment_method) { |
|
874 | 874 | $this->checkout->selected_method_of_payment = null; |
875 | 875 | $this->checkout->payment_method = null; |
876 | 876 | $this->checkout->billing_form = null; |
@@ -889,12 +889,12 @@ discard block |
||
889 | 889 | * @param string $selected_method_of_payment |
890 | 890 | * @return EE_Billing_Info_Form |
891 | 891 | */ |
892 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
893 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) |
|
892 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
893 | + $selected_method_of_payment = ! empty($selected_method_of_payment) |
|
894 | 894 | ? $selected_method_of_payment |
895 | 895 | : $this->checkout->selected_method_of_payment; |
896 | 896 | EE_Registry::instance()->SSN->set_session_data( |
897 | - array( 'selected_method_of_payment' => $selected_method_of_payment ) |
|
897 | + array('selected_method_of_payment' => $selected_method_of_payment) |
|
898 | 898 | ); |
899 | 899 | } |
900 | 900 | |
@@ -910,19 +910,19 @@ discard block |
||
910 | 910 | // load payment method classes |
911 | 911 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
912 | 912 | // switch up header depending on number of available payment methods |
913 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
913 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
914 | 914 | ? apply_filters( |
915 | 915 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
916 | - __( 'Please Select Your Method of Payment', 'event_espresso' ) |
|
916 | + __('Please Select Your Method of Payment', 'event_espresso') |
|
917 | 917 | ) |
918 | 918 | : apply_filters( |
919 | 919 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
920 | - __( 'Method of Payment', 'event_espresso' ) |
|
920 | + __('Method of Payment', 'event_espresso') |
|
921 | 921 | ); |
922 | 922 | $available_payment_methods = array( |
923 | 923 | // display the "Payment Method" header |
924 | 924 | 'payment_method_header' => new EE_Form_Section_HTML( |
925 | - EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' ) |
|
925 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
926 | 926 | ) |
927 | 927 | ); |
928 | 928 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
@@ -931,32 +931,32 @@ discard block |
||
931 | 931 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
932 | 932 | $payment_methods_billing_info = array( |
933 | 933 | new EE_Form_Section_HTML( |
934 | - EEH_HTML::div( '<br />', '', '', 'clear:both;' ) |
|
934 | + EEH_HTML::div('<br />', '', '', 'clear:both;') |
|
935 | 935 | ) |
936 | 936 | ); |
937 | 937 | // loop through payment methods |
938 | - foreach ( $this->checkout->available_payment_methods as $payment_method ) { |
|
939 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
938 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
939 | + if ($payment_method instanceof EE_Payment_Method) { |
|
940 | 940 | $payment_method_button = EEH_HTML::img( |
941 | 941 | $payment_method->button_url(), |
942 | 942 | $payment_method->name(), |
943 | - 'spco-payment-method-' . $payment_method->slug() . '-btn-img', |
|
943 | + 'spco-payment-method-'.$payment_method->slug().'-btn-img', |
|
944 | 944 | 'spco-payment-method-btn-img' |
945 | 945 | ); |
946 | 946 | // check if any payment methods are set as default |
947 | 947 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
948 | 948 | if ( |
949 | - ( $this->checkout->selected_method_of_payment === $payment_method->slug() ) |
|
950 | - || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() ) |
|
949 | + ($this->checkout->selected_method_of_payment === $payment_method->slug()) |
|
950 | + || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default()) |
|
951 | 951 | ) { |
952 | 952 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
953 | 953 | $this->_save_selected_method_of_payment(); |
954 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
954 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
955 | 955 | } else { |
956 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
956 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
957 | 957 | } |
958 | - $payment_methods_billing_info[ $payment_method->slug() |
|
959 | - . '-info' ] = $this->_payment_method_billing_info( |
|
958 | + $payment_methods_billing_info[$payment_method->slug() |
|
959 | + . '-info'] = $this->_payment_method_billing_info( |
|
960 | 960 | $payment_method |
961 | 961 | ); |
962 | 962 | } |
@@ -986,12 +986,12 @@ discard block |
||
986 | 986 | * @return EE_Payment_Method[] |
987 | 987 | */ |
988 | 988 | protected function _get_available_payment_methods() { |
989 | - if ( ! empty( $this->checkout->available_payment_methods ) ) { |
|
989 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
990 | 990 | return $this->checkout->available_payment_methods; |
991 | 991 | } |
992 | 992 | $available_payment_methods = array(); |
993 | 993 | // load EEM_Payment_Method |
994 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
994 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
995 | 995 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
996 | 996 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
997 | 997 | // get all active payment methods |
@@ -999,9 +999,9 @@ discard block |
||
999 | 999 | $this->checkout->transaction, |
1000 | 1000 | EEM_Payment_Method::scope_cart |
1001 | 1001 | ); |
1002 | - foreach ( $payment_methods as $payment_method ) { |
|
1003 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
1004 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
1002 | + foreach ($payment_methods as $payment_method) { |
|
1003 | + if ($payment_method instanceof EE_Payment_Method) { |
|
1004 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | return $available_payment_methods; |
@@ -1016,14 +1016,14 @@ discard block |
||
1016 | 1016 | * @param array $available_payment_method_options |
1017 | 1017 | * @return \EE_Form_Section_Proper |
1018 | 1018 | */ |
1019 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
1019 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
1020 | 1020 | // generate inputs |
1021 | 1021 | return new EE_Form_Section_Proper( |
1022 | 1022 | array( |
1023 | 1023 | 'html_id' => 'ee-available-payment-method-inputs', |
1024 | 1024 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
1025 | 1025 | 'subsections' => array( |
1026 | - '' => new EE_Radio_Button_Input ( |
|
1026 | + '' => new EE_Radio_Button_Input( |
|
1027 | 1027 | $available_payment_method_options, |
1028 | 1028 | array( |
1029 | 1029 | 'html_name' => 'selected_method_of_payment', |
@@ -1048,28 +1048,28 @@ discard block |
||
1048 | 1048 | * @return \EE_Form_Section_Proper |
1049 | 1049 | * @throws \EE_Error |
1050 | 1050 | */ |
1051 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
1051 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
1052 | 1052 | $currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug() |
1053 | 1053 | ? true |
1054 | 1054 | : false; |
1055 | 1055 | // generate the billing form for payment method |
1056 | 1056 | $billing_form = $currently_selected |
1057 | - ? $this->_get_billing_form_for_payment_method( $payment_method ) |
|
1057 | + ? $this->_get_billing_form_for_payment_method($payment_method) |
|
1058 | 1058 | : new EE_Form_Section_HTML(); |
1059 | 1059 | $this->checkout->billing_form = $currently_selected |
1060 | 1060 | ? $billing_form |
1061 | 1061 | : $this->checkout->billing_form; |
1062 | 1062 | // it's all in the details |
1063 | 1063 | $info_html = EEH_HTML::h3( |
1064 | - __( 'Important information regarding your payment', 'event_espresso' ), |
|
1064 | + __('Important information regarding your payment', 'event_espresso'), |
|
1065 | 1065 | '', |
1066 | 1066 | 'spco-payment-method-hdr' |
1067 | 1067 | ); |
1068 | 1068 | // add some info regarding the step, either from what's saved in the admin, |
1069 | 1069 | // or a default string depending on whether the PM has a billing form or not |
1070 | - if ( $payment_method->description() ) { |
|
1070 | + if ($payment_method->description()) { |
|
1071 | 1071 | $payment_method_info = $payment_method->description(); |
1072 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
1072 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
1073 | 1073 | $payment_method_info = sprintf( |
1074 | 1074 | __( |
1075 | 1075 | 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | ); |
1080 | 1080 | } else { |
1081 | 1081 | $payment_method_info = sprintf( |
1082 | - __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), |
|
1082 | + __('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), |
|
1083 | 1083 | $this->submit_button_text() |
1084 | 1084 | ); |
1085 | 1085 | } |
@@ -1093,13 +1093,13 @@ discard block |
||
1093 | 1093 | ); |
1094 | 1094 | return new EE_Form_Section_Proper( |
1095 | 1095 | array( |
1096 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
1096 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
1097 | 1097 | 'html_class' => 'spco-payment-method-info-dv', |
1098 | 1098 | // only display the selected or default PM |
1099 | 1099 | 'html_style' => $currently_selected ? '' : 'display:none;', |
1100 | 1100 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
1101 | 1101 | 'subsections' => array( |
1102 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
1102 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
1103 | 1103 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
1104 | 1104 | ) |
1105 | 1105 | ) |
@@ -1117,15 +1117,15 @@ discard block |
||
1117 | 1117 | */ |
1118 | 1118 | public function get_billing_form_html_for_payment_method() { |
1119 | 1119 | // how have they chosen to pay? |
1120 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1120 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1121 | 1121 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
1122 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
1122 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
1123 | 1123 | return false; |
1124 | 1124 | } |
1125 | - if ( apply_filters( |
|
1125 | + if (apply_filters( |
|
1126 | 1126 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1127 | 1127 | false |
1128 | - ) ) { |
|
1128 | + )) { |
|
1129 | 1129 | EE_Error::add_success( |
1130 | 1130 | apply_filters( |
1131 | 1131 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | ); |
1141 | 1141 | } |
1142 | 1142 | // now generate billing form for selected method of payment |
1143 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1143 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1144 | 1144 | // fill form with attendee info if applicable |
1145 | 1145 | if ( |
1146 | 1146 | $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form |
@@ -1162,10 +1162,10 @@ discard block |
||
1162 | 1162 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper |
1163 | 1163 | ? $payment_method_billing_form->get_html() |
1164 | 1164 | : ''; |
1165 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) ); |
|
1165 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
1166 | 1166 | // localize validation rules for main form |
1167 | 1167 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
1168 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
1168 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
1169 | 1169 | return true; |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1179,18 +1179,18 @@ discard block |
||
1179 | 1179 | * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML |
1180 | 1180 | * @throws \EE_Error |
1181 | 1181 | */ |
1182 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
1182 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
1183 | 1183 | $billing_form = $payment_method->type_obj()->billing_form( |
1184 | 1184 | $this->checkout->transaction, |
1185 | - array( 'amount_owing' => $this->checkout->amount_owing ) |
|
1185 | + array('amount_owing' => $this->checkout->amount_owing) |
|
1186 | 1186 | ); |
1187 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
1187 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
1188 | 1188 | if ( |
1189 | 1189 | apply_filters( |
1190 | 1190 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1191 | 1191 | false |
1192 | 1192 | ) |
1193 | - && EE_Registry::instance()->REQ->is_set( 'payment_method' ) |
|
1193 | + && EE_Registry::instance()->REQ->is_set('payment_method') |
|
1194 | 1194 | ) { |
1195 | 1195 | EE_Error::add_success( |
1196 | 1196 | apply_filters( |
@@ -1232,15 +1232,15 @@ discard block |
||
1232 | 1232 | $request_param = 'selected_method_of_payment' |
1233 | 1233 | ) { |
1234 | 1234 | // is selected_method_of_payment set in the request ? |
1235 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false ); |
|
1236 | - if ( $selected_method_of_payment ) { |
|
1235 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false); |
|
1236 | + if ($selected_method_of_payment) { |
|
1237 | 1237 | // sanitize it |
1238 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) |
|
1239 | - ? array_shift( $selected_method_of_payment ) |
|
1238 | + $selected_method_of_payment = is_array($selected_method_of_payment) |
|
1239 | + ? array_shift($selected_method_of_payment) |
|
1240 | 1240 | : $selected_method_of_payment; |
1241 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
1241 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
1242 | 1242 | // store it in the session so that it's available for all subsequent requests including AJAX |
1243 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
1243 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
1244 | 1244 | } else { |
1245 | 1245 | // or is is set in the session ? |
1246 | 1246 | $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | ); |
1249 | 1249 | } |
1250 | 1250 | // do ya really really gotta have it? |
1251 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
1251 | + if (empty($selected_method_of_payment) && $required) { |
|
1252 | 1252 | EE_Error::add_error( |
1253 | 1253 | sprintf( |
1254 | 1254 | __( |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | ), |
1258 | 1258 | '<br/>', |
1259 | 1259 | '<br/>', |
1260 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1260 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1261 | 1261 | ), |
1262 | 1262 | __FILE__, |
1263 | 1263 | __FUNCTION__, |
@@ -1284,13 +1284,13 @@ discard block |
||
1284 | 1284 | * @throws \EE_Error |
1285 | 1285 | */ |
1286 | 1286 | public function switch_payment_method() { |
1287 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1287 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1288 | 1288 | return false; |
1289 | 1289 | } |
1290 | - if ( apply_filters( |
|
1290 | + if (apply_filters( |
|
1291 | 1291 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1292 | 1292 | false |
1293 | - ) ) { |
|
1293 | + )) { |
|
1294 | 1294 | EE_Error::add_success( |
1295 | 1295 | apply_filters( |
1296 | 1296 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -1305,13 +1305,13 @@ discard block |
||
1305 | 1305 | ); |
1306 | 1306 | } |
1307 | 1307 | // generate billing form for selected method of payment if it hasn't been done already |
1308 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1308 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1309 | 1309 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1310 | 1310 | $this->checkout->payment_method |
1311 | 1311 | ); |
1312 | 1312 | } |
1313 | 1313 | // fill form with attendee info if applicable |
1314 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
|
1314 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form |
|
1315 | 1315 | && $this->checkout->transaction_has_primary_registrant() |
1316 | 1316 | ) { |
1317 | 1317 | $this->checkout->billing_form->populate_from_attendee( |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | ); |
1320 | 1320 | } |
1321 | 1321 | // and debug content |
1322 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1322 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1323 | 1323 | && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
1324 | 1324 | ) { |
1325 | 1325 | $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
@@ -1327,15 +1327,15 @@ discard block |
||
1327 | 1327 | ); |
1328 | 1328 | } |
1329 | 1329 | // get html and validation rules for form |
1330 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
1330 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
1331 | 1331 | $this->checkout->json_response->set_return_data( |
1332 | - array( 'payment_method_info' => $this->checkout->billing_form->get_html() ) |
|
1332 | + array('payment_method_info' => $this->checkout->billing_form->get_html()) |
|
1333 | 1333 | ); |
1334 | 1334 | // localize validation rules for main form |
1335 | - $this->checkout->billing_form->localize_validation_rules( true ); |
|
1336 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
1335 | + $this->checkout->billing_form->localize_validation_rules(true); |
|
1336 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
1337 | 1337 | } else { |
1338 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) ); |
|
1338 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
1339 | 1339 | } |
1340 | 1340 | //prevents advancement to next step |
1341 | 1341 | $this->checkout->continue_reg = false; |
@@ -1352,12 +1352,12 @@ discard block |
||
1352 | 1352 | */ |
1353 | 1353 | protected function _verify_payment_method_is_set() { |
1354 | 1354 | // generate billing form for selected method of payment if it hasn't been done already |
1355 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1355 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1356 | 1356 | // how have they chosen to pay? |
1357 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1357 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1358 | 1358 | } |
1359 | 1359 | // verify payment method |
1360 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
1360 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
1361 | 1361 | // get payment method for selected method of payment |
1362 | 1362 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
1363 | 1363 | } |
@@ -1376,25 +1376,25 @@ discard block |
||
1376 | 1376 | * @throws \EE_Error |
1377 | 1377 | */ |
1378 | 1378 | public function save_payer_details_via_ajax() { |
1379 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1379 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1380 | 1380 | return; |
1381 | 1381 | } |
1382 | 1382 | // generate billing form for selected method of payment if it hasn't been done already |
1383 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1383 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1384 | 1384 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1385 | 1385 | $this->checkout->payment_method |
1386 | 1386 | ); |
1387 | 1387 | } |
1388 | 1388 | // generate primary attendee from payer info if applicable |
1389 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1389 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1390 | 1390 | $attendee = $this->_create_attendee_from_request_data(); |
1391 | - if ( $attendee instanceof EE_Attendee ) { |
|
1392 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
1393 | - if ( $registration->is_primary_registrant() ) { |
|
1391 | + if ($attendee instanceof EE_Attendee) { |
|
1392 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
1393 | + if ($registration->is_primary_registrant()) { |
|
1394 | 1394 | $this->checkout->primary_attendee_obj = $attendee; |
1395 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1396 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1397 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1395 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1396 | + $registration->set_attendee_id($attendee->ID()); |
|
1397 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1398 | 1398 | } |
1399 | 1399 | } |
1400 | 1400 | } |
@@ -1412,50 +1412,50 @@ discard block |
||
1412 | 1412 | */ |
1413 | 1413 | protected function _create_attendee_from_request_data() { |
1414 | 1414 | // get State ID |
1415 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
1416 | - if ( ! empty( $STA_ID ) ) { |
|
1415 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
1416 | + if ( ! empty($STA_ID)) { |
|
1417 | 1417 | // can we get state object from name ? |
1418 | - EE_Registry::instance()->load_model( 'State' ); |
|
1419 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' ); |
|
1420 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
1418 | + EE_Registry::instance()->load_model('State'); |
|
1419 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
1420 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
1421 | 1421 | } |
1422 | 1422 | // get Country ISO |
1423 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
1424 | - if ( ! empty( $CNT_ISO ) ) { |
|
1423 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
1424 | + if ( ! empty($CNT_ISO)) { |
|
1425 | 1425 | // can we get country object from name ? |
1426 | - EE_Registry::instance()->load_model( 'Country' ); |
|
1426 | + EE_Registry::instance()->load_model('Country'); |
|
1427 | 1427 | $country = EEM_Country::instance()->get_col( |
1428 | - array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ), |
|
1428 | + array(array('CNT_name' => $CNT_ISO), 'limit' => 1), |
|
1429 | 1429 | 'CNT_ISO' |
1430 | 1430 | ); |
1431 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
1431 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
1432 | 1432 | } |
1433 | 1433 | // grab attendee data |
1434 | 1434 | $attendee_data = array( |
1435 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
1436 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1437 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1438 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1439 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1440 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
1435 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
1436 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1437 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1438 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1439 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1440 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1441 | 1441 | 'STA_ID' => $STA_ID, |
1442 | 1442 | 'CNT_ISO' => $CNT_ISO, |
1443 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1444 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1443 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1444 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1445 | 1445 | ); |
1446 | 1446 | // validate the email address since it is the most important piece of info |
1447 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) { |
|
1447 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) { |
|
1448 | 1448 | EE_Error::add_error( |
1449 | - __( 'An invalid email address was submitted.', 'event_espresso' ), |
|
1449 | + __('An invalid email address was submitted.', 'event_espresso'), |
|
1450 | 1450 | __FILE__, |
1451 | 1451 | __FUNCTION__, |
1452 | 1452 | __LINE__ |
1453 | 1453 | ); |
1454 | 1454 | } |
1455 | 1455 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1456 | - if ( ! empty( $attendee_data['ATT_fname'] ) |
|
1457 | - && ! empty( $attendee_data['ATT_lname'] ) |
|
1458 | - && ! empty( $attendee_data['ATT_email'] ) |
|
1456 | + if ( ! empty($attendee_data['ATT_fname']) |
|
1457 | + && ! empty($attendee_data['ATT_lname']) |
|
1458 | + && ! empty($attendee_data['ATT_email']) |
|
1459 | 1459 | ) { |
1460 | 1460 | $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( |
1461 | 1461 | array( |
@@ -1464,19 +1464,19 @@ discard block |
||
1464 | 1464 | 'ATT_email' => $attendee_data['ATT_email'] |
1465 | 1465 | ) |
1466 | 1466 | ); |
1467 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1467 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1468 | 1468 | return $existing_attendee; |
1469 | 1469 | } |
1470 | 1470 | } |
1471 | 1471 | // no existing attendee? kk let's create a new one |
1472 | 1472 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1473 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) |
|
1473 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) |
|
1474 | 1474 | ? $attendee_data['ATT_fname'] |
1475 | 1475 | : $attendee_data['ATT_email']; |
1476 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) |
|
1476 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) |
|
1477 | 1477 | ? $attendee_data['ATT_lname'] |
1478 | 1478 | : $attendee_data['ATT_email']; |
1479 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1479 | + return EE_Attendee::new_instance($attendee_data); |
|
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | |
@@ -1494,26 +1494,26 @@ discard block |
||
1494 | 1494 | // how have they chosen to pay? |
1495 | 1495 | $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() |
1496 | 1496 | ? 'no_payment_required' |
1497 | - : $this->_get_selected_method_of_payment( true ); |
|
1497 | + : $this->_get_selected_method_of_payment(true); |
|
1498 | 1498 | // choose your own adventure based on method_of_payment |
1499 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
1499 | + switch ($this->checkout->selected_method_of_payment) { |
|
1500 | 1500 | |
1501 | 1501 | case 'events_sold_out' : |
1502 | 1502 | $this->checkout->redirect = true; |
1503 | 1503 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1504 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1504 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1505 | 1505 | // mark this reg step as completed |
1506 | 1506 | $this->set_completed(); |
1507 | 1507 | return false; |
1508 | 1508 | break; |
1509 | 1509 | |
1510 | 1510 | case 'payments_closed' : |
1511 | - if ( apply_filters( |
|
1511 | + if (apply_filters( |
|
1512 | 1512 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', |
1513 | 1513 | false |
1514 | - ) ) { |
|
1514 | + )) { |
|
1515 | 1515 | EE_Error::add_success( |
1516 | - __( 'no payment required at this time.', 'event_espresso' ), |
|
1516 | + __('no payment required at this time.', 'event_espresso'), |
|
1517 | 1517 | __FILE__, |
1518 | 1518 | __FUNCTION__, |
1519 | 1519 | __LINE__ |
@@ -1525,12 +1525,12 @@ discard block |
||
1525 | 1525 | break; |
1526 | 1526 | |
1527 | 1527 | case 'no_payment_required' : |
1528 | - if ( apply_filters( |
|
1528 | + if (apply_filters( |
|
1529 | 1529 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', |
1530 | 1530 | false |
1531 | - ) ) { |
|
1531 | + )) { |
|
1532 | 1532 | EE_Error::add_success( |
1533 | - __( 'no payment required.', 'event_espresso' ), |
|
1533 | + __('no payment required.', 'event_espresso'), |
|
1534 | 1534 | __FILE__, |
1535 | 1535 | __FUNCTION__, |
1536 | 1536 | __LINE__ |
@@ -1550,15 +1550,15 @@ discard block |
||
1550 | 1550 | EE_Registry::instance()->SSN->checkout()->revisit |
1551 | 1551 | ); |
1552 | 1552 | // calculate difference between the two arrays |
1553 | - $registrations = array_diff( $registrations, $ejected_registrations ); |
|
1554 | - if ( empty( $registrations ) ) { |
|
1553 | + $registrations = array_diff($registrations, $ejected_registrations); |
|
1554 | + if (empty($registrations)) { |
|
1555 | 1555 | $this->_redirect_because_event_sold_out(); |
1556 | 1556 | return false; |
1557 | 1557 | } |
1558 | 1558 | $payment_successful = $this->_process_payment(); |
1559 | - if ( $payment_successful ) { |
|
1559 | + if ($payment_successful) { |
|
1560 | 1560 | $this->checkout->continue_reg = true; |
1561 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1561 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1562 | 1562 | } else { |
1563 | 1563 | $this->checkout->continue_reg = false; |
1564 | 1564 | } |
@@ -1579,10 +1579,10 @@ discard block |
||
1579 | 1579 | $this->checkout->continue_reg = false; |
1580 | 1580 | // set redirect URL |
1581 | 1581 | $this->checkout->redirect_url = add_query_arg( |
1582 | - array( 'e_reg_url_link' => $this->checkout->reg_url_link ), |
|
1582 | + array('e_reg_url_link' => $this->checkout->reg_url_link), |
|
1583 | 1583 | $this->checkout->current_step->reg_step_url() |
1584 | 1584 | ); |
1585 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1585 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | |
@@ -1595,8 +1595,8 @@ discard block |
||
1595 | 1595 | * @return void |
1596 | 1596 | * @throws \EE_Error |
1597 | 1597 | */ |
1598 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1599 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1598 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1599 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1600 | 1600 | case EE_PMT_Base::offsite : |
1601 | 1601 | break; |
1602 | 1602 | case EE_PMT_Base::onsite : |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | public function update_reg_step() { |
1620 | 1620 | $success = true; |
1621 | 1621 | // if payment required |
1622 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1622 | + if ($this->checkout->transaction->total() > 0) { |
|
1623 | 1623 | do_action( |
1624 | 1624 | 'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', |
1625 | 1625 | $this->checkout->transaction |
@@ -1627,13 +1627,13 @@ discard block |
||
1627 | 1627 | // attempt payment via payment method |
1628 | 1628 | $success = $this->process_reg_step(); |
1629 | 1629 | } |
1630 | - if ( $success && ! $this->checkout->redirect ) { |
|
1630 | + if ($success && ! $this->checkout->redirect) { |
|
1631 | 1631 | $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
1632 | 1632 | $this->checkout->transaction->ID() |
1633 | 1633 | ); |
1634 | 1634 | // set return URL |
1635 | 1635 | $this->checkout->redirect_url = add_query_arg( |
1636 | - array( 'e_reg_url_link' => $this->checkout->reg_url_link ), |
|
1636 | + array('e_reg_url_link' => $this->checkout->reg_url_link), |
|
1637 | 1637 | $this->checkout->thank_you_page_url |
1638 | 1638 | ); |
1639 | 1639 | } |
@@ -1653,28 +1653,28 @@ discard block |
||
1653 | 1653 | // clear any previous errors related to not selecting a payment method |
1654 | 1654 | // EE_Error::overwrite_errors(); |
1655 | 1655 | // ya gotta make a choice man |
1656 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1656 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1657 | 1657 | $this->checkout->json_response->set_plz_select_method_of_payment( |
1658 | - __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1658 | + __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1659 | 1659 | ); |
1660 | 1660 | return false; |
1661 | 1661 | } |
1662 | 1662 | // get EE_Payment_Method object |
1663 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1663 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1664 | 1664 | return false; |
1665 | 1665 | } |
1666 | 1666 | // setup billing form |
1667 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1667 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1668 | 1668 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1669 | 1669 | $this->checkout->payment_method |
1670 | 1670 | ); |
1671 | 1671 | // bad billing form ? |
1672 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1672 | + if ( ! $this->_billing_form_is_valid()) { |
|
1673 | 1673 | return false; |
1674 | 1674 | } |
1675 | 1675 | } |
1676 | 1676 | // ensure primary registrant has been fully processed |
1677 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1677 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1678 | 1678 | return false; |
1679 | 1679 | } |
1680 | 1680 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -1682,18 +1682,18 @@ discard block |
||
1682 | 1682 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1683 | 1683 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1684 | 1684 | // attempt payment |
1685 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1685 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1686 | 1686 | // process results |
1687 | - $payment = $this->_validate_payment( $payment ); |
|
1688 | - $payment = $this->_post_payment_processing( $payment ); |
|
1687 | + $payment = $this->_validate_payment($payment); |
|
1688 | + $payment = $this->_post_payment_processing($payment); |
|
1689 | 1689 | // verify payment |
1690 | - if ( $payment instanceof EE_Payment ) { |
|
1690 | + if ($payment instanceof EE_Payment) { |
|
1691 | 1691 | // store that for later |
1692 | 1692 | $this->checkout->payment = $payment; |
1693 | 1693 | /** @type EE_Transaction_Processor $transaction_processor */ |
1694 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1694 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1695 | 1695 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1696 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1696 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1697 | 1697 | $payment_status = $payment->status(); |
1698 | 1698 | if ( |
1699 | 1699 | $payment_status === EEM_Payment::status_id_approved |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | } else { |
1704 | 1704 | return false; |
1705 | 1705 | } |
1706 | - } else if ( $payment === true ) { |
|
1706 | + } else if ($payment === true) { |
|
1707 | 1707 | // please note that offline payment methods will NOT make a payment, |
1708 | 1708 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1709 | 1709 | $this->checkout->payment = $payment; |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | ); |
1729 | 1729 | $html = $payment_method_billing_info->get_html_and_js(); |
1730 | 1730 | $html .= $this->checkout->redirect_form; |
1731 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1731 | + EE_Registry::instance()->REQ->add_output($html); |
|
1732 | 1732 | return true; |
1733 | 1733 | } |
1734 | 1734 | |
@@ -1742,28 +1742,28 @@ discard block |
||
1742 | 1742 | * @throws \EE_Error |
1743 | 1743 | */ |
1744 | 1744 | private function _billing_form_is_valid() { |
1745 | - if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1745 | + if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1746 | 1746 | return true; |
1747 | 1747 | } |
1748 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1749 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1748 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1749 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1750 | 1750 | $this->checkout->billing_form->receive_form_submission(); |
1751 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1751 | + if ($this->checkout->billing_form->is_valid()) { |
|
1752 | 1752 | return true; |
1753 | 1753 | } |
1754 | 1754 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1755 | 1755 | $error_strings = array(); |
1756 | - foreach ( $validation_errors as $validation_error ) { |
|
1757 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1756 | + foreach ($validation_errors as $validation_error) { |
|
1757 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1758 | 1758 | $form_section = $validation_error->get_form_section(); |
1759 | - if ( $form_section instanceof EE_Form_Input_Base ) { |
|
1759 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1760 | 1760 | $label = $form_section->html_label_text(); |
1761 | - } elseif ( $form_section instanceof EE_Form_Section_Base ) { |
|
1761 | + } elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1762 | 1762 | $label = $form_section->name(); |
1763 | 1763 | } else { |
1764 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1764 | + $label = __('Validation Error', 'event_espresso'); |
|
1765 | 1765 | } |
1766 | - $error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1766 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1767 | 1767 | } |
1768 | 1768 | } |
1769 | 1769 | EE_Error::add_error( |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | 'event_espresso' |
1774 | 1774 | ), |
1775 | 1775 | '<br/>', |
1776 | - implode( '<br/>', $error_strings ) |
|
1776 | + implode('<br/>', $error_strings) |
|
1777 | 1777 | ), |
1778 | 1778 | __FILE__, |
1779 | 1779 | __FUNCTION__, |
@@ -1792,7 +1792,7 @@ discard block |
||
1792 | 1792 | } |
1793 | 1793 | } else { |
1794 | 1794 | EE_Error::add_error( |
1795 | - __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), |
|
1795 | + __('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), |
|
1796 | 1796 | __FILE__, |
1797 | 1797 | __FUNCTION__, |
1798 | 1798 | __LINE__ |
@@ -1827,13 +1827,13 @@ discard block |
||
1827 | 1827 | // grab the primary_registration object |
1828 | 1828 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1829 | 1829 | /** @type EE_Transaction_Processor $transaction_processor */ |
1830 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1830 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1831 | 1831 | // at this point we'll consider a TXN to not have been failed |
1832 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1832 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1833 | 1833 | // save the TXN ( which clears cached copy of primary_registration) |
1834 | 1834 | $this->checkout->transaction->save(); |
1835 | 1835 | // grab TXN ID and save it to the primary_registration |
1836 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1836 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1837 | 1837 | // save what we have so far |
1838 | 1838 | $primary_registration->save(); |
1839 | 1839 | return true; |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | private function _capture_primary_registration_data_from_billing_form() { |
1852 | 1852 | // convert billing form data into an attendee |
1853 | 1853 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1854 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1854 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1855 | 1855 | EE_Error::add_error( |
1856 | 1856 | sprintf( |
1857 | 1857 | __( |
@@ -1859,7 +1859,7 @@ discard block |
||
1859 | 1859 | 'event_espresso' |
1860 | 1860 | ), |
1861 | 1861 | '<br/>', |
1862 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1862 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1863 | 1863 | ), |
1864 | 1864 | __FILE__, |
1865 | 1865 | __FUNCTION__, |
@@ -1868,7 +1868,7 @@ discard block |
||
1868 | 1868 | return false; |
1869 | 1869 | } |
1870 | 1870 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1871 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1871 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1872 | 1872 | EE_Error::add_error( |
1873 | 1873 | sprintf( |
1874 | 1874 | __( |
@@ -1876,7 +1876,7 @@ discard block |
||
1876 | 1876 | 'event_espresso' |
1877 | 1877 | ), |
1878 | 1878 | '<br/>', |
1879 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1879 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1880 | 1880 | ), |
1881 | 1881 | __FILE__, |
1882 | 1882 | __FUNCTION__, |
@@ -1884,7 +1884,7 @@ discard block |
||
1884 | 1884 | ); |
1885 | 1885 | return false; |
1886 | 1886 | } |
1887 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) |
|
1887 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') |
|
1888 | 1888 | instanceof |
1889 | 1889 | EE_Attendee |
1890 | 1890 | ) { |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | 'event_espresso' |
1896 | 1896 | ), |
1897 | 1897 | '<br/>', |
1898 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1898 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1899 | 1899 | ), |
1900 | 1900 | __FILE__, |
1901 | 1901 | __FUNCTION__, |
@@ -1904,9 +1904,9 @@ discard block |
||
1904 | 1904 | return false; |
1905 | 1905 | } |
1906 | 1906 | /** @type EE_Registration_Processor $registration_processor */ |
1907 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1907 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1908 | 1908 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1909 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1909 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1910 | 1910 | return true; |
1911 | 1911 | } |
1912 | 1912 | |
@@ -1921,22 +1921,22 @@ discard block |
||
1921 | 1921 | * @throws \EE_Error |
1922 | 1922 | */ |
1923 | 1923 | private function _get_payment_method_for_selected_method_of_payment() { |
1924 | - if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) { |
|
1924 | + if ($this->checkout->selected_method_of_payment === 'events_sold_out') { |
|
1925 | 1925 | $this->_redirect_because_event_sold_out(); |
1926 | 1926 | return null; |
1927 | 1927 | } |
1928 | 1928 | // get EE_Payment_Method object |
1929 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) { |
|
1930 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1929 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1930 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1931 | 1931 | } else { |
1932 | 1932 | // load EEM_Payment_Method |
1933 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1933 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1934 | 1934 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1935 | 1935 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1936 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1936 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1937 | 1937 | } |
1938 | 1938 | // verify $payment_method |
1939 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1939 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1940 | 1940 | // not a payment |
1941 | 1941 | EE_Error::add_error( |
1942 | 1942 | sprintf( |
@@ -1945,7 +1945,7 @@ discard block |
||
1945 | 1945 | 'event_espresso' |
1946 | 1946 | ), |
1947 | 1947 | '<br/>', |
1948 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1948 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1949 | 1949 | ), |
1950 | 1950 | __FILE__, |
1951 | 1951 | __FUNCTION__, |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | return null; |
1955 | 1955 | } |
1956 | 1956 | // and verify it has a valid Payment_Method Type object |
1957 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1957 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1958 | 1958 | // not a payment |
1959 | 1959 | EE_Error::add_error( |
1960 | 1960 | sprintf( |
@@ -1963,7 +1963,7 @@ discard block |
||
1963 | 1963 | 'event_espresso' |
1964 | 1964 | ), |
1965 | 1965 | '<br/>', |
1966 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1966 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1967 | 1967 | ), |
1968 | 1968 | __FILE__, |
1969 | 1969 | __FUNCTION__, |
@@ -1984,29 +1984,29 @@ discard block |
||
1984 | 1984 | * @return mixed EE_Payment | boolean |
1985 | 1985 | * @throws \EE_Error |
1986 | 1986 | */ |
1987 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1987 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1988 | 1988 | $payment = null; |
1989 | 1989 | $this->checkout->transaction->save(); |
1990 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1991 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1990 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1991 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1992 | 1992 | return false; |
1993 | 1993 | } |
1994 | 1994 | try { |
1995 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1995 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1996 | 1996 | // generate payment object |
1997 | 1997 | $payment = $payment_processor->process_payment( |
1998 | 1998 | $payment_method, |
1999 | 1999 | $this->checkout->transaction, |
2000 | 2000 | $this->checkout->amount_owing, |
2001 | 2001 | $this->checkout->billing_form, |
2002 | - $this->_get_return_url( $payment_method ), |
|
2002 | + $this->_get_return_url($payment_method), |
|
2003 | 2003 | 'CART', |
2004 | 2004 | $this->checkout->admin_request, |
2005 | 2005 | true, |
2006 | 2006 | $this->reg_step_url() |
2007 | 2007 | ); |
2008 | - } catch ( Exception $e ) { |
|
2009 | - $this->_handle_payment_processor_exception( $e ); |
|
2008 | + } catch (Exception $e) { |
|
2009 | + $this->_handle_payment_processor_exception($e); |
|
2010 | 2010 | } |
2011 | 2011 | return $payment; |
2012 | 2012 | } |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | * @return void |
2022 | 2022 | * @throws \EE_Error |
2023 | 2023 | */ |
2024 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
2024 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
2025 | 2025 | EE_Error::add_error( |
2026 | 2026 | sprintf( |
2027 | 2027 | __( |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | 'event_espresso' |
2030 | 2030 | ), |
2031 | 2031 | '<br/>', |
2032 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
2032 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
2033 | 2033 | $e->getMessage(), |
2034 | 2034 | $e->getFile(), |
2035 | 2035 | $e->getLine() |
@@ -2050,9 +2050,9 @@ discard block |
||
2050 | 2050 | * @return string |
2051 | 2051 | * @throws \EE_Error |
2052 | 2052 | */ |
2053 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
2053 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
2054 | 2054 | $return_url = ''; |
2055 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
2055 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
2056 | 2056 | case EE_PMT_Base::offsite : |
2057 | 2057 | $return_url = add_query_arg( |
2058 | 2058 | array( |
@@ -2081,12 +2081,12 @@ discard block |
||
2081 | 2081 | * @return EE_Payment | FALSE |
2082 | 2082 | * @throws \EE_Error |
2083 | 2083 | */ |
2084 | - private function _validate_payment( $payment = null ) { |
|
2085 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
2084 | + private function _validate_payment($payment = null) { |
|
2085 | + if ($this->checkout->payment_method->is_off_line()) { |
|
2086 | 2086 | return true; |
2087 | 2087 | } |
2088 | 2088 | // verify payment object |
2089 | - if ( ! $payment instanceof EE_Payment ) { |
|
2089 | + if ( ! $payment instanceof EE_Payment) { |
|
2090 | 2090 | // not a payment |
2091 | 2091 | EE_Error::add_error( |
2092 | 2092 | sprintf( |
@@ -2095,7 +2095,7 @@ discard block |
||
2095 | 2095 | 'event_espresso' |
2096 | 2096 | ), |
2097 | 2097 | '<br/>', |
2098 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2098 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2099 | 2099 | ), |
2100 | 2100 | __FILE__, |
2101 | 2101 | __FUNCTION__, |
@@ -2116,27 +2116,27 @@ discard block |
||
2116 | 2116 | * @return bool |
2117 | 2117 | * @throws \EE_Error |
2118 | 2118 | */ |
2119 | - private function _post_payment_processing( $payment = null ) { |
|
2119 | + private function _post_payment_processing($payment = null) { |
|
2120 | 2120 | // Off-Line payment? |
2121 | - if ( $payment === true ) { |
|
2121 | + if ($payment === true) { |
|
2122 | 2122 | //$this->_setup_redirect_for_next_step(); |
2123 | 2123 | return true; |
2124 | 2124 | // On-Site payment? |
2125 | - } else if ( $this->checkout->payment_method->is_on_site() ) { |
|
2126 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) { |
|
2125 | + } else if ($this->checkout->payment_method->is_on_site()) { |
|
2126 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
2127 | 2127 | //$this->_setup_redirect_for_next_step(); |
2128 | 2128 | $this->checkout->continue_reg = false; |
2129 | 2129 | } |
2130 | 2130 | // Off-Site payment? |
2131 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
2131 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
2132 | 2132 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
2133 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ) { |
|
2134 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
2133 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
2134 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
2135 | 2135 | $this->checkout->redirect = true; |
2136 | 2136 | $this->checkout->redirect_form = $payment->redirect_form(); |
2137 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
2137 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
2138 | 2138 | // set JSON response |
2139 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
2139 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
2140 | 2140 | // set cron job for finalizing the TXN |
2141 | 2141 | // in case the user does not return from the off-site gateway |
2142 | 2142 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -2144,7 +2144,7 @@ discard block |
||
2144 | 2144 | $this->checkout->transaction->ID() |
2145 | 2145 | ); |
2146 | 2146 | // and lastly, let's bump the payment status to pending |
2147 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
2147 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
2148 | 2148 | $payment->save(); |
2149 | 2149 | } else { |
2150 | 2150 | // not a payment |
@@ -2156,7 +2156,7 @@ discard block |
||
2156 | 2156 | 'event_espresso' |
2157 | 2157 | ), |
2158 | 2158 | '<br/>', |
2159 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2159 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2160 | 2160 | ), |
2161 | 2161 | __FILE__, |
2162 | 2162 | __FUNCTION__, |
@@ -2194,21 +2194,21 @@ discard block |
||
2194 | 2194 | * @return bool |
2195 | 2195 | * @throws \EE_Error |
2196 | 2196 | */ |
2197 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
2197 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
2198 | 2198 | // off-line payment? carry on |
2199 | - if ( $payment_occurs === EE_PMT_Base::offline ) { |
|
2199 | + if ($payment_occurs === EE_PMT_Base::offline) { |
|
2200 | 2200 | return true; |
2201 | 2201 | } |
2202 | 2202 | // verify payment validity |
2203 | - if ( $payment instanceof EE_Payment ) { |
|
2204 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
2203 | + if ($payment instanceof EE_Payment) { |
|
2204 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
2205 | 2205 | $msg = $payment->gateway_response(); |
2206 | 2206 | // check results |
2207 | - switch ( $payment->status() ) { |
|
2207 | + switch ($payment->status()) { |
|
2208 | 2208 | // good payment |
2209 | 2209 | case EEM_Payment::status_id_approved : |
2210 | 2210 | EE_Error::add_success( |
2211 | - __( 'Your payment was processed successfully.', 'event_espresso' ), |
|
2211 | + __('Your payment was processed successfully.', 'event_espresso'), |
|
2212 | 2212 | __FILE__, |
2213 | 2213 | __FUNCTION__, |
2214 | 2214 | __LINE__ |
@@ -2217,45 +2217,45 @@ discard block |
||
2217 | 2217 | break; |
2218 | 2218 | // slow payment |
2219 | 2219 | case EEM_Payment::status_id_pending : |
2220 | - if ( empty( $msg ) ) { |
|
2220 | + if (empty($msg)) { |
|
2221 | 2221 | $msg = __( |
2222 | 2222 | 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', |
2223 | 2223 | 'event_espresso' |
2224 | 2224 | ); |
2225 | 2225 | } |
2226 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2226 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2227 | 2227 | return true; |
2228 | 2228 | break; |
2229 | 2229 | // don't wanna payment |
2230 | 2230 | case EEM_Payment::status_id_cancelled : |
2231 | - if ( empty( $msg ) ) { |
|
2231 | + if (empty($msg)) { |
|
2232 | 2232 | $msg = _n( |
2233 | 2233 | 'Payment cancelled. Please try again.', |
2234 | 2234 | 'Payment cancelled. Please try again or select another method of payment.', |
2235 | - count( $this->checkout->available_payment_methods ), |
|
2235 | + count($this->checkout->available_payment_methods), |
|
2236 | 2236 | 'event_espresso' |
2237 | 2237 | ); |
2238 | 2238 | } |
2239 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2239 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2240 | 2240 | return false; |
2241 | 2241 | break; |
2242 | 2242 | // not enough payment |
2243 | 2243 | case EEM_Payment::status_id_declined : |
2244 | - if ( empty( $msg ) ) { |
|
2244 | + if (empty($msg)) { |
|
2245 | 2245 | $msg = _n( |
2246 | 2246 | 'We\'re sorry but your payment was declined. Please try again.', |
2247 | 2247 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
2248 | - count( $this->checkout->available_payment_methods ), |
|
2248 | + count($this->checkout->available_payment_methods), |
|
2249 | 2249 | 'event_espresso' |
2250 | 2250 | ); |
2251 | 2251 | } |
2252 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2252 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2253 | 2253 | return false; |
2254 | 2254 | break; |
2255 | 2255 | // bad payment |
2256 | 2256 | case EEM_Payment::status_id_failed : |
2257 | - if ( ! empty( $msg ) ) { |
|
2258 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2257 | + if ( ! empty($msg)) { |
|
2258 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2259 | 2259 | return false; |
2260 | 2260 | } |
2261 | 2261 | // default to error below |
@@ -2264,7 +2264,7 @@ discard block |
||
2264 | 2264 | } |
2265 | 2265 | // off-site payment gateway responses are too unreliable, so let's just assume that |
2266 | 2266 | // the payment processing is just running slower than the registrant's request |
2267 | - if ( $payment_occurs === EE_PMT_Base::offsite ) { |
|
2267 | + if ($payment_occurs === EE_PMT_Base::offsite) { |
|
2268 | 2268 | return true; |
2269 | 2269 | } |
2270 | 2270 | EE_Error::add_error( |
@@ -2274,7 +2274,7 @@ discard block |
||
2274 | 2274 | 'event_espresso' |
2275 | 2275 | ), |
2276 | 2276 | '<br/>', |
2277 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2277 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2278 | 2278 | ), |
2279 | 2279 | __FILE__, |
2280 | 2280 | __FUNCTION__, |
@@ -2307,13 +2307,13 @@ discard block |
||
2307 | 2307 | public function process_gateway_response() { |
2308 | 2308 | $payment = null; |
2309 | 2309 | // how have they chosen to pay? |
2310 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
2310 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
2311 | 2311 | // get EE_Payment_Method object |
2312 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
2312 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
2313 | 2313 | $this->checkout->continue_reg = false; |
2314 | 2314 | return false; |
2315 | 2315 | } |
2316 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
2316 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
2317 | 2317 | return false; |
2318 | 2318 | } |
2319 | 2319 | $this->_validate_offsite_return(); |
@@ -2327,23 +2327,23 @@ discard block |
||
2327 | 2327 | // true |
2328 | 2328 | //); |
2329 | 2329 | // verify TXN |
2330 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
2330 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
2331 | 2331 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
2332 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
2332 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
2333 | 2333 | $this->checkout->continue_reg = false; |
2334 | 2334 | return false; |
2335 | 2335 | } |
2336 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
2337 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
2338 | - $payment = $this->_validate_payment( $payment ); |
|
2336 | + $payment = $this->_process_off_site_payment($gateway); |
|
2337 | + $payment = $this->_process_cancelled_payments($payment); |
|
2338 | + $payment = $this->_validate_payment($payment); |
|
2339 | 2339 | // if payment was not declined by the payment gateway or cancelled by the registrant |
2340 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
2340 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
2341 | 2341 | //$this->_setup_redirect_for_next_step(); |
2342 | 2342 | // store that for later |
2343 | 2343 | $this->checkout->payment = $payment; |
2344 | 2344 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
2345 | 2345 | // because we will complete this step during the IPN processing then |
2346 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) { |
|
2346 | + if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) { |
|
2347 | 2347 | $this->set_completed(); |
2348 | 2348 | } |
2349 | 2349 | return true; |
@@ -2367,21 +2367,21 @@ discard block |
||
2367 | 2367 | * @throws \EE_Error |
2368 | 2368 | */ |
2369 | 2369 | private function _validate_offsite_return() { |
2370 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
2371 | - if ( $TXN_ID !== $this->checkout->transaction->ID() ) { |
|
2370 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
2371 | + if ($TXN_ID !== $this->checkout->transaction->ID()) { |
|
2372 | 2372 | // Houston... we might have a problem |
2373 | 2373 | $invalid_TXN = false; |
2374 | 2374 | // first gather some info |
2375 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
2375 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
2376 | 2376 | $primary_registrant = $valid_TXN instanceof EE_Transaction |
2377 | 2377 | ? $valid_TXN->primary_registration() |
2378 | 2378 | : null; |
2379 | 2379 | // let's start by retrieving the cart for this TXN |
2380 | - $cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction ); |
|
2381 | - if ( $cart instanceof EE_Cart ) { |
|
2380 | + $cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction); |
|
2381 | + if ($cart instanceof EE_Cart) { |
|
2382 | 2382 | // verify that the current cart has tickets |
2383 | 2383 | $tickets = $cart->get_tickets(); |
2384 | - if ( empty( $tickets ) ) { |
|
2384 | + if (empty($tickets)) { |
|
2385 | 2385 | $invalid_TXN = true; |
2386 | 2386 | } |
2387 | 2387 | } else { |
@@ -2391,39 +2391,39 @@ discard block |
||
2391 | 2391 | ? $primary_registrant->session_ID() |
2392 | 2392 | : null; |
2393 | 2393 | // validate current Session ID and compare against valid TXN session ID |
2394 | - if ( EE_Session::instance()->id() === null ) { |
|
2394 | + if (EE_Session::instance()->id() === null) { |
|
2395 | 2395 | $invalid_TXN = true; |
2396 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
2396 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
2397 | 2397 | // WARNING !!! |
2398 | 2398 | // this could be PayPal sending back duplicate requests (ya they do that) |
2399 | 2399 | // or it **could** mean someone is simply registering AGAIN after having just done so |
2400 | 2400 | // so now we need to determine if this current TXN looks valid or not |
2401 | 2401 | /** @type EE_Transaction_Processor $transaction_processor */ |
2402 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
2402 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
2403 | 2403 | // has this step even been started ? |
2404 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
2404 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
2405 | 2405 | ) { |
2406 | 2406 | // really? you're half way through this reg step, but you never started it ? |
2407 | 2407 | $invalid_TXN = true; |
2408 | 2408 | } |
2409 | 2409 | } |
2410 | - if ( $invalid_TXN ) { |
|
2410 | + if ($invalid_TXN) { |
|
2411 | 2411 | // is the valid TXN completed ? |
2412 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
2412 | + if ($valid_TXN instanceof EE_Transaction) { |
|
2413 | 2413 | /** @type EE_Transaction_Processor $transaction_processor */ |
2414 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
2414 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
2415 | 2415 | // has this step even been started ? |
2416 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
2417 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
2416 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
2417 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
2418 | 2418 | // so it **looks** like this is a double request from PayPal |
2419 | 2419 | // so let's try to pick up where we left off |
2420 | 2420 | $this->checkout->transaction = $valid_TXN; |
2421 | - $this->checkout->refresh_all_entities( true ); |
|
2421 | + $this->checkout->refresh_all_entities(true); |
|
2422 | 2422 | return; |
2423 | 2423 | } |
2424 | 2424 | } |
2425 | 2425 | // you appear to be lost? |
2426 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
2426 | + $this->_redirect_wayward_request($primary_registrant); |
|
2427 | 2427 | } |
2428 | 2428 | } |
2429 | 2429 | } |
@@ -2438,14 +2438,14 @@ discard block |
||
2438 | 2438 | * @return bool |
2439 | 2439 | * @throws \EE_Error |
2440 | 2440 | */ |
2441 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
2442 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2441 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
2442 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2443 | 2443 | // try redirecting based on the current TXN |
2444 | 2444 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction |
2445 | 2445 | ? $this->checkout->transaction->primary_registration() |
2446 | 2446 | : null; |
2447 | 2447 | } |
2448 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2448 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2449 | 2449 | EE_Error::add_error( |
2450 | 2450 | sprintf( |
2451 | 2451 | __( |
@@ -2453,7 +2453,7 @@ discard block |
||
2453 | 2453 | 'event_espresso' |
2454 | 2454 | ), |
2455 | 2455 | '<br/>', |
2456 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2456 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2457 | 2457 | ), |
2458 | 2458 | __FILE__, |
2459 | 2459 | __FUNCTION__, |
@@ -2484,17 +2484,17 @@ discard block |
||
2484 | 2484 | * @return \EE_Payment |
2485 | 2485 | * @throws \EE_Error |
2486 | 2486 | */ |
2487 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
2487 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
2488 | 2488 | try { |
2489 | 2489 | $request_data = \EE_Registry::instance()->REQ->params(); |
2490 | 2490 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
2491 | 2491 | $this->set_handle_IPN_in_this_request( |
2492 | - $gateway->handle_IPN_in_this_request( $request_data, false ) |
|
2492 | + $gateway->handle_IPN_in_this_request($request_data, false) |
|
2493 | 2493 | ); |
2494 | - if ( $this->handle_IPN_in_this_request() ) { |
|
2494 | + if ($this->handle_IPN_in_this_request()) { |
|
2495 | 2495 | // get payment details and process results |
2496 | 2496 | /** @type EE_Payment_Processor $payment_processor */ |
2497 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
2497 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
2498 | 2498 | $payment = $payment_processor->process_ipn( |
2499 | 2499 | $request_data, |
2500 | 2500 | $this->checkout->transaction, |
@@ -2507,14 +2507,14 @@ discard block |
||
2507 | 2507 | $payment = $this->checkout->transaction->last_payment(); |
2508 | 2508 | //$payment_source = 'last_payment'; |
2509 | 2509 | } |
2510 | - } catch ( Exception $e ) { |
|
2510 | + } catch (Exception $e) { |
|
2511 | 2511 | // let's just eat the exception and try to move on using any previously set payment info |
2512 | 2512 | $payment = $this->checkout->transaction->last_payment(); |
2513 | 2513 | //$payment_source = 'last_payment after Exception'; |
2514 | 2514 | // but if we STILL don't have a payment object |
2515 | - if ( ! $payment instanceof EE_Payment ) { |
|
2515 | + if ( ! $payment instanceof EE_Payment) { |
|
2516 | 2516 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
2517 | - $this->_handle_payment_processor_exception( $e ); |
|
2517 | + $this->_handle_payment_processor_exception($e); |
|
2518 | 2518 | } |
2519 | 2519 | } |
2520 | 2520 | // DEBUG LOG |
@@ -2539,13 +2539,13 @@ discard block |
||
2539 | 2539 | * @return EE_Payment | FALSE |
2540 | 2540 | * @throws \EE_Error |
2541 | 2541 | */ |
2542 | - private function _process_cancelled_payments( $payment = null ) { |
|
2542 | + private function _process_cancelled_payments($payment = null) { |
|
2543 | 2543 | if ( |
2544 | 2544 | $payment instanceof EE_Payment |
2545 | - && isset( $_REQUEST['ee_cancel_payment'] ) |
|
2545 | + && isset($_REQUEST['ee_cancel_payment']) |
|
2546 | 2546 | && $payment->status() === EEM_Payment::status_id_failed |
2547 | 2547 | ) { |
2548 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
2548 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
2549 | 2549 | } |
2550 | 2550 | return $payment; |
2551 | 2551 | } |
@@ -2562,14 +2562,14 @@ discard block |
||
2562 | 2562 | public function get_transaction_details_for_gateways() { |
2563 | 2563 | $txn_details = array(); |
2564 | 2564 | // ya gotta make a choice man |
2565 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
2565 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
2566 | 2566 | $txn_details = array( |
2567 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
2567 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
2568 | 2568 | ); |
2569 | 2569 | } |
2570 | 2570 | // get EE_Payment_Method object |
2571 | 2571 | if ( |
2572 | - empty( $txn_details ) |
|
2572 | + empty($txn_details) |
|
2573 | 2573 | && |
2574 | 2574 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
2575 | 2575 | ) { |
@@ -2581,8 +2581,8 @@ discard block |
||
2581 | 2581 | ) |
2582 | 2582 | ); |
2583 | 2583 | } |
2584 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
2585 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
2584 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
2585 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
2586 | 2586 | $txn_details = array( |
2587 | 2587 | 'TXN_ID' => $this->checkout->transaction->ID(), |
2588 | 2588 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -2593,7 +2593,7 @@ discard block |
||
2593 | 2593 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
2594 | 2594 | 'payment_amount' => $this->checkout->amount_owing, |
2595 | 2595 | 'return_url' => $return_url, |
2596 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
2596 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
2597 | 2597 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
2598 | 2598 | array( |
2599 | 2599 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -2602,7 +2602,7 @@ discard block |
||
2602 | 2602 | ) |
2603 | 2603 | ); |
2604 | 2604 | } |
2605 | - echo json_encode( $txn_details ); |
|
2605 | + echo json_encode($txn_details); |
|
2606 | 2606 | exit(); |
2607 | 2607 | } |
2608 | 2608 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | */ |
43 | 43 | |
44 | -if ( function_exists( 'espresso_version' ) ) { |
|
44 | +if (function_exists('espresso_version')) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * espresso_duplicate_plugin_error |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | function espresso_duplicate_plugin_error() { |
51 | 51 | ?> |
52 | 52 | <div class="error"> |
53 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
53 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
54 | 54 | </div> |
55 | 55 | <?php |
56 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
56 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
57 | 57 | } |
58 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
58 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | 59 | |
60 | 60 | } else { |
61 | 61 | |
@@ -66,103 +66,103 @@ discard block |
||
66 | 66 | * @return string |
67 | 67 | */ |
68 | 68 | function espresso_version() { |
69 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.4.rc.004' ); |
|
69 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.4.rc.004'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // define versions |
73 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
74 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
75 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
76 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
77 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
78 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
73 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
74 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
75 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
76 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
77 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
78 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ] ); |
|
252 | - unset( $_REQUEST[ 'activate' ] ); |
|
253 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate']); |
|
252 | + unset($_REQUEST['activate']); |
|
253 | + deactivate_plugins($plugin_basename); |
|
254 | 254 | } |
255 | 255 | } |
@@ -880,8 +880,8 @@ discard block |
||
880 | 880 | * @return void |
881 | 881 | */ |
882 | 882 | public function deactivate_messenger( $messenger_name ) { |
883 | - $this->_initialize_collections(); |
|
884 | - if ( $messenger_name instanceof EE_messenger ) { |
|
883 | + $this->_initialize_collections(); |
|
884 | + if ( $messenger_name instanceof EE_messenger ) { |
|
885 | 885 | $messenger_name = $messenger_name->name; |
886 | 886 | } |
887 | 887 | unset( $this->_active_messengers[ $messenger_name ] ); |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | * @param string $message_type_name name of message type being deactivated |
898 | 898 | */ |
899 | 899 | public function deactivate_message_type( $message_type_name ) { |
900 | - $this->_initialize_collections(); |
|
900 | + $this->_initialize_collections(); |
|
901 | 901 | if ( $message_type_name instanceof EE_message_type ) { |
902 | 902 | $message_type_name = $message_type_name->name; |
903 | 903 | } |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | * @param string $messenger_name Name of messenger the message type is being deactivated for. |
928 | 928 | */ |
929 | 929 | public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) { |
930 | - $this->_initialize_collections(); |
|
930 | + $this->_initialize_collections(); |
|
931 | 931 | if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
932 | 932 | unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] ); |
933 | 933 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -134,13 +134,13 @@ discard block |
||
134 | 134 | * @return void |
135 | 135 | */ |
136 | 136 | protected function _initialize_collections() { |
137 | - if ( $this->_initialized ) { |
|
137 | + if ($this->_initialized) { |
|
138 | 138 | return; |
139 | 139 | } |
140 | 140 | $this->_initialized = true; |
141 | 141 | $this->_messenger_collection_loader->load_messengers_from_folder(); |
142 | 142 | $this->_message_type_collection_loader->load_message_types_from_folder(); |
143 | - $this->get_has_activated_messengers_option( true ); |
|
143 | + $this->get_has_activated_messengers_option(true); |
|
144 | 144 | $this->_set_active_messengers_and_message_types(); |
145 | 145 | } |
146 | 146 | |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | * @param string $messenger_name |
171 | 171 | * @return \EE_messenger |
172 | 172 | */ |
173 | - public function get_messenger( $messenger_name ) { |
|
174 | - return $this->messenger_collection()->get_by_info( $messenger_name ); |
|
173 | + public function get_messenger($messenger_name) { |
|
174 | + return $this->messenger_collection()->get_by_info($messenger_name); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | * @param string $messenger |
183 | 183 | * @return EE_messenger | null |
184 | 184 | */ |
185 | - public function get_active_messenger( $messenger ) { |
|
185 | + public function get_active_messenger($messenger) { |
|
186 | 186 | $this->_initialize_collections(); |
187 | - return ! empty( $this->_active_messengers[ $messenger ] ) ? $this->_active_messengers[ $messenger ] : null; |
|
187 | + return ! empty($this->_active_messengers[$messenger]) ? $this->_active_messengers[$messenger] : null; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | * @return \EE_messenger[] |
194 | 194 | */ |
195 | 195 | public function installed_messengers() { |
196 | - if ( empty( $this->_installed_messengers ) ) { |
|
196 | + if (empty($this->_installed_messengers)) { |
|
197 | 197 | $this->_installed_messengers = array(); |
198 | 198 | $this->messenger_collection()->rewind(); |
199 | - while ( $this->messenger_collection()->valid() ) { |
|
200 | - $this->_installed_messengers[ $this->messenger_collection()->current()->name ] = $this->messenger_collection()->current(); |
|
199 | + while ($this->messenger_collection()->valid()) { |
|
200 | + $this->_installed_messengers[$this->messenger_collection()->current()->name] = $this->messenger_collection()->current(); |
|
201 | 201 | $this->messenger_collection()->next(); |
202 | 202 | } |
203 | 203 | } |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | * @return \EE_messenger |
212 | 212 | * @throws \EE_Error |
213 | 213 | */ |
214 | - public function valid_messenger( $messenger_name ) { |
|
215 | - $messenger = $this->get_messenger( $messenger_name ); |
|
216 | - if ( $messenger instanceof EE_messenger ) { |
|
214 | + public function valid_messenger($messenger_name) { |
|
215 | + $messenger = $this->get_messenger($messenger_name); |
|
216 | + if ($messenger instanceof EE_messenger) { |
|
217 | 217 | return $messenger; |
218 | 218 | } |
219 | 219 | throw new EE_Error( |
220 | 220 | sprintf( |
221 | - __( 'The "%1$s" messenger is either invalid or not installed', 'event_espresso' ), |
|
221 | + __('The "%1$s" messenger is either invalid or not installed', 'event_espresso'), |
|
222 | 222 | $messenger_name |
223 | 223 | ) |
224 | 224 | ); |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | * @param string $message_type_name |
251 | 251 | * @return \EE_message_type |
252 | 252 | */ |
253 | - public function get_message_type( $message_type_name ) { |
|
254 | - return $this->message_type_collection()->get_by_info( $message_type_name ); |
|
253 | + public function get_message_type($message_type_name) { |
|
254 | + return $this->message_type_collection()->get_by_info($message_type_name); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | * @param string $message_type_name |
264 | 264 | * @return \EE_message_type|null |
265 | 265 | */ |
266 | - public function get_active_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
267 | - return $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
|
268 | - ? $this->get_message_type( $message_type_name ) |
|
266 | + public function get_active_message_type_for_messenger($messenger_name, $message_type_name) { |
|
267 | + return $this->is_message_type_active_for_messenger($messenger_name, $message_type_name) |
|
268 | + ? $this->get_message_type($message_type_name) |
|
269 | 269 | : null; |
270 | 270 | } |
271 | 271 | |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @return bool |
281 | 281 | */ |
282 | - public function is_message_type_active_for_messenger( $messenger_name, $message_type_name ) { |
|
282 | + public function is_message_type_active_for_messenger($messenger_name, $message_type_name) { |
|
283 | 283 | $this->_initialize_collections(); |
284 | - return ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] ); |
|
284 | + return ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | * @param string $messenger_name the name of the messenger to check if active. |
293 | 293 | * @return bool |
294 | 294 | */ |
295 | - public function is_messenger_active( $messenger_name ) { |
|
295 | + public function is_messenger_active($messenger_name) { |
|
296 | 296 | $this->_initialize_collections(); |
297 | - return ! empty( $this->_active_message_types[ $messenger_name ] ); |
|
297 | + return ! empty($this->_active_message_types[$messenger_name]); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | * @param string $message_type_name The slug of the message type getting the settings for. |
306 | 306 | * @return array |
307 | 307 | */ |
308 | - public function get_message_type_settings_for_messenger( $messenger_name, $message_type_name ) { |
|
308 | + public function get_message_type_settings_for_messenger($messenger_name, $message_type_name) { |
|
309 | 309 | $settings = array(); |
310 | - if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
311 | - $settings = isset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] ) |
|
312 | - ? $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] |
|
310 | + if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
311 | + $settings = isset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings']) |
|
312 | + ? $this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'] |
|
313 | 313 | : array(); |
314 | 314 | } |
315 | 315 | return $settings; |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | * @param string $messenger_name |
325 | 325 | * @return bool |
326 | 326 | */ |
327 | - public function messenger_has_active_message_types( $messenger_name ) { |
|
327 | + public function messenger_has_active_message_types($messenger_name) { |
|
328 | 328 | $this->_initialize_collections(); |
329 | 329 | return |
330 | - ! empty( $this->_active_message_types[ $messenger_name ] ) |
|
331 | - && ! empty( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ] ); |
|
330 | + ! empty($this->_active_message_types[$messenger_name]) |
|
331 | + && ! empty($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types']); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | * @param string $messenger_name The messenger being checked |
342 | 342 | * @return EE_message_type[]|array (empty array if no active_message_types) |
343 | 343 | */ |
344 | - public function get_active_message_types_for_messenger( $messenger_name ) { |
|
344 | + public function get_active_message_types_for_messenger($messenger_name) { |
|
345 | 345 | $message_types = array(); |
346 | - if ( ! $this->messenger_has_active_message_types( $messenger_name ) ) { |
|
346 | + if ( ! $this->messenger_has_active_message_types($messenger_name)) { |
|
347 | 347 | return $message_types; |
348 | 348 | } |
349 | 349 | $installed_message_types = $this->installed_message_types(); |
350 | - foreach ( $installed_message_types as $message_type_name => $message_type ) { |
|
351 | - if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
352 | - $message_types[ $message_type_name ] = $message_type; |
|
350 | + foreach ($installed_message_types as $message_type_name => $message_type) { |
|
351 | + if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
352 | + $message_types[$message_type_name] = $message_type; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | return $message_types; |
@@ -367,12 +367,12 @@ discard block |
||
367 | 367 | public function list_of_active_message_types() { |
368 | 368 | $active_message_type_names = array(); |
369 | 369 | $this->_initialize_collections(); |
370 | - foreach ( $this->_active_message_types as $messenger => $messenger_settings ) { |
|
371 | - if ( ! isset( $messenger_settings['settings'][ $messenger . '-message_types' ] ) ) { |
|
370 | + foreach ($this->_active_message_types as $messenger => $messenger_settings) { |
|
371 | + if ( ! isset($messenger_settings['settings'][$messenger.'-message_types'])) { |
|
372 | 372 | continue; |
373 | 373 | } |
374 | - foreach ( $messenger_settings['settings'][ $messenger . '-message_types' ] as $message_type_name => $message_type_config ) { |
|
375 | - if ( ! in_array( $message_type_name, $active_message_type_names ) ) { |
|
374 | + foreach ($messenger_settings['settings'][$messenger.'-message_types'] as $message_type_name => $message_type_config) { |
|
375 | + if ( ! in_array($message_type_name, $active_message_type_names)) { |
|
376 | 376 | $active_message_type_names[] = $message_type_name; |
377 | 377 | } |
378 | 378 | } |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | $active_message_types = array(); |
393 | 393 | $installed_message_types = $this->installed_message_types(); |
394 | 394 | $active_message_type_names = $this->list_of_active_message_types(); |
395 | - foreach ( $active_message_type_names as $active_message_type_name ) { |
|
396 | - if ( isset( $installed_message_types[ $active_message_type_name ] ) ) { |
|
397 | - $active_message_types[ $active_message_type_name ] = $installed_message_types[ $active_message_type_name ]; |
|
395 | + foreach ($active_message_type_names as $active_message_type_name) { |
|
396 | + if (isset($installed_message_types[$active_message_type_name])) { |
|
397 | + $active_message_types[$active_message_type_name] = $installed_message_types[$active_message_type_name]; |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | return $active_message_types; |
@@ -406,10 +406,10 @@ discard block |
||
406 | 406 | * @return \EE_message_type[] |
407 | 407 | */ |
408 | 408 | public function installed_message_types() { |
409 | - if ( empty( $this->_installed_message_types ) ) { |
|
409 | + if (empty($this->_installed_message_types)) { |
|
410 | 410 | $this->message_type_collection()->rewind(); |
411 | - while ( $this->message_type_collection()->valid() ) { |
|
412 | - $this->_installed_message_types[ $this->message_type_collection()->current()->name ] = $this->message_type_collection()->current(); |
|
411 | + while ($this->message_type_collection()->valid()) { |
|
412 | + $this->_installed_message_types[$this->message_type_collection()->current()->name] = $this->message_type_collection()->current(); |
|
413 | 413 | $this->message_type_collection()->next(); |
414 | 414 | } |
415 | 415 | } |
@@ -422,14 +422,14 @@ discard block |
||
422 | 422 | * @return \EE_message_type |
423 | 423 | * @throws \EE_Error |
424 | 424 | */ |
425 | - public function valid_message_type( $message_type_name ) { |
|
426 | - $message_type = $this->get_message_type( $message_type_name ); |
|
427 | - if ( $message_type instanceof EE_message_type ) { |
|
425 | + public function valid_message_type($message_type_name) { |
|
426 | + $message_type = $this->get_message_type($message_type_name); |
|
427 | + if ($message_type instanceof EE_message_type) { |
|
428 | 428 | return $message_type; |
429 | 429 | } |
430 | 430 | throw new EE_Error( |
431 | 431 | sprintf( |
432 | - __( 'The "%1$s" message type is either invalid or not installed', 'event_espresso' ), |
|
432 | + __('The "%1$s" message type is either invalid or not installed', 'event_espresso'), |
|
433 | 433 | $message_type_name |
434 | 434 | ) |
435 | 435 | ); |
@@ -445,9 +445,9 @@ discard block |
||
445 | 445 | * @return boolean |
446 | 446 | * @throws \EE_Error |
447 | 447 | */ |
448 | - public function valid_message_type_for_messenger( EE_messenger $messenger, $message_type_name ) { |
|
448 | + public function valid_message_type_for_messenger(EE_messenger $messenger, $message_type_name) { |
|
449 | 449 | $valid_message_types = $messenger->get_valid_message_types(); |
450 | - if ( ! in_array( $message_type_name, $valid_message_types ) ) { |
|
450 | + if ( ! in_array($message_type_name, $valid_message_types)) { |
|
451 | 451 | throw new EE_Error( |
452 | 452 | sprintf( |
453 | 453 | __( |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return array |
476 | 476 | */ |
477 | - public function get_active_messengers_option( $reset = false) { |
|
478 | - if ( $reset ) { |
|
479 | - $this->_active_message_types = get_option( 'ee_active_messengers', array() ); |
|
477 | + public function get_active_messengers_option($reset = false) { |
|
478 | + if ($reset) { |
|
479 | + $this->_active_message_types = get_option('ee_active_messengers', array()); |
|
480 | 480 | } |
481 | 481 | return $this->_active_message_types; |
482 | 482 | } |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | * representing this data is used. |
491 | 491 | * @return bool FALSE if not updated, TRUE if updated. |
492 | 492 | */ |
493 | - public function update_active_messengers_option( $active_messenger_settings = array() ) { |
|
494 | - $active_messenger_settings = empty( $active_messenger_settings ) ? $this->_active_message_types : $active_messenger_settings; |
|
493 | + public function update_active_messengers_option($active_messenger_settings = array()) { |
|
494 | + $active_messenger_settings = empty($active_messenger_settings) ? $this->_active_message_types : $active_messenger_settings; |
|
495 | 495 | //make sure _active_message_types is updated (this is the internal cache for the settings). |
496 | 496 | $this->_active_message_types = $active_messenger_settings; |
497 | - return update_option( 'ee_active_messengers', $active_messenger_settings ); |
|
497 | + return update_option('ee_active_messengers', $active_messenger_settings); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @return array |
511 | 511 | */ |
512 | - public function get_has_activated_messengers_option( $reset = false ) { |
|
513 | - if ( $reset || empty( $this->_has_activated_messengers_and_message_types ) ) { |
|
514 | - $this->_has_activated_messengers_and_message_types = get_option( 'ee_has_activated_messenger', array() ); |
|
512 | + public function get_has_activated_messengers_option($reset = false) { |
|
513 | + if ($reset || empty($this->_has_activated_messengers_and_message_types)) { |
|
514 | + $this->_has_activated_messengers_and_message_types = get_option('ee_has_activated_messenger', array()); |
|
515 | 515 | } |
516 | 516 | return $this->_has_activated_messengers_and_message_types; |
517 | 517 | } |
@@ -526,15 +526,15 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @return bool FALSE if not updated, TRUE if updated. |
528 | 528 | */ |
529 | - public function update_has_activated_messengers_option( $has_activated_messengers = array() ) { |
|
529 | + public function update_has_activated_messengers_option($has_activated_messengers = array()) { |
|
530 | 530 | //make sure the option has been retrieved from first so we don't overwrite it accidentally. |
531 | - if ( empty( $has_activated_messengers ) && empty( $this->_has_activated_messengers_and_message_types ) ) { |
|
531 | + if (empty($has_activated_messengers) && empty($this->_has_activated_messengers_and_message_types)) { |
|
532 | 532 | $this->get_has_activated_messengers_option(); |
533 | 533 | } |
534 | - $has_activated_messengers = empty( $has_activated_messengers ) |
|
534 | + $has_activated_messengers = empty($has_activated_messengers) |
|
535 | 535 | ? $this->_has_activated_messengers_and_message_types |
536 | 536 | : $has_activated_messengers; |
537 | - return update_option( 'ee_has_activated_messenger', $has_activated_messengers ); |
|
537 | + return update_option('ee_has_activated_messenger', $has_activated_messengers); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | //echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() \n"; |
557 | 557 | // list of activated messengers as set via the admin |
558 | 558 | // note calling `get_active_messengers_options` also initializes the _active_message_types property. |
559 | - $this->get_active_messengers_option( true ); |
|
560 | - $this->ensure_messengers_are_active( array(), false, true ); |
|
559 | + $this->get_active_messengers_option(true); |
|
560 | + $this->ensure_messengers_are_active(array(), false, true); |
|
561 | 561 | $this->update_active_messengers_option(); |
562 | 562 | $this->update_has_activated_messengers_option(); |
563 | 563 | } |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | * @param bool $update_option Whether to update the option in the db or not. |
576 | 576 | * @return boolean true if either already active or successfully activated. |
577 | 577 | */ |
578 | - public function ensure_messenger_is_active( $messenger_name, $update_option = true ) { |
|
579 | - if ( ! isset( $this->_active_messengers[ $messenger_name ] ) ) { |
|
578 | + public function ensure_messenger_is_active($messenger_name, $update_option = true) { |
|
579 | + if ( ! isset($this->_active_messengers[$messenger_name])) { |
|
580 | 580 | try { |
581 | - $this->activate_messenger( $messenger_name, array(), $update_option ); |
|
582 | - } catch( EE_Error $e ) { |
|
581 | + $this->activate_messenger($messenger_name, array(), $update_option); |
|
582 | + } catch (EE_Error $e) { |
|
583 | 583 | EE_Error::add_error( |
584 | 584 | $e->getMessage(), |
585 | 585 | __FILE__, |
@@ -606,25 +606,25 @@ discard block |
||
606 | 606 | * and a messenger is indicated as active, but is NOT installed, then it will automatically be |
607 | 607 | * deactivated. |
608 | 608 | */ |
609 | - public function ensure_messengers_are_active( $messenger_names = array(), $update_option = true, $verify = false ) { |
|
610 | - $messenger_names = empty( $messenger_names ) ? array_keys( $this->_active_message_types ) : $messenger_names; |
|
609 | + public function ensure_messengers_are_active($messenger_names = array(), $update_option = true, $verify = false) { |
|
610 | + $messenger_names = empty($messenger_names) ? array_keys($this->_active_message_types) : $messenger_names; |
|
611 | 611 | |
612 | 612 | $not_installed = array(); |
613 | - foreach( $messenger_names as $messenger_name ) { |
|
614 | - if ( $verify && ! $this->messenger_collection()->has_by_name( $messenger_name ) ) { |
|
613 | + foreach ($messenger_names as $messenger_name) { |
|
614 | + if ($verify && ! $this->messenger_collection()->has_by_name($messenger_name)) { |
|
615 | 615 | $not_installed[] = $messenger_name; |
616 | - $this->deactivate_messenger( $messenger_name ); |
|
616 | + $this->deactivate_messenger($messenger_name); |
|
617 | 617 | continue; |
618 | 618 | } |
619 | - $this->ensure_messenger_is_active( $messenger_name, $update_option ); |
|
619 | + $this->ensure_messenger_is_active($messenger_name, $update_option); |
|
620 | 620 | } |
621 | 621 | |
622 | - if ( ! empty( $not_installed_messenger ) ) { |
|
622 | + if ( ! empty($not_installed_messenger)) { |
|
623 | 623 | EE_Error::add_error( |
624 | 624 | sprintf( |
625 | - __( 'The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso' ), |
|
625 | + __('The following messengers are either not installed or are invalid:%1$s %2$s', 'event_espresso'), |
|
626 | 626 | '<br />', |
627 | - implode( ', ', $not_installed_messenger ) |
|
627 | + implode(', ', $not_installed_messenger) |
|
628 | 628 | ), |
629 | 629 | __FILE__, __FUNCTION__, __LINE__ |
630 | 630 | ); |
@@ -643,18 +643,18 @@ discard block |
||
643 | 643 | * @return bool Returns true if already is active or if was activated successfully. |
644 | 644 | * @throws \EE_Error |
645 | 645 | */ |
646 | - public function ensure_message_type_is_active( $message_type_name, $messenger_name, $update_option = true ) { |
|
646 | + public function ensure_message_type_is_active($message_type_name, $messenger_name, $update_option = true) { |
|
647 | 647 | // grab the messenger to work with. |
648 | - $messenger = $this->valid_messenger( $messenger_name ); |
|
649 | - if ( $this->valid_message_type_for_messenger( $messenger, $message_type_name ) ) { |
|
648 | + $messenger = $this->valid_messenger($messenger_name); |
|
649 | + if ($this->valid_message_type_for_messenger($messenger, $message_type_name)) { |
|
650 | 650 | //ensure messenger is active (that's an inherent coupling between active message types and the |
651 | 651 | //messenger they are being activated for. |
652 | 652 | try { |
653 | - if ( ! $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
653 | + if ( ! $this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
654 | 654 | //all is good so let's just get it active |
655 | - $this->activate_messenger( $messenger_name, array( $message_type_name ), $update_option ); |
|
655 | + $this->activate_messenger($messenger_name, array($message_type_name), $update_option); |
|
656 | 656 | } |
657 | - } catch( EE_Error $e ) { |
|
657 | + } catch (EE_Error $e) { |
|
658 | 658 | EE_Error::add_error( |
659 | 659 | $e->getMessage(), |
660 | 660 | __FILE__, |
@@ -678,14 +678,14 @@ discard block |
||
678 | 678 | * @param string $messenger_name The name of the messenger that the message types are to be activated on. |
679 | 679 | * @param bool $update_option Whether to persist the activation to the database or not (default true). |
680 | 680 | */ |
681 | - public function ensure_message_types_are_active( $message_type_names, $messenger_name, $update_option = true ) { |
|
681 | + public function ensure_message_types_are_active($message_type_names, $messenger_name, $update_option = true) { |
|
682 | 682 | $message_type_names = (array) $message_type_names; |
683 | - foreach ( $message_type_names as $message_type_name ) { |
|
683 | + foreach ($message_type_names as $message_type_name) { |
|
684 | 684 | // note, intentionally not updating option here because we're in a loop. |
685 | 685 | // We'll follow the instructions of the incoming $update_option argument after the loop. |
686 | - $this->ensure_message_type_is_active( $message_type_name, $messenger_name, false ); |
|
686 | + $this->ensure_message_type_is_active($message_type_name, $messenger_name, false); |
|
687 | 687 | } |
688 | - if ( $update_option ) { |
|
688 | + if ($update_option) { |
|
689 | 689 | $this->update_active_messengers_option(); |
690 | 690 | $this->update_has_activated_messengers_option(); |
691 | 691 | } |
@@ -712,24 +712,24 @@ discard block |
||
712 | 712 | ) { |
713 | 713 | $templates = array(); |
714 | 714 | // grab the messenger to work with. |
715 | - $messenger = $this->messenger_collection()->get_by_info( $messenger_name ); |
|
715 | + $messenger = $this->messenger_collection()->get_by_info($messenger_name); |
|
716 | 716 | // it's inactive. Activate it. |
717 | - if ( $messenger instanceof EE_messenger ) { |
|
718 | - $this->_active_messengers[ $messenger->name ] = $messenger; |
|
717 | + if ($messenger instanceof EE_messenger) { |
|
718 | + $this->_active_messengers[$messenger->name] = $messenger; |
|
719 | 719 | //activate incoming message types set to be activated with messenger. |
720 | - $message_type_names = $this->_activate_message_types( $messenger, $message_type_names ); |
|
720 | + $message_type_names = $this->_activate_message_types($messenger, $message_type_names); |
|
721 | 721 | // setup any initial settings for the messenger if necessary. |
722 | - $this->add_settings_for_messenger( $messenger->name ); |
|
723 | - if ( $update_active_messengers_option ) { |
|
722 | + $this->add_settings_for_messenger($messenger->name); |
|
723 | + if ($update_active_messengers_option) { |
|
724 | 724 | $this->update_active_messengers_option(); |
725 | 725 | $this->update_has_activated_messengers_option(); |
726 | 726 | } |
727 | 727 | //generate new templates if necessary and ensure all related templates that are already in the database are |
728 | 728 | //marked active. Note, this will also deactivate a message type for a messenger if the template |
729 | 729 | //cannot be successfully created during its attempt (only happens for global template attempts). |
730 | - if ( ! empty( $message_type_names ) ) { |
|
731 | - $templates = EEH_MSG_Template::generate_new_templates( $messenger->name, $message_type_names, 0, true ); |
|
732 | - EEH_MSG_Template::update_to_active( array( $messenger->name ), $message_type_names ); |
|
730 | + if ( ! empty($message_type_names)) { |
|
731 | + $templates = EEH_MSG_Template::generate_new_templates($messenger->name, $message_type_names, 0, true); |
|
732 | + EEH_MSG_Template::update_to_active(array($messenger->name), $message_type_names); |
|
733 | 733 | } |
734 | 734 | } |
735 | 735 | return $templates; |
@@ -748,29 +748,29 @@ discard block |
||
748 | 748 | * |
749 | 749 | * @return array |
750 | 750 | */ |
751 | - protected function _activate_message_types( EE_messenger $messenger, $message_type_names = array() ) { |
|
751 | + protected function _activate_message_types(EE_messenger $messenger, $message_type_names = array()) { |
|
752 | 752 | //If $message_type_names is empty, AND $this->_active_message_types is empty, then that means |
753 | 753 | //things have never been initialized (which should happen on EEH_Activation::generate_message_templates). |
754 | 754 | //So ONLY then do we need to actually grab defaults and cycle through them. Otherwise we |
755 | 755 | //only override _active_message_types when an explicit array of $message_type_names has been provided. |
756 | - $message_type_names = empty( $message_type_names ) && ! isset( $this->_active_message_types[ $messenger->name ] ) |
|
756 | + $message_type_names = empty($message_type_names) && ! isset($this->_active_message_types[$messenger->name]) |
|
757 | 757 | ? $messenger->get_default_message_types() |
758 | 758 | : (array) $message_type_names; |
759 | 759 | |
760 | 760 | //now we ALWAYS need to make sure that the messenger is active for the message types we're activating! |
761 | - if ( ! isset( $this->_active_message_types[ $messenger->name ] ) ) { |
|
762 | - $this->_active_message_types[ $messenger->name ]['settings'] = array(); |
|
761 | + if ( ! isset($this->_active_message_types[$messenger->name])) { |
|
762 | + $this->_active_message_types[$messenger->name]['settings'] = array(); |
|
763 | 763 | } |
764 | 764 | |
765 | - if ( $message_type_names ) { |
|
765 | + if ($message_type_names) { |
|
766 | 766 | // cycle thru message types |
767 | - foreach ( $message_type_names as $message_type_name ) { |
|
767 | + foreach ($message_type_names as $message_type_name) { |
|
768 | 768 | //only register the message type as active IF it isn't already active |
769 | 769 | //and if its actually installed. |
770 | 770 | if ( |
771 | - ! $this->is_message_type_active_for_messenger( $messenger->name, $message_type_name ) |
|
771 | + ! $this->is_message_type_active_for_messenger($messenger->name, $message_type_name) |
|
772 | 772 | ) { |
773 | - $this->add_settings_for_message_type( $messenger->name, $message_type_name ); |
|
773 | + $this->add_settings_for_message_type($messenger->name, $message_type_name); |
|
774 | 774 | $this->_set_messenger_has_activated_message_type( |
775 | 775 | $messenger, |
776 | 776 | $message_type_name |
@@ -793,24 +793,24 @@ discard block |
||
793 | 793 | * @param string $message_type_name The name of the message type adding the settings for |
794 | 794 | * @param array $new_settings Any new settings being set for the message type and messenger |
795 | 795 | */ |
796 | - public function add_settings_for_message_type( $messenger_name, $message_type_name, $new_settings = array() ) { |
|
796 | + public function add_settings_for_message_type($messenger_name, $message_type_name, $new_settings = array()) { |
|
797 | 797 | // get installed message type from collection |
798 | - $message_type = $this->message_type_collection()->get_by_info( $message_type_name ); |
|
799 | - $existing_settings = $this->get_message_type_settings_for_messenger( $messenger_name, $message_type_name ); |
|
798 | + $message_type = $this->message_type_collection()->get_by_info($message_type_name); |
|
799 | + $existing_settings = $this->get_message_type_settings_for_messenger($messenger_name, $message_type_name); |
|
800 | 800 | //we need to setup any initial settings for message types |
801 | - if ( $message_type instanceof EE_message_type ) { |
|
801 | + if ($message_type instanceof EE_message_type) { |
|
802 | 802 | $default_settings = $message_type->get_admin_settings_fields(); |
803 | - foreach ( $default_settings as $field => $values ) { |
|
804 | - if ( isset( $new_settings[ $field ] ) ) { |
|
805 | - $existing_settings[ $field ] = $new_settings[ $field ]; |
|
803 | + foreach ($default_settings as $field => $values) { |
|
804 | + if (isset($new_settings[$field])) { |
|
805 | + $existing_settings[$field] = $new_settings[$field]; |
|
806 | 806 | continue; |
807 | 807 | } |
808 | - if ( ! isset( $existing_settings[ $field ] ) ) { |
|
809 | - $existing_settings[ $field ] = $values['default']; |
|
808 | + if ( ! isset($existing_settings[$field])) { |
|
809 | + $existing_settings[$field] = $values['default']; |
|
810 | 810 | } |
811 | 811 | } |
812 | 812 | } |
813 | - $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ]['settings'] = $existing_settings; |
|
813 | + $this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]['settings'] = $existing_settings; |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | |
@@ -823,20 +823,20 @@ discard block |
||
823 | 823 | * @param \EE_messenger $messenger |
824 | 824 | * @param string $message_type_name |
825 | 825 | */ |
826 | - protected function _set_messenger_has_activated_message_type( EE_messenger $messenger, $message_type_name ) { |
|
826 | + protected function _set_messenger_has_activated_message_type(EE_messenger $messenger, $message_type_name) { |
|
827 | 827 | |
828 | 828 | //if _has_activated_messengers_and_message_types is empty then lets ensure its initialized |
829 | - if ( empty( $this->_has_activated_messengers_and_message_types ) ) { |
|
829 | + if (empty($this->_has_activated_messengers_and_message_types)) { |
|
830 | 830 | $this->get_has_activated_messengers_option(); |
831 | 831 | } |
832 | 832 | |
833 | 833 | // make sure this messenger has a record in the has_activated array |
834 | - if ( ! isset( $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) { |
|
835 | - $this->_has_activated_messengers_and_message_types[ $messenger->name ] = array(); |
|
834 | + if ( ! isset($this->_has_activated_messengers_and_message_types[$messenger->name])) { |
|
835 | + $this->_has_activated_messengers_and_message_types[$messenger->name] = array(); |
|
836 | 836 | } |
837 | 837 | // check if message type has already been added |
838 | - if ( ! in_array( $message_type_name, $this->_has_activated_messengers_and_message_types[ $messenger->name ] ) ) { |
|
839 | - $this->_has_activated_messengers_and_message_types[ $messenger->name ][] = $message_type_name; |
|
838 | + if ( ! in_array($message_type_name, $this->_has_activated_messengers_and_message_types[$messenger->name])) { |
|
839 | + $this->_has_activated_messengers_and_message_types[$messenger->name][] = $message_type_name; |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | |
@@ -851,20 +851,20 @@ discard block |
||
851 | 851 | * @param string $messenger_name The name of the messenger the settings is being added for. |
852 | 852 | * @param array $new_settings An array of settings to update the existing settings. |
853 | 853 | */ |
854 | - public function add_settings_for_messenger( $messenger_name, $new_settings = array() ) { |
|
855 | - $messenger = $this->get_messenger( $messenger_name ); |
|
856 | - if ( $messenger instanceof EE_messenger ) { |
|
854 | + public function add_settings_for_messenger($messenger_name, $new_settings = array()) { |
|
855 | + $messenger = $this->get_messenger($messenger_name); |
|
856 | + if ($messenger instanceof EE_messenger) { |
|
857 | 857 | $msgr_settings = $messenger->get_admin_settings_fields(); |
858 | - if ( ! empty( $msgr_settings ) ) { |
|
859 | - foreach ( $msgr_settings as $field => $value ) { |
|
858 | + if ( ! empty($msgr_settings)) { |
|
859 | + foreach ($msgr_settings as $field => $value) { |
|
860 | 860 | //is there a new setting for this? |
861 | - if ( isset( $new_settings[ $field ] ) ) { |
|
862 | - $this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $new_settings[ $field ]; |
|
861 | + if (isset($new_settings[$field])) { |
|
862 | + $this->_active_message_types[$messenger->name]['settings'][$field] = $new_settings[$field]; |
|
863 | 863 | continue; |
864 | 864 | } |
865 | 865 | //only set the default if it isn't already set. |
866 | - if ( ! isset( $this->_active_message_types[ $messenger->name ]['settings'][ $field ] ) ) { |
|
867 | - $this->_active_message_types[ $messenger->name ]['settings'][ $field ] = $value; |
|
866 | + if ( ! isset($this->_active_message_types[$messenger->name]['settings'][$field])) { |
|
867 | + $this->_active_message_types[$messenger->name]['settings'][$field] = $value; |
|
868 | 868 | } |
869 | 869 | } |
870 | 870 | } |
@@ -879,14 +879,14 @@ discard block |
||
879 | 879 | * @param string|EE_messenger $messenger_name name of messenger |
880 | 880 | * @return void |
881 | 881 | */ |
882 | - public function deactivate_messenger( $messenger_name ) { |
|
882 | + public function deactivate_messenger($messenger_name) { |
|
883 | 883 | $this->_initialize_collections(); |
884 | - if ( $messenger_name instanceof EE_messenger ) { |
|
884 | + if ($messenger_name instanceof EE_messenger) { |
|
885 | 885 | $messenger_name = $messenger_name->name; |
886 | 886 | } |
887 | - unset( $this->_active_messengers[ $messenger_name ] ); |
|
888 | - unset( $this->_active_message_types[ $messenger_name ] ); |
|
889 | - $this->_message_template_group_model->deactivate_message_template_groups_for( $messenger_name ); |
|
887 | + unset($this->_active_messengers[$messenger_name]); |
|
888 | + unset($this->_active_message_types[$messenger_name]); |
|
889 | + $this->_message_template_group_model->deactivate_message_template_groups_for($messenger_name); |
|
890 | 890 | $this->update_active_messengers_option(); |
891 | 891 | } |
892 | 892 | |
@@ -896,22 +896,22 @@ discard block |
||
896 | 896 | * |
897 | 897 | * @param string $message_type_name name of message type being deactivated |
898 | 898 | */ |
899 | - public function deactivate_message_type( $message_type_name ) { |
|
899 | + public function deactivate_message_type($message_type_name) { |
|
900 | 900 | $this->_initialize_collections(); |
901 | - if ( $message_type_name instanceof EE_message_type ) { |
|
901 | + if ($message_type_name instanceof EE_message_type) { |
|
902 | 902 | $message_type_name = $message_type_name->name; |
903 | 903 | } |
904 | - foreach ( $this->_active_message_types as $messenger_name => $settings ) { |
|
904 | + foreach ($this->_active_message_types as $messenger_name => $settings) { |
|
905 | 905 | unset( |
906 | - $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] |
|
906 | + $this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name] |
|
907 | 907 | ); |
908 | 908 | |
909 | 909 | //we always record (even on deactivation) that a message type has been activated because there should at |
910 | 910 | //least be a record in the "has_activated" option that it WAS active at one point. |
911 | - $messenger = $this->get_messenger( $messenger_name ); |
|
912 | - $this->_set_messenger_has_activated_message_type( $messenger, $message_type_name ); |
|
911 | + $messenger = $this->get_messenger($messenger_name); |
|
912 | + $this->_set_messenger_has_activated_message_type($messenger, $message_type_name); |
|
913 | 913 | } |
914 | - $this->_message_template_group_model->deactivate_message_template_groups_for( '', $message_type_name ); |
|
914 | + $this->_message_template_group_model->deactivate_message_template_groups_for('', $message_type_name); |
|
915 | 915 | $this->update_active_messengers_option(); |
916 | 916 | $this->update_has_activated_messengers_option(); |
917 | 917 | } |
@@ -926,12 +926,12 @@ discard block |
||
926 | 926 | * @param string $message_type_name Name of message type being deactivated. |
927 | 927 | * @param string $messenger_name Name of messenger the message type is being deactivated for. |
928 | 928 | */ |
929 | - public function deactivate_message_type_for_messenger( $message_type_name, $messenger_name ) { |
|
929 | + public function deactivate_message_type_for_messenger($message_type_name, $messenger_name) { |
|
930 | 930 | $this->_initialize_collections(); |
931 | - if ( $this->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
932 | - unset( $this->_active_message_types[ $messenger_name ]['settings'][ $messenger_name . '-message_types' ][ $message_type_name ] ); |
|
931 | + if ($this->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
932 | + unset($this->_active_message_types[$messenger_name]['settings'][$messenger_name.'-message_types'][$message_type_name]); |
|
933 | 933 | } |
934 | - $this->_message_template_group_model->deactivate_message_template_groups_for( array( $messenger_name ), array( $message_type_name ) ); |
|
934 | + $this->_message_template_group_model->deactivate_message_template_groups_for(array($messenger_name), array($message_type_name)); |
|
935 | 935 | $this->update_active_messengers_option(); |
936 | 936 | } |
937 | 937 | |
@@ -948,12 +948,12 @@ discard block |
||
948 | 948 | * |
949 | 949 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
950 | 950 | */ |
951 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
951 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
952 | 952 | //get the $messengers the message type says it can be used with. |
953 | - foreach ( $message_type->with_messengers() as $generating_messenger => $secondary_messengers ) { |
|
953 | + foreach ($message_type->with_messengers() as $generating_messenger => $secondary_messengers) { |
|
954 | 954 | if ( |
955 | 955 | $messenger->name === $generating_messenger |
956 | - && $this->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) |
|
956 | + && $this->is_message_type_active_for_messenger($messenger->name, $message_type->name) |
|
957 | 957 | ) { |
958 | 958 | return true; |
959 | 959 | } |
@@ -990,25 +990,25 @@ discard block |
||
990 | 990 | * or all contexts indexed by message type. |
991 | 991 | * @return array |
992 | 992 | */ |
993 | - public function get_all_contexts( $slugs_only = true ) { |
|
993 | + public function get_all_contexts($slugs_only = true) { |
|
994 | 994 | $key = $slugs_only ? 'slugs' : 'all'; |
995 | 995 | // check if contexts has been setup yet. |
996 | - if ( empty( $this->_contexts[ $key ] ) ) { |
|
996 | + if (empty($this->_contexts[$key])) { |
|
997 | 997 | // So let's get all active message type objects and loop through to get all unique contexts |
998 | - foreach ( $this->get_active_message_type_objects() as $message_type ) { |
|
999 | - if ( $message_type instanceof EE_message_type ) { |
|
998 | + foreach ($this->get_active_message_type_objects() as $message_type) { |
|
999 | + if ($message_type instanceof EE_message_type) { |
|
1000 | 1000 | $message_type_contexts = $message_type->get_contexts(); |
1001 | - if ( $slugs_only ) { |
|
1002 | - foreach ( $message_type_contexts as $context => $context_details ) { |
|
1003 | - $this->_contexts[ $key ][ $context ] = $context_details[ 'label' ]; |
|
1001 | + if ($slugs_only) { |
|
1002 | + foreach ($message_type_contexts as $context => $context_details) { |
|
1003 | + $this->_contexts[$key][$context] = $context_details['label']; |
|
1004 | 1004 | } |
1005 | 1005 | } else { |
1006 | - $this->_contexts[ $key ][ $message_type->name ] = $message_type_contexts; |
|
1006 | + $this->_contexts[$key][$message_type->name] = $message_type_contexts; |
|
1007 | 1007 | } |
1008 | 1008 | } |
1009 | 1009 | } |
1010 | 1010 | } |
1011 | - return ! empty( $this->_contexts[ $key ] ) ? $this->_contexts[ $key ] : array(); |
|
1011 | + return ! empty($this->_contexts[$key]) ? $this->_contexts[$key] : array(); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | |
@@ -1027,9 +1027,9 @@ discard block |
||
1027 | 1027 | $installed_message_types = $this->installed_message_types(); |
1028 | 1028 | $all_message_types_valid = true; |
1029 | 1029 | //loop through list of active message types and verify they are installed. |
1030 | - foreach( $list_of_active_message_type_names as $message_type_name ) { |
|
1031 | - if ( ! isset( $installed_message_types[$message_type_name] ) ) { |
|
1032 | - $this->deactivate_message_type( $message_type_name ); |
|
1030 | + foreach ($list_of_active_message_type_names as $message_type_name) { |
|
1031 | + if ( ! isset($installed_message_types[$message_type_name])) { |
|
1032 | + $this->deactivate_message_type($message_type_name); |
|
1033 | 1033 | $all_message_types_valid = false; |
1034 | 1034 | } |
1035 | 1035 | } |
@@ -1048,10 +1048,10 @@ discard block |
||
1048 | 1048 | * @param $messenger_name |
1049 | 1049 | * @return bool |
1050 | 1050 | */ |
1051 | - public function has_message_type_been_activated_for_messenger( $message_type_name, $messenger_name ) { |
|
1051 | + public function has_message_type_been_activated_for_messenger($message_type_name, $messenger_name) { |
|
1052 | 1052 | $has_activated = $this->get_has_activated_messengers_option(); |
1053 | - return isset( $has_activated[ $messenger_name ] ) |
|
1054 | - && in_array( $message_type_name, $has_activated[ $messenger_name ] ); |
|
1053 | + return isset($has_activated[$messenger_name]) |
|
1054 | + && in_array($message_type_name, $has_activated[$messenger_name]); |
|
1055 | 1055 | } |
1056 | 1056 | } |
1057 | 1057 | // End of file EE_Message_Resource_Manager.lib.php |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | |
42 | - /** |
|
43 | - * EE_Attendee_Shortcodes constructor. |
|
44 | - */ |
|
45 | - public function __construct() { |
|
42 | + /** |
|
43 | + * EE_Attendee_Shortcodes constructor. |
|
44 | + */ |
|
45 | + public function __construct() { |
|
46 | 46 | parent::__construct(); |
47 | 47 | } |
48 | 48 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | |
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * handles shortcode parsing |
|
77 | - * |
|
78 | - * @access protected |
|
79 | - * @param string $shortcode the shortcode to be parsed. |
|
80 | - * @return string |
|
81 | - * @throws \EE_Error |
|
82 | - */ |
|
83 | - protected function _parser( $shortcode ) { |
|
75 | + /** |
|
76 | + * handles shortcode parsing |
|
77 | + * |
|
78 | + * @access protected |
|
79 | + * @param string $shortcode the shortcode to be parsed. |
|
80 | + * @return string |
|
81 | + * @throws \EE_Error |
|
82 | + */ |
|
83 | + protected function _parser( $shortcode ) { |
|
84 | 84 | |
85 | 85 | |
86 | 86 | $this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL; |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | if ( ! $registration instanceof EE_Registration ) { |
92 | 92 | //let's attempt to get the txn_id for the error message. |
93 | 93 | $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' ); |
94 | - $msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', |
|
95 | - 'event_espresso'); |
|
96 | - $dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id); |
|
94 | + $msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', |
|
95 | + 'event_espresso'); |
|
96 | + $dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id); |
|
97 | 97 | throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
98 | 98 | } |
99 | 99 | |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | $attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ; |
102 | 102 | |
103 | 103 | if ( ! $attendee instanceof EE_Attendee ) { |
104 | - $msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', |
|
105 | - 'event_espresso'); |
|
106 | - $dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'), |
|
107 | - $registration->ID()); |
|
104 | + $msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', |
|
105 | + 'event_espresso'); |
|
106 | + $dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'), |
|
107 | + $registration->ID()); |
|
108 | 108 | throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
109 | 109 | } |
110 | 110 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | '[ADDRESS2]' => __('Whatever was in the address 2 field for the registration.', 'event_espresso'), |
66 | 66 | '[CITY]' => __('The city for the registration.', 'event_espresso'), |
67 | 67 | '[ZIP_PC]' => __('The ZIP (or Postal) Code for the Registration.', 'event_espresso'), |
68 | - '[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso' ), |
|
68 | + '[ADDRESS_STATE]' => __('The state/province for the registration.', 'event_espresso'), |
|
69 | 69 | '[COUNTRY]' => __('The country for the registration.', 'event_espresso') |
70 | 70 | ); |
71 | 71 | } |
@@ -80,27 +80,27 @@ discard block |
||
80 | 80 | * @return string |
81 | 81 | * @throws \EE_Error |
82 | 82 | */ |
83 | - protected function _parser( $shortcode ) { |
|
83 | + protected function _parser($shortcode) { |
|
84 | 84 | |
85 | 85 | |
86 | - $this->_xtra = !empty($this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL; |
|
86 | + $this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : NULL; |
|
87 | 87 | |
88 | 88 | //incoming object should only be a registration object. |
89 | 89 | $registration = ! $this->_data instanceof EE_Registration ? NULL : $this->_data; |
90 | 90 | |
91 | - if ( ! $registration instanceof EE_Registration ) { |
|
91 | + if ( ! $registration instanceof EE_Registration) { |
|
92 | 92 | //let's attempt to get the txn_id for the error message. |
93 | - $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso' ); |
|
93 | + $txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction ? $this->_xtra->txn->ID() : __('Unknown', 'event_espresso'); |
|
94 | 94 | $msg = __('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', |
95 | 95 | 'event_espresso'); |
96 | 96 | $dev_msg = sprintf(__('The transaction ID for this request is: %s', 'event_espresso'), $txn_id); |
97 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
97 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | //attendee obj for this registration |
101 | - $attendee = isset( $this->_xtra->registrations[$registration->ID()]['att_obj'] ) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null ; |
|
101 | + $attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) ? $this->_xtra->registrations[$registration->ID()]['att_obj'] : null; |
|
102 | 102 | |
103 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
103 | + if ( ! $attendee instanceof EE_Attendee) { |
|
104 | 104 | $msg = __('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', |
105 | 105 | 'event_espresso'); |
106 | 106 | $dev_msg = sprintf(__('The registration ID for this request is: %s', 'event_espresso'), |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
109 | 109 | } |
110 | 110 | |
111 | - switch ( $shortcode ) { |
|
111 | + switch ($shortcode) { |
|
112 | 112 | |
113 | 113 | case '[FNAME]' : |
114 | 114 | return $attendee->fname(); |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'filename' => 'registrations_overview_other' |
439 | 439 | ) |
440 | 440 | ), |
441 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
441 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
442 | 442 | 'qtips' => array('Registration_List_Table_Tips'), |
443 | 443 | 'list_table' => 'EE_Registrations_List_Table', |
444 | 444 | 'require_nonce' => FALSE |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | 'nav' => array( |
449 | 449 | 'label' => __('REG Details', 'event_espresso'), |
450 | 450 | 'order' => 15, |
451 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
451 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
452 | 452 | 'persistent' => FALSE |
453 | 453 | ), |
454 | 454 | 'help_tabs' => array( |
@@ -469,8 +469,8 @@ discard block |
||
469 | 469 | 'filename' => 'registrations_details_registrant_details' |
470 | 470 | ) |
471 | 471 | ), |
472 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
473 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
472 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
473 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
474 | 474 | 'require_nonce' => FALSE |
475 | 475 | ), |
476 | 476 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | 'order' => 15, |
495 | 495 | 'persistent' => FALSE |
496 | 496 | ), |
497 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
497 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
498 | 498 | 'require_nonce' => FALSE |
499 | 499 | ), |
500 | 500 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | 'label' => __('Edit Contact', 'event_espresso'), |
504 | 504 | 'order' => 15, |
505 | 505 | 'persistent' => FALSE, |
506 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
506 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
507 | 507 | ), |
508 | 508 | 'metaboxes' => array('attendee_editor_metaboxes'), |
509 | 509 | 'require_nonce' => FALSE |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | 'filename' => 'registrations_contact_list_other' |
534 | 534 | ) |
535 | 535 | ), |
536 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
536 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
537 | 537 | 'metaboxes' => array(), |
538 | 538 | 'require_nonce' => FALSE |
539 | 539 | ), |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | protected function _add_screen_options() {} |
553 | 553 | protected function _add_feature_pointers() {} |
554 | 554 | public function admin_init() { |
555 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
555 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
556 | 556 | } |
557 | 557 | public function admin_notices() {} |
558 | 558 | public function admin_footer_scripts() {} |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @return void |
571 | 571 | */ |
572 | 572 | private function _get_registration_status_array() { |
573 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
573 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | public function load_scripts_styles() { |
594 | 594 | //style |
595 | 595 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
596 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
596 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
597 | 597 | wp_enqueue_style('espresso_reg'); |
598 | 598 | |
599 | 599 | //script |
600 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
601 | 601 | wp_enqueue_script('espresso_reg'); |
602 | 602 | } |
603 | 603 | |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | public function load_scripts_styles_edit_attendee() { |
607 | 607 | //stuff to only show up on our attendee edit details page. |
608 | 608 | $attendee_details_translations = array( |
609 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
609 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
610 | 610 | ); |
611 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
611 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
612 | 612 | wp_enqueue_script('jquery-validate'); |
613 | 613 | } |
614 | 614 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | //styles |
618 | 618 | wp_enqueue_style('espresso-ui-theme'); |
619 | 619 | //scripts |
620 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
621 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
620 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
621 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | public function load_scripts_styles_contact_list() { |
630 | 630 | wp_deregister_style('espresso_reg'); |
631 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
631 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
632 | 632 | wp_enqueue_style('espresso_att'); |
633 | 633 | } |
634 | 634 | |
@@ -637,9 +637,9 @@ discard block |
||
637 | 637 | |
638 | 638 | |
639 | 639 | public function load_scripts_styles_new_registration() { |
640 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
640 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
641 | 641 | wp_enqueue_script('ee-spco-for-admin'); |
642 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
642 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
643 | 643 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
644 | 644 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
645 | 645 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | //for notification related bulk actions we need to make sure only active messengers have an option. |
667 | 667 | EED_Messages::set_autoloaders(); |
668 | 668 | /** @type EE_Message_Resource_Manager $message_resource_manager */ |
669 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
669 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
670 | 670 | $active_mts = $message_resource_manager->list_of_active_message_types(); |
671 | 671 | //key= bulk_action_slug, value= message type. |
672 | 672 | $match_array = array( |
@@ -679,23 +679,23 @@ discard block |
||
679 | 679 | |
680 | 680 | /** setup reg status bulk actions **/ |
681 | 681 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
682 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
682 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
683 | 683 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
684 | 684 | } |
685 | 685 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
686 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
686 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
687 | 687 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
688 | 688 | } |
689 | 689 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
690 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
690 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
691 | 691 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
692 | 692 | } |
693 | 693 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
694 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
694 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
695 | 695 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
696 | 696 | } |
697 | 697 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
698 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
698 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
699 | 699 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
700 | 700 | } |
701 | 701 | |
@@ -704,29 +704,29 @@ discard block |
||
704 | 704 | 'slug' => 'all', |
705 | 705 | 'label' => __('View All Registrations', 'event_espresso'), |
706 | 706 | 'count' => 0, |
707 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
707 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
708 | 708 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
709 | - ) ) |
|
709 | + )) |
|
710 | 710 | ), |
711 | 711 | 'month' => array( |
712 | 712 | 'slug' => 'month', |
713 | 713 | 'label' => __('This Month', 'event_espresso'), |
714 | 714 | 'count' => 0, |
715 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
715 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
716 | 716 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
717 | 717 | )) |
718 | 718 | ), |
719 | 719 | 'today' => array( |
720 | 720 | 'slug' => 'today', |
721 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
721 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
722 | 722 | 'count' => 0, |
723 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
723 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
724 | 724 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
725 | 725 | )) |
726 | 726 | ) |
727 | 727 | ); |
728 | 728 | |
729 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
729 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
730 | 730 | $this->_views['incomplete'] = array( |
731 | 731 | 'slug' => 'incomplete', |
732 | 732 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | ) |
763 | 763 | ); |
764 | 764 | |
765 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
765 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
766 | 766 | $this->_views['trash'] = array( |
767 | 767 | 'slug' => 'trash', |
768 | 768 | 'label' => __('Trash', 'event_espresso'), |
@@ -801,18 +801,18 @@ discard block |
||
801 | 801 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
802 | 802 | ), |
803 | 803 | ); |
804 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
804 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
805 | 805 | $fc_items['resend_registration'] = array( |
806 | 806 | 'class' => 'dashicons dashicons-email-alt', |
807 | 807 | 'desc' => __('Resend Registration Details', 'event_espresso') |
808 | 808 | ); |
809 | 809 | } else { |
810 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
810 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
811 | 811 | } |
812 | 812 | |
813 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
814 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
815 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
813 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
814 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
815 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
816 | 816 | $fc_items['view_related_messages'] = array( |
817 | 817 | 'class' => $related_for_icon['css_class'], |
818 | 818 | 'desc' => $related_for_icon['label'], |
@@ -822,35 +822,35 @@ discard block |
||
822 | 822 | |
823 | 823 | $sc_items = array( |
824 | 824 | 'approved_status' => array( |
825 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
826 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
825 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
826 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
827 | 827 | ), |
828 | 828 | 'pending_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'wait_list' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, false, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence') |
|
835 | 835 | ), |
836 | 836 | 'incomplete_status' => array( |
837 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
838 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
837 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
838 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
839 | 839 | ), |
840 | 840 | 'not_approved' => array( |
841 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
842 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
841 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
842 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
843 | 843 | ), |
844 | 844 | 'declined_status' => array( |
845 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
846 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
845 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
846 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
847 | 847 | ), |
848 | 848 | 'cancelled_status' => array( |
849 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
850 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
849 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
850 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
851 | 851 | ) |
852 | 852 | ); |
853 | - return array_merge( $fc_items, $sc_items ); |
|
853 | + return array_merge($fc_items, $sc_items); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | |
@@ -863,15 +863,15 @@ discard block |
||
863 | 863 | |
864 | 864 | |
865 | 865 | protected function _registrations_overview_list_table() { |
866 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
867 | - if ( $EVT_ID ) { |
|
868 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
869 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
866 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
867 | + if ($EVT_ID) { |
|
868 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
869 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
870 | 870 | } |
871 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
872 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
871 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
872 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
873 | 873 | } |
874 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
874 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
875 | 875 | $this->display_admin_list_table_page_with_no_sidebar(); |
876 | 876 | } |
877 | 877 | |
@@ -886,19 +886,19 @@ discard block |
||
886 | 886 | */ |
887 | 887 | private function _set_registration_object() { |
888 | 888 | //get out if we've already set the object |
889 | - if ( is_object( $this->_registration )) { |
|
889 | + if (is_object($this->_registration)) { |
|
890 | 890 | return TRUE; |
891 | 891 | } |
892 | 892 | |
893 | 893 | $REG = EEM_Registration::instance(); |
894 | 894 | |
895 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
895 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
896 | 896 | |
897 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
897 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
898 | 898 | return TRUE; |
899 | 899 | else { |
900 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
901 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
900 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
901 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
902 | 902 | $this->_registration = NULL; |
903 | 903 | return FALSE; |
904 | 904 | } |
@@ -916,24 +916,24 @@ discard block |
||
916 | 916 | * @throws \EE_Error |
917 | 917 | * @return mixed (int|array) int = count || array of registration objects |
918 | 918 | */ |
919 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
920 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
921 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
922 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
923 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
924 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
925 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
919 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
920 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
921 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
922 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
923 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
924 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE; |
|
925 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE; |
|
926 | 926 | $start_date = FALSE; |
927 | 927 | $end_date = FALSE; |
928 | 928 | $_where = array(); |
929 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
930 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
929 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE; |
|
930 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE; |
|
931 | 931 | |
932 | 932 | //set orderby |
933 | 933 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
934 | 934 | |
935 | 935 | |
936 | - switch ( $this->_req_data['orderby'] ) { |
|
936 | + switch ($this->_req_data['orderby']) { |
|
937 | 937 | case '_REG_ID': |
938 | 938 | $orderby = 'REG_ID'; |
939 | 939 | break; |
@@ -953,26 +953,26 @@ discard block |
||
953 | 953 | $orderby = 'REG_date'; |
954 | 954 | } |
955 | 955 | |
956 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
957 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
958 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
956 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
957 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
958 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
959 | 959 | |
960 | 960 | |
961 | - $offset = ($current_page-1)*$per_page; |
|
962 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
961 | + $offset = ($current_page - 1) * $per_page; |
|
962 | + $limit = $count ? NULL : array($offset, $per_page); |
|
963 | 963 | |
964 | - if($EVT_ID){ |
|
965 | - $_where['EVT_ID']=$EVT_ID; |
|
964 | + if ($EVT_ID) { |
|
965 | + $_where['EVT_ID'] = $EVT_ID; |
|
966 | 966 | } |
967 | - if($CAT_ID){ |
|
967 | + if ($CAT_ID) { |
|
968 | 968 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
969 | 969 | } |
970 | - if ( $incomplete ) { |
|
970 | + if ($incomplete) { |
|
971 | 971 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
972 | 972 | } else if ( ! $trash) { |
973 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
973 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
974 | 974 | } |
975 | - if($reg_status){ |
|
975 | + if ($reg_status) { |
|
976 | 976 | $_where['STS_ID'] = $reg_status; |
977 | 977 | } |
978 | 978 | |
@@ -984,105 +984,105 @@ discard block |
||
984 | 984 | $time_start = ' 00:00:00'; |
985 | 985 | $time_end = ' 23:59:59'; |
986 | 986 | |
987 | - if($today_a || $today ){ |
|
987 | + if ($today_a || $today) { |
|
988 | 988 | $curdate = date('Y-m-d', current_time('timestamp')); |
989 | - $_where['REG_date']= array('BETWEEN', |
|
989 | + $_where['REG_date'] = array('BETWEEN', |
|
990 | 990 | array( |
991 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
992 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
991 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
992 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
993 | 993 | )); |
994 | - }elseif($this_month_a || $this_month){ |
|
994 | + }elseif ($this_month_a || $this_month) { |
|
995 | 995 | $this_month_r = date('m', current_time('timestamp')); |
996 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
997 | - $_where['REG_date']= array('BETWEEN', |
|
996 | + $days_this_month = date('t', current_time('timestamp')); |
|
997 | + $_where['REG_date'] = array('BETWEEN', |
|
998 | 998 | array( |
999 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
1000 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
999 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
1000 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
1001 | 1001 | )); |
1002 | - }elseif($month_range){ |
|
1002 | + }elseif ($month_range) { |
|
1003 | 1003 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1004 | - $month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : ''; |
|
1005 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1006 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
1007 | - $_where['REG_date']= array('BETWEEN', |
|
1008 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
1009 | - }elseif($start_date && $end_date){ |
|
1004 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : ''; |
|
1005 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1006 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
1007 | + $_where['REG_date'] = array('BETWEEN', |
|
1008 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
1009 | + }elseif ($start_date && $end_date) { |
|
1010 | 1010 | throw new EE_Error("not yet supported"); |
1011 | - }elseif($start_date){ |
|
1011 | + }elseif ($start_date) { |
|
1012 | 1012 | throw new EE_Error("not yet supported"); |
1013 | - }elseif($end_date){ |
|
1013 | + }elseif ($end_date) { |
|
1014 | 1014 | throw new EE_Error("not yet supported"); |
1015 | 1015 | } |
1016 | 1016 | |
1017 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1018 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1017 | + if ( ! empty($this->_req_data['s'])) { |
|
1018 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1019 | 1019 | $_where['OR'] = array( |
1020 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1021 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1022 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1023 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1024 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1025 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1026 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1027 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1028 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1029 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1030 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1031 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1032 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1033 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1034 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1035 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1036 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1037 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1020 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1021 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1022 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1023 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1024 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1025 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1026 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1027 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1028 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1029 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1030 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1031 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1032 | + 'REG_code' => array('LIKE', $sstr), |
|
1033 | + 'REG_count' => array('LIKE', $sstr), |
|
1034 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1035 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1036 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1037 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1038 | 1038 | ); |
1039 | 1039 | } |
1040 | 1040 | |
1041 | 1041 | //capability checks |
1042 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1042 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1043 | 1043 | $_where['AND'] = array( |
1044 | 1044 | 'Event.EVT_wp_user' => get_current_user_id() |
1045 | 1045 | ); |
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | |
1049 | - if( $count ){ |
|
1050 | - if ( $trash ) { |
|
1051 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1052 | - } else if ( $incomplete ) { |
|
1053 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1049 | + if ($count) { |
|
1050 | + if ($trash) { |
|
1051 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1052 | + } else if ($incomplete) { |
|
1053 | + return EEM_Registration::instance()->count(array($_where)); |
|
1054 | 1054 | } else { |
1055 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1055 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1056 | 1056 | } |
1057 | 1057 | } else { |
1058 | 1058 | //make sure we remove default where conditions cause all registrations matching query are returned |
1059 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1060 | - if ( $per_page !== -1 ) { |
|
1059 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1060 | + if ($per_page !== -1) { |
|
1061 | 1061 | $query_params['limit'] = $limit; |
1062 | 1062 | } |
1063 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1063 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1064 | 1064 | |
1065 | 1065 | |
1066 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1066 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1067 | 1067 | $first_registration = $registrations[0]; |
1068 | 1068 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1069 | 1069 | $event_name = $first_registration->event_obj()->name(); |
1070 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1070 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1071 | 1071 | // edit event link |
1072 | - if ( $event_name != '' ) { |
|
1073 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1074 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1075 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1072 | + if ($event_name != '') { |
|
1073 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1074 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1075 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1079 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1078 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1079 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1080 | 1080 | |
1081 | 1081 | $this->_template_args['before_admin_page_content'] = ' |
1082 | 1082 | <div id="admin-page-header"> |
1083 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1084 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1085 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1083 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1084 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1085 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1086 | 1086 | </div> |
1087 | 1087 | '; |
1088 | 1088 | |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | |
1121 | 1121 | $this->_set_registration_object(); |
1122 | 1122 | |
1123 | - if ( is_object( $this->_registration )) { |
|
1123 | + if (is_object($this->_registration)) { |
|
1124 | 1124 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1125 | 1125 | $this->_session = $transaction->session_data(); |
1126 | 1126 | |
@@ -1128,10 +1128,10 @@ discard block |
||
1128 | 1128 | |
1129 | 1129 | |
1130 | 1130 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1131 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1131 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1132 | 1132 | |
1133 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime( 'REG_date' ); |
|
1134 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1133 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date'); |
|
1134 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1135 | 1135 | |
1136 | 1136 | $this->_template_args['grand_total'] = $transaction->total(); |
1137 | 1137 | |
@@ -1139,19 +1139,19 @@ discard block |
||
1139 | 1139 | // link back to overview |
1140 | 1140 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1141 | 1141 | $this->_template_args['registration'] = $this->_registration; |
1142 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1143 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1144 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1142 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1143 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1144 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1145 | 1145 | |
1146 | 1146 | //next and previous links |
1147 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1148 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1149 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1150 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1147 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1148 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1149 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1150 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1151 | 1151 | |
1152 | 1152 | // grab header |
1153 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1154 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1153 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1154 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1155 | 1155 | |
1156 | 1156 | } else { |
1157 | 1157 | |
@@ -1170,17 +1170,17 @@ discard block |
||
1170 | 1170 | |
1171 | 1171 | |
1172 | 1172 | protected function _registration_details_metaboxes() { |
1173 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1173 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1174 | 1174 | $this->_set_registration_object(); |
1175 | 1175 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1176 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1177 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1178 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1179 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1176 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1177 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1178 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1179 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1180 | 1180 | } |
1181 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1182 | - if ( $this->_registration->group_size() > 1 ) { |
|
1183 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1181 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1182 | + if ($this->_registration->group_size() > 1) { |
|
1183 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | |
@@ -1201,23 +1201,23 @@ discard block |
||
1201 | 1201 | |
1202 | 1202 | //let's get an array of all possible buttons that we can just reference |
1203 | 1203 | $status_buttons = $this->_get_reg_status_buttons(); |
1204 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1205 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1204 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1205 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1206 | 1206 | $template_args['attendee'] = $this->_registration->attendee(); |
1207 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1208 | - if ( $this->_set_registration_object() ) { |
|
1207 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1208 | + if ($this->_set_registration_object()) { |
|
1209 | 1209 | $current_status = $this->_registration->status_ID(); |
1210 | - unset( $status_buttons[$current_status] ); |
|
1211 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1212 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1210 | + unset($status_buttons[$current_status]); |
|
1211 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1212 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1213 | 1213 | } |
1214 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1214 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1215 | 1215 | } |
1216 | 1216 | $template_args['form_url'] = REG_ADMIN_URL; |
1217 | 1217 | $template_args['REG_ID'] = $this->_registration->ID(); |
1218 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1218 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1219 | 1219 | |
1220 | - EEH_Template::display_template( $template, $template_args ); |
|
1220 | + EEH_Template::display_template($template, $template_args); |
|
1221 | 1221 | |
1222 | 1222 | } |
1223 | 1223 | |
@@ -1231,11 +1231,11 @@ discard block |
||
1231 | 1231 | private function _get_reg_status_buttons() { |
1232 | 1232 | |
1233 | 1233 | $buttons = array( |
1234 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1235 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1236 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1237 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1238 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1234 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1235 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1236 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1237 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1238 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1239 | 1239 | ); |
1240 | 1240 | return $buttons; |
1241 | 1241 | } |
@@ -1249,13 +1249,13 @@ discard block |
||
1249 | 1249 | * |
1250 | 1250 | * @return array (array with reg_id(s) updated and whether update was successful. |
1251 | 1251 | */ |
1252 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1253 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1252 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1253 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1254 | 1254 | |
1255 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1255 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1256 | 1256 | |
1257 | 1257 | //notify? |
1258 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1258 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1259 | 1259 | $this->_process_resend_registration(); |
1260 | 1260 | } |
1261 | 1261 | |
@@ -1273,19 +1273,19 @@ discard block |
||
1273 | 1273 | * @param bool $status |
1274 | 1274 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1275 | 1275 | */ |
1276 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1276 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1277 | 1277 | $success = true; |
1278 | 1278 | // set default status if none is passed |
1279 | 1279 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1280 | 1280 | |
1281 | 1281 | //typecast and sanitize reg_id |
1282 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1282 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1283 | 1283 | |
1284 | 1284 | //loop through REG_ID's and change status |
1285 | - foreach ( $reg_ids as $r_id ) { |
|
1286 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1287 | - if ( $registration instanceof EE_Registration ) { |
|
1288 | - $registration->set_status( $status ); |
|
1285 | + foreach ($reg_ids as $r_id) { |
|
1286 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1287 | + if ($registration instanceof EE_Registration) { |
|
1288 | + $registration->set_status($status); |
|
1289 | 1289 | $result = $registration->save(); |
1290 | 1290 | |
1291 | 1291 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | $this->_req_data['_REG_ID'] = $reg_ids; |
1298 | 1298 | |
1299 | 1299 | //return $success and processed registrations |
1300 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1300 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | |
@@ -1309,37 +1309,37 @@ discard block |
||
1309 | 1309 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1310 | 1310 | * @return void |
1311 | 1311 | */ |
1312 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1312 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1313 | 1313 | |
1314 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1314 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1315 | 1315 | |
1316 | 1316 | |
1317 | - $success = isset( $result['success'] ) && $result['success']; |
|
1317 | + $success = isset($result['success']) && $result['success']; |
|
1318 | 1318 | |
1319 | 1319 | //setup success message |
1320 | - if ( $success ) { |
|
1321 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1322 | - EE_Error::add_success( $msg ); |
|
1320 | + if ($success) { |
|
1321 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1322 | + EE_Error::add_success($msg); |
|
1323 | 1323 | } else { |
1324 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1324 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1327 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1328 | 1328 | //unset nonces |
1329 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1330 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1331 | - unset( $this->_req_data[$ref] ); |
|
1329 | + foreach ($this->_req_data as $ref => $value) { |
|
1330 | + if (strpos($ref, 'nonce') !== false) { |
|
1331 | + unset($this->_req_data[$ref]); |
|
1332 | 1332 | continue; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1335 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1336 | 1336 | $this->_req_data[$ref] = $value; |
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | //merge request vars so that the reloaded list table contains any existing filter query params |
1340 | - $route = array_merge( $this->_req_data, $route ); |
|
1340 | + $route = array_merge($this->_req_data, $route); |
|
1341 | 1341 | |
1342 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1342 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | |
@@ -1351,29 +1351,29 @@ discard block |
||
1351 | 1351 | protected function _change_reg_status() { |
1352 | 1352 | $this->_req_data['return'] = 'view_registration'; |
1353 | 1353 | //set notify based on whether the send notifications toggle is set or not |
1354 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1355 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1354 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1355 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1356 | 1356 | |
1357 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1358 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1359 | - $this->approve_registration( $notify ); |
|
1357 | + switch ($this->_req_data['_reg_status_id']) { |
|
1358 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1359 | + $this->approve_registration($notify); |
|
1360 | 1360 | break; |
1361 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1362 | - $this->pending_registration( $notify ); |
|
1361 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1362 | + $this->pending_registration($notify); |
|
1363 | 1363 | break; |
1364 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1365 | - $this->not_approve_registration( $notify ); |
|
1364 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1365 | + $this->not_approve_registration($notify); |
|
1366 | 1366 | break; |
1367 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1368 | - $this->decline_registration( $notify ); |
|
1367 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1368 | + $this->decline_registration($notify); |
|
1369 | 1369 | break; |
1370 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1371 | - $this->cancel_registration( $notify ); |
|
1370 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1371 | + $this->cancel_registration($notify); |
|
1372 | 1372 | break; |
1373 | 1373 | default : |
1374 | 1374 | $result['success'] = false; |
1375 | - unset( $this->_req_data['return'] ); |
|
1376 | - $this->_reg_status_change_return( '', false ); |
|
1375 | + unset($this->_req_data['return']); |
|
1376 | + $this->_reg_status_change_return('', false); |
|
1377 | 1377 | break; |
1378 | 1378 | } |
1379 | 1379 | } |
@@ -1386,8 +1386,8 @@ discard block |
||
1386 | 1386 | * @param bool $notify whether or not to notify the registrant about their approval. |
1387 | 1387 | * @return void |
1388 | 1388 | */ |
1389 | - protected function approve_registration( $notify = false ) { |
|
1390 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1389 | + protected function approve_registration($notify = false) { |
|
1390 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1391 | 1391 | } |
1392 | 1392 | |
1393 | 1393 | |
@@ -1399,8 +1399,8 @@ discard block |
||
1399 | 1399 | * @param bool $notify whether or not to notify the registrant about their approval. |
1400 | 1400 | * @return void |
1401 | 1401 | */ |
1402 | - protected function decline_registration( $notify = false ) { |
|
1403 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1402 | + protected function decline_registration($notify = false) { |
|
1403 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | |
@@ -1412,8 +1412,8 @@ discard block |
||
1412 | 1412 | * @param bool $notify whether or not to notify the registrant about their approval. |
1413 | 1413 | * @return void |
1414 | 1414 | */ |
1415 | - protected function cancel_registration( $notify = false ) { |
|
1416 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1415 | + protected function cancel_registration($notify = false) { |
|
1416 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | |
@@ -1426,8 +1426,8 @@ discard block |
||
1426 | 1426 | * @param bool $notify whether or not to notify the registrant about their approval. |
1427 | 1427 | * @return void |
1428 | 1428 | */ |
1429 | - protected function not_approve_registration( $notify = false ) { |
|
1430 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1429 | + protected function not_approve_registration($notify = false) { |
|
1430 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1438,8 +1438,8 @@ discard block |
||
1438 | 1438 | * @param bool $notify whether or not to notify the registrant about their approval. |
1439 | 1439 | * @return void |
1440 | 1440 | */ |
1441 | - protected function pending_registration( $notify = false ) { |
|
1442 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1441 | + protected function pending_registration($notify = false) { |
|
1442 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | 1445 | |
@@ -1453,75 +1453,75 @@ discard block |
||
1453 | 1453 | public function _reg_details_meta_box() { |
1454 | 1454 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1455 | 1455 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1456 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1456 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1457 | 1457 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1458 | 1458 | $this->_session = $transaction->session_data(); |
1459 | 1459 | |
1460 | 1460 | $filters = new EE_Line_Item_Filter_Collection(); |
1461 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1462 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1463 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1461 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1462 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1463 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1464 | 1464 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1465 | 1465 | |
1466 | 1466 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1467 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1468 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1467 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1468 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1469 | 1469 | |
1470 | 1470 | |
1471 | 1471 | $attendee = $this->_registration->attendee(); |
1472 | 1472 | |
1473 | 1473 | |
1474 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1475 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1474 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1475 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1476 | 1476 | |
1477 | 1477 | |
1478 | 1478 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1479 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1479 | + $payment = $transaction->get_first_related('Payment'); |
|
1480 | 1480 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1481 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1481 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1482 | 1482 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1483 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1483 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1484 | 1484 | $reg_details = array( |
1485 | 1485 | 'payment_method' => $payment_method->name(), |
1486 | 1486 | 'response_msg' => $payment->gateway_response(), |
1487 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1487 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1488 | 1488 | 'registration_session' => $this->_registration->session_ID(), |
1489 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1490 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1489 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1490 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1491 | 1491 | ); |
1492 | 1492 | |
1493 | 1493 | |
1494 | - if ( isset( $reg_details['registration_id'] )) { |
|
1494 | + if (isset($reg_details['registration_id'])) { |
|
1495 | 1495 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1496 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1496 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1497 | 1497 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1498 | 1498 | } |
1499 | 1499 | |
1500 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1500 | + if (isset($reg_details['payment_method'])) { |
|
1501 | 1501 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1502 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1502 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1503 | 1503 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1504 | 1504 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1505 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1505 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1506 | 1506 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1507 | 1507 | } |
1508 | 1508 | |
1509 | 1509 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1510 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1510 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1511 | 1511 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1512 | 1512 | |
1513 | 1513 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1514 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1514 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1515 | 1515 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1516 | 1516 | |
1517 | 1517 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1518 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1518 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1519 | 1519 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1520 | 1520 | |
1521 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1521 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1522 | 1522 | |
1523 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1524 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1523 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1524 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1525 | 1525 | |
1526 | 1526 | } |
1527 | 1527 | |
@@ -1535,14 +1535,14 @@ discard block |
||
1535 | 1535 | */ |
1536 | 1536 | public function _reg_questions_meta_box() { |
1537 | 1537 | //allow someone to override this method entirely |
1538 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1539 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1540 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1538 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1539 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1540 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1541 | 1541 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1542 | 1542 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1543 | 1543 | |
1544 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1545 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1544 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1545 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1546 | 1546 | } |
1547 | 1547 | } |
1548 | 1548 | |
@@ -1556,12 +1556,12 @@ discard block |
||
1556 | 1556 | * @param string $output |
1557 | 1557 | * @return string |
1558 | 1558 | */ |
1559 | - public function form_before_question_group( $output ) { |
|
1559 | + public function form_before_question_group($output) { |
|
1560 | 1560 | EE_Error::doing_it_wrong( |
1561 | - __CLASS__ . '::' . __FUNCTION__, |
|
1562 | - __( 'This method would have been protected but was used on a filter callback' |
|
1561 | + __CLASS__.'::'.__FUNCTION__, |
|
1562 | + __('This method would have been protected but was used on a filter callback' |
|
1563 | 1563 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1564 | - 'event_espresso' ), |
|
1564 | + 'event_espresso'), |
|
1565 | 1565 | '4.8.32.rc.000' |
1566 | 1566 | ); |
1567 | 1567 | return ' |
@@ -1580,20 +1580,20 @@ discard block |
||
1580 | 1580 | * @param string $output |
1581 | 1581 | * @return string |
1582 | 1582 | */ |
1583 | - public function form_after_question_group( $output ) { |
|
1583 | + public function form_after_question_group($output) { |
|
1584 | 1584 | EE_Error::doing_it_wrong( |
1585 | - __CLASS__ . '::' . __FUNCTION__, |
|
1586 | - __( 'This method would have been protected but was used on a filter callback' |
|
1585 | + __CLASS__.'::'.__FUNCTION__, |
|
1586 | + __('This method would have been protected but was used on a filter callback' |
|
1587 | 1587 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1588 | - 'event_espresso' ), |
|
1588 | + 'event_espresso'), |
|
1589 | 1589 | '4.8.32.rc.000' |
1590 | 1590 | ); |
1591 | 1591 | return ' |
1592 | 1592 | <tr class="hide-if-no-js"> |
1593 | 1593 | <th> </th> |
1594 | 1594 | <td class="reg-admin-edit-attendee-question-td"> |
1595 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1596 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1595 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1596 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1597 | 1597 | <div class="dashicons dashicons-edit"></div> |
1598 | 1598 | </a> |
1599 | 1599 | </td> |
@@ -1613,18 +1613,18 @@ discard block |
||
1613 | 1613 | * @param string $label |
1614 | 1614 | * @return string |
1615 | 1615 | */ |
1616 | - public function form_form_field_label_wrap( $label ) { |
|
1616 | + public function form_form_field_label_wrap($label) { |
|
1617 | 1617 | EE_Error::doing_it_wrong( |
1618 | - __CLASS__ . '::' . __FUNCTION__, |
|
1619 | - __( 'This method would have been protected but was used on a filter callback' |
|
1618 | + __CLASS__.'::'.__FUNCTION__, |
|
1619 | + __('This method would have been protected but was used on a filter callback' |
|
1620 | 1620 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1621 | - 'event_espresso' ), |
|
1621 | + 'event_espresso'), |
|
1622 | 1622 | '4.8.32.rc.000' |
1623 | 1623 | ); |
1624 | 1624 | return ' |
1625 | 1625 | <tr> |
1626 | 1626 | <th> |
1627 | - ' . $label . ' |
|
1627 | + ' . $label.' |
|
1628 | 1628 | </th>'; |
1629 | 1629 | } |
1630 | 1630 | |
@@ -1638,17 +1638,17 @@ discard block |
||
1638 | 1638 | * @param string $input |
1639 | 1639 | * @return string |
1640 | 1640 | */ |
1641 | - public function form_form_field_input__wrap( $input ) { |
|
1641 | + public function form_form_field_input__wrap($input) { |
|
1642 | 1642 | EE_Error::doing_it_wrong( |
1643 | - __CLASS__ . '::' . __FUNCTION__, |
|
1644 | - __( 'This method would have been protected but was used on a filter callback' |
|
1643 | + __CLASS__.'::'.__FUNCTION__, |
|
1644 | + __('This method would have been protected but was used on a filter callback' |
|
1645 | 1645 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1646 | - 'event_espresso' ), |
|
1646 | + 'event_espresso'), |
|
1647 | 1647 | '4.8.32.rc.000' |
1648 | 1648 | ); |
1649 | 1649 | return ' |
1650 | 1650 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1651 | - ' . $input . ' |
|
1651 | + ' . $input.' |
|
1652 | 1652 | </td> |
1653 | 1653 | </tr>'; |
1654 | 1654 | } |
@@ -1662,14 +1662,14 @@ discard block |
||
1662 | 1662 | * @return void |
1663 | 1663 | */ |
1664 | 1664 | protected function _update_attendee_registration_form() { |
1665 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1666 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1667 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1668 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1669 | - if( $success ) { |
|
1665 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1666 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1667 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1668 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1669 | + if ($success) { |
|
1670 | 1670 | $what = __('Registration Form', 'event_espresso'); |
1671 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1672 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1671 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1672 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1673 | 1673 | } |
1674 | 1674 | } |
1675 | 1675 | } |
@@ -1680,11 +1680,11 @@ discard block |
||
1680 | 1680 | * @param int $REG_ID |
1681 | 1681 | * @return EE_Registration_Custom_Questions_Form |
1682 | 1682 | */ |
1683 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1684 | - if( ! $this->_reg_custom_questions_form ) { |
|
1685 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1686 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1687 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1683 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1684 | + if ( ! $this->_reg_custom_questions_form) { |
|
1685 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1686 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1687 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1688 | 1688 | } |
1689 | 1689 | return $this->_reg_custom_questions_form; |
1690 | 1690 | } |
@@ -1697,17 +1697,17 @@ discard block |
||
1697 | 1697 | * @param bool $REG_ID |
1698 | 1698 | * @return bool |
1699 | 1699 | */ |
1700 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1700 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1701 | 1701 | |
1702 | 1702 | if ( ! $REG_ID) { |
1703 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1703 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1704 | 1704 | } |
1705 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1706 | - $form->receive_form_submission( $this->_req_data ); |
|
1705 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1706 | + $form->receive_form_submission($this->_req_data); |
|
1707 | 1707 | $success = false; |
1708 | - if( $form->is_valid() ) { |
|
1709 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1710 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1708 | + if ($form->is_valid()) { |
|
1709 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1710 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1711 | 1711 | $where_conditions = array( |
1712 | 1712 | 'QST_ID' => $question_id, |
1713 | 1713 | 'REG_ID' => $REG_ID |
@@ -1715,19 +1715,19 @@ discard block |
||
1715 | 1715 | $possibly_new_values = array( |
1716 | 1716 | 'ANS_value' => $input->normalized_value() |
1717 | 1717 | ); |
1718 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1719 | - if( $answer instanceof EE_Answer ) { |
|
1720 | - $success = $answer->save( $possibly_new_values ); |
|
1718 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1719 | + if ($answer instanceof EE_Answer) { |
|
1720 | + $success = $answer->save($possibly_new_values); |
|
1721 | 1721 | } else { |
1722 | 1722 | //insert it then |
1723 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1724 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1723 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1724 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1725 | 1725 | $success = $answer->save(); |
1726 | 1726 | } |
1727 | 1727 | } |
1728 | 1728 | } |
1729 | 1729 | } else { |
1730 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1730 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1731 | 1731 | } |
1732 | 1732 | return $success; |
1733 | 1733 | } |
@@ -1745,29 +1745,29 @@ discard block |
||
1745 | 1745 | $registrations = $REG->get_all(array( |
1746 | 1746 | array( |
1747 | 1747 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1748 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1748 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1749 | 1749 | ), |
1750 | 1750 | 'force_join'=>array('Attendee'))); |
1751 | 1751 | |
1752 | 1752 | $this->_template_args['attendees'] = array(); |
1753 | 1753 | $this->_template_args['attendee_notice'] = ''; |
1754 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1755 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1754 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1755 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1756 | 1756 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1757 | 1757 | } else { |
1758 | 1758 | |
1759 | 1759 | $att_nmbr = 1; |
1760 | - foreach ( $registrations as $registration ) { |
|
1760 | + foreach ($registrations as $registration) { |
|
1761 | 1761 | /* @var $registration EE_Registration */ |
1762 | 1762 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1763 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1764 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1765 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1766 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1763 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1764 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1765 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1766 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1767 | 1767 | |
1768 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1768 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1769 | 1769 | |
1770 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1770 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1771 | 1771 | |
1772 | 1772 | $att_nmbr++; |
1773 | 1773 | } |
@@ -1779,8 +1779,8 @@ discard block |
||
1779 | 1779 | |
1780 | 1780 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1781 | 1781 | } |
1782 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1783 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1782 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1783 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1784 | 1784 | |
1785 | 1785 | } |
1786 | 1786 | |
@@ -1801,11 +1801,11 @@ discard block |
||
1801 | 1801 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1802 | 1802 | |
1803 | 1803 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1804 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1804 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1805 | 1805 | $primary_registration = $this->_registration->get_primary_registration(); |
1806 | 1806 | $primary_attendee = $primary_registration->attendee(); |
1807 | 1807 | |
1808 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1808 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1809 | 1809 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1810 | 1810 | $primary_registration = NULL; |
1811 | 1811 | } |
@@ -1814,27 +1814,27 @@ discard block |
||
1814 | 1814 | } |
1815 | 1815 | |
1816 | 1816 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1817 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1818 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1819 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1817 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1818 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1819 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1820 | 1820 | $this->_template_args['phone'] = $attendee->phone(); |
1821 | 1821 | |
1822 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1822 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1823 | 1823 | |
1824 | 1824 | |
1825 | 1825 | //edit link |
1826 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1826 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1827 | 1827 | $this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso'); |
1828 | 1828 | |
1829 | 1829 | //create link |
1830 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1830 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1831 | 1831 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1832 | 1832 | |
1833 | 1833 | $this->_template_args['att_check'] = $att_check; |
1834 | 1834 | |
1835 | 1835 | |
1836 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1837 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1836 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1837 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1838 | 1838 | } |
1839 | 1839 | |
1840 | 1840 | |
@@ -1847,7 +1847,7 @@ discard block |
||
1847 | 1847 | * @access protected |
1848 | 1848 | * @return void |
1849 | 1849 | */ |
1850 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1850 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1851 | 1851 | $REGM = EEM_Registration::instance(); |
1852 | 1852 | |
1853 | 1853 | $success = 1; |
@@ -1857,26 +1857,26 @@ discard block |
||
1857 | 1857 | $dtts = array(); |
1858 | 1858 | |
1859 | 1859 | //if empty _REG_ID then get out because there's nothing to do |
1860 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1860 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1861 | 1861 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1862 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1863 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1862 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1863 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1864 | 1864 | } |
1865 | 1865 | |
1866 | 1866 | //Checkboxes |
1867 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1867 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1868 | 1868 | // if array has more than one element than success message should be plural |
1869 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1869 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1870 | 1870 | // cycle thru checkboxes |
1871 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1871 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1872 | 1872 | |
1873 | 1873 | $REG = $REGM->get_one_by_ID($REG_ID); |
1874 | 1874 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1875 | - if ( $payment_count > 0 ) { |
|
1876 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1875 | + if ($payment_count > 0) { |
|
1876 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1877 | 1877 | $error = 1; |
1878 | 1878 | $success = 0; |
1879 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1879 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1880 | 1880 | continue; //can't trash this registration because it has payments. |
1881 | 1881 | } |
1882 | 1882 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | $dtts = array_merge($dtts, $dtt); |
1886 | 1886 | |
1887 | 1887 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1888 | - if ( !$updated ) { |
|
1888 | + if ( ! $updated) { |
|
1889 | 1889 | $success = 0; |
1890 | 1890 | } else { |
1891 | 1891 | $success = 2; |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | $tickets[$ticket->ID()] = $ticket; |
1901 | 1901 | $dtts = $ticket->get_many_related('Datetime'); |
1902 | 1902 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1903 | - if ( ! $updated ) { |
|
1903 | + if ( ! $updated) { |
|
1904 | 1904 | $success = 0; |
1905 | 1905 | } |
1906 | 1906 | |
@@ -1910,10 +1910,10 @@ discard block |
||
1910 | 1910 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1911 | 1911 | EEM_Datetime::instance()->update_sold($dtts); |
1912 | 1912 | |
1913 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1914 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1913 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1914 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1915 | 1915 | $overwrite_msgs = $error ? TRUE : FALSE; |
1916 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1916 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1917 | 1917 | } |
1918 | 1918 | |
1919 | 1919 | |
@@ -1937,16 +1937,16 @@ discard block |
||
1937 | 1937 | $success = 1; |
1938 | 1938 | |
1939 | 1939 | //Checkboxes |
1940 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1940 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1941 | 1941 | // if array has more than one element than success message should be plural |
1942 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1942 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1943 | 1943 | // cycle thru checkboxes |
1944 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1944 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1945 | 1945 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1946 | - if ( ! $REG instanceof EE_Registration ) |
|
1946 | + if ( ! $REG instanceof EE_Registration) |
|
1947 | 1947 | continue; |
1948 | 1948 | $deleted = $this->_delete_registration($REG); |
1949 | - if ( !$deleted ) { |
|
1949 | + if ( ! $deleted) { |
|
1950 | 1950 | $success = 0; |
1951 | 1951 | } |
1952 | 1952 | } |
@@ -1956,15 +1956,15 @@ discard block |
||
1956 | 1956 | $REG_ID = $this->_req_data['_REG_ID']; |
1957 | 1957 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1958 | 1958 | $deleted = $this->_delete_registration($REG); |
1959 | - if ( ! $deleted ) { |
|
1959 | + if ( ! $deleted) { |
|
1960 | 1960 | $success = 0; |
1961 | 1961 | } |
1962 | 1962 | |
1963 | 1963 | } |
1964 | 1964 | |
1965 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1966 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1967 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1965 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1966 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1967 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1968 | 1968 | } |
1969 | 1969 | |
1970 | 1970 | |
@@ -1976,31 +1976,31 @@ discard block |
||
1976 | 1976 | * @param EE_Registration $REG registration to be deleted permenantly |
1977 | 1977 | * @return boolean true = successful deletion, false = fail. |
1978 | 1978 | */ |
1979 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1979 | + protected function _delete_registration(EE_Registration $REG) { |
|
1980 | 1980 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1981 | 1981 | $TXN = $REG->get_first_related('Transaction'); |
1982 | 1982 | $REGS = $TXN->get_many_related('Registration'); |
1983 | 1983 | |
1984 | 1984 | $all_trashed = TRUE; |
1985 | - foreach ( $REGS as $registration ) { |
|
1986 | - if ( ! $registration->get('REG_deleted') ) |
|
1985 | + foreach ($REGS as $registration) { |
|
1986 | + if ( ! $registration->get('REG_deleted')) |
|
1987 | 1987 | $all_trashed = FALSE; |
1988 | 1988 | } |
1989 | 1989 | |
1990 | - if ( ! $all_trashed ) { |
|
1991 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1990 | + if ( ! $all_trashed) { |
|
1991 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1992 | 1992 | return false; |
1993 | 1993 | } |
1994 | 1994 | |
1995 | 1995 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1996 | - foreach ( $REGS as $registration ) { |
|
1996 | + foreach ($REGS as $registration) { |
|
1997 | 1997 | |
1998 | 1998 | //delete related answers |
1999 | 1999 | $registration->delete_related_permanently('Answer'); |
2000 | 2000 | |
2001 | 2001 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
2002 | 2002 | $attendee = $registration->get_first_related('Attendee'); |
2003 | - if ( $attendee instanceof EE_Attendee ) { |
|
2003 | + if ($attendee instanceof EE_Attendee) { |
|
2004 | 2004 | $registration->_remove_relation_to($attendee, 'Attendee'); |
2005 | 2005 | } |
2006 | 2006 | |
@@ -2010,7 +2010,7 @@ discard block |
||
2010 | 2010 | //now delete permanently the checkins related to this registration. |
2011 | 2011 | $registration->delete_related_permanently('Checkin'); |
2012 | 2012 | |
2013 | - if ( $registration->ID() === $REG->ID() ) |
|
2013 | + if ($registration->ID() === $REG->ID()) |
|
2014 | 2014 | continue; //we don't want to delete permanently the existing registration just yet. |
2015 | 2015 | |
2016 | 2016 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2043,35 +2043,35 @@ discard block |
||
2043 | 2043 | * @return void |
2044 | 2044 | */ |
2045 | 2045 | public function new_registration() { |
2046 | - if ( ! $this->_set_reg_event() ) { |
|
2047 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2046 | + if ( ! $this->_set_reg_event()) { |
|
2047 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2048 | 2048 | } |
2049 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2049 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2050 | 2050 | // gotta start with a clean slate if we're not coming here via ajax |
2051 | 2051 | if ( |
2052 | - ! defined('DOING_AJAX' ) |
|
2053 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2052 | + ! defined('DOING_AJAX') |
|
2053 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2054 | 2054 | ) { |
2055 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2055 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2056 | 2056 | } |
2057 | 2057 | |
2058 | - $this->_template_args['event_name'] = '' ; |
|
2058 | + $this->_template_args['event_name'] = ''; |
|
2059 | 2059 | // event name |
2060 | - if ( $this->_reg_event ) { |
|
2060 | + if ($this->_reg_event) { |
|
2061 | 2061 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2062 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2063 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2064 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2062 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2063 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2064 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2065 | 2065 | } |
2066 | 2066 | |
2067 | 2067 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2068 | 2068 | |
2069 | - if ( defined('DOING_AJAX' ) ) { |
|
2069 | + if (defined('DOING_AJAX')) { |
|
2070 | 2070 | $this->_return_json(); |
2071 | 2071 | } |
2072 | 2072 | // grab header |
2073 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2074 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2073 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2074 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2075 | 2075 | |
2076 | 2076 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2077 | 2077 | // the details template wrapper |
@@ -2088,7 +2088,7 @@ discard block |
||
2088 | 2088 | * @return string html |
2089 | 2089 | */ |
2090 | 2090 | protected function _get_registration_step_content() { |
2091 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2091 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2092 | 2092 | $warning_msg = sprintf( |
2093 | 2093 | __( |
2094 | 2094 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2104,7 +2104,7 @@ discard block |
||
2104 | 2104 | '</b>' |
2105 | 2105 | ); |
2106 | 2106 | return ' |
2107 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2107 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2108 | 2108 | <script > |
2109 | 2109 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2110 | 2110 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2139,16 +2139,16 @@ discard block |
||
2139 | 2139 | $cart = EE_Registry::instance()->SSN->cart(); |
2140 | 2140 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2141 | 2141 | |
2142 | - switch ( $step ) { |
|
2142 | + switch ($step) { |
|
2143 | 2143 | case 'ticket' : |
2144 | 2144 | $hidden_fields['processing_registration']['value'] = 1; |
2145 | 2145 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2146 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2146 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2147 | 2147 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2148 | 2148 | $template_args['show_notification_toggle'] = FALSE; |
2149 | 2149 | break; |
2150 | 2150 | case 'questions' : |
2151 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2151 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2152 | 2152 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2153 | 2153 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2154 | 2154 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2157,10 +2157,10 @@ discard block |
||
2157 | 2157 | break; |
2158 | 2158 | } |
2159 | 2159 | |
2160 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2160 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2161 | 2161 | |
2162 | 2162 | return EEH_Template::display_template( |
2163 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2163 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2164 | 2164 | ); |
2165 | 2165 | } |
2166 | 2166 | |
@@ -2175,11 +2175,11 @@ discard block |
||
2175 | 2175 | * @return boolean |
2176 | 2176 | */ |
2177 | 2177 | private function _set_reg_event() { |
2178 | - if ( is_object( $this->_reg_event )) { |
|
2178 | + if (is_object($this->_reg_event)) { |
|
2179 | 2179 | return TRUE; |
2180 | 2180 | } |
2181 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2182 | - if ( ! $EVT_ID ) { |
|
2181 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2182 | + if ( ! $EVT_ID) { |
|
2183 | 2183 | return FALSE; |
2184 | 2184 | } |
2185 | 2185 | |
@@ -2200,82 +2200,82 @@ discard block |
||
2200 | 2200 | public function process_reg_step() { |
2201 | 2201 | EE_System::do_not_cache(); |
2202 | 2202 | $this->_set_reg_event(); |
2203 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2203 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2204 | 2204 | |
2205 | 2205 | //what step are we on? |
2206 | 2206 | $cart = EE_Registry::instance()->SSN->cart(); |
2207 | 2207 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2208 | 2208 | |
2209 | 2209 | //if doing ajax then we need to verify the nonce |
2210 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2211 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2212 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2210 | + if (defined('DOING_AJAX')) { |
|
2211 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2212 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2213 | 2213 | } |
2214 | 2214 | |
2215 | - switch ( $step ) { |
|
2215 | + switch ($step) { |
|
2216 | 2216 | |
2217 | 2217 | case 'ticket' : |
2218 | 2218 | //process ticket selection |
2219 | 2219 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2220 | - if ( $success ) { |
|
2221 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2220 | + if ($success) { |
|
2221 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2222 | 2222 | } else { |
2223 | 2223 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2224 | 2224 | } |
2225 | - if ( defined('DOING_AJAX') ) { |
|
2225 | + if (defined('DOING_AJAX')) { |
|
2226 | 2226 | $this->new_registration(); //display next step |
2227 | 2227 | } else { |
2228 | 2228 | $query_args['action'] = 'new_registration'; |
2229 | 2229 | $query_args['processing_registration'] = 1; |
2230 | 2230 | $query_args['event_id'] = $this->_reg_event->ID(); |
2231 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2231 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2232 | 2232 | } |
2233 | 2233 | break; |
2234 | 2234 | |
2235 | 2235 | case 'questions' : |
2236 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2237 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2236 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2237 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2238 | 2238 | } |
2239 | 2239 | //process registration |
2240 | 2240 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2241 | - if ( $cart instanceof EE_Cart ) { |
|
2241 | + if ($cart instanceof EE_Cart) { |
|
2242 | 2242 | $grand_total = $cart->get_cart_grand_total(); |
2243 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2243 | + if ($grand_total instanceof EE_Line_Item) { |
|
2244 | 2244 | $grand_total->save_this_and_descendants_to_txn(); |
2245 | 2245 | } |
2246 | 2246 | } |
2247 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2247 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2248 | 2248 | $query_args = array( |
2249 | 2249 | 'action' => 'new_registration', |
2250 | 2250 | 'processing_registration' => 2, |
2251 | 2251 | 'event_id' => $this->_reg_event->ID() |
2252 | 2252 | ); |
2253 | 2253 | |
2254 | - if ( defined('DOING_AJAX' )) { |
|
2254 | + if (defined('DOING_AJAX')) { |
|
2255 | 2255 | //display registration form again because there are errors (maybe validation?) |
2256 | 2256 | $this->new_registration(); |
2257 | 2257 | return; |
2258 | 2258 | } else { |
2259 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2259 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2260 | 2260 | return; |
2261 | 2261 | } |
2262 | 2262 | } |
2263 | 2263 | /** @type EE_Transaction_Payments $transaction_payments */ |
2264 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2264 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2265 | 2265 | // maybe update status, and make sure to save transaction if not done already |
2266 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2266 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2267 | 2267 | $transaction->save(); |
2268 | 2268 | } |
2269 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2269 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2270 | 2270 | $this->_req_data = array(); |
2271 | 2271 | $query_args = array( |
2272 | 2272 | 'action' => 'redirect_to_txn', |
2273 | 2273 | 'TXN_ID' => $transaction->ID(), |
2274 | 2274 | 'EVT_ID' => $this->_reg_event->ID(), |
2275 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2275 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2276 | 2276 | 'redirect_from' => 'new_registration' |
2277 | 2277 | ); |
2278 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2278 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2279 | 2279 | break; |
2280 | 2280 | } |
2281 | 2281 | |
@@ -2292,21 +2292,21 @@ discard block |
||
2292 | 2292 | */ |
2293 | 2293 | public function redirect_to_txn() { |
2294 | 2294 | EE_System::do_not_cache(); |
2295 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2295 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2296 | 2296 | $query_args = array( |
2297 | 2297 | 'action' => 'view_transaction', |
2298 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2298 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2299 | 2299 | 'page' => 'espresso_transactions' |
2300 | 2300 | ); |
2301 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2302 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2303 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2304 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2301 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2302 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2303 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2304 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2305 | 2305 | } |
2306 | 2306 | EE_Error::add_success( |
2307 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2307 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2308 | 2308 | ); |
2309 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2309 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2310 | 2310 | } |
2311 | 2311 | |
2312 | 2312 | |
@@ -2317,7 +2317,7 @@ discard block |
||
2317 | 2317 | * @return void |
2318 | 2318 | */ |
2319 | 2319 | protected function _attendee_contact_list_table() { |
2320 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2320 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2321 | 2321 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2322 | 2322 | $this->display_admin_list_table_page_with_no_sidebar(); |
2323 | 2323 | } |
@@ -2332,10 +2332,10 @@ discard block |
||
2332 | 2332 | * @access public |
2333 | 2333 | * @return array |
2334 | 2334 | */ |
2335 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2335 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2336 | 2336 | |
2337 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2338 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2337 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2338 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2339 | 2339 | $ATT_MDL = EEM_Attendee::instance(); |
2340 | 2340 | |
2341 | 2341 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2363,47 +2363,47 @@ discard block |
||
2363 | 2363 | $orderby = 'ATT_lname'; |
2364 | 2364 | } |
2365 | 2365 | |
2366 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2366 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2367 | 2367 | |
2368 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2369 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2370 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2368 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2369 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2370 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2371 | 2371 | |
2372 | 2372 | $_where = array(); |
2373 | 2373 | |
2374 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2375 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2374 | + if (isset($this->_req_data['s'])) { |
|
2375 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2376 | 2376 | $_where['OR'] = array( |
2377 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2378 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2379 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2380 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2381 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2382 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2383 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2384 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2385 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2386 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2387 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2388 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2389 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2390 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2391 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2392 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2393 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2377 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2378 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2379 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2380 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2381 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2382 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2383 | + 'ATT_email' => array('LIKE', $sstr), |
|
2384 | + 'ATT_address' => array('LIKE', $sstr), |
|
2385 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2386 | + 'ATT_city' => array('LIKE', $sstr), |
|
2387 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2388 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2389 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2390 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2391 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2392 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2393 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2394 | 2394 | ); |
2395 | 2395 | } |
2396 | 2396 | |
2397 | 2397 | |
2398 | - $offset = ($current_page-1)*$per_page; |
|
2399 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2398 | + $offset = ($current_page - 1) * $per_page; |
|
2399 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2400 | 2400 | |
2401 | - if ( $trash ) { |
|
2402 | - $_where['status'] = array( '!=', 'publish' ); |
|
2403 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2401 | + if ($trash) { |
|
2402 | + $_where['status'] = array('!=', 'publish'); |
|
2403 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2404 | 2404 | } else { |
2405 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2406 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2405 | + $_where['status'] = array('IN', array('publish')); |
|
2406 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2407 | 2407 | } |
2408 | 2408 | |
2409 | 2409 | return $all_attendees; |
@@ -2420,10 +2420,10 @@ discard block |
||
2420 | 2420 | */ |
2421 | 2421 | protected function _resend_registration() { |
2422 | 2422 | $this->_process_resend_registration(); |
2423 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2423 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2424 | 2424 | 'action' => 'default' |
2425 | 2425 | ); |
2426 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2426 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | |
@@ -2431,26 +2431,26 @@ discard block |
||
2431 | 2431 | |
2432 | 2432 | |
2433 | 2433 | |
2434 | - public function _registrations_report(){ |
|
2435 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2436 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2434 | + public function _registrations_report() { |
|
2435 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2436 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2437 | 2437 | array( |
2438 | 2438 | 'page' => 'espresso_batch', |
2439 | 2439 | 'batch' => 'file', |
2440 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2441 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2442 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2443 | - )) ); |
|
2440 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2441 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2442 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2443 | + ))); |
|
2444 | 2444 | } else { |
2445 | 2445 | $new_request_args = array( |
2446 | 2446 | 'export' => 'report', |
2447 | 2447 | 'action' => 'registrations_report_for_event', |
2448 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2448 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2449 | 2449 | ); |
2450 | 2450 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2451 | 2451 | |
2452 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2453 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2452 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2453 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2454 | 2454 | $EE_Export = EE_Export::instance($this->_req_data); |
2455 | 2455 | $EE_Export->export(); |
2456 | 2456 | } |
@@ -2459,26 +2459,26 @@ discard block |
||
2459 | 2459 | |
2460 | 2460 | |
2461 | 2461 | |
2462 | - public function _contact_list_export(){ |
|
2463 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2464 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2462 | + public function _contact_list_export() { |
|
2463 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2464 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2465 | 2465 | $EE_Export = EE_Export::instance($this->_req_data); |
2466 | 2466 | $EE_Export->export_attendees(); |
2467 | 2467 | } |
2468 | 2468 | } |
2469 | 2469 | |
2470 | - public function _contact_list_report(){ |
|
2471 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2472 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2470 | + public function _contact_list_report() { |
|
2471 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2472 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2473 | 2473 | array( |
2474 | 2474 | 'page' => 'espresso_batch', |
2475 | 2475 | 'batch' => 'file', |
2476 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2477 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2478 | - )) ); |
|
2476 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2477 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2478 | + ))); |
|
2479 | 2479 | } else { |
2480 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2481 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2480 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2481 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2482 | 2482 | $EE_Export = EE_Export::instance($this->_req_data); |
2483 | 2483 | $EE_Export->report_attendees(); |
2484 | 2484 | } |
@@ -2498,73 +2498,73 @@ discard block |
||
2498 | 2498 | * @return void |
2499 | 2499 | */ |
2500 | 2500 | protected function _duplicate_attendee() { |
2501 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2501 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2502 | 2502 | //verify we have necessary info |
2503 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2504 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2505 | - $query_args = array( 'action' => $action ); |
|
2503 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2504 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2505 | + $query_args = array('action' => $action); |
|
2506 | 2506 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2507 | 2507 | } |
2508 | 2508 | |
2509 | 2509 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2510 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2510 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2511 | 2511 | $attendee = $registration->attendee(); |
2512 | 2512 | |
2513 | 2513 | //remove relation of existing attendee on registration |
2514 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2514 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2515 | 2515 | //new attendee |
2516 | 2516 | $new_attendee = clone $attendee; |
2517 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2517 | + $new_attendee->set('ATT_ID', 0); |
|
2518 | 2518 | $new_attendee->save(); |
2519 | 2519 | |
2520 | 2520 | //add new attendee to reg |
2521 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2521 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2522 | 2522 | |
2523 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2523 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2524 | 2524 | |
2525 | 2525 | //redirect to edit page for attendee |
2526 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2526 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2527 | 2527 | |
2528 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2528 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2529 | 2529 | } |
2530 | 2530 | |
2531 | 2531 | |
2532 | 2532 | //related to cpt routes |
2533 | 2533 | protected function _insert_update_cpt_item($post_id, $post) { |
2534 | 2534 | $success = true; |
2535 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2535 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2536 | 2536 | //for attendee updates |
2537 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2537 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2538 | 2538 | //note we should only be UPDATING attendees at this point. |
2539 | 2539 | $updated_fields = array( |
2540 | 2540 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2541 | 2541 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2542 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2542 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2543 | 2543 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2544 | 2544 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2545 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2546 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2547 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2548 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2549 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2550 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2545 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2546 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2547 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2548 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2549 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2550 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2551 | 2551 | ); |
2552 | - foreach ( $updated_fields as $field => $value ) { |
|
2552 | + foreach ($updated_fields as $field => $value) { |
|
2553 | 2553 | $attendee->set($field, $value); |
2554 | 2554 | } |
2555 | 2555 | |
2556 | 2556 | $success = $attendee->save(); |
2557 | 2557 | |
2558 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2559 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2560 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2561 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2558 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2559 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2560 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2561 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2562 | 2562 | } |
2563 | 2563 | } |
2564 | 2564 | } |
2565 | 2565 | |
2566 | - if ( $success === FALSE ) |
|
2567 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2566 | + if ($success === FALSE) |
|
2567 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2568 | 2568 | |
2569 | 2569 | } |
2570 | 2570 | |
@@ -2584,17 +2584,17 @@ discard block |
||
2584 | 2584 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2585 | 2585 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2586 | 2586 | |
2587 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2588 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2587 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2588 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2589 | 2589 | } |
2590 | 2590 | |
2591 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2591 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2592 | 2592 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2593 | 2593 | } |
2594 | 2594 | |
2595 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2596 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2597 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2595 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2596 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2597 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2598 | 2598 | } |
2599 | 2599 | |
2600 | 2600 | |
@@ -2603,10 +2603,10 @@ discard block |
||
2603 | 2603 | * @param WP_Post $post wp post object |
2604 | 2604 | * @return string attendee contact info ( and form ) |
2605 | 2605 | */ |
2606 | - public function attendee_contact_info( $post ) { |
|
2606 | + public function attendee_contact_info($post) { |
|
2607 | 2607 | //get attendee object ( should already have it ) |
2608 | 2608 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2609 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2609 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2610 | 2610 | EEH_Template::display_template($template, $this->_template_args); |
2611 | 2611 | } |
2612 | 2612 | |
@@ -2622,12 +2622,12 @@ discard block |
||
2622 | 2622 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2623 | 2623 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2624 | 2624 | new EE_Question_Form_Input( |
2625 | - EE_Question::new_instance( array( |
|
2625 | + EE_Question::new_instance(array( |
|
2626 | 2626 | 'QST_ID' => 0, |
2627 | 2627 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2628 | 2628 | 'QST_system' => 'admin-state' |
2629 | 2629 | )), |
2630 | - EE_Answer::new_instance( array( |
|
2630 | + EE_Answer::new_instance(array( |
|
2631 | 2631 | 'ANS_ID' => 0, |
2632 | 2632 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2633 | 2633 | )), |
@@ -2640,12 +2640,12 @@ discard block |
||
2640 | 2640 | )); |
2641 | 2641 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2642 | 2642 | new EE_Question_Form_Input( |
2643 | - EE_Question::new_instance( array( |
|
2643 | + EE_Question::new_instance(array( |
|
2644 | 2644 | 'QST_ID' => 0, |
2645 | 2645 | 'QST_display_text' => __('Country', 'event_espresso'), |
2646 | 2646 | 'QST_system' => 'admin-country' |
2647 | 2647 | )), |
2648 | - EE_Answer::new_instance( array( |
|
2648 | + EE_Answer::new_instance(array( |
|
2649 | 2649 | 'ANS_ID' => 0, |
2650 | 2650 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2651 | 2651 | )), |
@@ -2656,8 +2656,8 @@ discard block |
||
2656 | 2656 | 'append_qstn_id' => FALSE |
2657 | 2657 | ) |
2658 | 2658 | )); |
2659 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2660 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2659 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2660 | + EEH_Template::display_template($template, $this->_template_args); |
|
2661 | 2661 | |
2662 | 2662 | } |
2663 | 2663 | |
@@ -2667,11 +2667,11 @@ discard block |
||
2667 | 2667 | * @access protected |
2668 | 2668 | * @return void |
2669 | 2669 | */ |
2670 | - public function attendee_registrations_meta_box( $post ) { |
|
2670 | + public function attendee_registrations_meta_box($post) { |
|
2671 | 2671 | |
2672 | 2672 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2673 | 2673 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2674 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2674 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2675 | 2675 | EEH_Template::display_template($template, $this->_template_args); |
2676 | 2676 | |
2677 | 2677 | } |
@@ -2685,8 +2685,8 @@ discard block |
||
2685 | 2685 | * @return string html for new form. |
2686 | 2686 | */ |
2687 | 2687 | public function after_title_form_fields($post) { |
2688 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2689 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2688 | + if ($post->post_type == 'espresso_attendees') { |
|
2689 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2690 | 2690 | $template_args['attendee'] = $this->_cpt_model_obj; |
2691 | 2691 | EEH_Template::display_template($template, $template_args); |
2692 | 2692 | } |
@@ -2703,21 +2703,21 @@ discard block |
||
2703 | 2703 | * @access protected |
2704 | 2704 | * @return void |
2705 | 2705 | */ |
2706 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2706 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2707 | 2707 | |
2708 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2708 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2709 | 2709 | |
2710 | 2710 | $ATT_MDL = EEM_Attendee::instance(); |
2711 | 2711 | |
2712 | 2712 | $success = 1; |
2713 | 2713 | //Checkboxes |
2714 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2714 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2715 | 2715 | // if array has more than one element than success message should be plural |
2716 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2716 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2717 | 2717 | // cycle thru checkboxes |
2718 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2719 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2720 | - if ( !$updated ) { |
|
2718 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2719 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2720 | + if ( ! $updated) { |
|
2721 | 2721 | $success = 0; |
2722 | 2722 | } |
2723 | 2723 | } |
@@ -2726,18 +2726,18 @@ discard block |
||
2726 | 2726 | // grab single id and delete |
2727 | 2727 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2728 | 2728 | //get attendee |
2729 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2729 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2730 | 2730 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2731 | 2731 | $updated = $att->save(); |
2732 | - if ( ! $updated ) { |
|
2732 | + if ( ! $updated) { |
|
2733 | 2733 | $success = 0; |
2734 | 2734 | } |
2735 | 2735 | |
2736 | 2736 | } |
2737 | 2737 | |
2738 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2739 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2740 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2738 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2739 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2740 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2741 | 2741 | |
2742 | 2742 | } |
2743 | 2743 |