@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
106 | - * @return null |
|
106 | + * @return EE_Line_Item_Display |
|
107 | 107 | */ |
108 | 108 | public function line_item_display() { |
109 | 109 | return $this->line_item_display; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | |
114 | 114 | /** |
115 | - * @param null $line_item_display |
|
115 | + * @param EE_Line_Item_Display $line_item_display |
|
116 | 116 | */ |
117 | 117 | public function set_line_item_display( $line_item_display ) { |
118 | 118 | $this->line_item_display = $line_item_display; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | |
180 | 180 | /** |
181 | - * @return bool |
|
181 | + * @return EE_Form_Section_Proper |
|
182 | 182 | */ |
183 | 183 | public function generate_reg_form() { |
184 | 184 | EE_Registry::instance()->load_helper( 'HTML' ); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | * get_billing_form_html_for_payment_method |
731 | 731 | * |
732 | 732 | * @access public |
733 | - * @return string |
|
733 | + * @return boolean |
|
734 | 734 | */ |
735 | 735 | public function get_billing_form_html_for_payment_method() { |
736 | 736 | // how have they chosen to pay? |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * switch_payment_method |
851 | 851 | * |
852 | 852 | * @access public |
853 | - * @return string |
|
853 | + * @return boolean |
|
854 | 854 | */ |
855 | 855 | public function switch_payment_method() { |
856 | 856 | if ( ! $this->_verify_payment_method_is_set() ) { |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | |
1016 | 1016 | /** |
1017 | 1017 | * process_reg_step |
1018 | - * @return boolean |
|
1018 | + * @return null|boolean |
|
1019 | 1019 | */ |
1020 | 1020 | public function process_reg_step() { |
1021 | 1021 | // how have they chosen to pay? |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | * update_reg_step |
1092 | 1092 | * this is the final step after a user revisits the site to retry a payment |
1093 | 1093 | * |
1094 | - * @return boolean |
|
1094 | + * @return null|boolean |
|
1095 | 1095 | */ |
1096 | 1096 | public function update_reg_step() { |
1097 | 1097 | $success = TRUE; |
@@ -1373,7 +1373,7 @@ discard block |
||
1373 | 1373 | * |
1374 | 1374 | * @access private |
1375 | 1375 | * @type EE_Payment_Method $payment_method |
1376 | - * @return mixed EE_Payment | boolean |
|
1376 | + * @return EE_Payment|null EE_Payment | boolean |
|
1377 | 1377 | */ |
1378 | 1378 | private function _attempt_payment( EE_Payment_Method $payment_method ) { |
1379 | 1379 | $payment =NULL; |
@@ -1570,6 +1570,7 @@ discard block |
||
1570 | 1570 | * @access private |
1571 | 1571 | * @type EE_Payment $payment |
1572 | 1572 | * @param string $payment_occurs |
1573 | + * @param EE_Payment|null $payment |
|
1573 | 1574 | * @return bool |
1574 | 1575 | * @throws \EE_Error |
1575 | 1576 | */ |
@@ -1675,7 +1676,7 @@ discard block |
||
1675 | 1676 | * or present the payment options again |
1676 | 1677 | * |
1677 | 1678 | * @access private |
1678 | - * @return EE_Payment | FALSE |
|
1679 | + * @return boolean | FALSE |
|
1679 | 1680 | */ |
1680 | 1681 | public function process_gateway_response() { |
1681 | 1682 | $payment = null; |
@@ -1733,7 +1734,7 @@ discard block |
||
1733 | 1734 | * _validate_return |
1734 | 1735 | * |
1735 | 1736 | * @access private |
1736 | - * @return bool |
|
1737 | + * @return boolean|null |
|
1737 | 1738 | */ |
1738 | 1739 | private function _validate_offsite_return() { |
1739 | 1740 | $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
@@ -1800,7 +1801,7 @@ discard block |
||
1800 | 1801 | * |
1801 | 1802 | * @access private |
1802 | 1803 | * @param \EE_Registration $primary_registrant |
1803 | - * @return bool |
|
1804 | + * @return false|null |
|
1804 | 1805 | */ |
1805 | 1806 | private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
1806 | 1807 | if ( ! $primary_registrant instanceof EE_Registration ) { |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_Payment_Options |
|
5 | - * |
|
6 | - * Description |
|
7 | - * |
|
8 | - * @package Event Espresso |
|
9 | - * @subpackage core |
|
10 | - * @author Brent Christensen |
|
11 | - * @since 4.5.0 |
|
12 | - * |
|
13 | - */ |
|
3 | + * |
|
4 | + * Class EE_SPCO_Reg_Step_Payment_Options |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Payment_Options extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | return FALSE; |
741 | 741 | } |
742 | 742 | if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
743 | - EE_Error::add_success( |
|
744 | - apply_filters( |
|
745 | - 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
746 | - sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
747 | - ) |
|
748 | - ); |
|
749 | - } |
|
743 | + EE_Error::add_success( |
|
744 | + apply_filters( |
|
745 | + 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
746 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
747 | + ) |
|
748 | + ); |
|
749 | + } |
|
750 | 750 | // now generate billing form for selected method of payment |
751 | 751 | $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method, FALSE ); |
752 | 752 | // fill form with attendee info if applicable |
@@ -778,14 +778,14 @@ discard block |
||
778 | 778 | $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
779 | 779 | if ( $billing_form instanceof EE_Billing_Info_Form ) { |
780 | 780 | if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
781 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
782 | - EE_Error::add_success( |
|
783 | - apply_filters( |
|
784 | - 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
785 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
786 | - ) |
|
787 | - ); |
|
788 | - } |
|
781 | + if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
782 | + EE_Error::add_success( |
|
783 | + apply_filters( |
|
784 | + 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
|
785 | + sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
786 | + ) |
|
787 | + ); |
|
788 | + } |
|
789 | 789 | } |
790 | 790 | return apply_filters( |
791 | 791 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', |
@@ -1214,9 +1214,9 @@ |
||
1214 | 1214 | $form_section = $validation_error->get_form_section(); |
1215 | 1215 | if( $form_section instanceof EE_Form_Input_Base ){ |
1216 | 1216 | $label = $form_section->html_label_text(); |
1217 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1217 | + } elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1218 | 1218 | $label = $form_section->name(); |
1219 | - }else{ |
|
1219 | + } else{ |
|
1220 | 1220 | $label = __( 'Validation Error', 'event_espresso' ); |
1221 | 1221 | } |
1222 | 1222 | $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | - add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) ); |
|
32 | - add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
33 | - add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
34 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
35 | - add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
36 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
37 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
31 | + add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')); |
|
32 | + add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
33 | + add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
34 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
35 | + add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
36 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
37 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
38 | 38 | ); |
39 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 ); |
|
39 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * ajax switch_spco_billing_form |
46 | 46 | */ |
47 | 47 | public static function switch_spco_billing_form() { |
48 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
48 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * ajax save_payer_details |
55 | 55 | */ |
56 | 56 | public static function save_payer_details() { |
57 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
57 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * ajax get_transaction_details |
64 | 64 | */ |
65 | 65 | public static function get_transaction_details() { |
66 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
66 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @param EE_Checkout $checkout |
92 | 92 | * @return \EE_SPCO_Reg_Step_Payment_Options |
93 | 93 | */ |
94 | - public function __construct( EE_Checkout $checkout ) { |
|
94 | + public function __construct(EE_Checkout $checkout) { |
|
95 | 95 | $this->_slug = 'payment_options'; |
96 | 96 | $this->_name = __('Payment Options', 'event_espresso'); |
97 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
97 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
98 | 98 | $this->checkout = $checkout; |
99 | 99 | $this->_reset_success_message(); |
100 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
100 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param null $line_item_display |
116 | 116 | */ |
117 | - public function set_line_item_display( $line_item_display ) { |
|
117 | + public function set_line_item_display($line_item_display) { |
|
118 | 118 | $this->line_item_display = $line_item_display; |
119 | 119 | } |
120 | 120 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public function translate_js_strings() { |
128 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
129 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' ); |
|
130 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
128 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
129 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso'); |
|
130 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // $ 0.00 transactions (no payment required) |
157 | 157 | ! $this->checkout->payment_required() |
158 | 158 | // but do NOT remove if current action being called belongs to this reg step |
159 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
159 | + && ! is_callable(array($this, $this->checkout->action)) |
|
160 | 160 | && ! $this->completed() |
161 | 161 | ) { |
162 | 162 | // and if so, then we no longer need the Payment Options step |
163 | - if ( $this->is_current_step() ) { |
|
163 | + if ($this->is_current_step()) { |
|
164 | 164 | $this->checkout->generate_reg_form = false; |
165 | 165 | } |
166 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
166 | + $this->checkout->remove_reg_step($this->_slug); |
|
167 | 167 | // DEBUG LOG |
168 | 168 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | // load EEM_Payment_Method |
172 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
172 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
173 | 173 | // get all active payment methods |
174 | 174 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
175 | 175 | $this->checkout->transaction, EEM_Payment_Method::scope_cart |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return bool |
184 | 184 | */ |
185 | 185 | public function generate_reg_form() { |
186 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
186 | + EE_Registry::instance()->load_helper('HTML'); |
|
187 | 187 | // reset in case someone changes their mind |
188 | 188 | $this->_reset_selected_method_of_payment(); |
189 | 189 | // set some defaults |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | $sold_out_events = array(); |
195 | 195 | $reg_count = 0; |
196 | 196 | // loop thru registrations to gather info |
197 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
198 | - foreach ( $registrations as $registration ) { |
|
197 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
198 | + foreach ($registrations as $registration) { |
|
199 | 199 | //echo '<h3 style="color:#E76700;line-height:1em;">' . $registration->ID() . '<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h3>'; |
200 | 200 | /** @var $registration EE_Registration */ |
201 | 201 | $reg_count++; |
202 | 202 | // if returning registrant is Approved then do NOT do this |
203 | - if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) { |
|
204 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) { |
|
203 | + if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) { |
|
204 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
205 | 205 | // add event to list of events that are sold out |
206 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
206 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
207 | 207 | do_action( |
208 | 208 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
209 | 209 | $registration->event(), |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | ); |
212 | 212 | } |
213 | 213 | // event requires admin approval |
214 | - if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) { |
|
214 | + if ($registration->status_ID() == EEM_Registration::status_id_not_approved) { |
|
215 | 215 | // add event to list of events with pre-approval reg status |
216 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
216 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
217 | 217 | do_action( |
218 | 218 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
219 | 219 | $registration->event(), |
@@ -222,29 +222,29 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | // are they allowed to pay now and is there monies owing? |
225 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
226 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
225 | + if ($registration->owes_monies_and_can_pay()) { |
|
226 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
227 | 227 | do_action( |
228 | 228 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
229 | 229 | $registration->event(), |
230 | 230 | $this |
231 | 231 | ); |
232 | - } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free() ) { |
|
233 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
232 | + } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) { |
|
233 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | $subsections = array(); |
237 | 237 | // now decide which template to load |
238 | - if ( ! empty( $sold_out_events )) { |
|
239 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
238 | + if ( ! empty($sold_out_events)) { |
|
239 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
240 | 240 | } |
241 | - if ( ! empty( $registrations_requiring_pre_approval )) { |
|
242 | - $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval ); |
|
241 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
242 | + $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval); |
|
243 | 243 | } |
244 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
245 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
244 | + if ( ! empty($registrations_for_free_events)) { |
|
245 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
246 | 246 | } |
247 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
247 | + if ( ! empty($registrations_requiring_payment)) { |
|
248 | 248 | //EEH_Debug_Tools::printr( $registrations_requiring_payment, '$registrations_requiring_payment', __FILE__, __LINE__ ); |
249 | 249 | // autoload Line_Item_Display classes |
250 | 250 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -261,11 +261,11 @@ discard block |
||
261 | 261 | //EEH_Debug_Tools::printr( $filtered_line_item_tree->total(), '$filtered_line_item_tree->total()', __FILE__, __LINE__ ); |
262 | 262 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
263 | 263 | |
264 | - if ( $this->checkout->amount_owing > 0 ) { |
|
264 | + if ($this->checkout->amount_owing > 0) { |
|
265 | 265 | EEH_Autoloader::register_line_item_display_autoloaders(); |
266 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
267 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( |
|
268 | - $this->line_item_display->display_line_item( $filtered_line_item_tree ) |
|
266 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
267 | + $subsections['payment_options'] = $this->_display_payment_options( |
|
268 | + $this->line_item_display->display_line_item($filtered_line_item_tree) |
|
269 | 269 | ); |
270 | 270 | $this->_apply_transaction_payments_to_amount_owing(); |
271 | 271 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
301 | 301 | * @return \EE_Line_Item_Filter_Collection |
302 | 302 | */ |
303 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
303 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
304 | 304 | $line_item_filter_collection->add( |
305 | 305 | new EE_Billable_Line_Item_Filter( |
306 | 306 | EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ) |
309 | 309 | ) |
310 | 310 | ); |
311 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
311 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
312 | 312 | return $line_item_filter_collection; |
313 | 313 | } |
314 | 314 | |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | * @return void |
323 | 323 | */ |
324 | 324 | protected function _hide_reg_step_submit_button_if_revisit() { |
325 | - if ( $this->checkout->revisit ) { |
|
326 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
325 | + if ($this->checkout->revisit) { |
|
326 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -334,12 +334,12 @@ discard block |
||
334 | 334 | * @param \EE_Event[] $sold_out_events_array |
335 | 335 | * @return \EE_Form_Section_Proper |
336 | 336 | */ |
337 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
337 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
338 | 338 | // set some defaults |
339 | 339 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
340 | 340 | $sold_out_events = ''; |
341 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
342 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
341 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
342 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
343 | 343 | } |
344 | 344 | return new EE_Form_Section_Proper( |
345 | 345 | array( |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | ), |
352 | 352 | 'layout_strategy' => new EE_Template_Layout( |
353 | 353 | array( |
354 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template |
|
354 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template |
|
355 | 355 | 'template_args' => apply_filters( |
356 | 356 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
357 | 357 | array( |
358 | 358 | 'sold_out_events' => $sold_out_events, |
359 | 359 | 'sold_out_events_msg' => apply_filters( |
360 | 360 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
361 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ) |
|
361 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso') |
|
362 | 362 | ) |
363 | 363 | ) |
364 | 364 | ) |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | * @param array $registrations_requiring_pre_approval |
376 | 376 | * @return \EE_Form_Section_Proper |
377 | 377 | */ |
378 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) { |
|
378 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
379 | 379 | $events_requiring_pre_approval = ''; |
380 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
381 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
382 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
383 | - EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
380 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
381 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
382 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
383 | + EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
384 | 384 | ) |
385 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
385 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
386 | 386 | ); |
387 | 387 | } |
388 | 388 | } |
@@ -394,14 +394,14 @@ discard block |
||
394 | 394 | ), |
395 | 395 | 'layout_strategy' => new EE_Template_Layout( |
396 | 396 | array( |
397 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
397 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template |
|
398 | 398 | 'template_args' => apply_filters( |
399 | 399 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
400 | 400 | array( |
401 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
401 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
402 | 402 | 'events_requiring_pre_approval_msg' => apply_filters( |
403 | 403 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
404 | - __( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
404 | + __('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
405 | 405 | ) |
406 | 406 | ) |
407 | 407 | ), |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param \EE_Event[] $registrations_for_free_events |
420 | 420 | * @return \EE_Form_Section_Proper |
421 | 421 | */ |
422 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
422 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
423 | 423 | // set some defaults |
424 | 424 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
425 | 425 | // generate no_payment_required form |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | ), |
432 | 432 | 'layout_strategy' => new EE_Template_Layout( |
433 | 433 | array( |
434 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template |
|
434 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template |
|
435 | 435 | 'template_args' => apply_filters( |
436 | 436 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
437 | 437 | array( |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | 'registrations' => array(), |
440 | 440 | 'ticket_count' => array(), |
441 | 441 | 'registrations_for_free_events' => $registrations_for_free_events, |
442 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
442 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
443 | 443 | ) |
444 | 444 | ), |
445 | 445 | ) |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @param string $transaction_details |
457 | 457 | * @return \EE_Form_Section_Proper |
458 | 458 | */ |
459 | - private function _display_payment_options( $transaction_details = '' ) { |
|
459 | + private function _display_payment_options($transaction_details = '') { |
|
460 | 460 | // has method_of_payment been set by no-js user? |
461 | 461 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
462 | 462 | // build payment options form |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | 'before_payment_options' => apply_filters( |
469 | 469 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
470 | 470 | new EE_Form_Section_Proper( |
471 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
471 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
472 | 472 | ) |
473 | 473 | ), |
474 | 474 | 'payment_options' => $this->_setup_payment_options(), |
475 | 475 | 'after_payment_options' => apply_filters( |
476 | 476 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
477 | 477 | new EE_Form_Section_Proper( |
478 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
478 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
479 | 479 | ) |
480 | 480 | ), |
481 | 481 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
482 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( FALSE ) |
|
482 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(FALSE) |
|
483 | 483 | ), |
484 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
484 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
485 | 485 | 'layout_template_file' => $this->_template, |
486 | 486 | 'template_args' => apply_filters( |
487 | 487 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args', |
@@ -505,11 +505,11 @@ discard block |
||
505 | 505 | * @param bool $no_payment_required |
506 | 506 | * @return \EE_Form_Section_Proper |
507 | 507 | */ |
508 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
508 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
509 | 509 | |
510 | 510 | return new EE_Form_Section_Proper( |
511 | 511 | array( |
512 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
512 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
513 | 513 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
514 | 514 | 'subsections' => array( |
515 | 515 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | */ |
545 | 545 | protected function _apply_transaction_payments_to_amount_owing() { |
546 | 546 | $payments = $this->checkout->transaction->approved_payments(); |
547 | - if ( ! empty( $payments ) ) { |
|
548 | - foreach ( $payments as $payment ) { |
|
549 | - if ( $payment instanceof EE_Payment ) { |
|
547 | + if ( ! empty($payments)) { |
|
548 | + foreach ($payments as $payment) { |
|
549 | + if ($payment instanceof EE_Payment) { |
|
550 | 550 | $this->checkout->amount_owing -= $payment->amount(); |
551 | 551 | } |
552 | 552 | } |
@@ -562,9 +562,9 @@ discard block |
||
562 | 562 | * @param bool $force_reset |
563 | 563 | * @return void |
564 | 564 | */ |
565 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
566 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
567 | - if ( $reset_payment_method ) { |
|
565 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
566 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
567 | + if ($reset_payment_method) { |
|
568 | 568 | $this->checkout->selected_method_of_payment = NULL; |
569 | 569 | $this->checkout->payment_method = NULL; |
570 | 570 | $this->checkout->billing_form = NULL; |
@@ -583,9 +583,9 @@ discard block |
||
583 | 583 | * @param string $selected_method_of_payment |
584 | 584 | * @return EE_Billing_Info_Form |
585 | 585 | */ |
586 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
587 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
588 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
586 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
587 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
588 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | |
@@ -598,40 +598,40 @@ discard block |
||
598 | 598 | // load payment method classes |
599 | 599 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
600 | 600 | // switch up header depending on number of available payment methods |
601 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
602 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
603 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
601 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
602 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
603 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
604 | 604 | $available_payment_methods = array( |
605 | 605 | // display the "Payment Method" header |
606 | 606 | 'payment_method_header' => new EE_Form_Section_HTML( |
607 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
607 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
608 | 608 | ) |
609 | 609 | ); |
610 | 610 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
611 | 611 | $available_payment_method_options = array(); |
612 | 612 | $default_payment_method_option = array(); |
613 | 613 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
614 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
614 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
615 | 615 | // loop through payment methods |
616 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
617 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
618 | - $payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' ); |
|
616 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
617 | + if ($payment_method instanceof EE_Payment_Method) { |
|
618 | + $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img'); |
|
619 | 619 | // check if any payment methods are set as default |
620 | 620 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
621 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
621 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
622 | 622 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
623 | 623 | $this->_save_selected_method_of_payment(); |
624 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
624 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
625 | 625 | } else { |
626 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
626 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
627 | 627 | } |
628 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
628 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
632 | 632 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
633 | 633 | // now generate the actual form inputs |
634 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
634 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
635 | 635 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
636 | 636 | |
637 | 637 | // build the available payment methods form |
@@ -651,19 +651,19 @@ discard block |
||
651 | 651 | * @return EE_Payment_Method[] |
652 | 652 | */ |
653 | 653 | protected function _get_available_payment_methods() { |
654 | - if ( ! empty( $this->checkout->available_payment_methods )) { |
|
654 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
655 | 655 | return $this->checkout->available_payment_methods; |
656 | 656 | } |
657 | 657 | $available_payment_methods = array(); |
658 | 658 | // load EEM_Payment_Method |
659 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
659 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
660 | 660 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
661 | 661 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
662 | 662 | // get all active payment methods |
663 | - $payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
664 | - foreach ( $payment_methods as $payment_method ) { |
|
665 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
666 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
663 | + $payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
664 | + foreach ($payment_methods as $payment_method) { |
|
665 | + if ($payment_method instanceof EE_Payment_Method) { |
|
666 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | return $available_payment_methods; |
@@ -679,14 +679,14 @@ discard block |
||
679 | 679 | * @param array $available_payment_method_options |
680 | 680 | * @return \EE_Form_Section_Proper |
681 | 681 | */ |
682 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
682 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
683 | 683 | // generate inputs |
684 | 684 | return new EE_Form_Section_Proper( |
685 | 685 | array( |
686 | 686 | 'html_id' => 'ee-available-payment-method-inputs', |
687 | 687 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
688 | 688 | 'subsections' => array( |
689 | - '' => new EE_Radio_Button_Input ( |
|
689 | + '' => new EE_Radio_Button_Input( |
|
690 | 690 | $available_payment_method_options, |
691 | 691 | array( |
692 | 692 | 'html_name' => 'selected_method_of_payment', |
@@ -710,36 +710,36 @@ discard block |
||
710 | 710 | * @param EE_Payment_Method $payment_method |
711 | 711 | * @return \EE_Form_Section_Proper |
712 | 712 | */ |
713 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
713 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
714 | 714 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
715 | 715 | // generate the billing form for payment method |
716 | - $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML(); |
|
716 | + $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML(); |
|
717 | 717 | $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form; |
718 | 718 | // it's all in the details |
719 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
719 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
720 | 720 | // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not |
721 | - if ( $payment_method->description() ) { |
|
721 | + if ($payment_method->description()) { |
|
722 | 722 | $payment_method_info = $payment_method->description(); |
723 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
724 | - $payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
723 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
724 | + $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
725 | 725 | } else { |
726 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
726 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
727 | 727 | } |
728 | - $info_html .= EEH_HTML::p ( |
|
729 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
728 | + $info_html .= EEH_HTML::p( |
|
729 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
730 | 730 | '', |
731 | 731 | 'spco-payment-method-desc ee-attention' |
732 | 732 | ); |
733 | 733 | |
734 | 734 | return new EE_Form_Section_Proper( |
735 | 735 | array( |
736 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
736 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
737 | 737 | 'html_class' => 'spco-payment-method-info-dv', |
738 | 738 | // only display the selected or default PM |
739 | 739 | 'html_style' => $currently_selected ? '' : 'display:none;', |
740 | 740 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
741 | 741 | 'subsections' => array( |
742 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
742 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
743 | 743 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
744 | 744 | ) |
745 | 745 | ) |
@@ -757,12 +757,12 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public function get_billing_form_html_for_payment_method() { |
759 | 759 | // how have they chosen to pay? |
760 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
760 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
761 | 761 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
762 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
762 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
763 | 763 | return FALSE; |
764 | 764 | } |
765 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
765 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
766 | 766 | EE_Error::add_success( |
767 | 767 | apply_filters( |
768 | 768 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -771,20 +771,20 @@ discard block |
||
771 | 771 | ); |
772 | 772 | } |
773 | 773 | // now generate billing form for selected method of payment |
774 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
774 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
775 | 775 | // fill form with attendee info if applicable |
776 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
777 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
776 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
777 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
778 | 778 | } |
779 | 779 | // and debug content |
780 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
781 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
780 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
781 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
782 | 782 | } |
783 | 783 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
784 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
784 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
785 | 785 | // localize validation rules for main form |
786 | 786 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
787 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
787 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
788 | 788 | return TRUE; |
789 | 789 | } |
790 | 790 | |
@@ -797,15 +797,15 @@ discard block |
||
797 | 797 | * @param EE_Payment_Method $payment_method |
798 | 798 | * @return \EE_Billing_Info_Form |
799 | 799 | */ |
800 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
801 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
|
802 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
803 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
804 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
800 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
801 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing)); |
|
802 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
803 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
804 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
805 | 805 | EE_Error::add_success( |
806 | 806 | apply_filters( |
807 | 807 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
808 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
808 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
809 | 809 | ) |
810 | 810 | ); |
811 | 811 | } |
@@ -830,27 +830,27 @@ discard block |
||
830 | 830 | * @param string $request_param |
831 | 831 | * @return NULL|string |
832 | 832 | */ |
833 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
833 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
834 | 834 | // is selected_method_of_payment set in the request ? |
835 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
836 | - if ( $selected_method_of_payment ) { |
|
835 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
836 | + if ($selected_method_of_payment) { |
|
837 | 837 | // sanitize it |
838 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
839 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
838 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
839 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
840 | 840 | // store it in the session so that it's available for all subsequent requests including AJAX |
841 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
841 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
842 | 842 | } else { |
843 | 843 | // or is is set in the session ? |
844 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
844 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
845 | 845 | } |
846 | 846 | // do ya really really gotta have it? |
847 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
847 | + if (empty($selected_method_of_payment) && $required) { |
|
848 | 848 | EE_Error::add_error( |
849 | 849 | sprintf( |
850 | - __( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ), |
|
850 | + __('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'), |
|
851 | 851 | '<br/>', |
852 | 852 | '<br/>', |
853 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
853 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
854 | 854 | ), |
855 | 855 | __FILE__, __FUNCTION__, __LINE__ |
856 | 856 | ); |
@@ -876,37 +876,37 @@ discard block |
||
876 | 876 | * @return string |
877 | 877 | */ |
878 | 878 | public function switch_payment_method() { |
879 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
879 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
880 | 880 | return FALSE; |
881 | 881 | } |
882 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
882 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
883 | 883 | EE_Error::add_success( |
884 | 884 | apply_filters( |
885 | 885 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
886 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() ) |
|
886 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
887 | 887 | ) |
888 | 888 | ); |
889 | 889 | } |
890 | 890 | // generate billing form for selected method of payment if it hasn't been done already |
891 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
892 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
891 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
892 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
893 | 893 | } |
894 | 894 | // fill form with attendee info if applicable |
895 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
896 | - $this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
895 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
896 | + $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
897 | 897 | } |
898 | 898 | // and debug content |
899 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
900 | - $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form ); |
|
899 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
900 | + $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); |
|
901 | 901 | } |
902 | 902 | // get html and validation rules for form |
903 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
904 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() )); |
|
903 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
904 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); |
|
905 | 905 | // localize validation rules for main form |
906 | - $this->checkout->billing_form->localize_validation_rules( TRUE ); |
|
907 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
906 | + $this->checkout->billing_form->localize_validation_rules(TRUE); |
|
907 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
908 | 908 | } else { |
909 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' )); |
|
909 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
910 | 910 | } |
911 | 911 | //prevents advancement to next step |
912 | 912 | $this->checkout->continue_reg = FALSE; |
@@ -921,12 +921,12 @@ discard block |
||
921 | 921 | */ |
922 | 922 | protected function _verify_payment_method_is_set() { |
923 | 923 | // generate billing form for selected method of payment if it hasn't been done already |
924 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
924 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
925 | 925 | // how have they chosen to pay? |
926 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
926 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
927 | 927 | } |
928 | 928 | // verify payment method |
929 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
929 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
930 | 930 | // get payment method for selected method of payment |
931 | 931 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
932 | 932 | } |
@@ -946,23 +946,23 @@ discard block |
||
946 | 946 | * @return void |
947 | 947 | */ |
948 | 948 | public function save_payer_details_via_ajax() { |
949 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
949 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
950 | 950 | return; |
951 | 951 | } |
952 | 952 | // generate billing form for selected method of payment if it hasn't been done already |
953 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
954 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
953 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
954 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
955 | 955 | } |
956 | 956 | // generate primary attendee from payer info if applicable |
957 | 957 | if ( ! $this->checkout->transaction_has_primary_registrant()) { |
958 | 958 | $attendee = $this->_create_attendee_from_request_data(); |
959 | - if ( $attendee instanceof EE_Attendee ) { |
|
960 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
961 | - if ( $registration->is_primary_registrant() ) { |
|
959 | + if ($attendee instanceof EE_Attendee) { |
|
960 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
961 | + if ($registration->is_primary_registrant()) { |
|
962 | 962 | $this->checkout->primary_attendee_obj = $attendee; |
963 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
964 | - $registration->set_attendee_id( $attendee->ID() ); |
|
965 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
963 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
964 | + $registration->set_attendee_id($attendee->ID()); |
|
965 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
966 | 966 | } |
967 | 967 | } |
968 | 968 | } |
@@ -975,56 +975,56 @@ discard block |
||
975 | 975 | * uses info from alternate GET or POST data (such as AJAX) to create a new attendee |
976 | 976 | * @return \EE_Attendee |
977 | 977 | */ |
978 | - protected function _create_attendee_from_request_data(){ |
|
978 | + protected function _create_attendee_from_request_data() { |
|
979 | 979 | // get State ID |
980 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
981 | - if ( ! empty( $STA_ID )) { |
|
980 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
981 | + if ( ! empty($STA_ID)) { |
|
982 | 982 | // can we get state object from name ? |
983 | - EE_Registry::instance()->load_model( 'State' ); |
|
984 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' ); |
|
985 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
983 | + EE_Registry::instance()->load_model('State'); |
|
984 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
985 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
986 | 986 | } |
987 | 987 | // get Country ISO |
988 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
989 | - if ( ! empty( $CNT_ISO )) { |
|
988 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
989 | + if ( ! empty($CNT_ISO)) { |
|
990 | 990 | // can we get country object from name ? |
991 | - EE_Registry::instance()->load_model( 'Country' ); |
|
992 | - $country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' ); |
|
993 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
991 | + EE_Registry::instance()->load_model('Country'); |
|
992 | + $country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO'); |
|
993 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
994 | 994 | } |
995 | 995 | // grab attendee data |
996 | 996 | $attendee_data = array( |
997 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
998 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
999 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1000 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1001 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1002 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
997 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
998 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
999 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1000 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1001 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1002 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1003 | 1003 | 'STA_ID' => $STA_ID, |
1004 | 1004 | 'CNT_ISO' => $CNT_ISO, |
1005 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1006 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1005 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1006 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1007 | 1007 | ); |
1008 | 1008 | // validate the email address since it is the most important piece of info |
1009 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) { |
|
1010 | - EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1009 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) { |
|
1010 | + EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1011 | 1011 | } |
1012 | 1012 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1013 | - if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) { |
|
1014 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
1013 | + if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) { |
|
1014 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
1015 | 1015 | 'ATT_fname' => $attendee_data['ATT_fname'], |
1016 | 1016 | 'ATT_lname' => $attendee_data['ATT_lname'], |
1017 | 1017 | 'ATT_email' => $attendee_data['ATT_email'] |
1018 | 1018 | )); |
1019 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1019 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1020 | 1020 | return $existing_attendee; |
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | // no existing attendee? kk let's create a new one |
1024 | 1024 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1025 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1026 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1027 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1025 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1026 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1027 | + return EE_Attendee::new_instance($attendee_data); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | |
@@ -1044,22 +1044,22 @@ discard block |
||
1044 | 1044 | */ |
1045 | 1045 | public function process_reg_step() { |
1046 | 1046 | // how have they chosen to pay? |
1047 | - $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE ); |
|
1047 | + $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE); |
|
1048 | 1048 | // choose your own adventure based on method_of_payment |
1049 | - switch( $this->checkout->selected_method_of_payment ) { |
|
1049 | + switch ($this->checkout->selected_method_of_payment) { |
|
1050 | 1050 | |
1051 | 1051 | case 'events_sold_out' : |
1052 | 1052 | $this->checkout->redirect = TRUE; |
1053 | 1053 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1054 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1054 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1055 | 1055 | // mark this reg step as completed |
1056 | 1056 | $this->set_completed(); |
1057 | 1057 | return FALSE; |
1058 | 1058 | break; |
1059 | 1059 | |
1060 | 1060 | case 'payments_closed' : |
1061 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
1062 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1061 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
1062 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1063 | 1063 | } |
1064 | 1064 | // mark this reg step as completed |
1065 | 1065 | $this->set_completed(); |
@@ -1067,8 +1067,8 @@ discard block |
||
1067 | 1067 | break; |
1068 | 1068 | |
1069 | 1069 | case 'no_payment_required' : |
1070 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
1071 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
1071 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1072 | 1072 | } |
1073 | 1073 | // mark this reg step as completed |
1074 | 1074 | $this->set_completed(); |
@@ -1077,9 +1077,9 @@ discard block |
||
1077 | 1077 | |
1078 | 1078 | default: |
1079 | 1079 | $payment_successful = $this->_process_payment(); |
1080 | - if ( $payment_successful ) { |
|
1080 | + if ($payment_successful) { |
|
1081 | 1081 | $this->checkout->continue_reg = true; |
1082 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1082 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1083 | 1083 | } else { |
1084 | 1084 | $this->checkout->continue_reg = false; |
1085 | 1085 | } |
@@ -1097,8 +1097,8 @@ discard block |
||
1097 | 1097 | * @param \EE_Payment_Method $payment_method |
1098 | 1098 | * @return void |
1099 | 1099 | */ |
1100 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1101 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1100 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1101 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1102 | 1102 | case EE_PMT_Base::offsite : |
1103 | 1103 | break; |
1104 | 1104 | case EE_PMT_Base::onsite : |
@@ -1121,15 +1121,15 @@ discard block |
||
1121 | 1121 | public function update_reg_step() { |
1122 | 1122 | $success = TRUE; |
1123 | 1123 | // if payment required |
1124 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1125 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
1124 | + if ($this->checkout->transaction->total() > 0) { |
|
1125 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
1126 | 1126 | // attempt payment via payment method |
1127 | 1127 | $success = $this->process_reg_step(); |
1128 | 1128 | } |
1129 | - if ( $success && ! $this->checkout->redirect ) { |
|
1130 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
1129 | + if ($success && ! $this->checkout->redirect) { |
|
1130 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
1131 | 1131 | // set return URL |
1132 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
1132 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
1133 | 1133 | } |
1134 | 1134 | return $success; |
1135 | 1135 | } |
@@ -1149,24 +1149,24 @@ discard block |
||
1149 | 1149 | // clear any previous errors related to not selecting a payment method |
1150 | 1150 | // EE_Error::overwrite_errors(); |
1151 | 1151 | // ya gotta make a choice man |
1152 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
1153 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
1152 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1153 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
1154 | 1154 | return FALSE; |
1155 | 1155 | } |
1156 | 1156 | // get EE_Payment_Method object |
1157 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1157 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1158 | 1158 | return FALSE; |
1159 | 1159 | } |
1160 | 1160 | // setup billing form |
1161 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1162 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1161 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1162 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1163 | 1163 | // bad billing form ? |
1164 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1164 | + if ( ! $this->_billing_form_is_valid()) { |
|
1165 | 1165 | return FALSE; |
1166 | 1166 | } |
1167 | 1167 | } |
1168 | 1168 | // ensure primary registrant has been fully processed |
1169 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1169 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1170 | 1170 | return FALSE; |
1171 | 1171 | } |
1172 | 1172 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -1174,24 +1174,24 @@ discard block |
||
1174 | 1174 | // 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 |
1175 | 1175 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1176 | 1176 | // attempt payment |
1177 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1177 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1178 | 1178 | // process results |
1179 | - $payment = $this->_validate_payment( $payment ); |
|
1180 | - $payment = $this->_post_payment_processing( $payment ); |
|
1179 | + $payment = $this->_validate_payment($payment); |
|
1180 | + $payment = $this->_post_payment_processing($payment); |
|
1181 | 1181 | // verify payment |
1182 | - if ( $payment instanceof EE_Payment ) { |
|
1182 | + if ($payment instanceof EE_Payment) { |
|
1183 | 1183 | // store that for later |
1184 | 1184 | $this->checkout->payment = $payment; |
1185 | 1185 | /** @type EE_Transaction_Processor $transaction_processor */ |
1186 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1186 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1187 | 1187 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1188 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1189 | - if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) { |
|
1188 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1189 | + if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) { |
|
1190 | 1190 | return true; |
1191 | 1191 | } else { |
1192 | 1192 | return false; |
1193 | 1193 | } |
1194 | - } else if ( $payment === true ) { |
|
1194 | + } else if ($payment === true) { |
|
1195 | 1195 | // please note that offline payment methods will NOT make a payment, |
1196 | 1196 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1197 | 1197 | $this->checkout->payment = $payment; |
@@ -1210,10 +1210,10 @@ discard block |
||
1210 | 1210 | * @return bool |
1211 | 1211 | */ |
1212 | 1212 | public function redirect_form() { |
1213 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
1213 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
1214 | 1214 | $html = $payment_method_billing_info->get_html_and_js(); |
1215 | 1215 | $html .= $this->checkout->redirect_form; |
1216 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1216 | + EE_Registry::instance()->REQ->add_output($html); |
|
1217 | 1217 | return TRUE; |
1218 | 1218 | } |
1219 | 1219 | |
@@ -1226,33 +1226,33 @@ discard block |
||
1226 | 1226 | * @return bool |
1227 | 1227 | */ |
1228 | 1228 | private function _billing_form_is_valid() { |
1229 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1230 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1229 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1230 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1231 | 1231 | $this->checkout->billing_form->receive_form_submission(); |
1232 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1232 | + if ($this->checkout->billing_form->is_valid()) { |
|
1233 | 1233 | return TRUE; |
1234 | 1234 | } |
1235 | 1235 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1236 | 1236 | $error_strings = array(); |
1237 | - foreach( $validation_errors as $validation_error ){ |
|
1238 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
1237 | + foreach ($validation_errors as $validation_error) { |
|
1238 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1239 | 1239 | $form_section = $validation_error->get_form_section(); |
1240 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
1240 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1241 | 1241 | $label = $form_section->html_label_text(); |
1242 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1242 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1243 | 1243 | $label = $form_section->name(); |
1244 | - }else{ |
|
1245 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1244 | + } else { |
|
1245 | + $label = __('Validation Error', 'event_espresso'); |
|
1246 | 1246 | } |
1247 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1247 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1248 | 1248 | } |
1249 | 1249 | } |
1250 | - EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings ) ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1250 | + EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__); |
|
1251 | 1251 | } else { |
1252 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1252 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1253 | 1253 | } |
1254 | 1254 | } else { |
1255 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1255 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1256 | 1256 | } |
1257 | 1257 | return FALSE; |
1258 | 1258 | } |
@@ -1270,9 +1270,9 @@ discard block |
||
1270 | 1270 | */ |
1271 | 1271 | private function _setup_primary_registrant_prior_to_payment() { |
1272 | 1272 | // check if transaction has a primary registrant and that it has a related Attendee object |
1273 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1273 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1274 | 1274 | // need to at least gather some primary registrant data before attempting payment |
1275 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
1275 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
1276 | 1276 | return FALSE; |
1277 | 1277 | } |
1278 | 1278 | } |
@@ -1280,13 +1280,13 @@ discard block |
||
1280 | 1280 | // grab the primary_registration object |
1281 | 1281 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1282 | 1282 | /** @type EE_Transaction_Processor $transaction_processor */ |
1283 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1283 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1284 | 1284 | // at this point we'll consider a TXN to not have been failed |
1285 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1285 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1286 | 1286 | // save the TXN ( which clears cached copy of primary_registration) |
1287 | 1287 | $this->checkout->transaction->save(); |
1288 | 1288 | // grab TXN ID and save it to the primary_registration |
1289 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1289 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1290 | 1290 | // save what we have so far |
1291 | 1291 | $primary_registration->save(); |
1292 | 1292 | return TRUE; |
@@ -1303,41 +1303,41 @@ discard block |
||
1303 | 1303 | private function _capture_primary_registration_data_from_billing_form() { |
1304 | 1304 | // convert billing form data into an attendee |
1305 | 1305 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1306 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1306 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1307 | 1307 | EE_Error::add_error( |
1308 | 1308 | sprintf( |
1309 | - __( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1309 | + __('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1310 | 1310 | '<br/>', |
1311 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1311 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1312 | 1312 | ), __FILE__, __FUNCTION__, __LINE__ |
1313 | 1313 | ); |
1314 | 1314 | return FALSE; |
1315 | 1315 | } |
1316 | 1316 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1317 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1317 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1318 | 1318 | EE_Error::add_error( |
1319 | 1319 | sprintf( |
1320 | - __( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1320 | + __('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1321 | 1321 | '<br/>', |
1322 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1322 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1323 | 1323 | ), __FILE__, __FUNCTION__, __LINE__ |
1324 | 1324 | ); |
1325 | 1325 | return FALSE; |
1326 | 1326 | } |
1327 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
1327 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
1328 | 1328 | EE_Error::add_error( |
1329 | 1329 | sprintf( |
1330 | - __( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1330 | + __('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1331 | 1331 | '<br/>', |
1332 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1332 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1333 | 1333 | ), __FILE__, __FUNCTION__, __LINE__ |
1334 | 1334 | ); |
1335 | 1335 | return FALSE; |
1336 | 1336 | } |
1337 | 1337 | /** @type EE_Registration_Processor $registration_processor */ |
1338 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1338 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1339 | 1339 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1340 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1340 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1341 | 1341 | |
1342 | 1342 | return TRUE; |
1343 | 1343 | } |
@@ -1353,35 +1353,35 @@ discard block |
||
1353 | 1353 | */ |
1354 | 1354 | private function _get_payment_method_for_selected_method_of_payment() { |
1355 | 1355 | // get EE_Payment_Method object |
1356 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) { |
|
1357 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1356 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1357 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1358 | 1358 | } else { |
1359 | 1359 | // load EEM_Payment_Method |
1360 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1360 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1361 | 1361 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1362 | 1362 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1363 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1363 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1364 | 1364 | } |
1365 | 1365 | // verify $payment_method |
1366 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1366 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1367 | 1367 | // not a payment |
1368 | 1368 | EE_Error::add_error( |
1369 | 1369 | sprintf( |
1370 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1370 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1371 | 1371 | '<br/>', |
1372 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1372 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1373 | 1373 | ), __FILE__, __FUNCTION__, __LINE__ |
1374 | 1374 | ); |
1375 | 1375 | return NULL; |
1376 | 1376 | } |
1377 | 1377 | // and verify it has a valid Payment_Method Type object |
1378 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1378 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1379 | 1379 | // not a payment |
1380 | 1380 | EE_Error::add_error( |
1381 | 1381 | sprintf( |
1382 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1382 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1383 | 1383 | '<br/>', |
1384 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1384 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1385 | 1385 | ), __FILE__, __FUNCTION__, __LINE__ |
1386 | 1386 | ); |
1387 | 1387 | return NULL; |
@@ -1400,30 +1400,30 @@ discard block |
||
1400 | 1400 | * @type EE_Payment_Method $payment_method |
1401 | 1401 | * @return mixed EE_Payment | boolean |
1402 | 1402 | */ |
1403 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1404 | - $payment =NULL; |
|
1403 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1404 | + $payment = NULL; |
|
1405 | 1405 | $this->checkout->transaction->save(); |
1406 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1407 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1406 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1407 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1408 | 1408 | return FALSE; |
1409 | 1409 | } |
1410 | 1410 | try { |
1411 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1411 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1412 | 1412 | // generate payment object |
1413 | 1413 | $payment = $payment_processor->process_payment( |
1414 | 1414 | $payment_method, |
1415 | 1415 | $this->checkout->transaction, |
1416 | 1416 | $this->checkout->amount_owing, |
1417 | 1417 | $this->checkout->billing_form, |
1418 | - $this->_get_return_url( $payment_method ), |
|
1418 | + $this->_get_return_url($payment_method), |
|
1419 | 1419 | 'CART', |
1420 | 1420 | $this->checkout->admin_request, |
1421 | 1421 | TRUE, |
1422 | 1422 | $this->reg_step_url() |
1423 | 1423 | ); |
1424 | 1424 | |
1425 | - } catch( Exception $e ) { |
|
1426 | - $this->_handle_payment_processor_exception( $e ); |
|
1425 | + } catch (Exception $e) { |
|
1426 | + $this->_handle_payment_processor_exception($e); |
|
1427 | 1427 | } |
1428 | 1428 | return $payment; |
1429 | 1429 | } |
@@ -1437,12 +1437,12 @@ discard block |
||
1437 | 1437 | * @param \Exception $e |
1438 | 1438 | * @return void |
1439 | 1439 | */ |
1440 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1440 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1441 | 1441 | EE_Error::add_error( |
1442 | 1442 | sprintf( |
1443 | - __( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ), |
|
1443 | + __('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'), |
|
1444 | 1444 | '<br/>', |
1445 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1445 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1446 | 1446 | $e->getMessage(), |
1447 | 1447 | $e->getFile(), |
1448 | 1448 | $e->getLine() |
@@ -1459,9 +1459,9 @@ discard block |
||
1459 | 1459 | * @param \EE_Payment_Method $payment_method |
1460 | 1460 | * @return string |
1461 | 1461 | */ |
1462 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1462 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1463 | 1463 | $return_url = ''; |
1464 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1464 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1465 | 1465 | |
1466 | 1466 | case EE_PMT_Base::offsite : |
1467 | 1467 | $return_url = add_query_arg( |
@@ -1492,27 +1492,27 @@ discard block |
||
1492 | 1492 | * @param EE_Payment $payment |
1493 | 1493 | * @return EE_Payment | FALSE |
1494 | 1494 | */ |
1495 | - private function _validate_payment( $payment = NULL ) { |
|
1496 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1495 | + private function _validate_payment($payment = NULL) { |
|
1496 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1497 | 1497 | return TRUE; |
1498 | 1498 | } |
1499 | 1499 | // verify payment object |
1500 | - if ( $payment instanceof EE_Payment ) { |
|
1500 | + if ($payment instanceof EE_Payment) { |
|
1501 | 1501 | if ( |
1502 | 1502 | $payment->status() != EEM_Payment::status_id_approved |
1503 | 1503 | && $payment->status() != EEM_Payment::status_id_pending |
1504 | 1504 | && $payment->status() != EEM_Payment::status_id_cancelled |
1505 | 1505 | && $payment->gateway_response() != '' |
1506 | 1506 | ) { |
1507 | - EE_Error::add_error( $payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1507 | + EE_Error::add_error($payment->gateway_response(), __FILE__, __FUNCTION__, __LINE__); |
|
1508 | 1508 | } |
1509 | 1509 | } else { |
1510 | 1510 | // not a payment |
1511 | 1511 | EE_Error::add_error( |
1512 | 1512 | sprintf( |
1513 | - __( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1513 | + __('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1514 | 1514 | '<br/>', |
1515 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1515 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1516 | 1516 | ), __FILE__, __FUNCTION__, __LINE__ |
1517 | 1517 | ); |
1518 | 1518 | return FALSE; |
@@ -1529,23 +1529,23 @@ discard block |
||
1529 | 1529 | * @param EE_Payment $payment |
1530 | 1530 | * @return bool |
1531 | 1531 | */ |
1532 | - private function _post_payment_processing( $payment = NULL ) { |
|
1532 | + private function _post_payment_processing($payment = NULL) { |
|
1533 | 1533 | // On-Site payment? |
1534 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1535 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
1534 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1535 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1536 | 1536 | //$this->_setup_redirect_for_next_step(); |
1537 | 1537 | $this->checkout->continue_reg = false; |
1538 | 1538 | } |
1539 | 1539 | // Off-Site payment? |
1540 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
1540 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
1541 | 1541 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
1542 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
1543 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
1542 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
1543 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
1544 | 1544 | $this->checkout->redirect = TRUE; |
1545 | 1545 | $this->checkout->redirect_form = $payment->redirect_form(); |
1546 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
1546 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
1547 | 1547 | // set JSON response |
1548 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
1548 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
1549 | 1549 | // set cron job for finalizing the TXN |
1550 | 1550 | // in case the user does not return from the off-site gateway |
1551 | 1551 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1553,21 +1553,21 @@ discard block |
||
1553 | 1553 | $this->checkout->transaction->ID() |
1554 | 1554 | ); |
1555 | 1555 | // and lastly, let's bump the payment status to pending |
1556 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
1556 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
1557 | 1557 | $payment->save(); |
1558 | 1558 | } else { |
1559 | 1559 | // not a payment |
1560 | 1560 | $this->checkout->continue_reg = false; |
1561 | 1561 | EE_Error::add_error( |
1562 | 1562 | sprintf( |
1563 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1563 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1564 | 1564 | '<br/>', |
1565 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1565 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1566 | 1566 | ), __FILE__, __FUNCTION__, __LINE__ |
1567 | 1567 | ); |
1568 | 1568 | } |
1569 | 1569 | // Off-Line payment? |
1570 | - } else if ( $payment === TRUE ) { |
|
1570 | + } else if ($payment === TRUE) { |
|
1571 | 1571 | //$this->_setup_redirect_for_next_step(); |
1572 | 1572 | return TRUE; |
1573 | 1573 | } else { |
@@ -1603,65 +1603,65 @@ discard block |
||
1603 | 1603 | * @return bool |
1604 | 1604 | * @throws \EE_Error |
1605 | 1605 | */ |
1606 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
1606 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
1607 | 1607 | // off-line payment? carry on |
1608 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
1608 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
1609 | 1609 | return true; |
1610 | 1610 | } |
1611 | 1611 | // verify payment validity |
1612 | - if ( $payment instanceof EE_Payment ) { |
|
1613 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
1612 | + if ($payment instanceof EE_Payment) { |
|
1613 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
1614 | 1614 | $msg = $payment->gateway_response(); |
1615 | 1615 | // check results |
1616 | - switch ( $payment->status() ) { |
|
1616 | + switch ($payment->status()) { |
|
1617 | 1617 | |
1618 | 1618 | // good payment |
1619 | 1619 | case EEM_Payment::status_id_approved : |
1620 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1620 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1621 | 1621 | return TRUE; |
1622 | 1622 | break; |
1623 | 1623 | |
1624 | 1624 | // slow payment |
1625 | 1625 | case EEM_Payment::status_id_pending : |
1626 | - if ( empty( $msg )) { |
|
1627 | - $msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' ); |
|
1626 | + if (empty($msg)) { |
|
1627 | + $msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso'); |
|
1628 | 1628 | } |
1629 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1629 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1630 | 1630 | return TRUE; |
1631 | 1631 | break; |
1632 | 1632 | |
1633 | 1633 | // don't wanna payment |
1634 | 1634 | case EEM_Payment::status_id_cancelled : |
1635 | - if ( empty( $msg )) { |
|
1635 | + if (empty($msg)) { |
|
1636 | 1636 | $msg = _n( |
1637 | 1637 | 'Payment cancelled. Please try again.', |
1638 | 1638 | 'Payment cancelled. Please try again or select another method of payment.', |
1639 | - count( $this->checkout->available_payment_methods ), |
|
1639 | + count($this->checkout->available_payment_methods), |
|
1640 | 1640 | 'event_espresso' |
1641 | 1641 | ); |
1642 | 1642 | } |
1643 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1643 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1644 | 1644 | return FALSE; |
1645 | 1645 | break; |
1646 | 1646 | |
1647 | 1647 | // not enough payment |
1648 | 1648 | case EEM_Payment::status_id_declined : |
1649 | - if ( empty( $msg )) { |
|
1649 | + if (empty($msg)) { |
|
1650 | 1650 | $msg = _n( |
1651 | 1651 | 'We\'re sorry but your payment was declined. Please try again.', |
1652 | 1652 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
1653 | - count( $this->checkout->available_payment_methods ), |
|
1653 | + count($this->checkout->available_payment_methods), |
|
1654 | 1654 | 'event_espresso' |
1655 | 1655 | ); |
1656 | 1656 | } |
1657 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1657 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1658 | 1658 | return FALSE; |
1659 | 1659 | break; |
1660 | 1660 | |
1661 | 1661 | // bad payment |
1662 | 1662 | case EEM_Payment::status_id_failed : |
1663 | - if ( ! empty( $msg ) ) { |
|
1664 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1663 | + if ( ! empty($msg)) { |
|
1664 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1665 | 1665 | return false; |
1666 | 1666 | } |
1667 | 1667 | // default to error below |
@@ -1671,14 +1671,14 @@ discard block |
||
1671 | 1671 | } |
1672 | 1672 | // off-site payment gateway responses are too unreliable, so let's just assume that |
1673 | 1673 | // the payment processing is just running slower than the registrant's request |
1674 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
1674 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
1675 | 1675 | return true; |
1676 | 1676 | } |
1677 | 1677 | EE_Error::add_error( |
1678 | 1678 | sprintf( |
1679 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1679 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1680 | 1680 | '<br/>', |
1681 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1681 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1682 | 1682 | ), |
1683 | 1683 | __FILE__, __FUNCTION__, __LINE__ |
1684 | 1684 | ); |
@@ -1711,13 +1711,13 @@ discard block |
||
1711 | 1711 | public function process_gateway_response() { |
1712 | 1712 | $payment = null; |
1713 | 1713 | // how have they chosen to pay? |
1714 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1714 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1715 | 1715 | // get EE_Payment_Method object |
1716 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1716 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1717 | 1717 | $this->checkout->continue_reg = false; |
1718 | 1718 | return false; |
1719 | 1719 | } |
1720 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
1720 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
1721 | 1721 | return false; |
1722 | 1722 | } |
1723 | 1723 | $this->_validate_offsite_return(); |
@@ -1731,23 +1731,23 @@ discard block |
||
1731 | 1731 | // true |
1732 | 1732 | //); |
1733 | 1733 | // verify TXN |
1734 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1734 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1735 | 1735 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
1736 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
1736 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
1737 | 1737 | $this->checkout->continue_reg = false; |
1738 | 1738 | return false; |
1739 | 1739 | } |
1740 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
1741 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
1742 | - $payment = $this->_validate_payment( $payment ); |
|
1740 | + $payment = $this->_process_off_site_payment($gateway); |
|
1741 | + $payment = $this->_process_cancelled_payments($payment); |
|
1742 | + $payment = $this->_validate_payment($payment); |
|
1743 | 1743 | // if payment was not declined by the payment gateway or cancelled by the registrant |
1744 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
1744 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
1745 | 1745 | //$this->_setup_redirect_for_next_step(); |
1746 | 1746 | // store that for later |
1747 | 1747 | $this->checkout->payment = $payment; |
1748 | 1748 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
1749 | 1749 | // because we will complete this step during the IPN processing then |
1750 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) { |
|
1750 | + if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) { |
|
1751 | 1751 | $this->set_completed(); |
1752 | 1752 | } |
1753 | 1753 | return true; |
@@ -1770,19 +1770,19 @@ discard block |
||
1770 | 1770 | * @return bool |
1771 | 1771 | */ |
1772 | 1772 | private function _validate_offsite_return() { |
1773 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
1774 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
1773 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
1774 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
1775 | 1775 | // Houston... we might have a problem |
1776 | 1776 | $invalid_TXN = false; |
1777 | 1777 | // first gather some info |
1778 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1778 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1779 | 1779 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
1780 | 1780 | // let's start by retrieving the cart for this TXN |
1781 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
1782 | - if ( $cart instanceof EE_Cart ) { |
|
1781 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
1782 | + if ($cart instanceof EE_Cart) { |
|
1783 | 1783 | // verify that the current cart has tickets |
1784 | 1784 | $tickets = $cart->get_tickets(); |
1785 | - if ( empty( $tickets ) ) { |
|
1785 | + if (empty($tickets)) { |
|
1786 | 1786 | $invalid_TXN = true; |
1787 | 1787 | } |
1788 | 1788 | } else { |
@@ -1790,39 +1790,39 @@ discard block |
||
1790 | 1790 | } |
1791 | 1791 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
1792 | 1792 | // validate current Session ID and compare against valid TXN session ID |
1793 | - if ( EE_Session::instance()->id() === null ) { |
|
1793 | + if (EE_Session::instance()->id() === null) { |
|
1794 | 1794 | $invalid_TXN = true; |
1795 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
1795 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
1796 | 1796 | // WARNING !!! |
1797 | 1797 | // this could be PayPal sending back duplicate requests (ya they do that) |
1798 | 1798 | // or it **could** mean someone is simply registering AGAIN after having just done so |
1799 | 1799 | // so now we need to determine if this current TXN looks valid or not |
1800 | 1800 | /** @type EE_Transaction_Processor $transaction_processor */ |
1801 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1801 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1802 | 1802 | // has this step even been started ? |
1803 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
1803 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
1804 | 1804 | ) { |
1805 | 1805 | // really? you're half way through this reg step, but you never started it ? |
1806 | 1806 | $invalid_TXN = true; |
1807 | 1807 | } |
1808 | 1808 | } |
1809 | - if ( $invalid_TXN ) { |
|
1809 | + if ($invalid_TXN) { |
|
1810 | 1810 | // is the valid TXN completed ? |
1811 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
1811 | + if ($valid_TXN instanceof EE_Transaction) { |
|
1812 | 1812 | /** @type EE_Transaction_Processor $transaction_processor */ |
1813 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1813 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1814 | 1814 | // has this step even been started ? |
1815 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
1816 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
1815 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
1816 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
1817 | 1817 | // so it **looks** like this is a double request from PayPal |
1818 | 1818 | // so let's try to pick up where we left off |
1819 | 1819 | $this->checkout->transaction = $valid_TXN; |
1820 | - $this->checkout->refresh_all_entities( true ); |
|
1820 | + $this->checkout->refresh_all_entities(true); |
|
1821 | 1821 | return; |
1822 | 1822 | } |
1823 | 1823 | } |
1824 | 1824 | // you appear to be lost? |
1825 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
1825 | + $this->_redirect_wayward_request($primary_registrant); |
|
1826 | 1826 | } |
1827 | 1827 | } |
1828 | 1828 | } |
@@ -1836,16 +1836,16 @@ discard block |
||
1836 | 1836 | * @param \EE_Registration $primary_registrant |
1837 | 1837 | * @return bool |
1838 | 1838 | */ |
1839 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
1840 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1839 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
1840 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1841 | 1841 | // try redirecting based on the current TXN |
1842 | 1842 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
1843 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1843 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1844 | 1844 | EE_Error::add_error( |
1845 | 1845 | sprintf( |
1846 | - __( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1846 | + __('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1847 | 1847 | '<br/>', |
1848 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1848 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1849 | 1849 | ), |
1850 | 1850 | __FILE__, __FUNCTION__, __LINE__ |
1851 | 1851 | ); |
@@ -1873,16 +1873,16 @@ discard block |
||
1873 | 1873 | * @param \EE_Offsite_Gateway $gateway |
1874 | 1874 | * @return \EE_Payment |
1875 | 1875 | */ |
1876 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
1876 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
1877 | 1877 | try { |
1878 | 1878 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
1879 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
1879 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
1880 | 1880 | $payment = $this->checkout->transaction->last_payment(); |
1881 | 1881 | //$payment_source = 'last_payment'; |
1882 | 1882 | } else { |
1883 | 1883 | // get payment details and process results |
1884 | 1884 | /** @type EE_Payment_Processor $payment_processor */ |
1885 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1885 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1886 | 1886 | $payment = $payment_processor->process_ipn( |
1887 | 1887 | $_REQUEST, |
1888 | 1888 | $this->checkout->transaction, |
@@ -1892,14 +1892,14 @@ discard block |
||
1892 | 1892 | ); |
1893 | 1893 | //$payment_source = 'process_ipn'; |
1894 | 1894 | } |
1895 | - } catch ( Exception $e ) { |
|
1895 | + } catch (Exception $e) { |
|
1896 | 1896 | // let's just eat the exception and try to move on using any previously set payment info |
1897 | 1897 | $payment = $this->checkout->transaction->last_payment(); |
1898 | 1898 | //$payment_source = 'last_payment after Exception'; |
1899 | 1899 | // but if we STILL don't have a payment object |
1900 | - if ( ! $payment instanceof EE_Payment ) { |
|
1900 | + if ( ! $payment instanceof EE_Payment) { |
|
1901 | 1901 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
1902 | - $this->_handle_payment_processor_exception( $e ); |
|
1902 | + $this->_handle_payment_processor_exception($e); |
|
1903 | 1903 | } |
1904 | 1904 | } |
1905 | 1905 | // DEBUG LOG |
@@ -1923,13 +1923,13 @@ discard block |
||
1923 | 1923 | * @param EE_Payment $payment |
1924 | 1924 | * @return EE_Payment | FALSE |
1925 | 1925 | */ |
1926 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
1926 | + private function _process_cancelled_payments($payment = NULL) { |
|
1927 | 1927 | if ( |
1928 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
1928 | + isset($_REQUEST['ee_cancel_payment']) |
|
1929 | 1929 | && $payment instanceof EE_Payment |
1930 | 1930 | && $payment->status() == EEM_Payment::status_id_failed |
1931 | 1931 | ) { |
1932 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
1932 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
1933 | 1933 | } |
1934 | 1934 | return $payment; |
1935 | 1935 | } |
@@ -1946,23 +1946,23 @@ discard block |
||
1946 | 1946 | public function get_transaction_details_for_gateways() { |
1947 | 1947 | $txn_details = array(); |
1948 | 1948 | // ya gotta make a choice man |
1949 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1949 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1950 | 1950 | $txn_details = array( |
1951 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1951 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1952 | 1952 | ); |
1953 | 1953 | } |
1954 | 1954 | // get EE_Payment_Method object |
1955 | 1955 | if ( |
1956 | - empty( $txn_details ) && |
|
1956 | + empty($txn_details) && |
|
1957 | 1957 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
1958 | 1958 | ) { |
1959 | 1959 | $txn_details = array( |
1960 | 1960 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
1961 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
1961 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
1962 | 1962 | ); |
1963 | 1963 | } |
1964 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
1965 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
1964 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
1965 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
1966 | 1966 | $txn_details = array( |
1967 | 1967 | 'TXN_ID' => $this->checkout->transaction->ID(), |
1968 | 1968 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
1974 | 1974 | 'payment_amount' => $this->checkout->amount_owing, |
1975 | 1975 | 'return_url' => $return_url, |
1976 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
1976 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
1977 | 1977 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
1978 | 1978 | array( |
1979 | 1979 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -1982,7 +1982,7 @@ discard block |
||
1982 | 1982 | ) |
1983 | 1983 | ); |
1984 | 1984 | } |
1985 | - echo json_encode( $txn_details ); |
|
1985 | + echo json_encode($txn_details); |
|
1986 | 1986 | exit(); |
1987 | 1987 | } |
1988 | 1988 |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * |
462 | 462 | * @access public |
463 | 463 | * @access public |
464 | - * @return array or FALSE |
|
464 | + * @return boolean|null or FALSE |
|
465 | 465 | */ |
466 | 466 | public function process_ticket_selections() { |
467 | 467 | do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | * @access private |
721 | 721 | * @param EE_Ticket $ticket |
722 | 722 | * @param int $qty |
723 | - * @return TRUE on success, FALSE on fail |
|
723 | + * @return boolean on success, FALSE on fail |
|
724 | 724 | */ |
725 | 725 | private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
726 | 726 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | protected static $_event = NULL; |
36 | 36 | |
37 | 37 | /** |
38 | - * array of datetimes and the spaces available for them |
|
39 | - * |
|
40 | - * @access private |
|
41 | - * @var array |
|
42 | - */ |
|
38 | + * array of datetimes and the spaces available for them |
|
39 | + * |
|
40 | + * @access private |
|
41 | + * @var array |
|
42 | + */ |
|
43 | 43 | private static $_available_spaces = array(); |
44 | 44 | |
45 | 45 | |
@@ -855,11 +855,11 @@ discard block |
||
855 | 855 | |
856 | 856 | |
857 | 857 | /** |
858 | - * load js |
|
859 | - * |
|
860 | - * @access public |
|
861 | - * @return void |
|
862 | - */ |
|
858 | + * load js |
|
859 | + * |
|
860 | + * @access public |
|
861 | + * @return void |
|
862 | + */ |
|
863 | 863 | public static function load_tckt_slctr_assets() { |
864 | 864 | // add some style |
865 | 865 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return EED_Ticket_Selector |
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | - return parent::get_instance( __CLASS__ ); |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - protected function set_config(){ |
|
66 | - $this->set_config_section( 'template_settings' ); |
|
67 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
68 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
65 | + protected function set_config() { |
|
66 | + $this->set_config_section('template_settings'); |
|
67 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
68 | + $this->set_config_name('EED_Ticket_Selector'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function set_hooks() { |
82 | 82 | // routing |
83 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
84 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
85 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
86 | - add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
|
87 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
88 | - add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
|
89 | - add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
|
90 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
83 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
84 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
85 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
86 | + add_action('AHEE_event_details_before_post', array('EED_Ticket_Selector', 'ticket_selector_form_open'), 10, 1); |
|
87 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
88 | + add_action('AHEE__ticket_selector_chart__template__after_ticket_selector', array('EED_Ticket_Selector', 'display_ticket_selector_submit'), 10, 1); |
|
89 | + add_action('AHEE_event_details_after_post', array('EED_Ticket_Selector', 'ticket_selector_form_close'), 10); |
|
90 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
102 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
103 | 103 | //add button for iframe code to event editor. |
104 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
105 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
104 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
105 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | public static function set_definitions() { |
117 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
118 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
117 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
119 | 119 | |
120 | 120 | //if config is not set, initialize |
121 | 121 | //If config is not set, set it. |
122 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
122 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
123 | 123 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
124 | 124 | } |
125 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
125 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param object $WP |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function run( $WP ) {} |
|
136 | + public function run($WP) {} |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | public function ticket_selector_iframe() { |
146 | 146 | self::$_in_iframe = true; |
147 | 147 | /** @type EEM_Event $EEM_Event */ |
148 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
148 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
149 | 149 | $event = $EEM_Event->get_one_by_ID( |
150 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
150 | + EE_Registry::instance()->REQ->get('event', 0) |
|
151 | 151 | ); |
152 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
153 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
152 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
153 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
154 | 154 | $template_args['css'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
156 | 156 | array( |
157 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
158 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
159 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
160 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
157 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
158 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
159 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
160 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
161 | 161 | ) |
162 | 162 | ); |
163 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
164 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
163 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
164 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
165 | 165 | $template_args['eei18n'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
167 | 167 | EE_Registry::localize_i18n_js_strings() |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | $template_args['js'] = apply_filters( |
170 | 170 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
171 | 171 | array( |
172 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
173 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
174 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
172 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
173 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
174 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | EE_Registry::instance()->load_helper('Template'); |
178 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
179 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
178 | + $template_args['notices'] = EEH_Template::display_template( |
|
179 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
180 | 180 | array(), |
181 | 181 | true |
182 | 182 | ); |
183 | 183 | EEH_Template::display_template( |
184 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
184 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
185 | 185 | $template_args |
186 | 186 | ); |
187 | 187 | exit; |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string The new html string for the permalink area. |
202 | 202 | */ |
203 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
203 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
204 | 204 | //make sure this is ONLY when editing and the event id has been set. |
205 | - if ( ! empty( $id ) ) { |
|
206 | - $post = get_post( $id ); |
|
205 | + if ( ! empty($id)) { |
|
206 | + $post = get_post($id); |
|
207 | 207 | |
208 | 208 | //if NOT event then let's get out. |
209 | - if ( $post->post_type !== 'espresso_events' ) { |
|
209 | + if ($post->post_type !== 'espresso_events') { |
|
210 | 210 | return $permalink_string; |
211 | 211 | } |
212 | 212 | |
213 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
213 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
214 | 214 | |
215 | - $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' . __('Embed', 'event_espresso') . '</a> '; |
|
215 | + $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">'.__('Embed', 'event_espresso').'</a> '; |
|
216 | 216 | $permalink_string .= ' |
217 | 217 | <div id="js-ts-iframe" style="display:none"> |
218 | 218 | <div style="width:100%; height: 500px;"> |
219 | - <iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe> |
|
219 | + <iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe> |
|
220 | 220 | </div> |
221 | 221 | </div>'; |
222 | 222 | } |
@@ -235,23 +235,23 @@ discard block |
||
235 | 235 | * @param mixed $event |
236 | 236 | * @return bool |
237 | 237 | */ |
238 | - protected static function set_event( $event = null ) { |
|
239 | - if( $event === null ) { |
|
238 | + protected static function set_event($event = null) { |
|
239 | + if ($event === null) { |
|
240 | 240 | global $post; |
241 | 241 | $event = $post; |
242 | 242 | } |
243 | 243 | // d( $event ); |
244 | - if ( $event instanceof EE_Event ) { |
|
244 | + if ($event instanceof EE_Event) { |
|
245 | 245 | self::$_event = $event; |
246 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
246 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
247 | 247 | self::$_event = $event->EE_Event; |
248 | - } else if ( $event instanceof WP_Post && ( ! isset( $event->EE_Event ) || ! $event->EE_Event instanceof EE_Event ) ) { |
|
249 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
248 | + } else if ($event instanceof WP_Post && ( ! isset($event->EE_Event) || ! $event->EE_Event instanceof EE_Event)) { |
|
249 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
250 | 250 | self::$_event = $event->EE_Event; |
251 | 251 | } else { |
252 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
253 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
254 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
252 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
253 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
254 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | return true; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * @param bool $view_details |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
273 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
274 | 274 | // reset filter for displaying submit button |
275 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
275 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
276 | 276 | // poke and prod incoming event till it tells us what it is |
277 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
277 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | && ( |
286 | 286 | ! self::$_event->display_ticket_selector() |
287 | 287 | || $view_details |
288 | - || post_password_required( $event_post ) |
|
288 | + || post_password_required($event_post) |
|
289 | 289 | || ( |
290 | 290 | $_event_active_status != EE_Datetime::active |
291 | 291 | && $_event_active_status != EE_Datetime::upcoming |
@@ -303,70 +303,70 @@ discard block |
||
303 | 303 | $template_args = array(); |
304 | 304 | $template_args['event_status'] = $_event_active_status; |
305 | 305 | |
306 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
307 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
306 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
307 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
308 | 308 | |
309 | 309 | $template_args['EVT_ID'] = self::$_event->ID(); |
310 | 310 | $template_args['event'] = self::$_event; |
311 | 311 | |
312 | 312 | // is the event expired ? |
313 | 313 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
314 | - if ( $template_args['event_is_expired'] ) { |
|
315 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
314 | + if ($template_args['event_is_expired']) { |
|
315 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | $ticket_query_args = array( |
319 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
320 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
319 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
320 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
321 | 321 | ); |
322 | 322 | |
323 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
323 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
324 | 324 | //use the correct applicable time query depending on what version of core is being run. |
325 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
326 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
325 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
326 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | // get all tickets for this event ordered by the datetime |
330 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
330 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
331 | 331 | |
332 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
333 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
332 | + if (count($template_args['tickets']) < 1) { |
|
333 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
337 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
338 | - if ( $template_args['max_atndz'] < 1 ) { |
|
339 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
340 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
341 | - $sales_closed_msg .= sprintf( |
|
342 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
337 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
338 | + if ($template_args['max_atndz'] < 1) { |
|
339 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
340 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
341 | + $sales_closed_msg .= sprintf( |
|
342 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
343 | 343 | '<div class="ee-attention" style="text-align: left;"><b>', |
344 | 344 | '</b><br />', |
345 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
345 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
346 | 346 | '</a></span></div>' |
347 | 347 | ); |
348 | 348 | } |
349 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
349 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
350 | 350 | } |
351 | 351 | |
352 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
353 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
352 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
353 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
354 | 354 | |
355 | 355 | // redirecting to another site for registration ?? |
356 | 356 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
357 | 357 | // set up the form (but not for the admin) |
358 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
358 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
359 | 359 | // if not redirecting to another site for registration |
360 | - if ( ! $external_url ) { |
|
361 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
362 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
360 | + if ( ! $external_url) { |
|
361 | + EE_Registry::instance()->load_helper('Template'); |
|
362 | + EE_Registry::instance()->load_helper('URL'); |
|
363 | 363 | // then display the ticket selector |
364 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
364 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
365 | 365 | } else { |
366 | 366 | // if not we still need to trigger the display of the submit button |
367 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
367 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
368 | 368 | //display notice to admin that registration is external |
369 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
369 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
370 | 370 | } |
371 | 371 | // submit button and form close tag |
372 | 372 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -386,28 +386,28 @@ discard block |
||
386 | 386 | * @param string $external_url |
387 | 387 | * @return string |
388 | 388 | */ |
389 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
389 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
390 | 390 | // if redirecting, we don't need any anything else |
391 | - if ( $external_url ) { |
|
392 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
393 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
394 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
395 | - foreach ( $query_args as $query_arg => $value ) { |
|
396 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
391 | + if ($external_url) { |
|
392 | + EE_Registry::instance()->load_helper('URL'); |
|
393 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
394 | + $query_args = EEH_URL::get_query_string($external_url); |
|
395 | + foreach ($query_args as $query_arg => $value) { |
|
396 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
397 | 397 | } |
398 | 398 | return $html; |
399 | 399 | } |
400 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
401 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
402 | - if ( ! $checkout_url ) { |
|
403 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
400 | + EE_Registry::instance()->load_helper('Event_View'); |
|
401 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
402 | + if ( ! $checkout_url) { |
|
403 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
404 | 404 | } |
405 | 405 | EED_Ticket_Selector::set_event(); |
406 | 406 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
407 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
408 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
407 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
408 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
409 | 409 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
410 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
410 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
411 | 411 | return $html; |
412 | 412 | } |
413 | 413 | |
@@ -422,21 +422,21 @@ discard block |
||
422 | 422 | * @return string |
423 | 423 | */ |
424 | 424 | public static function display_ticket_selector_submit() { |
425 | - if ( ! is_admin() ) { |
|
426 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
425 | + if ( ! is_admin()) { |
|
426 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
427 | 427 | $btn_text = apply_filters( |
428 | 428 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
429 | - __('Register Now', 'event_espresso' ), |
|
429 | + __('Register Now', 'event_espresso'), |
|
430 | 430 | self::$_event |
431 | 431 | ); |
432 | - $html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"'; |
|
432 | + $html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"'; |
|
433 | 433 | $html .= ' class="ticket-selector-submit-btn ticket-selector-submit-ajax"'; |
434 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
435 | - $html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event ); |
|
434 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
435 | + $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event); |
|
436 | 436 | $html .= '<div class="clear"><br/></div></form>'; |
437 | 437 | return $html; |
438 | - } else if ( is_archive() ) { |
|
439 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
438 | + } else if (is_archive()) { |
|
439 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | return ''; |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | * @return string |
469 | 469 | */ |
470 | 470 | public static function display_view_details_btn() { |
471 | - if ( ! self::$_event->get_permalink() ) { |
|
472 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
471 | + if ( ! self::$_event->get_permalink()) { |
|
472 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
473 | 473 | } |
474 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
475 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
476 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
477 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
474 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
475 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
476 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
477 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
478 | 478 | $view_details_btn .= '<div class="clear"><br/></div>'; |
479 | 479 | $view_details_btn .= '</form>'; |
480 | 480 | return $view_details_btn; |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | * @return array or FALSE |
494 | 494 | */ |
495 | 495 | public function process_ticket_selections() { |
496 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
496 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
497 | 497 | // check nonce |
498 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
498 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
499 | 499 | EE_Error::add_error( |
500 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
500 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
501 | 501 | __FILE__, __FUNCTION__, __LINE__ |
502 | 502 | ); |
503 | 503 | return FALSE; |
@@ -511,16 +511,16 @@ discard block |
||
511 | 511 | |
512 | 512 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
513 | 513 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
514 | - EE_Registry::instance()->load_core( 'Session' ); |
|
514 | + EE_Registry::instance()->load_core('Session'); |
|
515 | 515 | // unless otherwise requested, clear the session |
516 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
517 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
516 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
517 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
518 | 518 | } |
519 | 519 | //d( EE_Registry::instance()->SSN ); |
520 | 520 | |
521 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
521 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
522 | 522 | // do we have an event id? |
523 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
523 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
524 | 524 | // validate/sanitize data |
525 | 525 | $valid = self::_validate_post_data(); |
526 | 526 | |
@@ -530,43 +530,43 @@ discard block |
||
530 | 530 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
531 | 531 | |
532 | 532 | //check total tickets ordered vs max number of attendees that can register |
533 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
533 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
534 | 534 | |
535 | 535 | // ordering too many tickets !!! |
536 | 536 | $singular = 'You have attempted to purchase %s ticket.'; |
537 | 537 | $plural = 'You have attempted to purchase %s tickets.'; |
538 | - $limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] ); |
|
538 | + $limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']); |
|
539 | 539 | // dev only message |
540 | 540 | $singular = 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
541 | 541 | $plural = 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
542 | - $limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] ); |
|
543 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
542 | + $limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']); |
|
543 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
544 | 544 | } else { |
545 | 545 | |
546 | 546 | // all data appears to be valid |
547 | 547 | $tckts_slctd = FALSE; |
548 | 548 | $success = TRUE; |
549 | 549 | // load cart |
550 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
550 | + EE_Registry::instance()->load_core('Cart'); |
|
551 | 551 | |
552 | 552 | // cycle thru the number of data rows sent from the event listing |
553 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
553 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
554 | 554 | // does this row actually contain a ticket quantity? |
555 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
555 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
556 | 556 | // YES we have a ticket quantity |
557 | 557 | $tckts_slctd = TRUE; |
558 | 558 | // d( $valid['ticket_obj'][$x] ); |
559 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
559 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
560 | 560 | // then add ticket to cart |
561 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
561 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
562 | 562 | $success = ! $ticket_added ? FALSE : $success; |
563 | - if ( EE_Error::has_error() ) { |
|
563 | + if (EE_Error::has_error()) { |
|
564 | 564 | break; |
565 | 565 | } |
566 | 566 | } else { |
567 | 567 | // nothing added to cart retrieved |
568 | 568 | EE_Error::add_error( |
569 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
569 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
570 | 570 | __FILE__, __FUNCTION__, __LINE__ |
571 | 571 | ); |
572 | 572 | } |
@@ -575,45 +575,45 @@ discard block |
||
575 | 575 | //d( EE_Registry::instance()->CART ); |
576 | 576 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
577 | 577 | |
578 | - if ( $tckts_slctd ) { |
|
579 | - if ( $success ) { |
|
580 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
578 | + if ($tckts_slctd) { |
|
579 | + if ($success) { |
|
580 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
581 | 581 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
582 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
582 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
583 | 583 | EE_Registry::instance()->SSN->update(); |
584 | 584 | //d( EE_Registry::instance()->CART ); |
585 | 585 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
586 | 586 | // just return TRUE for registrations being made from admin |
587 | - if ( is_admin() ) { |
|
587 | + if (is_admin()) { |
|
588 | 588 | return TRUE; |
589 | 589 | } |
590 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
590 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
591 | 591 | exit(); |
592 | 592 | |
593 | 593 | } else { |
594 | - if ( ! EE_Error::has_error() ) { |
|
594 | + if ( ! EE_Error::has_error()) { |
|
595 | 595 | // nothing added to cart |
596 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
596 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | 600 | } else { |
601 | 601 | // no ticket quantities were selected |
602 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
602 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
606 | 606 | // at this point, just return if registration is being made from admin |
607 | - if ( is_admin() ) { |
|
607 | + if (is_admin()) { |
|
608 | 608 | return FALSE; |
609 | 609 | } |
610 | - if ( $valid['return_url'] ) { |
|
611 | - EE_Error::get_notices( FALSE, TRUE ); |
|
612 | - wp_safe_redirect( $valid['return_url'] ); |
|
610 | + if ($valid['return_url']) { |
|
611 | + EE_Error::get_notices(FALSE, TRUE); |
|
612 | + wp_safe_redirect($valid['return_url']); |
|
613 | 613 | exit(); |
614 | - } elseif ( isset( $event_to_add['id'] )) { |
|
615 | - EE_Error::get_notices( FALSE, TRUE ); |
|
616 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
614 | + } elseif (isset($event_to_add['id'])) { |
|
615 | + EE_Error::get_notices(FALSE, TRUE); |
|
616 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
617 | 617 | exit(); |
618 | 618 | } else { |
619 | 619 | echo EE_Error::get_notices(); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } else { |
623 | 623 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
624 | 624 | EE_Error::add_error( |
625 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
625 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
626 | 626 | __FILE__, __FUNCTION__, __LINE__ |
627 | 627 | ); |
628 | 628 | } |
@@ -640,18 +640,18 @@ discard block |
||
640 | 640 | * @return array or FALSE |
641 | 641 | */ |
642 | 642 | private static function _validate_post_data() { |
643 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
643 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
644 | 644 | |
645 | 645 | // start with an empty array() |
646 | 646 | $valid_data = array(); |
647 | 647 | // d( $_POST ); |
648 | 648 | //if event id is valid |
649 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
650 | - if ( $id ) { |
|
649 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
650 | + if ($id) { |
|
651 | 651 | // grab valid id |
652 | 652 | $valid_data['id'] = $id; |
653 | 653 | // grab and sanitize return-url |
654 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
654 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
655 | 655 | // array of other form names |
656 | 656 | $inputs_to_clean = array( |
657 | 657 | 'event_id' => 'tkt-slctr-event-id', |
@@ -664,22 +664,22 @@ discard block |
||
664 | 664 | // let's track the total number of tickets ordered.' |
665 | 665 | $valid_data['total_tickets'] = 0; |
666 | 666 | // cycle through $inputs_to_clean array |
667 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
667 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
668 | 668 | // check for POST data |
669 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
669 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
670 | 670 | // grab value |
671 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
671 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
672 | 672 | switch ($what) { |
673 | 673 | |
674 | 674 | // integers |
675 | 675 | case 'event_id': |
676 | - $valid_data[$what] = absint( $input_value ); |
|
676 | + $valid_data[$what] = absint($input_value); |
|
677 | 677 | // get event via the event id we put in the form |
678 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
678 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
679 | 679 | break; |
680 | 680 | case 'rows': |
681 | 681 | case 'max_atndz': |
682 | - $valid_data[$what] = absint( $input_value ); |
|
682 | + $valid_data[$what] = absint($input_value); |
|
683 | 683 | break; |
684 | 684 | |
685 | 685 | // arrays of integers |
@@ -687,27 +687,27 @@ discard block |
||
687 | 687 | // d( $input_value ); |
688 | 688 | $row_qty = $input_value; |
689 | 689 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
690 | - if( ! is_array( $row_qty )) { |
|
690 | + if ( ! is_array($row_qty)) { |
|
691 | 691 | // get number of rows |
692 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
692 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
693 | 693 | // d( $rows ); |
694 | 694 | // explode ints by the dash |
695 | - $row_qty = explode( '-', $row_qty ); |
|
696 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
697 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
698 | - $row_qty = array( $row => $qty ); |
|
695 | + $row_qty = explode('-', $row_qty); |
|
696 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
697 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
698 | + $row_qty = array($row => $qty); |
|
699 | 699 | // d( $row_qty ); |
700 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
701 | - if ( ! isset( $row_qty[$x] )) { |
|
700 | + for ($x = 1; $x <= $rows; $x++) { |
|
701 | + if ( ! isset($row_qty[$x])) { |
|
702 | 702 | $row_qty[$x] = 0; |
703 | 703 | } |
704 | 704 | } |
705 | 705 | } |
706 | - ksort( $row_qty ); |
|
706 | + ksort($row_qty); |
|
707 | 707 | // d( $row_qty ); |
708 | 708 | // cycle thru values |
709 | - foreach ( $row_qty as $qty ) { |
|
710 | - $qty = absint( $qty ); |
|
709 | + foreach ($row_qty as $qty) { |
|
710 | + $qty = absint($qty); |
|
711 | 711 | // sanitize as integers |
712 | 712 | $valid_data[$what][] = $qty; |
713 | 713 | $valid_data['total_tickets'] += $qty; |
@@ -718,19 +718,19 @@ discard block |
||
718 | 718 | case 'ticket_id': |
719 | 719 | $value_array = array(); |
720 | 720 | // cycle thru values |
721 | - foreach ( $input_value as $key=>$value ) { |
|
721 | + foreach ($input_value as $key=>$value) { |
|
722 | 722 | // allow only numbers, letters, spaces, commas and dashes |
723 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
723 | + $value_array[$key] = wp_strip_all_tags($value); |
|
724 | 724 | // get ticket via the ticket id we put in the form |
725 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
726 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
725 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
726 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
727 | 727 | } |
728 | - $valid_data[ $what ] = $value_array; |
|
728 | + $valid_data[$what] = $value_array; |
|
729 | 729 | break; |
730 | 730 | |
731 | 731 | case 'return_url' : |
732 | 732 | // grab and sanitize return-url |
733 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
733 | + $valid_data[$what] = esc_url_raw($input_value); |
|
734 | 734 | break; |
735 | 735 | |
736 | 736 | } // end switch $what |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | } // end foreach $inputs_to_clean |
739 | 739 | |
740 | 740 | } else { |
741 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
741 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
742 | 742 | return FALSE; |
743 | 743 | } |
744 | 744 | |
@@ -756,28 +756,28 @@ discard block |
||
756 | 756 | * @param int $qty |
757 | 757 | * @return TRUE on success, FALSE on fail |
758 | 758 | */ |
759 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
760 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
759 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
760 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
761 | 761 | // get the number of spaces left for this datetime ticket |
762 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
762 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
763 | 763 | // compare available spaces against the number of tickets being purchased |
764 | - if ( $available_spaces >= $qty ) { |
|
764 | + if ($available_spaces >= $qty) { |
|
765 | 765 | // allow addons to prevent a ticket from being added to cart |
766 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
766 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
767 | 767 | return false; |
768 | 768 | } |
769 | 769 | // add event to cart |
770 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
771 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
770 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
771 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
772 | 772 | return true; |
773 | 773 | } else { |
774 | 774 | return false; |
775 | 775 | } |
776 | 776 | } else { |
777 | 777 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
778 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
778 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
779 | 779 | // greedy greedy greedy eh? |
780 | - if ( $available_spaces > 0 ) { |
|
780 | + if ($available_spaces > 0) { |
|
781 | 781 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
782 | 782 | EE_Error::add_error( |
783 | 783 | sprintf( |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | __FILE__, __FUNCTION__, __LINE__ |
794 | 794 | ); |
795 | 795 | } else { |
796 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
796 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 797 | } |
798 | 798 | return false; |
799 | 799 | } |
@@ -811,22 +811,22 @@ discard block |
||
811 | 811 | * @param bool $get_original_ticket_spaces |
812 | 812 | * @return int |
813 | 813 | */ |
814 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
814 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
815 | 815 | // if the $_available_spaces array has not been set up yet... |
816 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
817 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
816 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
817 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
818 | 818 | } |
819 | 819 | $available_spaces = $ticket->qty() - $ticket->sold(); |
820 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
820 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
821 | 821 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
822 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
822 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
823 | 823 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
824 | - if ( $get_original_ticket_spaces ) { |
|
824 | + if ($get_original_ticket_spaces) { |
|
825 | 825 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
826 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
826 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
827 | 827 | } else { |
828 | 828 | // we want the updated ticket availability as stored in the "datetimes" array |
829 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
829 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
830 | 830 | } |
831 | 831 | } |
832 | 832 | } |
@@ -842,23 +842,23 @@ discard block |
||
842 | 842 | * @param EE_Ticket $ticket |
843 | 843 | * @return int |
844 | 844 | */ |
845 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
845 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
846 | 846 | // first, get all of the datetimes that are available to this ticket |
847 | 847 | $datetimes = $ticket->get_many_related( |
848 | 848 | 'Datetime', |
849 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
849 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
850 | 850 | ); |
851 | - if ( ! empty( $datetimes )) { |
|
851 | + if ( ! empty($datetimes)) { |
|
852 | 852 | // now loop thru all of the datetimes |
853 | - foreach ( $datetimes as $datetime ) { |
|
854 | - if ( $datetime instanceof EE_Datetime ) { |
|
853 | + foreach ($datetimes as $datetime) { |
|
854 | + if ($datetime instanceof EE_Datetime) { |
|
855 | 855 | // the number of spaces available for the datetime without considering individual ticket quantities |
856 | 856 | $spaces_remaining = $datetime->spaces_remaining(); |
857 | 857 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
858 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
858 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
859 | 859 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
860 | 860 | // else just take the datetime spaces remaining, and assign to the datetimes array |
861 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
861 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | } |
@@ -874,12 +874,12 @@ discard block |
||
874 | 874 | * @param int $qty |
875 | 875 | * @return int |
876 | 876 | */ |
877 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
878 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
877 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
878 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
879 | 879 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
880 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
880 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
881 | 881 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
882 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
882 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
883 | 883 | } |
884 | 884 | } |
885 | 885 | } |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | */ |
897 | 897 | public static function load_tckt_slctr_assets() { |
898 | 898 | // add some style |
899 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
900 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
899 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
900 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
901 | 901 | wp_enqueue_style('ticket_selector'); |
902 | 902 | // make it dance |
903 | 903 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -911,9 +911,9 @@ discard block |
||
911 | 911 | |
912 | 912 | public static function load_tckt_slctr_assets_admin() { |
913 | 913 | //iframe button js on admin event editor page |
914 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
915 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
916 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
914 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
915 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
916 | + wp_enqueue_script('ticket_selector_embed'); |
|
917 | 917 | } |
918 | 918 | } |
919 | 919 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @access public |
99 | 99 | * @param string $title |
100 | - * @return void |
|
100 | + * @return string |
|
101 | 101 | */ |
102 | 102 | public function the_title( $title = '', $id = '' ) { |
103 | 103 | return $title; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @access public |
139 | 139 | * @param string $content |
140 | - * @return void |
|
140 | + * @return string |
|
141 | 141 | */ |
142 | 142 | public function venue_location( $content ) { |
143 | 143 | return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venues_Archive |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venues', 'Venues_Archive', 'run' ); |
|
40 | + EE_Config::register_route('venues', 'Venues_Archive', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @return void |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | * @access public |
73 | 73 | * @return void |
74 | 74 | */ |
75 | - public function template_include( $template ) { |
|
75 | + public function template_include($template) { |
|
76 | 76 | // not a custom template? |
77 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
77 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_venues.php') { |
|
78 | 78 | EEH_Template::load_espresso_theme_functions(); |
79 | 79 | // then add extra event data via hooks |
80 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 2 ); |
|
80 | + add_filter('the_title', array($this, 'the_title'), 100, 2); |
|
81 | 81 | // don't know if theme uses the_excerpt |
82 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
83 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
82 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
83 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
84 | 84 | // or the_content |
85 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
86 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
85 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
86 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
87 | 87 | // don't diplay entry meta because the existing theme will take car of that |
88 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
88 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
89 | 89 | } |
90 | 90 | return $template; |
91 | 91 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param string $title |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function the_title( $title = '', $id = '' ) { |
|
102 | + public function the_title($title = '', $id = '') { |
|
103 | 103 | return $title; |
104 | 104 | // global $post; |
105 | 105 | // return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
@@ -113,21 +113,21 @@ discard block |
||
113 | 113 | * @param string $content |
114 | 114 | * @return void |
115 | 115 | */ |
116 | - public function venue_details( $content ) { |
|
116 | + public function venue_details($content) { |
|
117 | 117 | global $post; |
118 | 118 | // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
119 | 119 | // it uses the_content() for displaying the $post->post_content |
120 | 120 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
121 | 121 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
122 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
123 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
122 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
123 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
124 | 124 | // now load our template |
125 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
125 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
126 | 126 | //now add our filter back in, plus some others |
127 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
128 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
127 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
128 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
129 | 129 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
130 | - return ! empty( $template ) ? $template : $content; |
|
130 | + return ! empty($template) ? $template : $content; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | * @param string $content |
140 | 140 | * @return void |
141 | 141 | */ |
142 | - public function venue_location( $content ) { |
|
143 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
142 | + public function venue_location($content) { |
|
143 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -154,19 +154,19 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function wp_enqueue_scripts() { |
156 | 156 | // get some style |
157 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
157 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
158 | 158 | // first check theme folder |
159 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
160 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
161 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
162 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
159 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
160 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
161 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
162 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
163 | 163 | } |
164 | 164 | // if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js' )) { |
165 | 165 | // wp_register_script( 'archive-espresso_venues', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js', array('espresso_core'), '1.0', TRUE ); |
166 | 166 | // } else if ( is_readable( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js' )) { |
167 | 167 | // wp_register_script( 'archive-espresso_venues', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.js', array('espresso_core'), '1.0', TRUE ); |
168 | 168 | // } |
169 | - wp_enqueue_style( $this->theme ); |
|
169 | + wp_enqueue_style($this->theme); |
|
170 | 170 | // wp_enqueue_script( 'archive-espresso_venues' ); |
171 | 171 | |
172 | 172 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * can_use_espresso_conditionals |
148 | 148 | * tests whether the Espresso Conditional tags like is_espresso_event_single() can be called |
149 | 149 | * |
150 | - * @param $conditional_tag |
|
150 | + * @param string $conditional_tag |
|
151 | 151 | * @return bool |
152 | 152 | */ |
153 | 153 | function can_use_espresso_conditionals( $conditional_tag ) { |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | /** |
876 | 876 | * espresso_event_venues |
877 | 877 | * |
878 | - * @return array all venues related to an event |
|
878 | + * @return EE_Venue[] all venues related to an event |
|
879 | 879 | */ |
880 | 880 | function espresso_event_venues() { |
881 | 881 | EE_Registry::instance()->load_helper( 'Venue_View' ); |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | * |
911 | 911 | * @param int $VNU_ID optional, the venue id to check. |
912 | 912 | * |
913 | - * @return bool | null |
|
913 | + * @return null|boolean | null |
|
914 | 914 | */ |
915 | 915 | function espresso_is_venue_private( $VNU_ID = 0 ) { |
916 | 916 | EE_Registry::instance()->load_helper( 'Venue_View' ); |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @param int | \EE_Event $event |
28 | 28 | * @return bool |
29 | 29 | */ |
30 | -function is_espresso_event( $event = NULL ) { |
|
31 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
30 | +function is_espresso_event($event = NULL) { |
|
31 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
32 | 32 | // load event view helper |
33 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
33 | + EE_Registry::instance()->load_helper('Event_View'); |
|
34 | 34 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
35 | - $event = EEH_Event_View::get_event( $event ); |
|
35 | + $event = EEH_Event_View::get_event($event); |
|
36 | 36 | // do we have a valid event ? |
37 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
37 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
38 | 38 | } |
39 | 39 | return FALSE; |
40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return bool |
47 | 47 | */ |
48 | 48 | function is_espresso_event_single() { |
49 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
49 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
50 | 50 | global $wp_query; |
51 | 51 | // return conditionals set by CPTs |
52 | 52 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return bool |
62 | 62 | */ |
63 | 63 | function is_espresso_event_archive() { |
64 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
64 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
65 | 65 | global $wp_query; |
66 | 66 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @return bool |
76 | 76 | */ |
77 | 77 | function is_espresso_event_taxonomy() { |
78 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
78 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
79 | 79 | global $wp_query; |
80 | 80 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
81 | 81 | } |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | * @param int | \EE_Venue $venue |
90 | 90 | * @return bool |
91 | 91 | */ |
92 | -function is_espresso_venue( $venue = NULL ) { |
|
93 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
92 | +function is_espresso_venue($venue = NULL) { |
|
93 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
94 | 94 | // load event view helper |
95 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
95 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
96 | 96 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
97 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
97 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
98 | 98 | // do we have a valid event ? |
99 | 99 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
100 | 100 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return bool |
109 | 109 | */ |
110 | 110 | function is_espresso_venue_single() { |
111 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
111 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
112 | 112 | global $wp_query; |
113 | 113 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return bool |
123 | 123 | */ |
124 | 124 | function is_espresso_venue_archive() { |
125 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
125 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
126 | 126 | global $wp_query; |
127 | 127 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
128 | 128 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @return bool |
137 | 137 | */ |
138 | 138 | function is_espresso_venue_taxonomy() { |
139 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
139 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
140 | 140 | global $wp_query; |
141 | 141 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
142 | 142 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @param $conditional_tag |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
154 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
153 | +function can_use_espresso_conditionals($conditional_tag) { |
|
154 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
155 | 155 | EE_Error::doing_it_wrong( |
156 | 156 | __FUNCTION__, |
157 | 157 | sprintf( |
158 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
158 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
159 | 159 | $conditional_tag |
160 | 160 | ), |
161 | 161 | '4.4.0' |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | |
171 | 171 | /*************************** Event Queries ***************************/ |
172 | 172 | |
173 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
173 | +if ( ! function_exists('espresso_get_events')) { |
|
174 | 174 | /** |
175 | 175 | * espresso_get_events |
176 | 176 | * @param array $params |
177 | 177 | * @return array |
178 | 178 | */ |
179 | - function espresso_get_events( $params = array() ) { |
|
179 | + function espresso_get_events($params = array()) { |
|
180 | 180 | //set default params |
181 | 181 | $default_espresso_events_params = array( |
182 | 182 | 'limit' => 10, |
@@ -187,18 +187,18 @@ discard block |
||
187 | 187 | 'sort' => 'ASC' |
188 | 188 | ); |
189 | 189 | // allow the defaults to be filtered |
190 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
190 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
191 | 191 | // grab params and merge with defaults, then extract |
192 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
192 | + $params = array_merge($default_espresso_events_params, $params); |
|
193 | 193 | // run the query |
194 | - $events_query = new EE_Event_List_Query( $params ); |
|
194 | + $events_query = new EE_Event_List_Query($params); |
|
195 | 195 | // assign results to a variable so we can return it |
196 | 196 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
197 | 197 | // but first reset the query and postdata |
198 | 198 | wp_reset_query(); |
199 | 199 | wp_reset_postdata(); |
200 | 200 | EED_Events_Archive::remove_all_events_archive_filters(); |
201 | - unset( $events_query ); |
|
201 | + unset($events_query); |
|
202 | 202 | return $events; |
203 | 203 | } |
204 | 204 | } |
@@ -212,32 +212,32 @@ discard block |
||
212 | 212 | * espresso_load_ticket_selector |
213 | 213 | */ |
214 | 214 | function espresso_load_ticket_selector() { |
215 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
215 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
216 | 216 | } |
217 | 217 | |
218 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
218 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
219 | 219 | /** |
220 | 220 | * espresso_ticket_selector |
221 | 221 | * @param null $event |
222 | 222 | */ |
223 | - function espresso_ticket_selector( $event = NULL ) { |
|
224 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
223 | + function espresso_ticket_selector($event = NULL) { |
|
224 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
225 | 225 | espresso_load_ticket_selector(); |
226 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
226 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | |
232 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
232 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
233 | 233 | /** |
234 | 234 | * espresso_view_details_btn |
235 | 235 | * @param null $event |
236 | 236 | */ |
237 | - function espresso_view_details_btn( $event = NULL ) { |
|
238 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
237 | + function espresso_view_details_btn($event = NULL) { |
|
238 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
239 | 239 | espresso_load_ticket_selector(); |
240 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
240 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | /*************************** EEH_Event_View ***************************/ |
249 | 249 | |
250 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
250 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
251 | 251 | /** |
252 | 252 | * espresso_load_event_list_assets |
253 | 253 | * ensures that event list styles and scripts are loaded |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | */ |
257 | 257 | function espresso_load_event_list_assets() { |
258 | 258 | $event_list = EED_Events_Archive::instance(); |
259 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
260 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
259 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
260 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
265 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
266 | 266 | /** |
267 | 267 | * espresso_event_reg_button |
268 | 268 | * returns the "Register Now" button if event is active, |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | * @param bool $EVT_ID |
275 | 275 | * @return string |
276 | 276 | */ |
277 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
278 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
279 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
280 | - switch ( $event_status ) { |
|
277 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
278 | + EE_Registry::instance()->load_helper('Event_View'); |
|
279 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
280 | + switch ($event_status) { |
|
281 | 281 | case EE_Datetime::sold_out : |
282 | 282 | $btn_text = __('Sold Out', 'event_espresso'); |
283 | 283 | $class = 'ee-pink'; |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | case EE_Datetime::upcoming : |
294 | 294 | case EE_Datetime::active : |
295 | 295 | default : |
296 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
296 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
297 | 297 | $class = 'ee-green'; |
298 | 298 | } |
299 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
299 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
300 | 300 | $btn_text = $btn_text_if_inactive; |
301 | 301 | $class = 'ee-grey'; |
302 | 302 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | |
312 | 312 | |
313 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
313 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
314 | 314 | /** |
315 | 315 | * espresso_display_ticket_selector |
316 | 316 | * whether or not to display the Ticket Selector for an event |
@@ -318,15 +318,15 @@ discard block |
||
318 | 318 | * @param bool $EVT_ID |
319 | 319 | * @return boolean |
320 | 320 | */ |
321 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
322 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
323 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
321 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
322 | + EE_Registry::instance()->load_helper('Event_View'); |
|
323 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
329 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
330 | 330 | /** |
331 | 331 | * espresso_event_status |
332 | 332 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | * @param bool $EVT_ID |
335 | 335 | * @return string |
336 | 336 | */ |
337 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
338 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
339 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
337 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
338 | + EE_Registry::instance()->load_helper('Event_View'); |
|
339 | + return EEH_Event_View::event_status($EVT_ID); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | 343 | |
344 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
344 | +if ( ! function_exists('espresso_event_status')) { |
|
345 | 345 | /** |
346 | 346 | * espresso_event_status |
347 | 347 | * returns the event status if it is sold out, expired, or inactive |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | * @param bool $echo |
351 | 351 | * @return string |
352 | 352 | */ |
353 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
354 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
355 | - if ( $echo ) { |
|
356 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
353 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
354 | + EE_Registry::instance()->load_helper('Event_View'); |
|
355 | + if ($echo) { |
|
356 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
357 | 357 | return ''; |
358 | 358 | } |
359 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
359 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | 363 | |
364 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
364 | +if ( ! function_exists('espresso_event_categories')) { |
|
365 | 365 | /** |
366 | 366 | * espresso_event_categories |
367 | 367 | * returns the terms associated with an event |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | * @param bool $echo |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
375 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
376 | - if ( $echo ) { |
|
377 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
374 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
375 | + EE_Registry::instance()->load_helper('Event_View'); |
|
376 | + if ($echo) { |
|
377 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
378 | 378 | return ''; |
379 | 379 | } |
380 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
380 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | 384 | |
385 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
385 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
386 | 386 | /** |
387 | 387 | * espresso_event_tickets_available |
388 | 388 | * returns the ticket types available for purchase for an event |
@@ -392,27 +392,27 @@ discard block |
||
392 | 392 | * @param bool $format |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
396 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
397 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
398 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
395 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
396 | + EE_Registry::instance()->load_helper('Event_View'); |
|
397 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
398 | + if (is_array($tickets) && ! empty($tickets)) { |
|
399 | 399 | // if formatting then $html will be a string, else it will be an array of ticket objects |
400 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
401 | - foreach ( $tickets as $ticket ) { |
|
402 | - if ( $ticket instanceof EE_Ticket ) { |
|
403 | - if ( $format ) { |
|
404 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
405 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
400 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
401 | + foreach ($tickets as $ticket) { |
|
402 | + if ($ticket instanceof EE_Ticket) { |
|
403 | + if ($format) { |
|
404 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
405 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
406 | 406 | $html .= '</li>'; |
407 | 407 | } else { |
408 | 408 | $html[] = $ticket; |
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
412 | - if ( $format ) { |
|
412 | + if ($format) { |
|
413 | 413 | $html .= '</ul>'; |
414 | 414 | } |
415 | - if ( $echo && ! $format ) { |
|
415 | + if ($echo && ! $format) { |
|
416 | 416 | echo $html; |
417 | 417 | return ''; |
418 | 418 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
425 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
426 | 426 | /** |
427 | 427 | * espresso_event_date_obj |
428 | 428 | * returns the primary date object for an event |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | * @param bool $EVT_ID |
431 | 431 | * @return object |
432 | 432 | */ |
433 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
434 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
435 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
433 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
434 | + EE_Registry::instance()->load_helper('Event_View'); |
|
435 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 | |
439 | 439 | |
440 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
440 | +if ( ! function_exists('espresso_event_date')) { |
|
441 | 441 | /** |
442 | 442 | * espresso_event_date |
443 | 443 | * returns the primary date for an event |
@@ -448,23 +448,23 @@ discard block |
||
448 | 448 | * @param bool $echo |
449 | 449 | * @return string |
450 | 450 | */ |
451 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
452 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
453 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
454 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
455 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
456 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
457 | - if($echo){ |
|
458 | - echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
451 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
452 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
453 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
454 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
455 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
456 | + EE_Registry::instance()->load_helper('Event_View'); |
|
457 | + if ($echo) { |
|
458 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
459 | 459 | return ''; |
460 | 460 | } |
461 | - return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
461 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
462 | 462 | |
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | 466 | |
467 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
467 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
468 | 468 | /** |
469 | 469 | * espresso_list_of_event_dates |
470 | 470 | * returns a unordered list of dates for an event |
@@ -479,41 +479,41 @@ discard block |
||
479 | 479 | * @param null $limit |
480 | 480 | * @return string |
481 | 481 | */ |
482 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
483 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
484 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
485 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
486 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
487 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
488 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
489 | - if ( ! $format ) { |
|
490 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
482 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
483 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
484 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
485 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
486 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
487 | + EE_Registry::instance()->load_helper('Event_View'); |
|
488 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
489 | + if ( ! $format) { |
|
490 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
491 | 491 | } |
492 | 492 | //d( $datetimes ); |
493 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
493 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
494 | 494 | global $post; |
495 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul">' : ''; |
|
496 | - foreach ( $datetimes as $datetime ) { |
|
497 | - if ( $datetime instanceof EE_Datetime ) { |
|
498 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID(); |
|
499 | - $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">'; |
|
495 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul">' : ''; |
|
496 | + foreach ($datetimes as $datetime) { |
|
497 | + if ($datetime instanceof EE_Datetime) { |
|
498 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID(); |
|
499 | + $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">'; |
|
500 | 500 | $datetime_name = $datetime->name(); |
501 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
502 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
503 | - $html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>'; |
|
504 | - $html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format ); |
|
501 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
502 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
503 | + $html .= '<span class="dashicons dashicons-calendar"></span>'.$datetime->date_range($date_format).'<br/>'; |
|
504 | + $html .= '<span class="dashicons dashicons-clock"></span>'.$datetime->time_range($time_format); |
|
505 | 505 | $datetime_description = $datetime->description(); |
506 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
507 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
508 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
506 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
507 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
508 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
509 | 509 | $html .= '</li>'; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | $html .= $format ? '</ul>' : ''; |
513 | 513 | } else { |
514 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
514 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
515 | 515 | } |
516 | - if ( $echo ) { |
|
516 | + if ($echo) { |
|
517 | 517 | echo $html; |
518 | 518 | return ''; |
519 | 519 | } |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | |
525 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
525 | +if ( ! function_exists('espresso_event_end_date')) { |
|
526 | 526 | /** |
527 | 527 | * espresso_event_end_date |
528 | 528 | * returns the last date for an event |
@@ -533,21 +533,21 @@ discard block |
||
533 | 533 | * @param bool $echo |
534 | 534 | * @return string |
535 | 535 | */ |
536 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
537 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
538 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
539 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
540 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
541 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
542 | - if($echo){ |
|
543 | - echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
536 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
537 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
538 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
539 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
540 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
541 | + EE_Registry::instance()->load_helper('Event_View'); |
|
542 | + if ($echo) { |
|
543 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
544 | 544 | return ''; |
545 | 545 | } |
546 | - return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
546 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | |
550 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
550 | +if ( ! function_exists('espresso_event_date_range')) { |
|
551 | 551 | /** |
552 | 552 | * espresso_event_date_range |
553 | 553 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -559,32 +559,32 @@ discard block |
||
559 | 559 | * @param bool $EVT_ID |
560 | 560 | * @return string |
561 | 561 | */ |
562 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
563 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
562 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
563 | + EE_Registry::instance()->load_helper('Event_View'); |
|
564 | 564 | // set and filter date and time formats when a range is returned |
565 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
566 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
565 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
566 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
567 | 567 | // get the start and end date with NO time portion |
568 | - $the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID ); |
|
569 | - $the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID ); |
|
568 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
569 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
570 | 570 | // now we can determine if date range spans more than one day |
571 | - if ( $the_event_date != $the_event_end_date ) { |
|
572 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
573 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
571 | + if ($the_event_date != $the_event_end_date) { |
|
572 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
573 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
574 | 574 | $html = sprintf( |
575 | - __( '%1$s - %2$s', 'event_espresso' ), |
|
576 | - EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ), |
|
577 | - EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ) |
|
575 | + __('%1$s - %2$s', 'event_espresso'), |
|
576 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
577 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
578 | 578 | ); |
579 | 579 | } else { |
580 | 580 | // set and filter date and time formats when only a single datetime is returned |
581 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
582 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
583 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
584 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
585 | - $html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID ); |
|
581 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
582 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
583 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
584 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
585 | + $html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
586 | 586 | } |
587 | - if ( $echo ) { |
|
587 | + if ($echo) { |
|
588 | 588 | echo $html; |
589 | 589 | return ''; |
590 | 590 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | } |
594 | 594 | |
595 | 595 | |
596 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
596 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
597 | 597 | /** |
598 | 598 | * espresso_event_date_as_calendar_page |
599 | 599 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -601,16 +601,16 @@ discard block |
||
601 | 601 | * @param bool $EVT_ID |
602 | 602 | * @return string |
603 | 603 | */ |
604 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
605 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
606 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
604 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
605 | + EE_Registry::instance()->load_helper('Event_View'); |
|
606 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
610 | 610 | |
611 | 611 | |
612 | 612 | |
613 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
613 | +if ( ! function_exists('espresso_event_link_url')) { |
|
614 | 614 | /** |
615 | 615 | * espresso_event_link_url |
616 | 616 | * |
@@ -618,19 +618,19 @@ discard block |
||
618 | 618 | * @param bool $echo |
619 | 619 | * @return string |
620 | 620 | */ |
621 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
622 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
623 | - if ( $echo ) { |
|
624 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
621 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
622 | + EE_Registry::instance()->load_helper('Event_View'); |
|
623 | + if ($echo) { |
|
624 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
625 | 625 | return ''; |
626 | 626 | } |
627 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
627 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
628 | 628 | } |
629 | 629 | } |
630 | 630 | |
631 | 631 | |
632 | 632 | |
633 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
633 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
634 | 634 | /** |
635 | 635 | * espresso_event_has_content_or_excerpt |
636 | 636 | * |
@@ -638,16 +638,16 @@ discard block |
||
638 | 638 | * @param bool $EVT_ID |
639 | 639 | * @return boolean |
640 | 640 | */ |
641 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
642 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
643 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
641 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
642 | + EE_Registry::instance()->load_helper('Event_View'); |
|
643 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | |
647 | 647 | |
648 | 648 | |
649 | 649 | |
650 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
650 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
651 | 651 | /** |
652 | 652 | * espresso_event_content_or_excerpt |
653 | 653 | * |
@@ -656,19 +656,19 @@ discard block |
||
656 | 656 | * @param bool $echo |
657 | 657 | * @return string |
658 | 658 | */ |
659 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
660 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
661 | - if ( $echo ) { |
|
662 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
659 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
660 | + EE_Registry::instance()->load_helper('Event_View'); |
|
661 | + if ($echo) { |
|
662 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
663 | 663 | return ''; |
664 | 664 | } |
665 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
665 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | |
669 | 669 | |
670 | 670 | |
671 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
671 | +if ( ! function_exists('espresso_event_phone')) { |
|
672 | 672 | /** |
673 | 673 | * espresso_event_phone |
674 | 674 | * |
@@ -676,19 +676,19 @@ discard block |
||
676 | 676 | * @param bool $echo |
677 | 677 | * @return string |
678 | 678 | */ |
679 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
680 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
681 | - if ( $echo ) { |
|
682 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
679 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
680 | + EE_Registry::instance()->load_helper('Event_View'); |
|
681 | + if ($echo) { |
|
682 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
683 | 683 | return ''; |
684 | 684 | } |
685 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
685 | + return EEH_Event_View::event_phone($EVT_ID); |
|
686 | 686 | } |
687 | 687 | } |
688 | 688 | |
689 | 689 | |
690 | 690 | |
691 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
691 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
692 | 692 | /** |
693 | 693 | * espresso_edit_event_link |
694 | 694 | * returns a link to edit an event |
@@ -697,41 +697,41 @@ discard block |
||
697 | 697 | * @param bool $echo |
698 | 698 | * @return string |
699 | 699 | */ |
700 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
701 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
702 | - if ( $echo ) { |
|
703 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
700 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
701 | + EE_Registry::instance()->load_helper('Event_View'); |
|
702 | + if ($echo) { |
|
703 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
704 | 704 | return ''; |
705 | 705 | } |
706 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
706 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
707 | 707 | } |
708 | 708 | } |
709 | 709 | |
710 | 710 | |
711 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
711 | +if ( ! function_exists('espresso_organization_name')) { |
|
712 | 712 | /** |
713 | 713 | * espresso_organization_name |
714 | 714 | * @param bool $echo |
715 | 715 | * @return string |
716 | 716 | */ |
717 | 717 | function espresso_organization_name($echo = TRUE) { |
718 | - if($echo){ |
|
719 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
718 | + if ($echo) { |
|
719 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
720 | 720 | return ''; |
721 | 721 | } |
722 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
722 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
723 | 723 | } |
724 | 724 | } |
725 | 725 | |
726 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
726 | +if ( ! function_exists('espresso_organization_address')) { |
|
727 | 727 | /** |
728 | 728 | * espresso_organization_address |
729 | 729 | * @param string $type |
730 | 730 | * @return string |
731 | 731 | */ |
732 | - function espresso_organization_address( $type = 'inline' ) { |
|
733 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
734 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
732 | + function espresso_organization_address($type = 'inline') { |
|
733 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
734 | + EE_Registry::instance()->load_helper('Formatter'); |
|
735 | 735 | $address = new EE_Generic_Address( |
736 | 736 | EE_Registry::instance()->CFG->organization->address_1, |
737 | 737 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -740,129 +740,129 @@ discard block |
||
740 | 740 | EE_Registry::instance()->CFG->organization->zip, |
741 | 741 | EE_Registry::instance()->CFG->organization->CNT_ISO |
742 | 742 | ); |
743 | - return EEH_Address::format( $address, $type ); |
|
743 | + return EEH_Address::format($address, $type); |
|
744 | 744 | } |
745 | 745 | return ''; |
746 | 746 | } |
747 | 747 | } |
748 | 748 | |
749 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
749 | +if ( ! function_exists('espresso_organization_email')) { |
|
750 | 750 | /** |
751 | 751 | * espresso_organization_email |
752 | 752 | * @param bool $echo |
753 | 753 | * @return string |
754 | 754 | */ |
755 | - function espresso_organization_email( $echo = TRUE ) { |
|
756 | - if($echo){ |
|
757 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
755 | + function espresso_organization_email($echo = TRUE) { |
|
756 | + if ($echo) { |
|
757 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
758 | 758 | return ''; |
759 | 759 | } |
760 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
760 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
761 | 761 | } |
762 | 762 | } |
763 | 763 | |
764 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
764 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
765 | 765 | /** |
766 | 766 | * espresso_organization_logo_url |
767 | 767 | * @param bool $echo |
768 | 768 | * @return string |
769 | 769 | */ |
770 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
771 | - if($echo){ |
|
772 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
770 | + function espresso_organization_logo_url($echo = TRUE) { |
|
771 | + if ($echo) { |
|
772 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
773 | 773 | return ''; |
774 | 774 | } |
775 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
775 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
779 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
779 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
780 | 780 | /** |
781 | 781 | * espresso_organization_facebook |
782 | 782 | * @param bool $echo |
783 | 783 | * @return string |
784 | 784 | */ |
785 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
786 | - if($echo){ |
|
787 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
785 | + function espresso_organization_facebook($echo = TRUE) { |
|
786 | + if ($echo) { |
|
787 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
788 | 788 | return ''; |
789 | 789 | } |
790 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
790 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
791 | 791 | } |
792 | 792 | } |
793 | 793 | |
794 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
794 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
795 | 795 | /** |
796 | 796 | * espresso_organization_twitter |
797 | 797 | * @param bool $echo |
798 | 798 | * @return string |
799 | 799 | */ |
800 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
801 | - if($echo){ |
|
802 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
800 | + function espresso_organization_twitter($echo = TRUE) { |
|
801 | + if ($echo) { |
|
802 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
803 | 803 | return ''; |
804 | 804 | } |
805 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
805 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
809 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
809 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
810 | 810 | /** |
811 | 811 | * espresso_organization_linkedin |
812 | 812 | * @param bool $echo |
813 | 813 | * @return string |
814 | 814 | */ |
815 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
816 | - if($echo){ |
|
817 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
815 | + function espresso_organization_linkedin($echo = TRUE) { |
|
816 | + if ($echo) { |
|
817 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
818 | 818 | return ''; |
819 | 819 | } |
820 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
820 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
824 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
824 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
825 | 825 | /** |
826 | 826 | * espresso_organization_pinterest |
827 | 827 | * @param bool $echo |
828 | 828 | * @return string |
829 | 829 | */ |
830 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
831 | - if($echo){ |
|
832 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
830 | + function espresso_organization_pinterest($echo = TRUE) { |
|
831 | + if ($echo) { |
|
832 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
833 | 833 | return ''; |
834 | 834 | } |
835 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
835 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | |
839 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
839 | +if ( ! function_exists('espresso_organization_google')) { |
|
840 | 840 | /** |
841 | 841 | * espresso_organization_google |
842 | 842 | * @param bool $echo |
843 | 843 | * @return string |
844 | 844 | */ |
845 | - function espresso_organization_google( $echo = TRUE ) { |
|
846 | - if($echo){ |
|
847 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
845 | + function espresso_organization_google($echo = TRUE) { |
|
846 | + if ($echo) { |
|
847 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
848 | 848 | return ''; |
849 | 849 | } |
850 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
850 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
851 | 851 | } |
852 | 852 | } |
853 | 853 | |
854 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
854 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
855 | 855 | /** |
856 | 856 | * espresso_organization_instagram |
857 | 857 | * @param bool $echo |
858 | 858 | * @return string |
859 | 859 | */ |
860 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
861 | - if($echo){ |
|
862 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
860 | + function espresso_organization_instagram($echo = TRUE) { |
|
861 | + if ($echo) { |
|
862 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
863 | 863 | return ''; |
864 | 864 | } |
865 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
865 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
@@ -872,14 +872,14 @@ discard block |
||
872 | 872 | |
873 | 873 | |
874 | 874 | |
875 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
875 | +if ( ! function_exists('espresso_event_venues')) { |
|
876 | 876 | /** |
877 | 877 | * espresso_event_venues |
878 | 878 | * |
879 | 879 | * @return array all venues related to an event |
880 | 880 | */ |
881 | 881 | function espresso_event_venues() { |
882 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
882 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
883 | 883 | return EEH_Venue_View::get_event_venues(); |
884 | 884 | } |
885 | 885 | } |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | |
888 | 888 | |
889 | 889 | |
890 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
890 | +if ( ! function_exists('espresso_venue_id')) { |
|
891 | 891 | /** |
892 | 892 | * espresso_venue_name |
893 | 893 | * |
@@ -895,16 +895,16 @@ discard block |
||
895 | 895 | * @param int $EVT_ID |
896 | 896 | * @return string |
897 | 897 | */ |
898 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
899 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
900 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
898 | + function espresso_venue_id($EVT_ID = 0) { |
|
899 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
900 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
901 | 901 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
902 | 902 | } |
903 | 903 | } |
904 | 904 | |
905 | 905 | |
906 | 906 | |
907 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
907 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
908 | 908 | /** |
909 | 909 | * Return whether a venue is private or not. |
910 | 910 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -913,16 +913,16 @@ discard block |
||
913 | 913 | * |
914 | 914 | * @return bool | null |
915 | 915 | */ |
916 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
917 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
918 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
916 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
917 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
918 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | |
922 | 922 | |
923 | 923 | |
924 | 924 | |
925 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
925 | +if ( ! function_exists('espresso_venue_name')) { |
|
926 | 926 | /** |
927 | 927 | * espresso_venue_name |
928 | 928 | * |
@@ -932,20 +932,20 @@ discard block |
||
932 | 932 | * @param bool $echo |
933 | 933 | * @return string |
934 | 934 | */ |
935 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
936 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
937 | - if($echo){ |
|
938 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
935 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
936 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
937 | + if ($echo) { |
|
938 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
939 | 939 | return ''; |
940 | 940 | } |
941 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
941 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
942 | 942 | } |
943 | 943 | } |
944 | 944 | |
945 | 945 | |
946 | 946 | |
947 | 947 | |
948 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
948 | +if ( ! function_exists('espresso_venue_link')) { |
|
949 | 949 | /** |
950 | 950 | * espresso_venue_link |
951 | 951 | * |
@@ -954,15 +954,15 @@ discard block |
||
954 | 954 | * @param string $text |
955 | 955 | * @return string |
956 | 956 | */ |
957 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
958 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
959 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
957 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
958 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
959 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
960 | 960 | } |
961 | 961 | } |
962 | 962 | |
963 | 963 | |
964 | 964 | |
965 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
965 | +if ( ! function_exists('espresso_venue_description')) { |
|
966 | 966 | /** |
967 | 967 | * espresso_venue_description |
968 | 968 | * |
@@ -971,18 +971,18 @@ discard block |
||
971 | 971 | * @param bool $echo |
972 | 972 | * @return string |
973 | 973 | */ |
974 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
975 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
976 | - if($echo){ |
|
977 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
974 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
975 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
976 | + if ($echo) { |
|
977 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
978 | 978 | return ''; |
979 | 979 | } |
980 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
980 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
981 | 981 | } |
982 | 982 | } |
983 | 983 | |
984 | 984 | |
985 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
985 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
986 | 986 | /** |
987 | 987 | * espresso_venue_excerpt |
988 | 988 | * |
@@ -991,19 +991,19 @@ discard block |
||
991 | 991 | * @param bool $echo |
992 | 992 | * @return string |
993 | 993 | */ |
994 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
995 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
996 | - if ( $echo ) { |
|
997 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID, $echo ); |
|
994 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
995 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
996 | + if ($echo) { |
|
997 | + echo EEH_Venue_View::venue_excerpt($VNU_ID, $echo); |
|
998 | 998 | return ''; |
999 | 999 | } |
1000 | - return EEH_Venue_View::venue_excerpt( $VNU_ID, $echo ); |
|
1000 | + return EEH_Venue_View::venue_excerpt($VNU_ID, $echo); |
|
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | |
1005 | 1005 | |
1006 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
1006 | +if ( ! function_exists('espresso_venue_categories')) { |
|
1007 | 1007 | /** |
1008 | 1008 | * espresso_venue_categories |
1009 | 1009 | * returns the terms associated with a venue |
@@ -1013,18 +1013,18 @@ discard block |
||
1013 | 1013 | * @param bool $echo |
1014 | 1014 | * @return string |
1015 | 1015 | */ |
1016 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
1017 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1018 | - if ( $echo ) { |
|
1019 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1016 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
1017 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1018 | + if ($echo) { |
|
1019 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1020 | 1020 | return ''; |
1021 | 1021 | } |
1022 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1022 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1023 | 1023 | } |
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | |
1027 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
1027 | +if ( ! function_exists('espresso_venue_address')) { |
|
1028 | 1028 | /** |
1029 | 1029 | * espresso_venue_address |
1030 | 1030 | * returns a formatted block of html for displaying a venue's address |
@@ -1034,18 +1034,18 @@ discard block |
||
1034 | 1034 | * @param bool $echo |
1035 | 1035 | * @return string |
1036 | 1036 | */ |
1037 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1038 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1039 | - if ( $echo ) { |
|
1040 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1037 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1038 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1039 | + if ($echo) { |
|
1040 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1041 | 1041 | return ''; |
1042 | 1042 | } |
1043 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1043 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | |
1048 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
1048 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1049 | 1049 | /** |
1050 | 1050 | * espresso_venue_address |
1051 | 1051 | * returns an UN-formatted string containing a venue's address |
@@ -1055,18 +1055,18 @@ discard block |
||
1055 | 1055 | * @param bool $echo |
1056 | 1056 | * @return string |
1057 | 1057 | */ |
1058 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1059 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1060 | - if ( $echo ) { |
|
1061 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1058 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1059 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1060 | + if ($echo) { |
|
1061 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1062 | 1062 | return ''; |
1063 | 1063 | } |
1064 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1064 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | |
1069 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
1069 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1070 | 1070 | /** |
1071 | 1071 | * espresso_venue_has_address |
1072 | 1072 | * returns TRUE or FALSE if a Venue has address information |
@@ -1074,14 +1074,14 @@ discard block |
||
1074 | 1074 | * @param int $VNU_ID |
1075 | 1075 | * @return bool |
1076 | 1076 | */ |
1077 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
1078 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1079 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
1077 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
1078 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1079 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1080 | 1080 | } |
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | |
1084 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
1084 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1085 | 1085 | /** |
1086 | 1086 | * espresso_venue_gmap |
1087 | 1087 | * returns a google map for the venue address |
@@ -1092,18 +1092,18 @@ discard block |
||
1092 | 1092 | * @param bool $echo |
1093 | 1093 | * @return string |
1094 | 1094 | */ |
1095 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
1096 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1097 | - if ( $echo ) { |
|
1098 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1095 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
1096 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1097 | + if ($echo) { |
|
1098 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1099 | 1099 | return ''; |
1100 | 1100 | } |
1101 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1101 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1102 | 1102 | } |
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | |
1106 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
1106 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1107 | 1107 | /** |
1108 | 1108 | * espresso_venue_phone |
1109 | 1109 | * |
@@ -1111,19 +1111,19 @@ discard block |
||
1111 | 1111 | * @param bool $echo |
1112 | 1112 | * @return string |
1113 | 1113 | */ |
1114 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
1115 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1116 | - if ( $echo ) { |
|
1117 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1114 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
1115 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1116 | + if ($echo) { |
|
1117 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
1118 | 1118 | return ''; |
1119 | 1119 | } |
1120 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1120 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | |
1125 | 1125 | |
1126 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
1126 | +if ( ! function_exists('espresso_venue_website')) { |
|
1127 | 1127 | /** |
1128 | 1128 | * espresso_venue_website |
1129 | 1129 | * |
@@ -1131,19 +1131,19 @@ discard block |
||
1131 | 1131 | * @param bool $echo |
1132 | 1132 | * @return string |
1133 | 1133 | */ |
1134 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
1135 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1136 | - if ( $echo ) { |
|
1137 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1134 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
1135 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1136 | + if ($echo) { |
|
1137 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
1138 | 1138 | return ''; |
1139 | 1139 | } |
1140 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1140 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1141 | 1141 | } |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
1145 | 1145 | |
1146 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
1146 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1147 | 1147 | /** |
1148 | 1148 | * espresso_edit_venue_link |
1149 | 1149 | * |
@@ -1151,13 +1151,13 @@ discard block |
||
1151 | 1151 | * @param bool $echo |
1152 | 1152 | * @return string |
1153 | 1153 | */ |
1154 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
1155 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
1156 | - if($echo){ |
|
1157 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1154 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
1155 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1156 | + if ($echo) { |
|
1157 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1158 | 1158 | return ''; |
1159 | 1159 | } |
1160 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1160 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 |
@@ -229,7 +229,7 @@ |
||
229 | 229 | * |
230 | 230 | * @access public |
231 | 231 | * @param string $event_list_css |
232 | - * @return array |
|
232 | + * @return string |
|
233 | 233 | */ |
234 | 234 | public function event_list_css( $event_list_css = '' ) { |
235 | 235 | $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | * @param WP $WP |
51 | 51 | * @return void |
52 | 52 | */ |
53 | - public function run( WP $WP ) { |
|
54 | - if ( ! did_action( 'pre_get_posts' )) { |
|
53 | + public function run(WP $WP) { |
|
54 | + if ( ! did_action('pre_get_posts')) { |
|
55 | 55 | // this will trigger the EED_Events_Archive module's event_list() method during the pre_get_posts hook point, |
56 | 56 | // this allows us to initialize things, enqueue assets, etc, |
57 | 57 | // as well, this saves an instantiation of the module in an array using 'espresso_events' as the key, so that we can retrieve it |
58 | - add_action( 'pre_get_posts', array( EED_Events_Archive::instance(), 'event_list' )); |
|
58 | + add_action('pre_get_posts', array(EED_Events_Archive::instance(), 'event_list')); |
|
59 | 59 | } else { |
60 | 60 | EED_Events_Archive::instance()->event_list(); |
61 | 61 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | * @param array $attributes |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public function process_shortcode( $attributes = array() ) { |
|
82 | + public function process_shortcode($attributes = array()) { |
|
83 | 83 | // make sure EED_Events_Archive is setup properly |
84 | - if ( apply_filters( 'FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE )) { |
|
84 | + if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE)) { |
|
85 | 85 | EED_Events_Archive::instance()->event_list(); |
86 | 86 | } |
87 | 87 | // merge in any attributes passed via fallback shortcode processor |
88 | - $attributes = array_merge( (array)$attributes, (array)$this->_attributes ); |
|
88 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
89 | 89 | //set default attributes |
90 | 90 | $default_espresso_events_shortcode_atts = array( |
91 | 91 | 'title' => NULL, |
@@ -99,26 +99,26 @@ discard block |
||
99 | 99 | 'fallback_shortcode_processor' => FALSE |
100 | 100 | ); |
101 | 101 | // allow the defaults to be filtered |
102 | - $default_espresso_events_shortcode_atts = apply_filters( 'EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts ); |
|
102 | + $default_espresso_events_shortcode_atts = apply_filters('EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts); |
|
103 | 103 | // grab attributes and merge with defaults, then extract |
104 | - $attributes = array_merge( $default_espresso_events_shortcode_atts, $attributes ); |
|
104 | + $attributes = array_merge($default_espresso_events_shortcode_atts, $attributes); |
|
105 | 105 | // make sure we use the_excerpt() |
106 | - add_filter( 'FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true' ); |
|
106 | + add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true'); |
|
107 | 107 | // apply query filters |
108 | - add_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
108 | + add_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
109 | 109 | // run the query |
110 | 110 | global $wp_query; |
111 | - $wp_query = new EE_Event_List_Query( $attributes ); |
|
111 | + $wp_query = new EE_Event_List_Query($attributes); |
|
112 | 112 | // check what template is loaded and load filters accordingly |
113 | - EED_Events_Archive::instance()->template_include( 'loop-espresso_events.php' ); |
|
113 | + EED_Events_Archive::instance()->template_include('loop-espresso_events.php'); |
|
114 | 114 | // load our template |
115 | - $event_list = EEH_Template::locate_template( 'loop-espresso_events.php', array(), TRUE, TRUE ); |
|
115 | + $event_list = EEH_Template::locate_template('loop-espresso_events.php', array(), TRUE, TRUE); |
|
116 | 116 | // now reset the query and postdata |
117 | 117 | wp_reset_query(); |
118 | 118 | wp_reset_postdata(); |
119 | 119 | EED_Events_Archive::remove_all_events_archive_filters(); |
120 | 120 | // remove query filters |
121 | - remove_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' ); |
|
121 | + remove_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true'); |
|
122 | 122 | // pull our content from the output buffer and return it |
123 | 123 | return $event_list; |
124 | 124 | } |
@@ -163,46 +163,46 @@ discard block |
||
163 | 163 | * @param array $args |
164 | 164 | * @return \EE_Event_List_Query |
165 | 165 | */ |
166 | - function __construct( $args = array() ) { |
|
166 | + function __construct($args = array()) { |
|
167 | 167 | // EEH_Debug_Tools::printr( $args, '$args <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
168 | 168 | // incoming args could be a mix of WP query args + EE shortcode args |
169 | - foreach ( $args as $key =>$value ) { |
|
170 | - $property = '_' . $key; |
|
169 | + foreach ($args as $key =>$value) { |
|
170 | + $property = '_'.$key; |
|
171 | 171 | // if the arg is a property of this class, then it's an EE shortcode arg |
172 | - if ( property_exists( $this, $property )) { |
|
172 | + if (property_exists($this, $property)) { |
|
173 | 173 | // set the property value |
174 | 174 | $this->$property = $value; |
175 | 175 | // then remove it from the array of args that will later be passed to WP_Query() |
176 | - unset( $args[ $key ] ); |
|
176 | + unset($args[$key]); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | // setup the events list query |
180 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
180 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
181 | 181 | //add query filters |
182 | 182 | EEH_Event_Query::add_query_filters(); |
183 | 183 | // set params that will get used by the filters |
184 | - EEH_Event_Query::set_query_params( $this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort ); |
|
184 | + EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort); |
|
185 | 185 | // first off, let's remove any filters from previous queries |
186 | - remove_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' )); |
|
187 | - remove_all_filters( 'FHEE__content_espresso_events__event_class' ); |
|
186 | + remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title')); |
|
187 | + remove_all_filters('FHEE__content_espresso_events__event_class'); |
|
188 | 188 | // Event List Title ? |
189 | - add_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' ), 10, 1 ); |
|
189 | + add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1); |
|
190 | 190 | // add the css class |
191 | - add_filter( 'FHEE__content_espresso_events__event_class', array( $this, 'event_list_css' ), 10, 1 ); |
|
191 | + add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1); |
|
192 | 192 | // the current "page" we are viewing |
193 | - $paged = max( 1, get_query_var( 'paged' )); |
|
193 | + $paged = max(1, get_query_var('paged')); |
|
194 | 194 | // Force these args |
195 | - $args = array_merge( $args, array( |
|
195 | + $args = array_merge($args, array( |
|
196 | 196 | 'post_type' => 'espresso_events', |
197 | 197 | 'posts_per_page' => $this->_limit, |
198 | 198 | 'update_post_term_cache' => FALSE, |
199 | 199 | 'update_post_meta_cache' => FALSE, |
200 | 200 | 'paged' => $paged, |
201 | - 'offset' => ( $paged - 1 ) * $this->_limit |
|
201 | + 'offset' => ($paged - 1) * $this->_limit |
|
202 | 202 | )); |
203 | 203 | |
204 | 204 | // run the query |
205 | - parent::__construct( $args ); |
|
205 | + parent::__construct($args); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param string $event_list_title |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public function event_list_title( $event_list_title = '' ) { |
|
219 | - if ( ! empty( $this->_title )) { |
|
218 | + public function event_list_title($event_list_title = '') { |
|
219 | + if ( ! empty($this->_title)) { |
|
220 | 220 | return $this->_title; |
221 | 221 | } |
222 | 222 | return $event_list_title; |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | * @param string $event_list_css |
232 | 232 | * @return array |
233 | 233 | */ |
234 | - public function event_list_css( $event_list_css = '' ) { |
|
235 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
236 | - $event_list_css .= ! empty( $this->_css_class ) ? $this->_css_class : ''; |
|
237 | - $event_list_css .= ! empty( $event_list_css ) ? ' ' : ''; |
|
238 | - $event_list_css .= ! empty( $this->_category_slug ) ? $this->_category_slug : ''; |
|
234 | + public function event_list_css($event_list_css = '') { |
|
235 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
236 | + $event_list_css .= ! empty($this->_css_class) ? $this->_css_class : ''; |
|
237 | + $event_list_css .= ! empty($event_list_css) ? ' ' : ''; |
|
238 | + $event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : ''; |
|
239 | 239 | return $event_list_css; |
240 | 240 | } |
241 | 241 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -56,7 +56,7 @@ |
||
56 | 56 | * |
57 | 57 | * @access public |
58 | 58 | * @param array $attributes |
59 | - * @return void |
|
59 | + * @return string |
|
60 | 60 | */ |
61 | 61 | public function process_shortcode( $attributes = array() ) { |
62 | 62 | extract( $attributes ); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @access public |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public function run( WP $WP ) { |
|
51 | + public function run(WP $WP) { |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | * @param array $attributes |
59 | 59 | * @return void |
60 | 60 | */ |
61 | - public function process_shortcode( $attributes = array() ) { |
|
62 | - extract( $attributes ); |
|
63 | - $event = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $event_id ); |
|
61 | + public function process_shortcode($attributes = array()) { |
|
62 | + extract($attributes); |
|
63 | + $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id); |
|
64 | 64 | ob_start(); |
65 | - do_action( 'AHEE_event_details_before_post', $event_id ); |
|
66 | - espresso_ticket_selector( $event ); |
|
67 | - do_action( 'AHEE_event_details_after_post' ); |
|
65 | + do_action('AHEE_event_details_before_post', $event_id); |
|
66 | + espresso_ticket_selector($event); |
|
67 | + do_action('AHEE_event_details_after_post'); |
|
68 | 68 | return ob_get_clean(); |
69 | 69 | } |
70 | 70 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | //Copied from _whats_new() |
118 | 118 | $steps = EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ? $this->_get_started_steps() : FALSE; |
119 | 119 | $steps = $steps !== FALSE ? $steps : ''; |
120 | - $this->_admin_page_title = sprintf( __('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION ); |
|
120 | + $this->_admin_page_title = sprintf(__('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); |
|
121 | 121 | $settings_message = $steps; |
122 | - $this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso' ) . $settings_message; |
|
123 | - $template = EE_ABOUT_TEMPLATE_PATH . 'ee4-overview.template.php'; |
|
124 | - $this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE ); |
|
122 | + $this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso').$settings_message; |
|
123 | + $template = EE_ABOUT_TEMPLATE_PATH.'ee4-overview.template.php'; |
|
124 | + $this->_template_args['about_admin_page_content'] = EEH_Template::display_template($template, $this->_template_args, TRUE); |
|
125 | 125 | $this->display_about_admin_page(); |
126 | 126 | } |
127 | 127 | |
@@ -129,36 +129,36 @@ discard block |
||
129 | 129 | |
130 | 130 | protected function _get_started_steps() { |
131 | 131 | $steps = '<h3>'.__('Getting Started').'</h3>'; |
132 | - $step_one = '<p>'.sprintf( __('%sStep 1%s: Visit your %sOrganization Settings%s and add/update your details.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_general_settings">', '</a>') .'</strong></p>'; |
|
133 | - $step_two = '<p>'.sprintf( __('%sStep 2%s: Setup your %sPayment Methods%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_payment_settings">', '</a>') .'</strong></p>'; |
|
134 | - $step_three = '<p>'.sprintf( __('%sStep 3%s: Create your %sFirst Event%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_events&action=create_new">', '</a>') .'</strong></p>'; |
|
132 | + $step_one = '<p>'.sprintf(__('%sStep 1%s: Visit your %sOrganization Settings%s and add/update your details.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_general_settings">', '</a>').'</strong></p>'; |
|
133 | + $step_two = '<p>'.sprintf(__('%sStep 2%s: Setup your %sPayment Methods%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_payment_settings">', '</a>').'</strong></p>'; |
|
134 | + $step_three = '<p>'.sprintf(__('%sStep 3%s: Create your %sFirst Event%s.', 'event_espresso'), '<strong>', '</strong>', '<a href="admin.php?page=espresso_events&action=create_new">', '</a>').'</strong></p>'; |
|
135 | 135 | |
136 | 136 | //done? |
137 | 137 | $done_step_one = EE_Registry::instance()->CFG->organization->address_1 == '123 Onna Road' ? FALSE : TRUE; |
138 | - $active_invoice_pm = EEM_Payment_Method::instance()->get_one_active( EEM_Payment_Method::scope_cart, array( array( 'PMD_type' => 'Invoice' ) ) ); |
|
139 | - $active_pms_count = EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ); |
|
138 | + $active_invoice_pm = EEM_Payment_Method::instance()->get_one_active(EEM_Payment_Method::scope_cart, array(array('PMD_type' => 'Invoice'))); |
|
139 | + $active_pms_count = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
140 | 140 | //done step two if a non-invoice paymetn method is active; or there is more than one PM active, or |
141 | 141 | //if only teh invoice is active but it's clearly been updated |
142 | - $done_step_two = $active_pms_count > 1 || |
|
143 | - ( $active_pms_count === 1 && ! $active_invoice_pm ) || |
|
144 | - ( $active_invoice_pm instanceof EE_Payment_Method && ( |
|
145 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_name', TRUE, '' ) || |
|
146 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_email', TRUE, '' ) || |
|
147 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_tax_number', TRUE, '' ) || |
|
148 | - $active_invoice_pm->get_extra_meta( 'pdf_payee_address', TRUE, '' ) || |
|
149 | - $active_invoice_pm->get_extra_meta( 'page_extra_info', TRUE, '' ) |
|
142 | + $done_step_two = $active_pms_count > 1 || |
|
143 | + ($active_pms_count === 1 && ! $active_invoice_pm) || |
|
144 | + ($active_invoice_pm instanceof EE_Payment_Method && ( |
|
145 | + $active_invoice_pm->get_extra_meta('pdf_payee_name', TRUE, '') || |
|
146 | + $active_invoice_pm->get_extra_meta('pdf_payee_email', TRUE, '') || |
|
147 | + $active_invoice_pm->get_extra_meta('pdf_payee_tax_number', TRUE, '') || |
|
148 | + $active_invoice_pm->get_extra_meta('pdf_payee_address', TRUE, '') || |
|
149 | + $active_invoice_pm->get_extra_meta('page_extra_info', TRUE, '') |
|
150 | 150 | ) |
151 | 151 | ); |
152 | 152 | $done_step_three = EE_Registry::instance()->load_model('Event')->count() > 0 ? TRUE : FALSE; |
153 | 153 | |
154 | 154 | //if ALL steps are done, let's just return FALSE so we don't display anything |
155 | - if ( $done_step_one && $done_step_two && $done_step_three ) |
|
155 | + if ($done_step_one && $done_step_two && $done_step_three) |
|
156 | 156 | return FALSE; |
157 | 157 | |
158 | 158 | //now let's put it together |
159 | - $steps .= sprintf( '%s' . $step_one . '%s', $done_step_one ? '<strike>' : '', $done_step_one ? '</strike>': '' ); |
|
160 | - $steps .= sprintf( '%s' . $step_two . '%s', $done_step_two ? '<strike>' : '', $done_step_two ? '</strike>': '' ); |
|
161 | - $steps .= sprintf( '%s' . $step_three . '%s', $done_step_three ? '<strike>' : '', $done_step_three ? '</strike>': '' ); |
|
159 | + $steps .= sprintf('%s'.$step_one.'%s', $done_step_one ? '<strike>' : '', $done_step_one ? '</strike>' : ''); |
|
160 | + $steps .= sprintf('%s'.$step_two.'%s', $done_step_two ? '<strike>' : '', $done_step_two ? '</strike>' : ''); |
|
161 | + $steps .= sprintf('%s'.$step_three.'%s', $done_step_three ? '<strike>' : '', $done_step_three ? '</strike>' : ''); |
|
162 | 162 | |
163 | 163 | return $steps; |
164 | 164 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | |
167 | 167 | |
168 | 168 | protected function _credits() { |
169 | - $this->_template_args['admin_page_title'] = sprintf( __('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION ); |
|
169 | + $this->_template_args['admin_page_title'] = sprintf(__('Welcome to Event Espresso %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); |
|
170 | 170 | $this->_template_args['admin_page_subtitle'] = __('Thank you for choosing Event Espresso Decaf, the most powerful, and free, Event Management plugin for WordPress.', 'event_espresso'); |
171 | - $template = EE_ABOUT_TEMPLATE_PATH . 'credits.template.php'; |
|
172 | - $this->_template_args['about_admin_page_content'] = EEH_Template::display_template( $template, $this->_template_args, TRUE ); |
|
171 | + $template = EE_ABOUT_TEMPLATE_PATH.'credits.template.php'; |
|
172 | + $this->_template_args['about_admin_page_content'] = EEH_Template::display_template($template, $this->_template_args, TRUE); |
|
173 | 173 | $this->display_about_admin_page(); |
174 | 174 | } |
175 | 175 |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * |
@@ -152,8 +153,9 @@ discard block |
||
152 | 153 | $done_step_three = EE_Registry::instance()->load_model('Event')->count() > 0 ? TRUE : FALSE; |
153 | 154 | |
154 | 155 | //if ALL steps are done, let's just return FALSE so we don't display anything |
155 | - if ( $done_step_one && $done_step_two && $done_step_three ) |
|
156 | - return FALSE; |
|
156 | + if ( $done_step_one && $done_step_two && $done_step_three ) { |
|
157 | + return FALSE; |
|
158 | + } |
|
157 | 159 | |
158 | 160 | //now let's put it together |
159 | 161 | $steps .= sprintf( '%s' . $step_one . '%s', $done_step_one ? '<strike>' : '', $done_step_one ? '</strike>': '' ); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __construct() { |
32 | 32 | //define some events related constants |
33 | - define( 'EE_ABOUT_PG_SLUG', 'espresso_about' ); |
|
34 | - define( 'EE_ABOUT_LABEL', __('About', 'event_espresso')); |
|
35 | - define( 'EE_ABOUT_ADMIN', EE_ADMIN_PAGES . 'about' . DS ); |
|
36 | - define( 'EE_ABOUT_ADMIN_URL', admin_url( 'admin.php?page=' . EE_ABOUT_PG_SLUG )); |
|
37 | - define( 'EE_ABOUT_TEMPLATE_PATH', EE_ABOUT_ADMIN . 'templates' . DS ); |
|
38 | - define( 'EE_ABOUT_ASSETS_URL', EE_ADMIN_PAGES_URL . 'about/assets/' ); |
|
33 | + define('EE_ABOUT_PG_SLUG', 'espresso_about'); |
|
34 | + define('EE_ABOUT_LABEL', __('About', 'event_espresso')); |
|
35 | + define('EE_ABOUT_ADMIN', EE_ADMIN_PAGES.'about'.DS); |
|
36 | + define('EE_ABOUT_ADMIN_URL', admin_url('admin.php?page='.EE_ABOUT_PG_SLUG)); |
|
37 | + define('EE_ABOUT_TEMPLATE_PATH', EE_ABOUT_ADMIN.'templates'.DS); |
|
38 | + define('EE_ABOUT_ASSETS_URL', EE_ADMIN_PAGES_URL.'about/assets/'); |
|
39 | 39 | parent::__construct(); |
40 | 40 | } |
41 | 41 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | protected function _set_menu_map() { |
47 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
47 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
48 | 48 | 'menu_group' => 'extras', |
49 | 49 | 'menu_order' => 40, |
50 | 50 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN, |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <ul class="wp-people-group" id="ee-people-group-owners"> |
4 | 4 | <li class="wp-person" id="ee-person-sshoultes"> |
5 | 5 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
6 | - <?php echo esp_gravatar_image( '[email protected]', 'Seth Shoultes' ); ?> |
|
6 | + <?php echo esp_gravatar_image('[email protected]', 'Seth Shoultes'); ?> |
|
7 | 7 | </a> |
8 | 8 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
9 | 9 | Seth Shoultes |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | </li> |
13 | 13 | <li class="wp-person" id="ee-person-gkoyle"> |
14 | 14 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
15 | - <?php echo esp_gravatar_image( '[email protected]', 'Garth Koyle' ); ?> |
|
15 | + <?php echo esp_gravatar_image('[email protected]', 'Garth Koyle'); ?> |
|
16 | 16 | </a> |
17 | 17 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
18 | 18 | Garth Koyle |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | <ul class="wp-people-group" id="ee-people-group-core-developers"> |
25 | 25 | <li class="wp-person" id="ee-person-bchristensen"> |
26 | 26 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
27 | - <?php echo esp_gravatar_image( '[email protected]', 'Brent Christensen' ); ?> |
|
27 | + <?php echo esp_gravatar_image('[email protected]', 'Brent Christensen'); ?> |
|
28 | 28 | </a> |
29 | 29 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
30 | 30 | Brent Christensen |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | </li> |
34 | 34 | <li class="wp-person" id="ee-person-dethier"> |
35 | 35 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
36 | - <?php echo esp_gravatar_image( '[email protected]', 'Darren Ethier' ); ?> |
|
36 | + <?php echo esp_gravatar_image('[email protected]', 'Darren Ethier'); ?> |
|
37 | 37 | </a> |
38 | 38 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
39 | 39 | Darren Ethier |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | </li> |
43 | 43 | <li class="wp-person" id="ee-person-mnelson"> |
44 | 44 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
45 | - <?php echo esp_gravatar_image( '[email protected]', 'Michael Nelson' ); ?> |
|
45 | + <?php echo esp_gravatar_image('[email protected]', 'Michael Nelson'); ?> |
|
46 | 46 | </a> |
47 | 47 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
48 | 48 | Michael Nelson |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | </li> |
52 | 52 | <li class="wp-person" id="ee-person-nkolivoshka"> |
53 | 53 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
54 | - <?php echo esp_gravatar_image( '[email protected]', 'Nazar Kolivoshka' ); ?> |
|
54 | + <?php echo esp_gravatar_image('[email protected]', 'Nazar Kolivoshka'); ?> |
|
55 | 55 | </a> |
56 | 56 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
57 | 57 | Nazar Kolivoshka |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | <ul class="wp-people-group" id="ee-people-group-support-staff"> |
64 | 64 | <li class="wp-person" id="ee-person-jfeck"> |
65 | 65 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
66 | - <?php echo esp_gravatar_image( '[email protected]', 'Josh Feck' ); ?> |
|
66 | + <?php echo esp_gravatar_image('[email protected]', 'Josh Feck'); ?> |
|
67 | 67 | </a> |
68 | 68 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
69 | 69 | Josh Feck |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | </li> |
72 | 72 | <li class="wp-person" id="ee-person-drobinson"> |
73 | 73 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
74 | - <?php echo esp_gravatar_image( '[email protected]', 'Dean Robinson' ); ?> |
|
74 | + <?php echo esp_gravatar_image('[email protected]', 'Dean Robinson'); ?> |
|
75 | 75 | </a> |
76 | 76 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
77 | 77 | Dean Robinson |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | </li> |
80 | 80 | <li class="wp-person" id="ee-person-jwilson"> |
81 | 81 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
82 | - <?php echo esp_gravatar_image( '[email protected]', 'Jonathan Wilson' ); ?> |
|
82 | + <?php echo esp_gravatar_image('[email protected]', 'Jonathan Wilson'); ?> |
|
83 | 83 | </a> |
84 | 84 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
85 | 85 | Jonathan Wilson |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | </li> |
88 | 88 | <li class="wp-person" id="ee-person-twarwick"> |
89 | 89 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
90 | - <?php echo esp_gravatar_image( '[email protected]', 'Tony Warwick' ); ?> |
|
90 | + <?php echo esp_gravatar_image('[email protected]', 'Tony Warwick'); ?> |
|
91 | 91 | </a> |
92 | 92 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
93 | 93 | Tony Warwick |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | </li> |
96 | 96 | <li class="wp-person" id="ee-person-lcaum"> |
97 | 97 | <a href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
98 | - <?php echo esp_gravatar_image( '[email protected]', 'Lorenzo Caum' ); ?> |
|
98 | + <?php echo esp_gravatar_image('[email protected]', 'Lorenzo Caum'); ?> |
|
99 | 99 | </a> |
100 | 100 | <a class="web" href="<?php esp_gravatar_profile('[email protected]'); ?>"> |
101 | 101 | Lorenzo Caum |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | </ul> |
106 | 106 | <h4 class="wp-people-group"><?php _e('Contributor Recognition', 'event_espresso'); ?></h4> |
107 | 107 | <p class="description"> |
108 | - <?php printf( __('For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core" title="Contribute to Event Espresso by making a pull request via GitHub">', '</a>' ); ?> |
|
108 | + <?php printf(__('For every major release we want to recognize the people who contributed to the release via a GitHub pull request. Want to see your name listed here? %sWhen you submit a pull request that gets included in a major release%s, we\'ll add your name here linked to your GitHub profile.', 'event_espresso'), '<a href="https://github.com/eventespresso/event-espresso-core" title="Contribute to Event Espresso by making a pull request via GitHub">', '</a>'); ?> |
|
109 | 109 | </p> |
110 | 110 | <p class="wp-credits-list"> |
111 | 111 | <ul> |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | </p> |
120 | 120 | <h4 class="wp-people-group"><?php _e('External Libraries', 'event_espresso'); ?></h4> |
121 | 121 | <p class="description"> |
122 | - <?php printf( __('Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', 'event_espresso'), '<a href="credits.php">', '</a>' ); ?> |
|
122 | + <?php printf(__('Along with the libraries %sincluded with WordPress%s, Event Espresso utilizes the following third party libraries:', 'event_espresso'), '<a href="credits.php">', '</a>'); ?> |
|
123 | 123 | </p> |
124 | 124 | <p class="wp-credits-list"> |
125 | 125 | <a href="http://josscrowcroft.github.io/accounting.js/"><?php _e('accounting.js', 'event_espresso'); ?></a>, |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | |
136 | 136 | <?php |
137 | 137 | function esp_gravatar_profile($email) { |
138 | - echo 'http://www.gravatar.com/' . md5($email); |
|
138 | + echo 'http://www.gravatar.com/'.md5($email); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | function esp_gravatar_image($email, $name) { |
142 | - echo '<img src="http://0.gravatar.com/avatar/' . md5($email) . '?s=60" class="gravatar" alt="' . $name . '"/>'; |
|
142 | + echo '<img src="http://0.gravatar.com/avatar/'.md5($email).'?s=60" class="gravatar" alt="'.$name.'"/>'; |
|
143 | 143 | } |
144 | 144 | ?> |