@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * @param string $CNT_ISO |
426 | 426 | * @param string $STA_ID |
427 | 427 | * @param array $cols_n_values |
428 | - * @return boolean |
|
428 | + * @return boolean|null |
|
429 | 429 | */ |
430 | 430 | public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) { |
431 | 431 | $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE; |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * |
515 | 515 | * @access public |
516 | 516 | * @param EE_State[] $state_options |
517 | - * @return boolean |
|
517 | + * @return EE_State[] |
|
518 | 518 | */ |
519 | 519 | public static function state_options( $state_options = array() ) { |
520 | 520 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
@@ -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 | * |
4 | 6 | * EED_Add_New_State class |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Add_New_State |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | */ |
29 | 29 | public static function set_hooks() { |
30 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
31 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 1 ); |
|
32 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
33 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
34 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
35 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
36 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
30 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
31 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 1); |
|
32 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
33 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
34 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
35 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
36 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | public static function set_hooks_admin() { |
46 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
47 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
48 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
49 | - add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
50 | - add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
51 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
52 | - add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
53 | - add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
54 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
55 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
56 | - add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 ); |
|
46 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
47 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
48 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
49 | + add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
50 | + add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
51 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
52 | + add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
53 | + add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
54 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
55 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
56 | + add_filter('FHEE__Single_Page_Checkout___check_form_submission__request_params', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @return void |
66 | 66 | */ |
67 | 67 | public static function set_definitions() { |
68 | - define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
69 | - define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
68 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
69 | + define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param \WP $WP |
79 | 79 | * @return void |
80 | 80 | */ |
81 | - public function run( $WP ) { |
|
81 | + public function run($WP) { |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @return void |
107 | 107 | */ |
108 | 108 | public static function wp_enqueue_scripts() { |
109 | - wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
110 | - wp_enqueue_script( 'add_new_state' ); |
|
109 | + wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
110 | + wp_enqueue_script('add_new_state'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -120,31 +120,31 @@ discard block |
||
120 | 120 | * @return string |
121 | 121 | */ |
122 | 122 | // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
123 | - public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){ |
|
123 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) { |
|
124 | 124 | // only add the 'new_state_micro_form' when displaying reg forms, |
125 | 125 | // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
126 | - if ( EE_Registry::instance()->REQ->get( 'action', '' ) === 'process_reg_step' ) { |
|
126 | + if (EE_Registry::instance()->REQ->get('action', '') === 'process_reg_step') { |
|
127 | 127 | return $question_group_reg_form; |
128 | 128 | } |
129 | 129 | // is the "state" question in this form section? |
130 | - $input = $question_group_reg_form->get_subsection( 'state' ); |
|
130 | + $input = $question_group_reg_form->get_subsection('state'); |
|
131 | 131 | // we're only doing this for state select inputs |
132 | - if ( $input instanceof EE_State_Select_Input ) { |
|
132 | + if ($input instanceof EE_State_Select_Input) { |
|
133 | 133 | // load helpers |
134 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
134 | + EE_Registry::instance()->load_helper('HTML'); |
|
135 | 135 | // load JS |
136 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 ); |
|
136 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
137 | 137 | // grab any set values from the request |
138 | - $country_name = str_replace( 'state', 'new_state_country', $input->html_name() ); |
|
139 | - $state_name = str_replace( 'state', 'new_state_name', $input->html_name() ); |
|
140 | - $abbrv_name = str_replace( 'state', 'new_state_abbrv', $input->html_name() ); |
|
141 | - $new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() ); |
|
138 | + $country_name = str_replace('state', 'new_state_country', $input->html_name()); |
|
139 | + $state_name = str_replace('state', 'new_state_name', $input->html_name()); |
|
140 | + $abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name()); |
|
141 | + $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
142 | 142 | $country_options = array(); |
143 | 143 | $countries = EEM_Country::instance()->get_all_countries(); |
144 | - if ( ! empty( $countries )) { |
|
145 | - foreach( $countries as $country ){ |
|
146 | - if ( $country instanceof EE_Country ) { |
|
147 | - $country_options[ $country->ID() ] = $country->name(); |
|
144 | + if ( ! empty($countries)) { |
|
145 | + foreach ($countries as $country) { |
|
146 | + if ($country instanceof EE_Country) { |
|
147 | + $country_options[$country->ID()] = $country->name(); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | // add hidden input to indicate that a new state is being added |
158 | 158 | 'add_new_state' => new EE_Hidden_Input( |
159 | 159 | array( |
160 | - 'html_name' => str_replace( 'state', 'add_new_state', $input->html_name() ), |
|
161 | - 'html_id' => str_replace( 'state', 'add_new_state', $input->html_id() ), |
|
160 | + 'html_name' => str_replace('state', 'add_new_state', $input->html_name()), |
|
161 | + 'html_id' => str_replace('state', 'add_new_state', $input->html_id()), |
|
162 | 162 | 'default' => 0 |
163 | 163 | ) |
164 | 164 | ), |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | '', |
171 | 171 | __('click here to add a new state/province', 'event_espresso'), |
172 | 172 | '', |
173 | - 'display-' . $input->html_id(), |
|
173 | + 'display-'.$input->html_id(), |
|
174 | 174 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
175 | 175 | '', |
176 | - 'rel="' . $input->html_id() . '"' |
|
176 | + 'rel="'.$input->html_id().'"' |
|
177 | 177 | ) |
178 | 178 | ) |
179 | 179 | ), |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | 'add_new_state_micro_form' =>new EE_Form_Section_HTML( |
182 | 182 | apply_filters( |
183 | 183 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
184 | - EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) . |
|
185 | - EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) . |
|
186 | - EEH_HTML::ul() . |
|
187 | - EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) . |
|
188 | - EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) . |
|
189 | - EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) . |
|
190 | - EEH_HTML::li( __('click the ADD button', 'event_espresso') ) . |
|
184 | + EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;'). |
|
185 | + EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')). |
|
186 | + EEH_HTML::ul(). |
|
187 | + EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')). |
|
188 | + EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')). |
|
189 | + EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')). |
|
190 | + EEH_HTML::li(__('click the ADD button', 'event_espresso')). |
|
191 | 191 | EEH_HTML::ulx() |
192 | 192 | ) |
193 | 193 | ), |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | $country_options, |
197 | 197 | array( |
198 | 198 | 'html_name' => $country_name, |
199 | - 'html_id' => str_replace( 'state', 'new_state_country', $input->html_id() ), |
|
200 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
199 | + 'html_id' => str_replace('state', 'new_state_country', $input->html_id()), |
|
200 | + 'html_class' => $input->html_class().' new-state-country', |
|
201 | 201 | 'html_label_text' => __('New State/Province Country', 'event_espresso'), |
202 | - 'default' => EE_Registry::instance()->REQ->get( $country_name, '' ), |
|
202 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
203 | 203 | 'required' => false |
204 | 204 | ) |
205 | 205 | ), |
@@ -207,23 +207,23 @@ discard block |
||
207 | 207 | 'new_state_name' => new EE_Text_Input( |
208 | 208 | array( |
209 | 209 | 'html_name' => $state_name, |
210 | - 'html_id' => str_replace( 'state', 'new_state_name', $input->html_id() ), |
|
211 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
210 | + 'html_id' => str_replace('state', 'new_state_name', $input->html_id()), |
|
211 | + 'html_class' => $input->html_class().' new-state-state', |
|
212 | 212 | 'html_label_text' => __('New State/Province Name', 'event_espresso'), |
213 | - 'default' => EE_Registry::instance()->REQ->get( $state_name, '' ), |
|
213 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
214 | 214 | 'required' => false |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ), |
|
217 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
218 | 218 | // NEW STATE NAME |
219 | 219 | 'new_state_abbrv' => new EE_Text_Input( |
220 | 220 | array( |
221 | 221 | 'html_name' => $abbrv_name, |
222 | - 'html_id' => str_replace( 'state', 'new_state_abbrv', $input->html_id() ), |
|
223 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
222 | + 'html_id' => str_replace('state', 'new_state_abbrv', $input->html_id()), |
|
223 | + 'html_class' => $input->html_class().' new-state-abbrv', |
|
224 | 224 | 'html_label_text' => __('New State/Province Abbreviation', 'event_espresso'), |
225 | 225 | 'html_other_attributes' => 'size="24"', |
226 | - 'default' => EE_Registry::instance()->REQ->get( $abbrv_name, '' ), |
|
226 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
227 | 227 | 'required' => false |
228 | 228 | ) |
229 | 229 | ), |
@@ -231,26 +231,26 @@ discard block |
||
231 | 231 | 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
232 | 232 | apply_filters( |
233 | 233 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
234 | - EEH_HTML::nbsp(3) . |
|
235 | - EEH_HTML::link( '', __('ADD', 'event_espresso'), '', 'submit-' . $new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="' . $new_state_submit_id . '"' ) |
|
234 | + EEH_HTML::nbsp(3). |
|
235 | + EEH_HTML::link('', __('ADD', 'event_espresso'), '', 'submit-'.$new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="'.$new_state_submit_id.'"') |
|
236 | 236 | ) |
237 | 237 | ), |
238 | 238 | // extra info |
239 | 239 | 'add_new_state_extra' => new EE_Form_Section_HTML( |
240 | 240 | apply_filters( |
241 | 241 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
242 | - EEH_HTML::br(2) . |
|
243 | - EEH_HTML::div( '', '', 'small-text' ) . |
|
244 | - EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) . |
|
245 | - EEH_HTML::br() . |
|
242 | + EEH_HTML::br(2). |
|
243 | + EEH_HTML::div('', '', 'small-text'). |
|
244 | + EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')). |
|
245 | + EEH_HTML::br(). |
|
246 | 246 | sprintf( |
247 | 247 | __('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'), |
248 | - EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' ) |
|
249 | - ) . |
|
250 | - EEH_HTML::divx() . |
|
251 | - EEH_HTML::br() . |
|
252 | - EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="' . $input->html_id() . '"' ) . |
|
253 | - EEH_HTML::divx() . |
|
248 | + EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk') |
|
249 | + ). |
|
250 | + EEH_HTML::divx(). |
|
251 | + EEH_HTML::br(). |
|
252 | + EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="'.$input->html_id().'"'). |
|
253 | + EEH_HTML::divx(). |
|
254 | 254 | EEH_HTML::br(2) |
255 | 255 | ) |
256 | 256 | ) |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | ) |
259 | 259 | ) |
260 | 260 | ); |
261 | - $question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'country' ); |
|
261 | + $question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'country'); |
|
262 | 262 | } |
263 | 263 | return $question_group_reg_form; |
264 | 264 | } |
@@ -275,41 +275,41 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public static function add_new_state() { |
277 | 277 | $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
278 | - if ( $REQ->is_set( 'add_new_state' ) && $REQ->get( 'add_new_state' ) == 1 ) { |
|
278 | + if ($REQ->is_set('add_new_state') && $REQ->get('add_new_state') == 1) { |
|
279 | 279 | EE_Registry::instance()->load_model('State'); |
280 | 280 | // grab country ISO code, new state name, and new state abbreviation |
281 | - $state_country = $REQ->is_set( 'new_state_country' ) ? sanitize_text_field( $REQ->get( 'new_state_country' )) : FALSE; |
|
282 | - $state_name = $REQ->is_set( 'new_state_name' ) ? sanitize_text_field( $REQ->get( 'new_state_name' )) : FALSE; |
|
283 | - $state_abbr = $REQ->is_set( 'new_state_abbrv' ) ? sanitize_text_field( $REQ->get( 'new_state_abbrv' )) : FALSE; |
|
281 | + $state_country = $REQ->is_set('new_state_country') ? sanitize_text_field($REQ->get('new_state_country')) : FALSE; |
|
282 | + $state_name = $REQ->is_set('new_state_name') ? sanitize_text_field($REQ->get('new_state_name')) : FALSE; |
|
283 | + $state_abbr = $REQ->is_set('new_state_abbrv') ? sanitize_text_field($REQ->get('new_state_abbrv')) : FALSE; |
|
284 | 284 | |
285 | 285 | //echo '<h4>$state_country : ' . $state_country . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
286 | 286 | //echo '<h4>$state_name : ' . $state_name . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
287 | 287 | //echo '<h4>$state_abbr : ' . $state_abbr . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
288 | 288 | |
289 | - if ( $state_country && $state_name && $state_abbr ) { |
|
290 | - $new_state = EED_Add_New_State::save_new_state_to_db( array( |
|
291 | - 'CNT_ISO'=> strtoupper( $state_country ), |
|
292 | - 'STA_abbrev' => strtoupper( $state_abbr ), |
|
293 | - 'STA_name' => ucwords( $state_name ), |
|
289 | + if ($state_country && $state_name && $state_abbr) { |
|
290 | + $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
291 | + 'CNT_ISO'=> strtoupper($state_country), |
|
292 | + 'STA_abbrev' => strtoupper($state_abbr), |
|
293 | + 'STA_name' => ucwords($state_name), |
|
294 | 294 | 'STA_active' => FALSE |
295 | 295 | )); |
296 | 296 | |
297 | - if ( $new_state instanceof EE_State ) { |
|
297 | + if ($new_state instanceof EE_State) { |
|
298 | 298 | // clean house |
299 | - EE_Registry::instance()->REQ->un_set( 'add_new_state' ); |
|
300 | - EE_Registry::instance()->REQ->un_set( 'new_state_country' ); |
|
301 | - EE_Registry::instance()->REQ->un_set( 'new_state_name' ); |
|
302 | - EE_Registry::instance()->REQ->un_set( 'new_state_abbrv' ); |
|
299 | + EE_Registry::instance()->REQ->un_set('add_new_state'); |
|
300 | + EE_Registry::instance()->REQ->un_set('new_state_country'); |
|
301 | + EE_Registry::instance()->REQ->un_set('new_state_name'); |
|
302 | + EE_Registry::instance()->REQ->un_set('new_state_abbrv'); |
|
303 | 303 | |
304 | 304 | // get any existing new states |
305 | 305 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
306 | 306 | 'new_states' |
307 | 307 | ); |
308 | - $new_states[ $new_state->ID() ] = $new_state; |
|
309 | - EE_Registry::instance()->SSN->set_session_data( array( 'new_states' => $new_states )); |
|
308 | + $new_states[$new_state->ID()] = $new_state; |
|
309 | + EE_Registry::instance()->SSN->set_session_data(array('new_states' => $new_states)); |
|
310 | 310 | |
311 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
312 | - echo json_encode( array( |
|
311 | + if (EE_Registry::instance()->REQ->ajax) { |
|
312 | + echo json_encode(array( |
|
313 | 313 | 'success' => TRUE, |
314 | 314 | 'id' => $new_state->ID(), |
315 | 315 | 'name' => $new_state->name(), |
@@ -324,12 +324,12 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | } else { |
327 | - $error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' ); |
|
328 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
329 | - echo json_encode( array( 'error' => $error )); |
|
327 | + $error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso'); |
|
328 | + if (EE_Registry::instance()->REQ->ajax) { |
|
329 | + echo json_encode(array('error' => $error)); |
|
330 | 330 | exit(); |
331 | 331 | } else { |
332 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
332 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | } |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | * @param array $request_params |
348 | 348 | * @return void |
349 | 349 | */ |
350 | - public static function filter_checkout_request_params ( $request_params ) { |
|
351 | - foreach ( $request_params as $form_section ) { |
|
352 | - if ( is_array( $form_section )) { |
|
353 | - EED_Add_New_State::unset_new_state_request_params( $form_section ); |
|
354 | - EED_Add_New_State::filter_checkout_request_params( $form_section ); |
|
350 | + public static function filter_checkout_request_params($request_params) { |
|
351 | + foreach ($request_params as $form_section) { |
|
352 | + if (is_array($form_section)) { |
|
353 | + EED_Add_New_State::unset_new_state_request_params($form_section); |
|
354 | + EED_Add_New_State::filter_checkout_request_params($form_section); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | } |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | * @param array $request_params |
366 | 366 | * @return boolean |
367 | 367 | */ |
368 | - public static function unset_new_state_request_params ( $request_params ) { |
|
369 | - unset( $request_params['new_state_micro_form'] ); |
|
370 | - unset( $request_params['add_new_state'] ); |
|
371 | - unset( $request_params['new_state_country'] ); |
|
372 | - unset( $request_params['new_state_name'] ); |
|
373 | - unset( $request_params['new_state_abbrv'] ); |
|
368 | + public static function unset_new_state_request_params($request_params) { |
|
369 | + unset($request_params['new_state_micro_form']); |
|
370 | + unset($request_params['add_new_state']); |
|
371 | + unset($request_params['new_state_country']); |
|
372 | + unset($request_params['new_state_name']); |
|
373 | + unset($request_params['new_state_abbrv']); |
|
374 | 374 | return $request_params; |
375 | 375 | } |
376 | 376 | |
@@ -383,26 +383,26 @@ discard block |
||
383 | 383 | * @param array $props_n_values |
384 | 384 | * @return boolean |
385 | 385 | */ |
386 | - public static function save_new_state_to_db ( $props_n_values = array() ) { |
|
386 | + public static function save_new_state_to_db($props_n_values = array()) { |
|
387 | 387 | // EEH_Debug_Tools::printr( $props_n_values, '$props_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
388 | - $existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 )); |
|
389 | - if ( ! empty( $existing_state )) { |
|
390 | - return array_pop( $existing_state ); |
|
388 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
389 | + if ( ! empty($existing_state)) { |
|
390 | + return array_pop($existing_state); |
|
391 | 391 | } |
392 | - $new_state = EE_State::new_instance( $props_n_values ); |
|
393 | - if ( $new_state instanceof EE_State ) { |
|
392 | + $new_state = EE_State::new_instance($props_n_values); |
|
393 | + if ($new_state instanceof EE_State) { |
|
394 | 394 | // if not non-ajax admin |
395 | - $new_state_key = $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
395 | + $new_state_key = $new_state->country_iso().'-'.$new_state->abbrev(); |
|
396 | 396 | $new_state_notice = sprintf( |
397 | - __( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State |
|
398 | - added to dropdown select lists in forms.', 'event_espresso' ), |
|
399 | - '<b>' . $new_state->name() . '</b>', |
|
400 | - '<b>' . $new_state->abbrev() . '</b>', |
|
401 | - '<b>' . $new_state->country()->name() . '</b>', |
|
402 | - '<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>', |
|
397 | + __('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State |
|
398 | + added to dropdown select lists in forms.', 'event_espresso'), |
|
399 | + '<b>'.$new_state->name().'</b>', |
|
400 | + '<b>'.$new_state->abbrev().'</b>', |
|
401 | + '<b>'.$new_state->country()->name().'</b>', |
|
402 | + '<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>', |
|
403 | 403 | '<br />' |
404 | 404 | ); |
405 | - EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice ); |
|
405 | + EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
406 | 406 | $new_state->save(); |
407 | 407 | EEM_State::instance()->reset_cached_states(); |
408 | 408 | return $new_state; |
@@ -421,22 +421,22 @@ discard block |
||
421 | 421 | * @param array $cols_n_values |
422 | 422 | * @return boolean |
423 | 423 | */ |
424 | - public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) { |
|
425 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE; |
|
426 | - if ( ! $CNT_ISO ) { |
|
427 | - EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
424 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) { |
|
425 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE; |
|
426 | + if ( ! $CNT_ISO) { |
|
427 | + EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
428 | 428 | } |
429 | - $STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
430 | - if ( ! $STA_abbrev && ! empty( $STA_ID )) { |
|
431 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
432 | - if ( $state instanceof EE_State ) { |
|
429 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
430 | + if ( ! $STA_abbrev && ! empty($STA_ID)) { |
|
431 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
432 | + if ($state instanceof EE_State) { |
|
433 | 433 | $STA_abbrev = $state->abbrev(); |
434 | 434 | } |
435 | 435 | } |
436 | - if ( ! $STA_abbrev ) { |
|
437 | - EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
436 | + if ( ! $STA_abbrev) { |
|
437 | + EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
438 | 438 | } |
439 | - EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE ); |
|
439 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -448,17 +448,17 @@ discard block |
||
448 | 448 | * @param EE_State[] $state_options |
449 | 449 | * @return boolean |
450 | 450 | */ |
451 | - public static function state_options( $state_options = array() ) { |
|
451 | + public static function state_options($state_options = array()) { |
|
452 | 452 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
453 | 453 | 'new_states' |
454 | 454 | ); |
455 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
456 | - foreach ( $new_states as $new_state ) { |
|
455 | + if (is_array($new_states) && ! empty($new_states)) { |
|
456 | + foreach ($new_states as $new_state) { |
|
457 | 457 | if ( |
458 | 458 | $new_state instanceof EE_State |
459 | 459 | && $new_state->country() instanceof EE_Country |
460 | 460 | ) { |
461 | - $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name(); |
|
461 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
@@ -474,17 +474,17 @@ discard block |
||
474 | 474 | * @param EE_Country[] $country_options |
475 | 475 | * @return boolean |
476 | 476 | */ |
477 | - public static function country_options( $country_options = array() ) { |
|
477 | + public static function country_options($country_options = array()) { |
|
478 | 478 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
479 | 479 | 'new_states' |
480 | 480 | ); |
481 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
482 | - foreach ( $new_states as $new_state ) { |
|
481 | + if (is_array($new_states) && ! empty($new_states)) { |
|
482 | + foreach ($new_states as $new_state) { |
|
483 | 483 | if ( |
484 | 484 | $new_state instanceof EE_State |
485 | 485 | && $new_state->country() instanceof EE_Country |
486 | 486 | ) { |
487 | - $country_options[ $new_state->country()->ID() ] = $new_state->country()->name(); |
|
487 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
@@ -112,7 +112,7 @@ |
||
112 | 112 | * the_content |
113 | 113 | * |
114 | 114 | * @access public |
115 | - * @return void |
|
115 | + * @return string |
|
116 | 116 | */ |
117 | 117 | public function the_content( $content ) { |
118 | 118 | $content .= $this->ouput; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Module |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @access public |
61 | 61 | * @return void |
62 | 62 | */ |
63 | - public function run( $WP ) { |
|
63 | + public function run($WP) { |
|
64 | 64 | // add_filter( 'FHEE_load_ee_config', '__return_true' ); |
65 | 65 | // add_filter( 'FHEE_run_EE_wp', '__return_true' ); |
66 | 66 | // add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public function certificate_launch() { |
82 | - if ( EE_Registry::instance()->REQ->is_set( 'id' ) && EE_Registry::instance()->REQ->is_set( 'r_id' )) { |
|
83 | - echo espresso_certificate_launch( EE_Registry::instance()->REQ->get( 'id' ), EE_Registry::instance()->REQ->get( 'r_id' )); |
|
82 | + if (EE_Registry::instance()->REQ->is_set('id') && EE_Registry::instance()->REQ->is_set('r_id')) { |
|
83 | + echo espresso_certificate_launch(EE_Registry::instance()->REQ->get('id'), EE_Registry::instance()->REQ->get('r_id')); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @access public |
115 | 115 | * @return void |
116 | 116 | */ |
117 | - public function the_content( $content ) { |
|
117 | + public function the_content($content) { |
|
118 | 118 | $content .= $this->ouput; |
119 | 119 | return $content; |
120 | 120 | } |
@@ -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 | * |
@@ -495,7 +495,7 @@ |
||
495 | 495 | * display_description |
496 | 496 | * |
497 | 497 | * @access public |
498 | - * @param $value |
|
498 | + * @param integer $value |
|
499 | 499 | * @return bool |
500 | 500 | */ |
501 | 501 | public static function display_description( $value ) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return EED_Events_Archive |
34 | 34 | */ |
35 | 35 | public static function instance() { |
36 | - return parent::get_instance( __CLASS__ ); |
|
36 | + return parent::get_instance(__CLASS__); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | public static function set_hooks() { |
48 | - EE_Config::register_route( __( 'events', 'event_espresso' ), 'Events_Archive', 'run' ); |
|
49 | - EE_Config::register_route( 'event_list', 'Events_Archive', 'event_list' ); |
|
50 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
48 | + EE_Config::register_route(__('events', 'event_espresso'), 'Events_Archive', 'run'); |
|
49 | + EE_Config::register_route('event_list', 'Events_Archive', 'event_list'); |
|
50 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return void |
58 | 58 | */ |
59 | 59 | public static function set_hooks_admin() { |
60 | - add_action( 'wp_loaded', array( 'EED_Events_Archive', 'set_definitions' ), 2 ); |
|
60 | + add_action('wp_loaded', array('EED_Events_Archive', 'set_definitions'), 2); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | public static function set_definitions() { |
73 | - define( 'EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
74 | - define( 'EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
73 | + define('EVENTS_ARCHIVE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
74 | + define('EVENTS_ARCHIVE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return \EE_Events_Archive_Config |
83 | 83 | */ |
84 | - protected function set_config(){ |
|
85 | - $this->set_config_section( 'template_settings' ); |
|
86 | - $this->set_config_class( 'EE_Events_Archive_Config' ); |
|
87 | - $this->set_config_name( 'EED_Events_Archive' ); |
|
84 | + protected function set_config() { |
|
85 | + $this->set_config_section('template_settings'); |
|
86 | + $this->set_config_class('EE_Events_Archive_Config'); |
|
87 | + $this->set_config_name('EED_Events_Archive'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | * @param WP $WP |
97 | 97 | * @return void |
98 | 98 | */ |
99 | - public function run( $WP ) { |
|
100 | - do_action( 'AHEE__EED_Events_Archive__before_run' ); |
|
99 | + public function run($WP) { |
|
100 | + do_action('AHEE__EED_Events_Archive__before_run'); |
|
101 | 101 | // ensure valid EE_Events_Archive_Config() object exists |
102 | 102 | $this->set_config(); |
103 | 103 | // load other required components |
104 | 104 | $this->load_event_list_assets(); |
105 | 105 | // filter the WP posts_join, posts_where, and posts_orderby SQL clauses |
106 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
106 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
107 | 107 | //add query filters |
108 | 108 | EEH_Event_Query::add_query_filters(); |
109 | 109 | // set params that will get used by the filters |
110 | 110 | EEH_Event_Query::set_query_params( |
111 | - '', // month |
|
112 | - '', // category |
|
113 | - $this->config()->display_expired_events, // show_expired |
|
114 | - 'start_date', // orderby |
|
111 | + '', // month |
|
112 | + '', // category |
|
113 | + $this->config()->display_expired_events, // show_expired |
|
114 | + 'start_date', // orderby |
|
115 | 115 | 'ASC' // sort |
116 | 116 | ); |
117 | 117 | // check what template is loaded |
118 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
119 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
118 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
119 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -148,28 +148,28 @@ discard block |
||
148 | 148 | * @param string $template |
149 | 149 | * @return string |
150 | 150 | */ |
151 | - public function template_include( $template = '' ) { |
|
151 | + public function template_include($template = '') { |
|
152 | 152 | // ensure valid EE_Events_Archive_Config() object exists |
153 | 153 | // EED_Events_Archive::_set_config(); |
154 | 154 | // don't add content filter for dedicated EE child themes or private posts |
155 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
156 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
155 | + EE_Registry::instance()->load_helper('Template'); |
|
156 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
157 | 157 | // add status banner ? |
158 | - if ( $this->config()->display_status_banner ) { |
|
159 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
158 | + if ($this->config()->display_status_banner) { |
|
159 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
160 | 160 | } |
161 | 161 | // if NOT a custom template |
162 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
162 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
163 | 163 | // load functions.php file for the theme (loaded by WP if using child theme) |
164 | 164 | EEH_Template::load_espresso_theme_functions(); |
165 | 165 | // because we don't know if the theme is using the_excerpt() |
166 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
166 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
167 | 167 | // or the_content |
168 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
168 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
169 | 169 | // and just in case they are running get_the_excerpt() which DESTROYS things |
170 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
170 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
171 | 171 | // don't display entry meta because the existing theme will take care of that |
172 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
172 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | * @param string $excerpt |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
189 | - if ( post_password_required() ) { |
|
188 | + public static function get_the_excerpt($excerpt = '') { |
|
189 | + if (post_password_required()) { |
|
190 | 190 | return $excerpt; |
191 | 191 | } |
192 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
193 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
194 | - return EED_Events_Archive::event_details( $excerpt ); |
|
192 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
193 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
194 | + return EED_Events_Archive::event_details($excerpt); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | * @param string $id |
205 | 205 | * @return string |
206 | 206 | */ |
207 | - public static function the_title( $title = '', $id = '' ) { |
|
207 | + public static function the_title($title = '', $id = '') { |
|
208 | 208 | global $post; |
209 | - if ( $post instanceof WP_Post ) { |
|
210 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
209 | + if ($post instanceof WP_Post) { |
|
210 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
211 | 211 | } |
212 | 212 | return $title; |
213 | 213 | } |
@@ -221,33 +221,33 @@ discard block |
||
221 | 221 | * @param string $content |
222 | 222 | * @return string |
223 | 223 | */ |
224 | - public static function event_details( $content ) { |
|
224 | + public static function event_details($content) { |
|
225 | 225 | |
226 | 226 | global $post; |
227 | 227 | $template = ''; |
228 | 228 | if ( |
229 | 229 | $post->post_type == 'espresso_events' |
230 | - && ! apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', FALSE ) |
|
230 | + && ! apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', FALSE) |
|
231 | 231 | && ! post_password_required() |
232 | 232 | ) { |
233 | 233 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
234 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
235 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
236 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
234 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
235 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
236 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
237 | 237 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
238 | 238 | EED_Events_Archive::_add_additional_excerpt_filters(); |
239 | 239 | EED_Events_Archive::_add_additional_content_filters(); |
240 | 240 | // now load our template |
241 | - $template = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
241 | + $template = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
242 | 242 | // re-add our main filters (or else the next event won't have them) |
243 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
244 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
245 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
243 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
244 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
245 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
246 | 246 | // but remove the other filters so that they don't get applied to the next post |
247 | 247 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
248 | 248 | } |
249 | 249 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
250 | - return ! empty( $template ) ? $template : $content; |
|
250 | + return ! empty($template) ? $template : $content; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -259,9 +259,9 @@ discard block |
||
259 | 259 | * @return void |
260 | 260 | */ |
261 | 261 | private static function _add_additional_excerpt_filters() { |
262 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
263 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
264 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
262 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
263 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
264 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | * @return void |
274 | 274 | */ |
275 | 275 | private static function _add_additional_content_filters() { |
276 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
277 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
278 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
276 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
277 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
278 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | * @param string $content |
288 | 288 | * @return string |
289 | 289 | */ |
290 | - public static function event_datetimes( $content ) { |
|
291 | - if ( post_password_required() ) { |
|
290 | + public static function event_datetimes($content) { |
|
291 | + if (post_password_required()) { |
|
292 | 292 | return $content; |
293 | 293 | } |
294 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
294 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | * @param string $content |
302 | 302 | * @return string |
303 | 303 | */ |
304 | - public static function event_tickets( $content ) { |
|
305 | - if ( post_password_required() ) { |
|
304 | + public static function event_tickets($content) { |
|
305 | + if (post_password_required()) { |
|
306 | 306 | return $content; |
307 | 307 | } |
308 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
308 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | * @param string $content |
316 | 316 | * @return string |
317 | 317 | */ |
318 | - public static function event_venues( $content ) { |
|
319 | - if ( post_password_required() ) { |
|
318 | + public static function event_venues($content) { |
|
319 | + if (post_password_required()) { |
|
320 | 320 | return $content; |
321 | 321 | } |
322 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
322 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | * @return void |
330 | 330 | */ |
331 | 331 | private static function _remove_additional_events_archive_filters() { |
332 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
333 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
334 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
335 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
336 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
337 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
332 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
333 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
334 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
335 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
336 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
337 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
338 | 338 | } |
339 | 339 | /** |
340 | 340 | * remove_all_events_archive_filters |
@@ -343,18 +343,18 @@ discard block |
||
343 | 343 | * @return void |
344 | 344 | */ |
345 | 345 | public static function remove_all_events_archive_filters() { |
346 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
347 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
348 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
349 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
350 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
351 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
352 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
353 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
354 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
355 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
346 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
347 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
348 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
349 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
350 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
351 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
352 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
353 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
354 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
355 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
356 | 356 | // don't display entry meta because the existing theme will take care of that |
357 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
357 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -369,14 +369,14 @@ discard block |
||
369 | 369 | * @return void |
370 | 370 | */ |
371 | 371 | public function load_event_list_assets() { |
372 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
373 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
374 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
375 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
376 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
377 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
378 | - } |
|
379 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
372 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
373 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
374 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
375 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
376 | + EE_Registry::instance()->load_helper('Maps'); |
|
377 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
378 | + } |
|
379 | + EE_Registry::instance()->load_helper('Event_View'); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | */ |
393 | 393 | public function wp_enqueue_scripts() { |
394 | 394 | // get some style |
395 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
395 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
396 | 396 | // first check uploads folder |
397 | - EE_Registry::instance()->load_helper( 'File' ); |
|
398 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
399 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
397 | + EE_Registry::instance()->load_helper('File'); |
|
398 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
399 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
400 | 400 | } else { |
401 | 401 | } |
402 | - wp_enqueue_style( $this->theme ); |
|
402 | + wp_enqueue_style($this->theme); |
|
403 | 403 | |
404 | 404 | } |
405 | 405 | } |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public static function template_settings_form() { |
419 | 419 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
420 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
421 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
420 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
421 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
422 | 422 | $events_archive_settings = array( |
423 | 423 | 'display_status_banner' => 0, |
424 | 424 | 'display_description' => 1, |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | 'display_venue' => 0, |
428 | 428 | 'display_expired_events' => 0 |
429 | 429 | ); |
430 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
431 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
430 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
431 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
@@ -444,16 +444,16 @@ discard block |
||
444 | 444 | * @param EE_Request_Handler $REQ |
445 | 445 | * @return EE_Template_Config |
446 | 446 | */ |
447 | - public static function update_template_settings( $CFG, $REQ ) { |
|
447 | + public static function update_template_settings($CFG, $REQ) { |
|
448 | 448 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
449 | 449 | // unless we are resetting the config... |
450 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
451 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
452 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
453 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
454 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
455 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
456 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
450 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
451 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
452 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
453 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
454 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
455 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
456 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
457 | 457 | return $CFG; |
458 | 458 | } |
459 | 459 | |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | * @param string $extra_class |
467 | 467 | * @return string |
468 | 468 | */ |
469 | - public static function event_list_css( $extra_class = '' ) { |
|
470 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
469 | + public static function event_list_css($extra_class = '') { |
|
470 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
471 | 471 | $event_list_css[] = 'espresso-event-list-event'; |
472 | - return implode( ' ', $event_list_css ); |
|
472 | + return implode(' ', $event_list_css); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | * @param $value |
497 | 497 | * @return bool |
498 | 498 | */ |
499 | - public static function display_description( $value ) { |
|
499 | + public static function display_description($value) { |
|
500 | 500 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
501 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
501 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
502 | 502 | return $display_description === $value ? TRUE : FALSE; |
503 | 503 | } |
504 | 504 | |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public static function display_ticket_selector() { |
513 | 513 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
514 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
514 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | |
@@ -523,9 +523,9 @@ discard block |
||
523 | 523 | * @return bool |
524 | 524 | */ |
525 | 525 | public static function display_venue() { |
526 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
526 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
527 | 527 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
528 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
528 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public static function display_datetimes() { |
539 | 539 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
540 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
540 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * @return string |
553 | 553 | */ |
554 | 554 | public static function event_list_title() { |
555 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
555 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
556 | 556 | } |
557 | 557 | |
558 | 558 | |
@@ -561,11 +561,11 @@ discard block |
||
561 | 561 | /** |
562 | 562 | * @since 4.4.0 |
563 | 563 | */ |
564 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
564 | + public static function _doing_it_wrong_notice($function = '') { |
|
565 | 565 | EE_Error::doing_it_wrong( |
566 | 566 | __FUNCTION__, |
567 | 567 | sprintf( |
568 | - __( 'EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso' ), |
|
568 | + __('EED_Events_Archive::%1$s was moved to EEH_Event_Query::%1$s:%2$sPlease update your existing code because the method it calls will be removed in version %3$s', 'event_espresso'), |
|
569 | 569 | $function, |
570 | 570 | '<br />', |
571 | 571 | '4.6.0' |
@@ -581,107 +581,107 @@ discard block |
||
581 | 581 | * @since 4.4.0 |
582 | 582 | */ |
583 | 583 | public function get_post_data() { |
584 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
584 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
585 | 585 | EEH_Event_Query::set_query_params(); |
586 | 586 | } |
587 | 587 | /** |
588 | 588 | * @deprecated |
589 | 589 | * @since 4.4.0 |
590 | 590 | */ |
591 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
592 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
593 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
594 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
591 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
592 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
593 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
594 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
595 | 595 | } |
596 | 596 | /** |
597 | 597 | * @deprecated |
598 | 598 | * @since 4.4.0 |
599 | 599 | */ |
600 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
601 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
602 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
603 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
600 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
601 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
602 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
603 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
604 | 604 | } |
605 | 605 | /** |
606 | 606 | * @deprecated |
607 | 607 | * @since 4.4.0 |
608 | 608 | */ |
609 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
610 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
611 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
612 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
609 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
610 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
611 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
612 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
613 | 613 | } |
614 | 614 | /** |
615 | 615 | * @deprecated |
616 | 616 | * @since 4.4.0 |
617 | 617 | */ |
618 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
619 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
620 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
621 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
618 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
619 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
620 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
621 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
622 | 622 | } |
623 | 623 | /** |
624 | 624 | * @deprecated |
625 | 625 | * @since 4.4.0 |
626 | 626 | */ |
627 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
628 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
629 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
630 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
627 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
628 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
629 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
630 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
631 | 631 | } |
632 | 632 | /** |
633 | 633 | * @deprecated |
634 | 634 | * @since 4.4.0 |
635 | 635 | */ |
636 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
637 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
638 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
639 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
636 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
637 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
638 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
639 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
640 | 640 | } |
641 | 641 | /** |
642 | 642 | * @deprecated |
643 | 643 | * @since 4.4.0 |
644 | 644 | */ |
645 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
646 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
647 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
648 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
645 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
646 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
647 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
648 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
649 | 649 | } |
650 | 650 | /** |
651 | 651 | * @deprecated |
652 | 652 | * @since 4.4.0 |
653 | 653 | */ |
654 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
655 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
656 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
657 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
654 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
655 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
656 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
657 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
658 | 658 | } |
659 | 659 | /** |
660 | 660 | * @deprecated |
661 | 661 | * @since 4.4.0 |
662 | 662 | */ |
663 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
664 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
665 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
666 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
663 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
664 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
665 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
666 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
667 | 667 | } |
668 | 668 | /** |
669 | 669 | * @deprecated |
670 | 670 | * @since 4.4.0 |
671 | 671 | */ |
672 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
673 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
674 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
675 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
672 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
673 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
674 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
675 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
676 | 676 | } |
677 | 677 | /** |
678 | 678 | * @deprecated |
679 | 679 | * @since 4.4.0 |
680 | 680 | */ |
681 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
682 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
683 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
684 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
681 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
682 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
683 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
684 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -712,8 +712,8 @@ discard block |
||
712 | 712 | * @param string $extra_class |
713 | 713 | * @return string |
714 | 714 | */ |
715 | -function espresso_event_list_css( $extra_class = '' ) { |
|
716 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
715 | +function espresso_event_list_css($extra_class = '') { |
|
716 | + return EED_Events_Archive::event_list_css($extra_class); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | /** |
@@ -727,14 +727,14 @@ discard block |
||
727 | 727 | * @return bool |
728 | 728 | */ |
729 | 729 | function espresso_display_full_description_in_event_list() { |
730 | - return EED_Events_Archive::display_description( 2 ); |
|
730 | + return EED_Events_Archive::display_description(2); |
|
731 | 731 | } |
732 | 732 | |
733 | 733 | /** |
734 | 734 | * @return bool |
735 | 735 | */ |
736 | 736 | function espresso_display_excerpt_in_event_list() { |
737 | - return EED_Events_Archive::display_description( 1 ); |
|
737 | + return EED_Events_Archive::display_description(1); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | /** |
@@ -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 | * |
@@ -271,6 +271,7 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @access public |
273 | 273 | * @param mixed boolean|string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet |
274 | + * @param string $join_terms |
|
274 | 275 | * @return string |
275 | 276 | */ |
276 | 277 | public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
@@ -423,7 +424,7 @@ discard block |
||
423 | 424 | * or else some of the table references below will result in MySQL errors |
424 | 425 | * |
425 | 426 | * @access public |
426 | - * @param boolean $orderby_params |
|
427 | + * @param string[] $orderby_params |
|
427 | 428 | * @return string |
428 | 429 | */ |
429 | 430 | public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
@@ -534,7 +535,7 @@ discard block |
||
534 | 535 | * |
535 | 536 | * @access public |
536 | 537 | * @param string $content |
537 | - * @return void |
|
538 | + * @return string |
|
538 | 539 | */ |
539 | 540 | public function event_details( $content ) { |
540 | 541 | return EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-details.php', array( 'the_content' => $content ), TRUE ); |
@@ -546,7 +547,7 @@ discard block |
||
546 | 547 | * |
547 | 548 | * @access public |
548 | 549 | * @param string $content |
549 | - * @return void |
|
550 | + * @return string |
|
550 | 551 | */ |
551 | 552 | public function event_tickets( $content ) { |
552 | 553 | return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-tickets.php', array(), TRUE ); |
@@ -557,7 +558,7 @@ discard block |
||
557 | 558 | * |
558 | 559 | * @access public |
559 | 560 | * @param string $content |
560 | - * @return void |
|
561 | + * @return string |
|
561 | 562 | */ |
562 | 563 | public function event_datetimes( $content ) { |
563 | 564 | return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-datetimes.php', array(), TRUE ); |
@@ -568,7 +569,7 @@ discard block |
||
568 | 569 | * |
569 | 570 | * @access public |
570 | 571 | * @param string $content |
571 | - * @return void |
|
572 | + * @return string |
|
572 | 573 | */ |
573 | 574 | public function event_venues( $content ) { |
574 | 575 | return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-venues.php', array(), TRUE ); |
@@ -618,7 +619,7 @@ discard block |
||
618 | 619 | * excerpt_length |
619 | 620 | * |
620 | 621 | * @access public |
621 | - * @return void |
|
622 | + * @return integer|null |
|
622 | 623 | */ |
623 | 624 | public function excerpt_length( $length ) { |
624 | 625 | |
@@ -648,7 +649,7 @@ discard block |
||
648 | 649 | * excerpt_more |
649 | 650 | * |
650 | 651 | * @access public |
651 | - * @return void |
|
652 | + * @return string |
|
652 | 653 | */ |
653 | 654 | public function excerpt_more( $more ) { |
654 | 655 | return '…'; |
@@ -813,7 +814,7 @@ discard block |
||
813 | 814 | * get_template_part |
814 | 815 | * |
815 | 816 | * @access public |
816 | - * @return void |
|
817 | + * @return string|null |
|
817 | 818 | */ |
818 | 819 | public static function get_template_part() { |
819 | 820 | switch ( self::$_type ) { |
@@ -857,7 +858,7 @@ discard block |
||
857 | 858 | * event_list_css |
858 | 859 | * |
859 | 860 | * @access public |
860 | - * @return void |
|
861 | + * @return string |
|
861 | 862 | */ |
862 | 863 | public static function event_list_css( $extra_class = '' ) { |
863 | 864 | $EE = EE_Registry::instance(); |
@@ -892,7 +893,7 @@ discard block |
||
892 | 893 | * display_description |
893 | 894 | * |
894 | 895 | * @access public |
895 | - * @return void |
|
896 | + * @return boolean |
|
896 | 897 | */ |
897 | 898 | public static function display_description( $value ) { |
898 | 899 | $EE = EE_Registry::instance(); |
@@ -906,7 +907,7 @@ discard block |
||
906 | 907 | * display_venue_details |
907 | 908 | * |
908 | 909 | * @access public |
909 | - * @return void |
|
910 | + * @return boolean |
|
910 | 911 | */ |
911 | 912 | public static function display_venue_details() { |
912 | 913 | $EE = EE_Registry::instance(); |
@@ -921,7 +922,7 @@ discard block |
||
921 | 922 | * display_address |
922 | 923 | * |
923 | 924 | * @access public |
924 | - * @return void |
|
925 | + * @return boolean |
|
925 | 926 | */ |
926 | 927 | public static function display_address() { |
927 | 928 | $EE = EE_Registry::instance(); |
@@ -937,7 +938,7 @@ discard block |
||
937 | 938 | * pagination |
938 | 939 | * |
939 | 940 | * @access public |
940 | - * @return void |
|
941 | + * @return string |
|
941 | 942 | */ |
942 | 943 | public static function pagination() { |
943 | 944 | global $wp_query; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Events_Archive_Filters |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @var $_types |
72 | 72 | * @access protected |
73 | 73 | */ |
74 | - protected static $_types = array( 'grid', 'text', 'dates' ); |
|
74 | + protected static $_types = array('grid', 'text', 'dates'); |
|
75 | 75 | |
76 | 76 | |
77 | 77 | // public static $espresso_event_list_ID = 0; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @access public |
126 | 126 | * @return void |
127 | 127 | */ |
128 | - public function run( $WP ) { |
|
128 | + public function run($WP) { |
|
129 | 129 | // do_action( 'AHEE__EED_Events_Archive_Filters__before_run' ); |
130 | 130 | // // set config |
131 | 131 | // if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters instanceof EE_Events_Archive_Config ) { |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | */ |
171 | 171 | private function _filter_query_parts() { |
172 | 172 | // build event list query |
173 | - add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 ); |
|
174 | - add_filter( 'posts_where', array( $this, 'posts_where' ), 1, 2 ); |
|
175 | - add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 ); |
|
173 | + add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
174 | + add_filter('posts_where', array($this, 'posts_where'), 1, 2); |
|
175 | + add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | * @return string |
183 | 183 | */ |
184 | 184 | public static function set_type() { |
185 | - do_action( 'AHEE__EED_Events_Archive_Filters__before_set_type' ); |
|
186 | - EED_Events_Archive_Filters::$_types = apply_filters( 'EED_Events_Archive_Filters__set_type__types', EED_Events_Archive_Filters::$_types ); |
|
187 | - $view = isset( EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type'] ) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type'] : 'grid'; |
|
188 | - $elf_type = EE_Registry::instance()->REQ->is_set( 'elf_type' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_type' )) : ''; |
|
189 | - $view = ! empty( $elf_type ) ? $elf_type : $view; |
|
190 | - $view = apply_filters( 'EED_Events_Archive_Filters__set_type__type', $view ); |
|
191 | - if ( ! empty( $view ) && in_array( $view, EED_Events_Archive_Filters::$_types )) { |
|
185 | + do_action('AHEE__EED_Events_Archive_Filters__before_set_type'); |
|
186 | + EED_Events_Archive_Filters::$_types = apply_filters('EED_Events_Archive_Filters__set_type__types', EED_Events_Archive_Filters::$_types); |
|
187 | + $view = isset(EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type']) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['default_type'] : 'grid'; |
|
188 | + $elf_type = EE_Registry::instance()->REQ->is_set('elf_type') ? sanitize_text_field(EE_Registry::instance()->REQ->get('elf_type')) : ''; |
|
189 | + $view = ! empty($elf_type) ? $elf_type : $view; |
|
190 | + $view = apply_filters('EED_Events_Archive_Filters__set_type__type', $view); |
|
191 | + if ( ! empty($view) && in_array($view, EED_Events_Archive_Filters::$_types)) { |
|
192 | 192 | self::$_type = $view; |
193 | 193 | } |
194 | 194 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | * @param boolean $req_only if TRUE, then ignore defaults and only return $_POST value |
201 | 201 | * @return boolean |
202 | 202 | */ |
203 | - private static function _show_expired( $req_only = FALSE ) { |
|
203 | + private static function _show_expired($req_only = FALSE) { |
|
204 | 204 | // get default value for "display_expired_events" as set in the EE General Settings > Templates > Event Listings |
205 | - $show_expired = ! $req_only && isset( EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] ) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] : FALSE; |
|
205 | + $show_expired = ! $req_only && isset(EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events']) ? EE_Registry::instance()->CFG->EED_Events_Archive_Filters['display_expired_events'] : FALSE; |
|
206 | 206 | // override default expired option if set via filter |
207 | - $show_expired = EE_Registry::instance()->REQ->is_set( 'elf_expired_chk' ) ? absint( EE_Registry::instance()->REQ->get( 'elf_expired_chk' )) : $show_expired; |
|
207 | + $show_expired = EE_Registry::instance()->REQ->is_set('elf_expired_chk') ? absint(EE_Registry::instance()->REQ->get('elf_expired_chk')) : $show_expired; |
|
208 | 208 | return $show_expired ? TRUE : FALSE; |
209 | 209 | } |
210 | 210 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return string |
216 | 216 | */ |
217 | 217 | private static function _event_category_slug() { |
218 | - return EE_Registry::instance()->REQ->is_set( 'elf_category_dd' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_category_dd' )) : ''; |
|
218 | + return EE_Registry::instance()->REQ->is_set('elf_category_dd') ? sanitize_text_field(EE_Registry::instance()->REQ->get('elf_category_dd')) : ''; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @return string |
226 | 226 | */ |
227 | 227 | private static function _display_month() { |
228 | - return EE_Registry::instance()->REQ->is_set( 'elf_month_dd' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_month_dd' )) : ''; |
|
228 | + return EE_Registry::instance()->REQ->is_set('elf_month_dd') ? sanitize_text_field(EE_Registry::instance()->REQ->get('elf_month_dd')) : ''; |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public function get_post_data() { |
240 | 240 | $this->_elf_month = EED_Events_Archive_Filters::_display_month(); |
241 | 241 | $this->_elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
242 | - $this->_show_expired = EED_Events_Archive_Filters::_show_expired( TRUE ); |
|
242 | + $this->_show_expired = EED_Events_Archive_Filters::_show_expired(TRUE); |
|
243 | 243 | // EEH_Debug_Tools::printr( EE_Registry::instance()->REQ, 'EE_Registry::instance()->REQ <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
244 | 244 | // echo '<h4>$this->_elf_month : ' . $this->_elf_month . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
245 | 245 | // echo '<h4>$this->_elf_category : ' . $this->_elf_category . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * @access public |
257 | 257 | * @return void |
258 | 258 | */ |
259 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
260 | - if ( isset( $wp_query->query ) && isset( $wp_query->query['post_type'] ) && $wp_query->query['post_type'] == 'espresso_events' ) { |
|
259 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
260 | + if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
261 | 261 | // Category |
262 | 262 | // $elf_category = EE_Registry::instance()->REQ->is_set( 'elf_category_dd' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'elf_category_dd' )) : ''; |
263 | - $SQL .= EED_Events_Archive_Filters::posts_join_sql_for_terms( EED_Events_Archive_Filters::_event_category_slug() ); |
|
263 | + $SQL .= EED_Events_Archive_Filters::posts_join_sql_for_terms(EED_Events_Archive_Filters::_event_category_slug()); |
|
264 | 264 | } |
265 | 265 | return $SQL; |
266 | 266 | } |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | * @param mixed boolean|string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet |
274 | 274 | * @return string |
275 | 275 | */ |
276 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
277 | - $SQL= ''; |
|
278 | - if ( ! empty( $join_terms )) { |
|
276 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
277 | + $SQL = ''; |
|
278 | + if ( ! empty($join_terms)) { |
|
279 | 279 | global $wpdb; |
280 | 280 | $SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)"; |
281 | 281 | $SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; |
@@ -293,28 +293,28 @@ discard block |
||
293 | 293 | * @param array $orderby_params |
294 | 294 | * @return string |
295 | 295 | */ |
296 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
296 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
297 | 297 | global $wpdb; |
298 | - $SQL= ''; |
|
299 | - $orderby_params = is_array( $orderby_params ) ? $orderby_params : array( $orderby_params ); |
|
300 | - foreach( $orderby_params as $orderby ) { |
|
301 | - switch ( $orderby ) { |
|
298 | + $SQL = ''; |
|
299 | + $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
300 | + foreach ($orderby_params as $orderby) { |
|
301 | + switch ($orderby) { |
|
302 | 302 | |
303 | 303 | case 'ticket_start' : |
304 | 304 | case 'ticket_end' : |
305 | - $SQL .= ' LEFT JOIN ' . EEM_Datetime_Ticket::instance()->table() . ' ON (' . EEM_Datetime::instance()->table() . '.DTT_ID = ' . EEM_Datetime_Ticket::instance()->table() . '.DTT_ID )'; |
|
306 | - $SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.TKT_ID = ' . EEM_Ticket::instance()->table() . '.TKT_ID )'; |
|
305 | + $SQL .= ' LEFT JOIN '.EEM_Datetime_Ticket::instance()->table().' ON ('.EEM_Datetime::instance()->table().'.DTT_ID = '.EEM_Datetime_Ticket::instance()->table().'.DTT_ID )'; |
|
306 | + $SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.TKT_ID = '.EEM_Ticket::instance()->table().'.TKT_ID )'; |
|
307 | 307 | break; |
308 | 308 | |
309 | 309 | case 'venue_title' : |
310 | 310 | case 'city' : |
311 | - $SQL .= ' LEFT JOIN ' . EEM_Event_Venue::instance()->table() . ' ON (' . $wpdb->posts . '.ID = ' . EEM_Event_Venue::instance()->table() . '.EVT_ID )'; |
|
312 | - $SQL .= ' LEFT JOIN ' . EEM_Venue::instance()->table() . ' ON (' . EEM_Event_Venue::instance()->table() . '.VNU_ID = ' . EEM_Venue::instance()->table() . '.VNU_ID )'; |
|
311 | + $SQL .= ' LEFT JOIN '.EEM_Event_Venue::instance()->table().' ON ('.$wpdb->posts.'.ID = '.EEM_Event_Venue::instance()->table().'.EVT_ID )'; |
|
312 | + $SQL .= ' LEFT JOIN '.EEM_Venue::instance()->table().' ON ('.EEM_Event_Venue::instance()->table().'.VNU_ID = '.EEM_Venue::instance()->table().'.VNU_ID )'; |
|
313 | 313 | break; |
314 | 314 | |
315 | 315 | case 'state' : |
316 | - $SQL .= ' LEFT JOIN ' . EEM_Event_Venue::instance()->table() . ' ON (' . $wpdb->posts . '.ID = ' . EEM_Event_Venue::instance()->table() . '.EVT_ID )'; |
|
317 | - $SQL .= ' LEFT JOIN ' . EEM_Event_Venue::instance()->second_table() . ' ON (' . EEM_Event_Venue::instance()->table() . '.VNU_ID = ' . EEM_Event_Venue::instance()->second_table() . '.VNU_ID )'; |
|
316 | + $SQL .= ' LEFT JOIN '.EEM_Event_Venue::instance()->table().' ON ('.$wpdb->posts.'.ID = '.EEM_Event_Venue::instance()->table().'.EVT_ID )'; |
|
317 | + $SQL .= ' LEFT JOIN '.EEM_Event_Venue::instance()->second_table().' ON ('.EEM_Event_Venue::instance()->table().'.VNU_ID = '.EEM_Event_Venue::instance()->second_table().'.VNU_ID )'; |
|
318 | 318 | break; |
319 | 319 | |
320 | 320 | break; |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | * @access public |
332 | 332 | * @return void |
333 | 333 | */ |
334 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
335 | - if ( isset( $wp_query->query_vars ) && isset( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'espresso_events' ) { |
|
334 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
335 | + if (isset($wp_query->query_vars) && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
336 | 336 | // Show Expired ? |
337 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_show_expired( EED_Events_Archive_Filters::_show_expired() ); |
|
337 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_show_expired(EED_Events_Archive_Filters::_show_expired()); |
|
338 | 338 | // Category |
339 | 339 | //$elf_category = EED_Events_Archive_Filters::_event_category_slug(); |
340 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_category_slug( EED_Events_Archive_Filters::_event_category_slug() ); |
|
340 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_category_slug(EED_Events_Archive_Filters::_event_category_slug()); |
|
341 | 341 | // Start Date |
342 | 342 | //$elf_month = EED_Events_Archive_Filters::_display_month(); |
343 | - $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_list_month( EED_Events_Archive_Filters::_display_month() ); |
|
343 | + $SQL .= EED_Events_Archive_Filters::posts_where_sql_for_event_list_month(EED_Events_Archive_Filters::_display_month()); |
|
344 | 344 | } |
345 | 345 | return $SQL; |
346 | 346 | } |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | * @param boolean $show_expired if TRUE, then displayed past events |
354 | 354 | * @return string |
355 | 355 | */ |
356 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
357 | - return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . date('Y-m-d H:s:i') . '" ' : ''; |
|
356 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
357 | + return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.date('Y-m-d H:s:i').'" ' : ''; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | * @param boolean $event_category_slug |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
368 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
369 | 369 | global $wpdb; |
370 | - return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : ''; |
|
370 | + return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : ''; |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | * @param boolean $month |
378 | 378 | * @return string |
379 | 379 | */ |
380 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
381 | - $SQL= ''; |
|
382 | - if ( ! empty( $month )) { |
|
380 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
381 | + $SQL = ''; |
|
382 | + if ( ! empty($month)) { |
|
383 | 383 | // event start date is LESS than the end of the month ( so nothing that doesn't start until next month ) |
384 | - $SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . date('Y-m-t 23:59:59', strtotime( $month )) . '"'; |
|
384 | + $SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.date('Y-m-t 23:59:59', strtotime($month)).'"'; |
|
385 | 385 | // event end date is GREATER than the start of the month ( so nothing that ended before this month ) |
386 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . date('Y-m-d 0:0:00', strtotime( $month )) . '" '; |
|
386 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.date('Y-m-d 0:0:00', strtotime($month)).'" '; |
|
387 | 387 | } |
388 | 388 | return $SQL; |
389 | 389 | } |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | * @access public |
396 | 396 | * @return void |
397 | 397 | */ |
398 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
399 | - if ( isset( $wp_query->query ) && isset( $wp_query->query['post_type'] ) && $wp_query->query['post_type'] == 'espresso_events' ) { |
|
400 | - $SQL = EED_Events_Archive_Filters::posts_orderby_sql( array( 'start_date' )); |
|
398 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
399 | + if (isset($wp_query->query) && isset($wp_query->query['post_type']) && $wp_query->query['post_type'] == 'espresso_events') { |
|
400 | + $SQL = EED_Events_Archive_Filters::posts_orderby_sql(array('start_date')); |
|
401 | 401 | } |
402 | 402 | return $SQL; |
403 | 403 | } |
@@ -426,54 +426,54 @@ discard block |
||
426 | 426 | * @param boolean $orderby_params |
427 | 427 | * @return string |
428 | 428 | */ |
429 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
429 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
430 | 430 | global $wpdb; |
431 | 431 | $SQL = ''; |
432 | 432 | $cntr = 1; |
433 | - $orderby_params = is_array( $orderby_params ) ? $orderby_params : array( $orderby_params ); |
|
434 | - foreach( $orderby_params as $orderby ) { |
|
435 | - $glue = $cntr == 1 || $cntr == count( $orderby_params ) ? ' ' : ', '; |
|
436 | - switch ( $orderby ) { |
|
433 | + $orderby_params = is_array($orderby_params) ? $orderby_params : array($orderby_params); |
|
434 | + foreach ($orderby_params as $orderby) { |
|
435 | + $glue = $cntr == 1 || $cntr == count($orderby_params) ? ' ' : ', '; |
|
436 | + switch ($orderby) { |
|
437 | 437 | |
438 | 438 | case 'id' : |
439 | 439 | case 'ID' : |
440 | - $SQL .= $glue . $wpdb->posts . '.ID ' . $sort; |
|
440 | + $SQL .= $glue.$wpdb->posts.'.ID '.$sort; |
|
441 | 441 | break; |
442 | 442 | |
443 | 443 | case 'start_date' : |
444 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort; |
|
444 | + $SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_start '.$sort; |
|
445 | 445 | break; |
446 | 446 | |
447 | 447 | case 'end_date' : |
448 | - $SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort; |
|
448 | + $SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort; |
|
449 | 449 | break; |
450 | 450 | |
451 | 451 | case 'event_name' : |
452 | - $SQL .= $glue . $wpdb->posts . '.post_title ' . $sort; |
|
452 | + $SQL .= $glue.$wpdb->posts.'.post_title '.$sort; |
|
453 | 453 | break; |
454 | 454 | |
455 | 455 | case 'category_slug' : |
456 | - $SQL .= $glue . $wpdb->terms . '.slug ' . $sort; |
|
456 | + $SQL .= $glue.$wpdb->terms.'.slug '.$sort; |
|
457 | 457 | break; |
458 | 458 | |
459 | 459 | case 'ticket_start' : |
460 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort; |
|
460 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort; |
|
461 | 461 | break; |
462 | 462 | |
463 | 463 | case 'ticket_end' : |
464 | - $SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort; |
|
464 | + $SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort; |
|
465 | 465 | break; |
466 | 466 | |
467 | 467 | case 'venue_title' : |
468 | - $SQL .= $glue . 'venue_title ' . $sort; |
|
468 | + $SQL .= $glue.'venue_title '.$sort; |
|
469 | 469 | break; |
470 | 470 | |
471 | 471 | case 'city' : |
472 | - $SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort; |
|
472 | + $SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort; |
|
473 | 473 | break; |
474 | 474 | |
475 | 475 | case 'state' : |
476 | - $SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort; |
|
476 | + $SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort; |
|
477 | 477 | break; |
478 | 478 | |
479 | 479 | } |
@@ -493,26 +493,26 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function template_redirect() { |
495 | 495 | // add event list filters |
496 | - add_action( 'loop_start', array( $this, 'event_list_template_filters' )); |
|
496 | + add_action('loop_start', array($this, 'event_list_template_filters')); |
|
497 | 497 | // and pagination |
498 | - add_action( 'loop_start', array( $this, 'event_list_pagination' )); |
|
499 | - add_action( 'loop_end', array( $this, 'event_list_pagination' )); |
|
498 | + add_action('loop_start', array($this, 'event_list_pagination')); |
|
499 | + add_action('loop_end', array($this, 'event_list_pagination')); |
|
500 | 500 | // if NOT a custom template |
501 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
501 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
502 | 502 | // don't know if theme uses the_excerpt |
503 | - add_filter( 'the_excerpt', array( $this, 'event_details' ), 100 ); |
|
504 | - add_filter( 'the_excerpt', array( $this, 'event_tickets' ), 110 ); |
|
505 | - add_filter( 'the_excerpt', array( $this, 'event_datetimes' ), 120 ); |
|
506 | - add_filter( 'the_excerpt', array( $this, 'event_venues' ), 130 ); |
|
503 | + add_filter('the_excerpt', array($this, 'event_details'), 100); |
|
504 | + add_filter('the_excerpt', array($this, 'event_tickets'), 110); |
|
505 | + add_filter('the_excerpt', array($this, 'event_datetimes'), 120); |
|
506 | + add_filter('the_excerpt', array($this, 'event_venues'), 130); |
|
507 | 507 | // or the_content |
508 | - add_filter( 'the_content', array( $this, 'event_details' ), 100 ); |
|
509 | - add_filter( 'the_content', array( $this, 'event_tickets' ), 110 ); |
|
510 | - add_filter( 'the_content', array( $this, 'event_datetimes' ), 120 ); |
|
511 | - add_filter( 'the_content', array( $this, 'event_venues' ), 130 ); |
|
508 | + add_filter('the_content', array($this, 'event_details'), 100); |
|
509 | + add_filter('the_content', array($this, 'event_tickets'), 110); |
|
510 | + add_filter('the_content', array($this, 'event_datetimes'), 120); |
|
511 | + add_filter('the_content', array($this, 'event_venues'), 130); |
|
512 | 512 | } else { |
513 | - remove_all_filters( 'excerpt_length' ); |
|
514 | - add_filter( 'excerpt_length', array( $this, 'excerpt_length' ), 10 ); |
|
515 | - add_filter( 'excerpt_more', array( $this, 'excerpt_more' ), 10 ); |
|
513 | + remove_all_filters('excerpt_length'); |
|
514 | + add_filter('excerpt_length', array($this, 'excerpt_length'), 10); |
|
515 | + add_filter('excerpt_more', array($this, 'excerpt_more'), 10); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @return void |
526 | 526 | */ |
527 | 527 | public function event_list_pagination() { |
528 | - echo '<div class="ee-pagination-dv clear">' . espresso_event_list_pagination() . '</div>'; |
|
528 | + echo '<div class="ee-pagination-dv clear">'.espresso_event_list_pagination().'</div>'; |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | * @param string $content |
537 | 537 | * @return void |
538 | 538 | */ |
539 | - public function event_details( $content ) { |
|
540 | - return EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-details.php', array( 'the_content' => $content ), TRUE ); |
|
539 | + public function event_details($content) { |
|
540 | + return EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-details.php', array('the_content' => $content), TRUE); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * @param string $content |
549 | 549 | * @return void |
550 | 550 | */ |
551 | - public function event_tickets( $content ) { |
|
552 | - return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-tickets.php', array(), TRUE ); |
|
551 | + public function event_tickets($content) { |
|
552 | + return $content.EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-tickets.php', array(), TRUE); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | /** |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @param string $content |
560 | 560 | * @return void |
561 | 561 | */ |
562 | - public function event_datetimes( $content ) { |
|
563 | - return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-datetimes.php', array(), TRUE ); |
|
562 | + public function event_datetimes($content) { |
|
563 | + return $content.EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-datetimes.php', array(), TRUE); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | /** |
@@ -570,8 +570,8 @@ discard block |
||
570 | 570 | * @param string $content |
571 | 571 | * @return void |
572 | 572 | */ |
573 | - public function event_venues( $content ) { |
|
574 | - return $content . EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'content-espresso_events-venues.php', array(), TRUE ); |
|
573 | + public function event_venues($content) { |
|
574 | + return $content.EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'content-espresso_events-venues.php', array(), TRUE); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -586,16 +586,16 @@ discard block |
||
586 | 586 | * @return void |
587 | 587 | */ |
588 | 588 | private function _load_assests() { |
589 | - do_action( 'AHEE__EED_Events_Archive_Filters__before_load_assests' ); |
|
590 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
591 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
592 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
593 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
594 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
595 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
589 | + do_action('AHEE__EED_Events_Archive_Filters__before_load_assests'); |
|
590 | + add_filter('FHEE_load_css', '__return_true'); |
|
591 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
592 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
593 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
594 | + EE_Registry::instance()->load_helper('Maps'); |
|
595 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
596 | 596 | } |
597 | 597 | //add_filter( 'the_excerpt', array( $this, 'the_excerpt' ), 999 ); |
598 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
598 | + EE_Registry::instance()->load_helper('Event_View'); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | * @access private |
609 | 609 | * @return string |
610 | 610 | */ |
611 | - private function _get_template( $which = 'part' ) { |
|
612 | - return EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events.php'; |
|
611 | + private function _get_template($which = 'part') { |
|
612 | + return EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events.php'; |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | * @access public |
621 | 621 | * @return void |
622 | 622 | */ |
623 | - public function excerpt_length( $length ) { |
|
623 | + public function excerpt_length($length) { |
|
624 | 624 | |
625 | - if ( self::$_type == 'grid' ) { |
|
625 | + if (self::$_type == 'grid') { |
|
626 | 626 | return 36; |
627 | 627 | } |
628 | 628 | |
629 | - switch ( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size ) { |
|
629 | + switch (EE_Registry::instance()->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) { |
|
630 | 630 | case 'tiny' : |
631 | 631 | return 12; |
632 | 632 | break; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @access public |
651 | 651 | * @return void |
652 | 652 | */ |
653 | - public function excerpt_more( $more ) { |
|
653 | + public function excerpt_more($more) { |
|
654 | 654 | return '…'; |
655 | 655 | } |
656 | 656 | |
@@ -680,23 +680,23 @@ discard block |
||
680 | 680 | */ |
681 | 681 | public function wp_enqueue_scripts() { |
682 | 682 | // get some style |
683 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
683 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
684 | 684 | // first check uploads folder |
685 | - EE_Registry::instance()->load_helper( 'File' ); |
|
686 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.css' )) { |
|
687 | - wp_register_style( 'archive-espresso_events', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.css', array( 'dashicons', 'espresso_default' )); |
|
685 | + EE_Registry::instance()->load_helper('File'); |
|
686 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'archive-espresso_events.css')) { |
|
687 | + wp_register_style('archive-espresso_events', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'archive-espresso_events.css', array('dashicons', 'espresso_default')); |
|
688 | 688 | } else { |
689 | - wp_register_style( 'archive-espresso_events', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'archive-espresso_events.css', array( 'dashicons', 'espresso_default' )); |
|
689 | + wp_register_style('archive-espresso_events', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'archive-espresso_events.css', array('dashicons', 'espresso_default')); |
|
690 | 690 | } |
691 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.js' )) { |
|
692 | - wp_register_script( 'archive-espresso_events', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'archive-espresso_events.js', array( 'jquery-masonry' ), '1.0', TRUE ); |
|
691 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'archive-espresso_events.js')) { |
|
692 | + wp_register_script('archive-espresso_events', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'archive-espresso_events.js', array('jquery-masonry'), '1.0', TRUE); |
|
693 | 693 | } else { |
694 | - wp_register_script( 'archive-espresso_events', EVENTS_ARCHIVE_ASSETS_URL . 'archive-espresso_events.js', array( 'jquery-masonry' ), '1.0', TRUE ); |
|
694 | + wp_register_script('archive-espresso_events', EVENTS_ARCHIVE_ASSETS_URL.'archive-espresso_events.js', array('jquery-masonry'), '1.0', TRUE); |
|
695 | 695 | } |
696 | - wp_enqueue_style( 'archive-espresso_events' ); |
|
697 | - wp_enqueue_script( 'jquery-masonry' ); |
|
698 | - wp_enqueue_script( 'archive-espresso_events' ); |
|
699 | - add_action( 'wp_footer', array( 'EED_Events_Archive_Filters', 'localize_grid_event_lists' ), 1 ); |
|
696 | + wp_enqueue_style('archive-espresso_events'); |
|
697 | + wp_enqueue_script('jquery-masonry'); |
|
698 | + wp_enqueue_script('archive-espresso_events'); |
|
699 | + add_action('wp_footer', array('EED_Events_Archive_Filters', 'localize_grid_event_lists'), 1); |
|
700 | 700 | } |
701 | 701 | } |
702 | 702 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | * @return void |
712 | 712 | */ |
713 | 713 | public static function localize_grid_event_lists() { |
714 | - wp_localize_script( 'archive-espresso_events', 'espresso_grid_event_lists', EED_Events_Archive_Filters::$espresso_grid_event_lists ); |
|
714 | + wp_localize_script('archive-espresso_events', 'espresso_grid_event_lists', EED_Events_Archive_Filters::$espresso_grid_event_lists); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | |
@@ -726,9 +726,9 @@ discard block |
||
726 | 726 | */ |
727 | 727 | public static function template_settings_form() { |
728 | 728 | $EE = EE_Registry::instance(); |
729 | - $EE->CFG->template_settings->EED_Events_Archive_Filters = isset( $EE->CFG->template_settings->EED_Events_Archive_Filters ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters : new EE_Events_Archive_Config(); |
|
730 | - $EE->CFG->template_settings->EED_Events_Archive_Filters = apply_filters( 'FHEE__Event_List__template_settings_form__event_list_config', $EE->CFG->template_settings->EED_Events_Archive_Filters ); |
|
731 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $EE->CFG->template_settings->EED_Events_Archive_Filters ); |
|
729 | + $EE->CFG->template_settings->EED_Events_Archive_Filters = isset($EE->CFG->template_settings->EED_Events_Archive_Filters) ? $EE->CFG->template_settings->EED_Events_Archive_Filters : new EE_Events_Archive_Config(); |
|
730 | + $EE->CFG->template_settings->EED_Events_Archive_Filters = apply_filters('FHEE__Event_List__template_settings_form__event_list_config', $EE->CFG->template_settings->EED_Events_Archive_Filters); |
|
731 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $EE->CFG->template_settings->EED_Events_Archive_Filters); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | |
@@ -742,16 +742,16 @@ discard block |
||
742 | 742 | * @static |
743 | 743 | * @return void |
744 | 744 | */ |
745 | - public static function set_default_settings( $CFG ) { |
|
745 | + public static function set_default_settings($CFG) { |
|
746 | 746 | //EEH_Debug_Tools::printr( $CFG, '$CFG <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
747 | - $CFG->display_description = isset( $CFG->display_description ) && ! empty( $CFG->display_description ) ? $CFG->display_description : 1; |
|
748 | - $CFG->display_address = isset( $CFG->display_address ) && ! empty( $CFG->display_address ) ? $CFG->display_address : TRUE; |
|
749 | - $CFG->display_venue_details = isset( $CFG->display_venue_details ) && ! empty( $CFG->display_venue_details ) ? $CFG->display_venue_details : TRUE; |
|
750 | - $CFG->display_expired_events = isset( $CFG->display_expired_events ) && ! empty( $CFG->display_expired_events ) ? $CFG->display_expired_events : FALSE; |
|
751 | - $CFG->default_type = isset( $CFG->default_type ) && ! empty( $CFG->default_type ) ? $CFG->default_type : 'grid'; |
|
752 | - $CFG->event_list_grid_size = isset( $CFG->event_list_grid_size ) && ! empty( $CFG->event_list_grid_size ) ? $CFG->event_list_grid_size : 'medium'; |
|
753 | - $CFG->templates['full'] = isset( $CFG->templates['full'] ) && ! empty( $CFG->templates['full'] ) ? $CFG->templates['full'] : EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events.php'; |
|
754 | - $CFG->templates['part'] = isset( $CFG->templates['part'] ) && ! empty( $CFG->templates['part'] ) ? $CFG->templates['part'] : EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-grid-view.php'; |
|
747 | + $CFG->display_description = isset($CFG->display_description) && ! empty($CFG->display_description) ? $CFG->display_description : 1; |
|
748 | + $CFG->display_address = isset($CFG->display_address) && ! empty($CFG->display_address) ? $CFG->display_address : TRUE; |
|
749 | + $CFG->display_venue_details = isset($CFG->display_venue_details) && ! empty($CFG->display_venue_details) ? $CFG->display_venue_details : TRUE; |
|
750 | + $CFG->display_expired_events = isset($CFG->display_expired_events) && ! empty($CFG->display_expired_events) ? $CFG->display_expired_events : FALSE; |
|
751 | + $CFG->default_type = isset($CFG->default_type) && ! empty($CFG->default_type) ? $CFG->default_type : 'grid'; |
|
752 | + $CFG->event_list_grid_size = isset($CFG->event_list_grid_size) && ! empty($CFG->event_list_grid_size) ? $CFG->event_list_grid_size : 'medium'; |
|
753 | + $CFG->templates['full'] = isset($CFG->templates['full']) && ! empty($CFG->templates['full']) ? $CFG->templates['full'] : EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events.php'; |
|
754 | + $CFG->templates['part'] = isset($CFG->templates['part']) && ! empty($CFG->templates['part']) ? $CFG->templates['part'] : EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-grid-view.php'; |
|
755 | 755 | return $CFG; |
756 | 756 | } |
757 | 757 | |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | * @access public |
764 | 764 | * @return void |
765 | 765 | */ |
766 | - public function filter_config( $CFG ) { |
|
766 | + public function filter_config($CFG) { |
|
767 | 767 | return $CFG; |
768 | 768 | } |
769 | 769 | |
@@ -776,32 +776,32 @@ discard block |
||
776 | 776 | * @access public |
777 | 777 | * @return void |
778 | 778 | */ |
779 | - public static function update_template_settings( $CFG, $REQ ) { |
|
779 | + public static function update_template_settings($CFG, $REQ) { |
|
780 | 780 | // EEH_Debug_Tools::printr( $REQ, '$REQ <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
781 | 781 | // EEH_Debug_Tools::printr( $CFG, '$CFG <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
782 | 782 | //$CFG->template_settings->EED_Events_Archive_Filters = new stdClass(); |
783 | - $CFG->EED_Events_Archive_Filters->display_description = isset( $REQ['display_description_in_event_list'] ) ? absint( $REQ['display_description_in_event_list'] ) : 1; |
|
784 | - $CFG->EED_Events_Archive_Filters->display_address = isset( $REQ['display_address_in_event_list'] ) ? absint( $REQ['display_address_in_event_list'] ) : TRUE; |
|
785 | - $CFG->EED_Events_Archive_Filters->display_venue_details = isset( $REQ['display_venue_details_in_event_list'] ) ? absint( $REQ['display_venue_details_in_event_list'] ) : TRUE; |
|
786 | - $CFG->EED_Events_Archive_Filters->display_expired_events = isset( $REQ['display_expired_events'] ) ? absint( $REQ['display_expired_events'] ) : FALSE; |
|
787 | - $CFG->EED_Events_Archive_Filters->default_type = isset( $REQ['default_type'] ) ? sanitize_text_field( $REQ['default_type'] ) : 'grid'; |
|
788 | - $CFG->EED_Events_Archive_Filters->event_list_grid_size = isset( $REQ['event_list_grid_size'] ) ? sanitize_text_field( $REQ['event_list_grid_size'] ) : 'medium'; |
|
783 | + $CFG->EED_Events_Archive_Filters->display_description = isset($REQ['display_description_in_event_list']) ? absint($REQ['display_description_in_event_list']) : 1; |
|
784 | + $CFG->EED_Events_Archive_Filters->display_address = isset($REQ['display_address_in_event_list']) ? absint($REQ['display_address_in_event_list']) : TRUE; |
|
785 | + $CFG->EED_Events_Archive_Filters->display_venue_details = isset($REQ['display_venue_details_in_event_list']) ? absint($REQ['display_venue_details_in_event_list']) : TRUE; |
|
786 | + $CFG->EED_Events_Archive_Filters->display_expired_events = isset($REQ['display_expired_events']) ? absint($REQ['display_expired_events']) : FALSE; |
|
787 | + $CFG->EED_Events_Archive_Filters->default_type = isset($REQ['default_type']) ? sanitize_text_field($REQ['default_type']) : 'grid'; |
|
788 | + $CFG->EED_Events_Archive_Filters->event_list_grid_size = isset($REQ['event_list_grid_size']) ? sanitize_text_field($REQ['event_list_grid_size']) : 'medium'; |
|
789 | 789 | $CFG->EED_Events_Archive_Filters->templates = array( |
790 | - 'full' => EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events.php' |
|
790 | + 'full' => EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events.php' |
|
791 | 791 | ); |
792 | 792 | |
793 | - switch ( $CFG->EED_Events_Archive_Filters->default_type ) { |
|
793 | + switch ($CFG->EED_Events_Archive_Filters->default_type) { |
|
794 | 794 | case 'dates' : |
795 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-dates-view.php'; |
|
795 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-dates-view.php'; |
|
796 | 796 | break; |
797 | 797 | case 'text' : |
798 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-text-view.php'; |
|
798 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-text-view.php'; |
|
799 | 799 | break; |
800 | 800 | default : |
801 | - $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-grid-view.php'; |
|
801 | + $CFG->EED_Events_Archive_Filters->templates['part'] = EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-grid-view.php'; |
|
802 | 802 | } |
803 | 803 | |
804 | - $CFG->EED_Events_Archive_Filters = isset( $REQ['reset_event_list_settings'] ) && absint( $REQ['reset_event_list_settings'] ) == 1 ? new EE_Events_Archive_Config() : $CFG->EED_Events_Archive_Filters; |
|
804 | + $CFG->EED_Events_Archive_Filters = isset($REQ['reset_event_list_settings']) && absint($REQ['reset_event_list_settings']) == 1 ? new EE_Events_Archive_Config() : $CFG->EED_Events_Archive_Filters; |
|
805 | 805 | return $CFG; |
806 | 806 | } |
807 | 807 | |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * @return void |
817 | 817 | */ |
818 | 818 | public static function get_template_part() { |
819 | - switch ( self::$_type ) { |
|
819 | + switch (self::$_type) { |
|
820 | 820 | case 'dates' : |
821 | 821 | return 'archive-espresso_events-dates-view.php'; |
822 | 822 | break; |
@@ -840,13 +840,13 @@ discard block |
||
840 | 840 | */ |
841 | 841 | public function event_list_template_filters() { |
842 | 842 | $args = array( |
843 | - 'form_url' => get_post_type_archive_link( 'espresso_events' ), //add_query_arg( array( 'post_type' => 'espresso_events' ), home_url() ), |
|
843 | + 'form_url' => get_post_type_archive_link('espresso_events'), //add_query_arg( array( 'post_type' => 'espresso_events' ), home_url() ), |
|
844 | 844 | 'elf_month' => EED_Events_Archive_Filters::_display_month(), |
845 | 845 | 'elf_category' => EED_Events_Archive_Filters::_event_category_slug(), |
846 | 846 | 'elf_show_expired' => EED_Events_Archive_Filters::_show_expired(), |
847 | 847 | 'elf_type' => self::$_type |
848 | 848 | ); |
849 | - EEH_Template::display_template( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_events-filters.php', $args ); |
|
849 | + EEH_Template::display_template(EE_TEMPLATES.EE_Config::get_current_theme().DS.'archive-espresso_events-filters.php', $args); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | |
@@ -859,16 +859,16 @@ discard block |
||
859 | 859 | * @access public |
860 | 860 | * @return void |
861 | 861 | */ |
862 | - public static function event_list_css( $extra_class = '' ) { |
|
862 | + public static function event_list_css($extra_class = '') { |
|
863 | 863 | $EE = EE_Registry::instance(); |
864 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
864 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
865 | 865 | $event_list_css[] = 'espresso-event-list-event'; |
866 | - if ( self::$_type == 'grid' ) { |
|
867 | - $event_list_grid_size = isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size : 'medium'; |
|
868 | - $event_list_css[] = $event_list_grid_size . '-event-list-grid'; |
|
866 | + if (self::$_type == 'grid') { |
|
867 | + $event_list_grid_size = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->event_list_grid_size : 'medium'; |
|
868 | + $event_list_css[] = $event_list_grid_size.'-event-list-grid'; |
|
869 | 869 | } |
870 | - $event_list_css = apply_filters( 'EED_Events_Archive_Filters__event_list_css__event_list_css_array', $event_list_css ); |
|
871 | - return implode( ' ', $event_list_css ); |
|
870 | + $event_list_css = apply_filters('EED_Events_Archive_Filters__event_list_css__event_list_css_array', $event_list_css); |
|
871 | + return implode(' ', $event_list_css); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
@@ -894,9 +894,9 @@ discard block |
||
894 | 894 | * @access public |
895 | 895 | * @return void |
896 | 896 | */ |
897 | - public static function display_description( $value ) { |
|
897 | + public static function display_description($value) { |
|
898 | 898 | $EE = EE_Registry::instance(); |
899 | - $display_description= isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description : 1; |
|
899 | + $display_description = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_description) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_description : 1; |
|
900 | 900 | return $display_description === $value ? TRUE : FALSE; |
901 | 901 | } |
902 | 902 | |
@@ -910,10 +910,10 @@ discard block |
||
910 | 910 | */ |
911 | 911 | public static function display_venue_details() { |
912 | 912 | $EE = EE_Registry::instance(); |
913 | - $EE->load_helper( 'Venue_View' ); |
|
914 | - $display_venue_details= isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details : TRUE; |
|
913 | + $EE->load_helper('Venue_View'); |
|
914 | + $display_venue_details = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_venue_details : TRUE; |
|
915 | 915 | $venue_name = EEH_Venue_View::venue_name(); |
916 | - return $display_venue_details && ! empty( $venue_name ) ? TRUE : FALSE; |
|
916 | + return $display_venue_details && ! empty($venue_name) ? TRUE : FALSE; |
|
917 | 917 | } |
918 | 918 | |
919 | 919 | |
@@ -925,10 +925,10 @@ discard block |
||
925 | 925 | */ |
926 | 926 | public static function display_address() { |
927 | 927 | $EE = EE_Registry::instance(); |
928 | - $EE->load_helper( 'Venue_View' ); |
|
929 | - $display_address= isset( $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address ) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address : FALSE; |
|
928 | + $EE->load_helper('Venue_View'); |
|
929 | + $display_address = isset($EE->CFG->template_settings->EED_Events_Archive_Filters->display_address) ? $EE->CFG->template_settings->EED_Events_Archive_Filters->display_address : FALSE; |
|
930 | 930 | $venue_name = EEH_Venue_View::venue_name(); |
931 | - return $display_address && ! empty( $venue_name ) ? TRUE : FALSE; |
|
931 | + return $display_address && ! empty($venue_name) ? TRUE : FALSE; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | |
@@ -942,22 +942,22 @@ discard block |
||
942 | 942 | public static function pagination() { |
943 | 943 | global $wp_query; |
944 | 944 | $big = 999999999; // need an unlikely integer |
945 | - $pagination = paginate_links( array( |
|
946 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
945 | + $pagination = paginate_links(array( |
|
946 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
947 | 947 | 'format' => '?paged=%#%', |
948 | - 'current' => max( 1, get_query_var('paged') ), |
|
948 | + 'current' => max(1, get_query_var('paged')), |
|
949 | 949 | 'total' => $wp_query->max_num_pages, |
950 | 950 | 'show_all' => TRUE, |
951 | 951 | 'end_size' => 10, |
952 | 952 | 'mid_size' => 6, |
953 | 953 | 'prev_next' => TRUE, |
954 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
955 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
954 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
955 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
956 | 956 | 'type' => 'plain', |
957 | 957 | 'add_args' => FALSE, |
958 | 958 | 'add_fragment' => '' |
959 | 959 | )); |
960 | - return ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
960 | + return ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | * @return void |
972 | 972 | */ |
973 | 973 | public static function event_list_title() { |
974 | - return apply_filters( 'EED_Events_Archive_Filters__event_list_title__event_list_title', __( 'Upcoming Events', 'event_espresso' )); |
|
974 | + return apply_filters('EED_Events_Archive_Filters__event_list_title__event_list_title', __('Upcoming Events', 'event_espresso')); |
|
975 | 975 | } |
976 | 976 | |
977 | 977 |
@@ -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 | * |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @access public |
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | - * @return void |
|
128 | + * @return string |
|
129 | 129 | */ |
130 | 130 | public static function comment_feed_join( $SQL ) { |
131 | 131 | global $wpdb; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @access public |
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | - * @return void |
|
149 | + * @return string |
|
150 | 150 | */ |
151 | 151 | public static function comment_feed_where( $SQL ) { |
152 | 152 | global $wp_query, $wpdb; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @access public |
166 | 166 | * @param string $content |
167 | - * @return void |
|
167 | + * @return string |
|
168 | 168 | */ |
169 | 169 | public static function the_event_feed( $content ) { |
170 | 170 | if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @access public |
207 | 207 | * @param string $content |
208 | - * @return void |
|
208 | + * @return string |
|
209 | 209 | */ |
210 | 210 | public static function the_venue_feed( $content ) { |
211 | 211 | if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return EED_Feeds |
30 | 30 | */ |
31 | 31 | public static function instance() { |
32 | - return parent::get_instance( __CLASS__ ); |
|
32 | + return parent::get_instance(__CLASS__); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @return void |
42 | 42 | */ |
43 | 43 | public static function set_hooks() { |
44 | - add_action( 'parse_request', array( 'EED_Feeds', 'parse_request' ), 10 ); |
|
45 | - add_filter( 'default_feed', array( 'EED_Feeds', 'default_feed' ), 10, 1 ); |
|
46 | - add_filter( 'comment_feed_join', array( 'EED_Feeds', 'comment_feed_join' ), 10, 2 ); |
|
47 | - add_filter( 'comment_feed_where', array( 'EED_Feeds', 'comment_feed_where' ), 10, 2 ); |
|
44 | + add_action('parse_request', array('EED_Feeds', 'parse_request'), 10); |
|
45 | + add_filter('default_feed', array('EED_Feeds', 'default_feed'), 10, 1); |
|
46 | + add_filter('comment_feed_join', array('EED_Feeds', 'comment_feed_join'), 10, 2); |
|
47 | + add_filter('comment_feed_where', array('EED_Feeds', 'comment_feed_where'), 10, 2); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access public |
65 | 65 | * @return void |
66 | 66 | */ |
67 | - public function run( $WP ) { |
|
67 | + public function run($WP) { |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param type rss2, atom, rss, rdf, rssjs |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - public static function default_feed( $type = 'rss2' ) { |
|
79 | + public static function default_feed($type = 'rss2') { |
|
80 | 80 | //rss2, atom, rss, rdf, rssjs |
81 | 81 | $type = 'rss2'; |
82 | 82 | return $type; |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | public static function parse_request() { |
95 | - if ( EE_Registry::instance()->REQ->is_set( 'post_type' )) { |
|
95 | + if (EE_Registry::instance()->REQ->is_set('post_type')) { |
|
96 | 96 | // define path to templates |
97 | - define( 'RSS_FEEDS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
97 | + define('RSS_FEEDS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
98 | 98 | // what kinda post_type are we dealing with ? |
99 | - switch( EE_Registry::instance()->REQ->get( 'post_type' )) { |
|
99 | + switch (EE_Registry::instance()->REQ->get('post_type')) { |
|
100 | 100 | case 'espresso_events' : |
101 | 101 | // for rss2, atom, rss, rdf |
102 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
103 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_event_feed' ), 10, 1 ); |
|
102 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
103 | + add_filter('the_content_feed', array('EED_Feeds', 'the_event_feed'), 10, 1); |
|
104 | 104 | // for json ( also uses the above filter ) |
105 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_event_rssjs_feed' ), 10, 1 ); |
|
105 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_event_rssjs_feed'), 10, 1); |
|
106 | 106 | break; |
107 | 107 | case 'espresso_venues' : |
108 | 108 | // for rss2, atom, rss, rdf |
109 | - add_filter( 'the_excerpt_rss', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
110 | - add_filter( 'the_content_feed', array( 'EED_Feeds', 'the_venue_feed' ), 10, 1 ); |
|
109 | + add_filter('the_excerpt_rss', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
110 | + add_filter('the_content_feed', array('EED_Feeds', 'the_venue_feed'), 10, 1); |
|
111 | 111 | // for json ( also uses the above filter ) |
112 | - add_filter( 'rssjs_feed_item', array( 'EED_Feeds', 'the_venue_rssjs_feed' ), 10, 1 ); |
|
112 | + add_filter('rssjs_feed_item', array('EED_Feeds', 'the_venue_rssjs_feed'), 10, 1); |
|
113 | 113 | break; |
114 | 114 | } |
115 | 115 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @param string $SQL the JOIN clause for the comment feed query |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public static function comment_feed_join( $SQL ) { |
|
130 | + public static function comment_feed_join($SQL) { |
|
131 | 131 | global $wpdb; |
132 | 132 | // check for wp_posts table in JOIN clause |
133 | - if ( strpos( $SQL, $wpdb->posts ) !== FALSE ) { |
|
134 | - add_filter( 'EED_Feeds__comment_feed_where__espresso_attendees', '__return_true' ); |
|
133 | + if (strpos($SQL, $wpdb->posts) !== FALSE) { |
|
134 | + add_filter('EED_Feeds__comment_feed_where__espresso_attendees', '__return_true'); |
|
135 | 135 | } |
136 | 136 | return $SQL; |
137 | 137 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param string $SQL the WHERE clause for the comment feed query |
149 | 149 | * @return void |
150 | 150 | */ |
151 | - public static function comment_feed_where( $SQL ) { |
|
151 | + public static function comment_feed_where($SQL) { |
|
152 | 152 | global $wp_query, $wpdb; |
153 | - if ( $wp_query->is_comment_feed && apply_filters( 'EED_Feeds__comment_feed_where__espresso_attendees', FALSE )) { |
|
153 | + if ($wp_query->is_comment_feed && apply_filters('EED_Feeds__comment_feed_where__espresso_attendees', FALSE)) { |
|
154 | 154 | $SQL .= " AND $wpdb->posts.post_type != 'espresso_attendees'"; |
155 | 155 | } |
156 | 156 | return $SQL; |
@@ -166,16 +166,16 @@ discard block |
||
166 | 166 | * @param string $content |
167 | 167 | * @return void |
168 | 168 | */ |
169 | - public static function the_event_feed( $content ) { |
|
170 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php' )) { |
|
171 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
172 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
169 | + public static function the_event_feed($content) { |
|
170 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php')) { |
|
171 | + EE_Registry::instance()->load_helper('Event_View'); |
|
172 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
173 | 173 | global $post; |
174 | 174 | $template_args = array( |
175 | 175 | 'EVT_ID' => $post->ID, |
176 | 176 | 'event_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
177 | 177 | ); |
178 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_events_feed.template.php', $template_args, TRUE ); |
|
178 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_events_feed.template.php', $template_args, TRUE); |
|
179 | 179 | } |
180 | 180 | return $content; |
181 | 181 | } |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * @param object $item |
191 | 191 | * @return void |
192 | 192 | */ |
193 | - public static function the_event_rssjs_feed( $item ) { |
|
194 | - if ( is_feed() && isset( $item->description )) { |
|
195 | - $item->description = EED_Feeds::the_event_feed( $item->description ); |
|
193 | + public static function the_event_rssjs_feed($item) { |
|
194 | + if (is_feed() && isset($item->description)) { |
|
195 | + $item->description = EED_Feeds::the_event_feed($item->description); |
|
196 | 196 | } |
197 | 197 | return $item; |
198 | 198 | } |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | * @param string $content |
208 | 208 | * @return void |
209 | 209 | */ |
210 | - public static function the_venue_feed( $content ) { |
|
211 | - if ( is_feed() && is_readable( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php' )) { |
|
212 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
213 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
210 | + public static function the_venue_feed($content) { |
|
211 | + if (is_feed() && is_readable(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php')) { |
|
212 | + EE_Registry::instance()->load_helper('Event_View'); |
|
213 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
214 | 214 | global $post; |
215 | 215 | $template_args = array( |
216 | 216 | 'VNU_ID' => $post->ID, |
217 | 217 | 'venue_description' => get_option('rss_use_excerpt') ? $post->post_excerpt : $post->post_content |
218 | 218 | ); |
219 | - $content = EEH_Template::display_template( RSS_FEEDS_TEMPLATES_PATH . 'espresso_venues_feed.template.php', $template_args, TRUE ); |
|
219 | + $content = EEH_Template::display_template(RSS_FEEDS_TEMPLATES_PATH.'espresso_venues_feed.template.php', $template_args, TRUE); |
|
220 | 220 | } |
221 | 221 | return $content; |
222 | 222 | } |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param object $item |
232 | 232 | * @return void |
233 | 233 | */ |
234 | - public static function the_venue_rssjs_feed( $item ) { |
|
235 | - if ( is_feed() && isset( $item->description )) { |
|
236 | - $item->description = EED_Feeds::the_venue_feed( $item->description ); |
|
234 | + public static function the_venue_rssjs_feed($item) { |
|
235 | + if (is_feed() && isset($item->description)) { |
|
236 | + $item->description = EED_Feeds::the_venue_feed($item->description); |
|
237 | 237 | } |
238 | 238 | return $item; |
239 | 239 | } |
@@ -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 | * |
@@ -558,7 +558,7 @@ |
||
558 | 558 | * |
559 | 559 | * @param string $payment_status The payment status being matched. |
560 | 560 | * |
561 | - * @return string|bool The payment message type slug matching the status or false if no match. |
|
561 | + * @return string|false The payment message type slug matching the status or false if no match. |
|
562 | 562 | */ |
563 | 563 | protected static function _get_payment_message_type( $payment_status ) { |
564 | 564 | $matches = array( |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage modules, messages |
8 | 8 | */ |
9 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
10 | + exit('No direct script access allowed'); |
|
11 | +} |
|
10 | 12 | /** |
11 | 13 | * |
12 | 14 | * Messages module. Takes care of registering all the triggers for messages. |
@@ -216,14 +218,16 @@ discard block |
||
216 | 218 | $template = basename( $template_path ); |
217 | 219 | |
218 | 220 | //is this already set? |
219 | - if ( isset( self::$_TMP_PACKS[$template] ) ) |
|
220 | - continue; |
|
221 | + if ( isset( self::$_TMP_PACKS[$template] ) ) { |
|
222 | + continue; |
|
223 | + } |
|
221 | 224 | |
222 | 225 | //setup classname. |
223 | 226 | $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template ) ) ); |
224 | 227 | |
225 | - if ( ! class_exists( $pack_class ) ) |
|
226 | - continue; |
|
228 | + if ( ! class_exists( $pack_class ) ) { |
|
229 | + continue; |
|
230 | + } |
|
227 | 231 | |
228 | 232 | $template_packs[$template] = new $pack_class; |
229 | 233 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return EED_Module |
59 | 59 | */ |
60 | 60 | public static function instance() { |
61 | - return parent::get_instance( __CLASS__ ); |
|
61 | + return parent::get_instance(__CLASS__); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function set_hooks() { |
75 | 75 | //actions |
76 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
77 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 ); |
|
76 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful', array('EED_Messages', 'payment'), 10, 2); |
|
77 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2); |
|
78 | 78 | //filters |
79 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
80 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
79 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
80 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
81 | 81 | //register routes |
82 | 82 | self::_register_routes(); |
83 | 83 | } |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function set_hooks_admin() { |
92 | 92 | //actions |
93 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
94 | - add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder'), 10 ); |
|
95 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 ); |
|
96 | - add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array( 'EED_Messages', 'send_newsletter_message'), 10, 2 ); |
|
97 | - add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 ); |
|
93 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful', array('EED_Messages', 'payment'), 10, 2); |
|
94 | + add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10); |
|
95 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3); |
|
96 | + add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', array('EED_Messages', 'send_newsletter_message'), 10, 2); |
|
97 | + add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10); |
|
98 | 98 | //filters |
99 | - add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 ); |
|
100 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', array( 'EED_Messages', 'process_admin_payment'), 10, 2 ); |
|
101 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
102 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
99 | + add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2); |
|
100 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', array('EED_Messages', 'process_admin_payment'), 10, 2); |
|
101 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
102 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * @return void |
114 | 114 | */ |
115 | 115 | protected static function _register_routes() { |
116 | - EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' ); |
|
117 | - do_action( 'AHEE__EED_Messages___register_routes' ); |
|
116 | + EE_Config::register_route('msg_url_trigger', 'Messages', 'run'); |
|
117 | + do_action('AHEE__EED_Messages___register_routes'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @throws EE_Error |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function run( $WP ) { |
|
130 | + public function run($WP) { |
|
131 | 131 | |
132 | 132 | $sending_messenger = EE_Registry::instance()->REQ->is_set('snd_msgr') ? EE_Registry::instance()->REQ->get('snd_msgr') : ''; |
133 | 133 | $generating_messenger = EE_Registry::instance()->REQ->is_set('gen_msgr') ? EE_Registry::instance()->REQ->get('gen_msgr') : ''; |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | $data_id = EE_Registry::instance()->REQ->is_set('id') ? (int) EE_Registry::instance()->REQ->get('id') : 0; |
138 | 138 | |
139 | 139 | //verify the needed params are present. |
140 | - if ( empty( $sending_messenger ) || empty( $generating_messenger ) || empty( $message_type ) || empty( $context ) || empty( $token ) ) { |
|
141 | - EE_Error::add_error( __( 'The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
140 | + if (empty($sending_messenger) || empty($generating_messenger) || empty($message_type) || empty($context) || empty($token)) { |
|
141 | + EE_Error::add_error(__('The request for the "msg_url_trigger" route has a malformed url.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | //get the registration: the token will always be the unique REG_url_link saved with a registration. We use that to make sure we retrieve the correct data for the given registration. |
145 | - $registration = EEM_Registration::instance()->get_one( array( array( 'REG_url_link' => $token ) ) ); |
|
145 | + $registration = EEM_Registration::instance()->get_one(array(array('REG_url_link' => $token))); |
|
146 | 146 | //if no registration then bail early. |
147 | - if ( ! $registration instanceof EE_Registration ) { |
|
148 | - EE_Error::add_error( __( 'Unable to complete the request because the token is invalid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
147 | + if ( ! $registration instanceof EE_Registration) { |
|
148 | + EE_Error::add_error(__('Unable to complete the request because the token is invalid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | //ensure controller is loaded |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | // retrieve the data via the handler |
156 | 156 | // Depending on the context and the message type data handler, the data_id will correspond to the specific data handler item we need to retrieve for specific messages |
157 | 157 | // (i.e. a specific payment or specific refund). |
158 | - $data = $this->_get_messages_data_from_url( $generating_messenger, $message_type, $registration, $data_id, $context ); |
|
158 | + $data = $this->_get_messages_data_from_url($generating_messenger, $message_type, $registration, $data_id, $context); |
|
159 | 159 | //make sure we drop generating messenger if both sending and generating are the same. |
160 | 160 | $generating_messenger = $sending_messenger != $generating_messenger ? $generating_messenger : NULL; |
161 | 161 | //now we can trigger the actual sending of the message via the message type. |
162 | - self::$_EEMSG->send_message( $message_type, $data, $sending_messenger, $generating_messenger, $context ); |
|
163 | - } catch ( EE_Error $e ) { |
|
164 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
162 | + self::$_EEMSG->send_message($message_type, $data, $sending_messenger, $generating_messenger, $context); |
|
163 | + } catch (EE_Error $e) { |
|
164 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
165 | 165 | // add specific message for developers if WP_DEBUG in on |
166 | - $error_msg .= '||' . $e->getMessage(); |
|
167 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
166 | + $error_msg .= '||'.$e->getMessage(); |
|
167 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return EE_Messages_Template_Pack |
181 | 181 | */ |
182 | - public static function get_template_pack( $template_pack_name ) { |
|
183 | - if ( isset( self::$_TMP_PACKS[$template_pack_name] ) ) { |
|
182 | + public static function get_template_pack($template_pack_name) { |
|
183 | + if (isset(self::$_TMP_PACKS[$template_pack_name])) { |
|
184 | 184 | return self::$_TMP_PACKS[$template_pack_name]; |
185 | 185 | } |
186 | 186 | |
187 | 187 | //not set yet so let's attempt to get it. |
188 | - $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template_pack_name ) ) ); |
|
188 | + $pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template_pack_name))); |
|
189 | 189 | |
190 | - if ( ! class_exists( $pack_class ) ) { |
|
190 | + if ( ! class_exists($pack_class)) { |
|
191 | 191 | $pack_class = 'EE_Messages_Template_Pack_Default'; |
192 | - self::$_TMP_PACKS['default'] = empty( self::$_TMP_PACKS['default'] ) ? new $pack_class : self::$_TMP_PACKS['default']; |
|
192 | + self::$_TMP_PACKS['default'] = empty(self::$_TMP_PACKS['default']) ? new $pack_class : self::$_TMP_PACKS['default']; |
|
193 | 193 | return self::$_TMP_PACKS['default']; |
194 | 194 | } else { |
195 | 195 | $pack = new $pack_class; |
@@ -209,27 +209,27 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public static function get_template_packs() { |
211 | 211 | //glob the defaults directory for messages |
212 | - $templates = glob( EE_LIBRARIES . 'messages/defaults/*', GLOB_ONLYDIR ); |
|
212 | + $templates = glob(EE_LIBRARIES.'messages/defaults/*', GLOB_ONLYDIR); |
|
213 | 213 | $template_packs = array(); |
214 | - foreach( $templates as $template_path ) { |
|
214 | + foreach ($templates as $template_path) { |
|
215 | 215 | //grab folder name |
216 | - $template = basename( $template_path ); |
|
216 | + $template = basename($template_path); |
|
217 | 217 | |
218 | 218 | //is this already set? |
219 | - if ( isset( self::$_TMP_PACKS[$template] ) ) |
|
219 | + if (isset(self::$_TMP_PACKS[$template])) |
|
220 | 220 | continue; |
221 | 221 | |
222 | 222 | //setup classname. |
223 | - $pack_class = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_' , ' ', $template ) ) ); |
|
223 | + $pack_class = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template))); |
|
224 | 224 | |
225 | - if ( ! class_exists( $pack_class ) ) |
|
225 | + if ( ! class_exists($pack_class)) |
|
226 | 226 | continue; |
227 | 227 | |
228 | 228 | $template_packs[$template] = new $pack_class; |
229 | 229 | } |
230 | 230 | |
231 | - $template_packs = apply_filters( 'FHEE__EED_Messages__get_template_packs__template_packs', $template_packs ); |
|
232 | - self::$_TMP_PACKS = array_merge( self::$_TMP_PACKS, $template_packs ); |
|
231 | + $template_packs = apply_filters('FHEE__EED_Messages__get_template_packs__template_packs', $template_packs); |
|
232 | + self::$_TMP_PACKS = array_merge(self::$_TMP_PACKS, $template_packs); |
|
233 | 233 | return self::$_TMP_PACKS; |
234 | 234 | } |
235 | 235 | |
@@ -251,15 +251,15 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
253 | 253 | */ |
254 | - protected function _get_messages_data_from_url( $generating_messenger, $message_type, EE_Registration $registration, $data_id, $context ) { |
|
254 | + protected function _get_messages_data_from_url($generating_messenger, $message_type, EE_Registration $registration, $data_id, $context) { |
|
255 | 255 | //get message type object then get the correct data setup for that message type. |
256 | - $message_type = self::$_EEMSG->get_active_message_type( $generating_messenger, $message_type ); |
|
256 | + $message_type = self::$_EEMSG->get_active_message_type($generating_messenger, $message_type); |
|
257 | 257 | //if no message type then it likely isn't active for this messenger. |
258 | - if ( ! $message_type instanceof EE_message_type ) { |
|
259 | - throw new EE_Error( sprintf( __('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger ) ); |
|
258 | + if ( ! $message_type instanceof EE_message_type) { |
|
259 | + throw new EE_Error(sprintf(__('Unable to get data for the %s message type, likely because it is not active for the %s messenger.', 'event_espresso'), $message_type->name, $generating_messenger)); |
|
260 | 260 | } |
261 | 261 | //get data according to data handler requirements |
262 | - return $message_type->get_data_for_context( $context, $registration, $data_id ); |
|
262 | + return $message_type->get_data_for_context($context, $registration, $data_id); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | * @return void |
273 | 273 | */ |
274 | 274 | public static function set_autoloaders() { |
275 | - if ( empty( self::$_MSG_PATHS ) ) { |
|
275 | + if (empty(self::$_MSG_PATHS)) { |
|
276 | 276 | self::_set_messages_paths(); |
277 | 277 | EE_Registry::instance()->load_helper('Autoloader'); |
278 | - foreach ( self::$_MSG_PATHS as $path ) { |
|
279 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path ); |
|
278 | + foreach (self::$_MSG_PATHS as $path) { |
|
279 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | 'shortcodes' |
307 | 307 | ); |
308 | 308 | $paths = array(); |
309 | - foreach ( $dir_ref as $index => $dir ) { |
|
310 | - $paths[$index] = EE_LIBRARIES . $dir; |
|
309 | + foreach ($dir_ref as $index => $dir) { |
|
310 | + $paths[$index] = EE_LIBRARIES.$dir; |
|
311 | 311 | } |
312 | - self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths ); |
|
312 | + self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @return void |
322 | 322 | */ |
323 | 323 | protected static function _load_controller() { |
324 | - if ( ! self::$_EEMSG instanceof EE_messages ) { |
|
324 | + if ( ! self::$_EEMSG instanceof EE_messages) { |
|
325 | 325 | self::set_autoloaders(); |
326 | 326 | self::$_EEMSG = new EE_messages(); |
327 | 327 | } |
@@ -332,10 +332,10 @@ discard block |
||
332 | 332 | /** |
333 | 333 | * @param EE_Transaction $transaction |
334 | 334 | */ |
335 | - public static function payment_reminder( EE_Transaction $transaction ) { |
|
335 | + public static function payment_reminder(EE_Transaction $transaction) { |
|
336 | 336 | self::_load_controller(); |
337 | - $data = array( $transaction, null ); |
|
338 | - if ( self::$_EEMSG->send_message( 'payment_reminder', $data ) ) { |
|
337 | + $data = array($transaction, null); |
|
338 | + if (self::$_EEMSG->send_message('payment_reminder', $data)) { |
|
339 | 339 | //self::log( |
340 | 340 | // __CLASS__, __FUNCTION__, __LINE__, |
341 | 341 | // $transaction, |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | * @param EE_Payment object |
357 | 357 | * @return void |
358 | 358 | */ |
359 | - public static function payment( EE_Transaction $transaction, EE_Payment $payment ) { |
|
359 | + public static function payment(EE_Transaction $transaction, EE_Payment $payment) { |
|
360 | 360 | self::_load_controller(); |
361 | - $data = array( $transaction, $payment ); |
|
361 | + $data = array($transaction, $payment); |
|
362 | 362 | |
363 | - $message_type = self::_get_payment_message_type( $payment->STS_ID() ); |
|
363 | + $message_type = self::_get_payment_message_type($payment->STS_ID()); |
|
364 | 364 | |
365 | 365 | //if payment amount is less than 0 then switch to payment_refund message type. |
366 | 366 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | //verify this message type is present and active. If it isn't then no message is sent. |
369 | 369 | $active_mts = self::$_EEMSG->get_active_message_types(); |
370 | 370 | |
371 | - $message_type = in_array( $message_type, $active_mts ) ? $message_type : false; |
|
371 | + $message_type = in_array($message_type, $active_mts) ? $message_type : false; |
|
372 | 372 | |
373 | - if ( $message_type ) { |
|
374 | - if ( self::$_EEMSG->send_message( $message_type, $data ) ) { |
|
373 | + if ($message_type) { |
|
374 | + if (self::$_EEMSG->send_message($message_type, $data)) { |
|
375 | 375 | //self::log( |
376 | 376 | // __CLASS__, __FUNCTION__, __LINE__, |
377 | 377 | // $transaction, |
@@ -391,15 +391,15 @@ discard block |
||
391 | 391 | /** |
392 | 392 | * @param EE_Transaction $transaction |
393 | 393 | */ |
394 | - public static function cancelled_registration( EE_Transaction $transaction ) { |
|
394 | + public static function cancelled_registration(EE_Transaction $transaction) { |
|
395 | 395 | self::_load_controller(); |
396 | 396 | |
397 | - $data = array( $transaction, NULL ); |
|
397 | + $data = array($transaction, NULL); |
|
398 | 398 | |
399 | 399 | $active_mts = self::$_EEMSG->get_active_message_types(); |
400 | 400 | |
401 | - if ( in_array( 'cancelled_registration', $active_mts ) ) { |
|
402 | - self::$_EEMSG->send_message( 'cancelled_registration', $data ); |
|
401 | + if (in_array('cancelled_registration', $active_mts)) { |
|
402 | + self::$_EEMSG->send_message('cancelled_registration', $data); |
|
403 | 403 | } |
404 | 404 | return; |
405 | 405 | } |
@@ -414,19 +414,19 @@ discard block |
||
414 | 414 | * @param array $extra_details |
415 | 415 | * @return void |
416 | 416 | */ |
417 | - public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) { |
|
417 | + public static function maybe_registration(EE_Registration $registration, $extra_details = array()) { |
|
418 | 418 | |
419 | - if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) { |
|
419 | + if ( ! self::_verify_registration_notification_send($registration, $extra_details)) { |
|
420 | 420 | //no messages please |
421 | 421 | return; |
422 | 422 | } |
423 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
423 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
424 | 424 | // send the message type matching the status if that message type is active. |
425 | - $message_type = self::_get_reg_status_array( $registration->status_ID() ); |
|
425 | + $message_type = self::_get_reg_status_array($registration->status_ID()); |
|
426 | 426 | // verify message type is active |
427 | - if ( EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
427 | + if (EEH_MSG_Template::is_mt_active($message_type)) { |
|
428 | 428 | self::_load_controller(); |
429 | - if ( self::$_EEMSG->send_message( $message_type, array( $registration->transaction(), null ) ) ) { |
|
429 | + if (self::$_EEMSG->send_message($message_type, array($registration->transaction(), null))) { |
|
430 | 430 | // DEBUG LOG |
431 | 431 | //self::log( |
432 | 432 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -452,25 +452,25 @@ discard block |
||
452 | 452 | * |
453 | 453 | * @return bool true = send away, false = nope halt the presses. |
454 | 454 | */ |
455 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
455 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
456 | 456 | // currently only using this to send messages for the primary registrant |
457 | - if ( ! $registration->is_primary_registrant() ) { |
|
457 | + if ( ! $registration->is_primary_registrant()) { |
|
458 | 458 | return false; |
459 | 459 | } |
460 | 460 | //first we check if we're in admin and not doing front ajax and if we |
461 | 461 | //make sure appropriate admin params are set for sending messages |
462 | 462 | if ( |
463 | - ( is_admin() && ! EE_FRONT_AJAX ) |
|
463 | + (is_admin() && ! EE_FRONT_AJAX) |
|
464 | 464 | && |
465 | - ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) |
|
465 | + (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) |
|
466 | 466 | ) { |
467 | 467 | //no messages sent please. |
468 | 468 | return false; |
469 | 469 | } |
470 | 470 | // frontend ? |
471 | 471 | if ( |
472 | - ! ( is_admin() && ! EE_FRONT_AJAX ) && |
|
473 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
472 | + ! (is_admin() && ! EE_FRONT_AJAX) && |
|
473 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
474 | 474 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
475 | 475 | ) { |
476 | 476 | return false; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * @param string $reg_status |
487 | 487 | * @return array |
488 | 488 | */ |
489 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
489 | + protected static function _get_reg_status_array($reg_status = '') { |
|
490 | 490 | $reg_status_array = array( |
491 | 491 | EEM_Registration::status_id_approved => 'registration', |
492 | 492 | EEM_Registration::status_id_pending_payment => 'pending_approval', |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | EEM_Registration::status_id_cancelled => 'cancelled_registration', |
495 | 495 | EEM_Registration::status_id_declined => 'declined_registration' |
496 | 496 | ); |
497 | - return isset( $reg_status_array[ $reg_status ] ) ? $reg_status_array[ $reg_status ] : $reg_status_array; |
|
497 | + return isset($reg_status_array[$reg_status]) ? $reg_status_array[$reg_status] : $reg_status_array; |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @return string|bool The payment message type slug matching the status or false if no match. |
508 | 508 | */ |
509 | - protected static function _get_payment_message_type( $payment_status ) { |
|
509 | + protected static function _get_payment_message_type($payment_status) { |
|
510 | 510 | $matches = array( |
511 | 511 | EEM_Payment::status_id_approved => 'payment', |
512 | 512 | EEM_Payment::status_id_pending => 'payment_pending', |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | EEM_Payment::status_id_failed => 'payment_failed' |
516 | 516 | ); |
517 | 517 | |
518 | - return isset( $matches[$payment_status] ) ? $matches[$payment_status] : false; |
|
518 | + return isset($matches[$payment_status]) ? $matches[$payment_status] : false; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -528,20 +528,20 @@ discard block |
||
528 | 528 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
529 | 529 | * @return bool success/fail |
530 | 530 | */ |
531 | - public static function process_resend( $req_data ) { |
|
531 | + public static function process_resend($req_data) { |
|
532 | 532 | |
533 | 533 | //first let's make sure we have the reg id (needed for resending!); |
534 | - if ( ! isset( $req_data['_REG_ID'] ) ) { |
|
535 | - EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
534 | + if ( ! isset($req_data['_REG_ID'])) { |
|
535 | + EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
536 | 536 | return FALSE; |
537 | 537 | } |
538 | 538 | |
539 | 539 | //get reg object from reg_id |
540 | - $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID( $req_data['_REG_ID'] ); |
|
540 | + $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($req_data['_REG_ID']); |
|
541 | 541 | |
542 | 542 | //if no reg object then send error |
543 | - if ( ! $reg instanceof EE_Registration ) { |
|
544 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) ); |
|
543 | + if ( ! $reg instanceof EE_Registration) { |
|
544 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'])); |
|
545 | 545 | return FALSE; |
546 | 546 | } |
547 | 547 | |
@@ -550,24 +550,24 @@ discard block |
||
550 | 550 | //get status_match_array |
551 | 551 | $status_match_array = self::_get_reg_status_array(); |
552 | 552 | $active_mts = self::$_EEMSG->get_active_message_types(); |
553 | - if ( ! in_array( $status_match_array[ $reg->status_ID() ], $active_mts ) ) { |
|
553 | + if ( ! in_array($status_match_array[$reg->status_ID()], $active_mts)) { |
|
554 | 554 | EE_Error::add_error( |
555 | 555 | sprintf( |
556 | 556 | __('Cannot resend the message for this registration because the corresponding message type (%1$s) is not active. If you wish to send messages for this message type then please activate it by visiting the %2$sMessages Admin Page%3$s.', 'event_espresso'), |
557 | - $status_match_array[ $reg->status_ID() ], |
|
558 | - '<a href="' . admin_url('admin.php?page=espresso_messages&action=settings') . '">', |
|
557 | + $status_match_array[$reg->status_ID()], |
|
558 | + '<a href="'.admin_url('admin.php?page=espresso_messages&action=settings').'">', |
|
559 | 559 | '</a>' |
560 | 560 | ) |
561 | 561 | ); |
562 | 562 | return FALSE; |
563 | 563 | } |
564 | 564 | |
565 | - if ( self::$_EEMSG->send_message( $status_match_array[$reg->status_ID()], $reg ) ) { |
|
565 | + if (self::$_EEMSG->send_message($status_match_array[$reg->status_ID()], $reg)) { |
|
566 | 566 | EE_Error::overwrite_success(); |
567 | - EE_Error::add_success( __('The message for this registration has been re-sent', 'event_espresso') ); |
|
567 | + EE_Error::add_success(__('The message for this registration has been re-sent', 'event_espresso')); |
|
568 | 568 | return TRUE; |
569 | 569 | } else { |
570 | - EE_Error::add_error( __('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
570 | + EE_Error::add_error(__('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | return FALSE; |
@@ -583,12 +583,12 @@ discard block |
||
583 | 583 | * @param EE_Payment $payment EE_payment object |
584 | 584 | * @return bool success/fail |
585 | 585 | */ |
586 | - public static function process_admin_payment( $success = TRUE, EE_Payment $payment ) { |
|
586 | + public static function process_admin_payment($success = TRUE, EE_Payment $payment) { |
|
587 | 587 | //we need to get the transaction object |
588 | 588 | $transaction = $payment->transaction(); |
589 | - if ( $transaction instanceof EE_Transaction ) { |
|
590 | - $data = array( $transaction, $payment ); |
|
591 | - $message_type = self::_get_payment_message_type( $payment->STS_ID() ); |
|
589 | + if ($transaction instanceof EE_Transaction) { |
|
590 | + $data = array($transaction, $payment); |
|
591 | + $message_type = self::_get_payment_message_type($payment->STS_ID()); |
|
592 | 592 | |
593 | 593 | //if payment amount is less than 0 then switch to payment_refund message type. |
594 | 594 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -599,18 +599,18 @@ discard block |
||
599 | 599 | self::_load_controller(); |
600 | 600 | //verify this message type is present and active. If it isn't then no message is sent. |
601 | 601 | $active_mts = self::$_EEMSG->get_active_message_types(); |
602 | - $message_type = in_array( $message_type, $active_mts ) ? $message_type : false; |
|
602 | + $message_type = in_array($message_type, $active_mts) ? $message_type : false; |
|
603 | 603 | |
604 | 604 | |
605 | - if ( $message_type ) { |
|
605 | + if ($message_type) { |
|
606 | 606 | |
607 | - $success = self::$_EEMSG->send_message( $message_type, $data ); |
|
608 | - if ( ! $success ) { |
|
609 | - EE_Error::add_error( __('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
607 | + $success = self::$_EEMSG->send_message($message_type, $data); |
|
608 | + if ( ! $success) { |
|
609 | + EE_Error::add_error(__('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | } else { |
613 | - EE_Error::add_error( __('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
613 | + EE_Error::add_error(__('The message type for the status of this payment is not active or does not exist, so no notification was sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | } |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | * @param int $grp_id a specific message template group id. |
629 | 629 | * @return void |
630 | 630 | */ |
631 | - public static function send_newsletter_message( $contacts, $grp_id ) { |
|
631 | + public static function send_newsletter_message($contacts, $grp_id) { |
|
632 | 632 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
633 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
633 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
634 | 634 | |
635 | 635 | self::_load_controller(); |
636 | 636 | self::$_EEMSG->send_message('newsletter', $contacts); |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | * @param string $message_type |
649 | 649 | * @return string |
650 | 650 | */ |
651 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
651 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
652 | 652 | EE_Registry::instance()->load_helper('MSG_Template'); |
653 | 653 | // whitelist $messenger |
654 | - switch ( $messenger ) { |
|
654 | + switch ($messenger) { |
|
655 | 655 | case 'pdf' : |
656 | 656 | $sending_messenger = 'pdf'; |
657 | 657 | $generating_messenger = 'html'; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | break; |
664 | 664 | } |
665 | 665 | // whitelist $message_type |
666 | - switch ( $message_type ) { |
|
666 | + switch ($message_type) { |
|
667 | 667 | case 'receipt' : |
668 | 668 | $message_type = 'receipt'; |
669 | 669 | break; |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | break; |
674 | 674 | } |
675 | 675 | // verify that both the messenger AND the message type are active |
676 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type )) { |
|
676 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
677 | 677 | //need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?) |
678 | 678 | $template_query_params = array( |
679 | 679 | 'MTP_is_active' => TRUE, |
@@ -682,16 +682,16 @@ discard block |
||
682 | 682 | 'Event.EVT_ID' => $registration->event_ID() |
683 | 683 | ); |
684 | 684 | //get the message template group. |
685 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
685 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
686 | 686 | //if we don't have an EE_Message_Template_Group then return |
687 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
687 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
688 | 688 | // remove EVT_ID from query params so that global templates get picked up |
689 | - unset( $template_query_params[ 'Event.EVT_ID' ] ); |
|
689 | + unset($template_query_params['Event.EVT_ID']); |
|
690 | 690 | //get global template as the fallback |
691 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
691 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
692 | 692 | } |
693 | 693 | //if we don't have an EE_Message_Template_Group then return |
694 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
694 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
695 | 695 | return ''; |
696 | 696 | } |
697 | 697 | // generate the URL |
@@ -721,17 +721,17 @@ discard block |
||
721 | 721 | * @param array $info |
722 | 722 | * @param bool $display_request |
723 | 723 | */ |
724 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
724 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
725 | 725 | EE_Registry::instance()->load_helper('Debug_Tools'); |
726 | - if ( WP_DEBUG && false ) { |
|
727 | - if ( $transaction instanceof EE_Transaction ) { |
|
726 | + if (WP_DEBUG && false) { |
|
727 | + if ($transaction instanceof EE_Transaction) { |
|
728 | 728 | // don't serialize objects |
729 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
730 | - $info[ 'TXN_status' ] = $transaction->status_ID(); |
|
731 | - $info[ 'TXN_reg_steps' ] = $transaction->reg_steps(); |
|
732 | - if ( $transaction->ID() ) { |
|
733 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
734 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
729 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
730 | + $info['TXN_status'] = $transaction->status_ID(); |
|
731 | + $info['TXN_reg_steps'] = $transaction->reg_steps(); |
|
732 | + if ($transaction->ID()) { |
|
733 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
734 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | } |
@@ -387,7 +387,7 @@ |
||
387 | 387 | |
388 | 388 | /** |
389 | 389 | * creates the default hidden inputs section |
390 | - * @return EE_Form_Input_Base[] |
|
390 | + * @return EE_Form_Section_Proper |
|
391 | 391 | */ |
392 | 392 | public function reg_step_hidden_inputs() { |
393 | 393 | // hidden inputs for admin registrations |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step |
|
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 |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | abstract class EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | public function set_completed() { |
154 | 154 | // DEBUG LOG |
155 | 155 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
156 | - $this->_completed = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this ); |
|
156 | + $this->_completed = apply_filters('FHEE__EE_SPCO_Reg_Step__set_completed___completed', true, $this); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -201,18 +201,18 @@ discard block |
||
201 | 201 | * sets the text that appears on the reg step form submit button |
202 | 202 | * @param string $submit_button_text |
203 | 203 | */ |
204 | - public function set_submit_button_text( $submit_button_text = '' ) { |
|
205 | - if ( ! empty( $submit_button_text )) { |
|
204 | + public function set_submit_button_text($submit_button_text = '') { |
|
205 | + if ( ! empty($submit_button_text)) { |
|
206 | 206 | $this->_submit_button_text = $submit_button_text; |
207 | - } else if ( $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
208 | - if ( $this->checkout->revisit ) { |
|
209 | - $this->_submit_button_text = sprintf( __( 'Update %s', 'event_espresso' ), $this->checkout->current_step->name() ); |
|
207 | + } else if ($this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
208 | + if ($this->checkout->revisit) { |
|
209 | + $this->_submit_button_text = sprintf(__('Update %s', 'event_espresso'), $this->checkout->current_step->name()); |
|
210 | 210 | } else { |
211 | - $this->_submit_button_text = sprintf( __( 'Proceed to %s', 'event_espresso' ), $this->checkout->next_step->name() ); |
|
211 | + $this->_submit_button_text = sprintf(__('Proceed to %s', 'event_espresso'), $this->checkout->next_step->name()); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | // filters the submit button text |
215 | - $this->_submit_button_text = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout ); |
|
215 | + $this->_submit_button_text = apply_filters('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', $this->_submit_button_text, $this->checkout); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param boolean $is_current_step |
222 | 222 | */ |
223 | - public function set_is_current_step( $is_current_step ) { |
|
223 | + public function set_is_current_step($is_current_step) { |
|
224 | 224 | $this->_is_current_step = $is_current_step; |
225 | 225 | } |
226 | 226 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * @param int $order |
249 | 249 | */ |
250 | - public function set_order( $order ) { |
|
250 | + public function set_order($order) { |
|
251 | 251 | $this->_order = $order; |
252 | 252 | } |
253 | 253 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * _set_success_message |
286 | 286 | * @param string $success_message |
287 | 287 | */ |
288 | - protected function _set_success_message( $success_message ) { |
|
288 | + protected function _set_success_message($success_message) { |
|
289 | 289 | $this->_success_message = $success_message; |
290 | 290 | } |
291 | 291 | |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | /** |
314 | 314 | * @param string $instructions |
315 | 315 | */ |
316 | - public function set_instructions( $instructions ) { |
|
317 | - $this->_instructions = apply_filters( 'FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this ); |
|
316 | + public function set_instructions($instructions) { |
|
317 | + $this->_instructions = apply_filters('FHEE__EE_SPCO_Reg_Step__set_instructions__instructions', $instructions, $this); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * @param array $valid_data |
324 | 324 | */ |
325 | - public function set_valid_data( $valid_data ) { |
|
325 | + public function set_valid_data($valid_data) { |
|
326 | 326 | $this->_valid_data = $valid_data; |
327 | 327 | } |
328 | 328 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | * @return array |
333 | 333 | */ |
334 | 334 | public function valid_data() { |
335 | - if ( empty( $this->_valid_data )) { |
|
335 | + if (empty($this->_valid_data)) { |
|
336 | 336 | $this->_valid_data = $this->reg_form->valid_data(); |
337 | 337 | } |
338 | 338 | return $this->_valid_data; |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @return string |
344 | 344 | */ |
345 | 345 | public function reg_form_name() { |
346 | - if ( empty( $this->_reg_form_name )) { |
|
347 | - $this->set_reg_form_name( 'ee-spco-' . $this->slug() . '-reg-step-form' ); |
|
346 | + if (empty($this->_reg_form_name)) { |
|
347 | + $this->set_reg_form_name('ee-spco-'.$this->slug().'-reg-step-form'); |
|
348 | 348 | } |
349 | 349 | return $this->_reg_form_name; |
350 | 350 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | /** |
355 | 355 | * @param string $reg_form_name |
356 | 356 | */ |
357 | - protected function set_reg_form_name( $reg_form_name ) { |
|
357 | + protected function set_reg_form_name($reg_form_name) { |
|
358 | 358 | $this->_reg_form_name = $reg_form_name; |
359 | 359 | } |
360 | 360 | |
@@ -365,22 +365,22 @@ discard block |
||
365 | 365 | * @param string $action |
366 | 366 | * @return string |
367 | 367 | */ |
368 | - public function reg_step_url( $action = '' ) { |
|
369 | - $query_args = array( 'step' => $this->slug() ); |
|
370 | - if( ! empty( $action )) { |
|
368 | + public function reg_step_url($action = '') { |
|
369 | + $query_args = array('step' => $this->slug()); |
|
370 | + if ( ! empty($action)) { |
|
371 | 371 | $query_args['action'] = $action; |
372 | 372 | } |
373 | 373 | // final step has no display |
374 | - if ( $this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step' ) { |
|
375 | - $query_args[ 'action' ] = 'process_reg_step'; |
|
374 | + if ($this instanceof EE_SPCO_Reg_Step_Finalize_Registration && $action == 'display_spco_reg_step') { |
|
375 | + $query_args['action'] = 'process_reg_step'; |
|
376 | 376 | } |
377 | - if( $this->checkout->revisit ) { |
|
377 | + if ($this->checkout->revisit) { |
|
378 | 378 | $query_args['revisit'] = TRUE; |
379 | 379 | } |
380 | - if( $this->checkout->reg_url_link ) { |
|
380 | + if ($this->checkout->reg_url_link) { |
|
381 | 381 | $query_args['e_reg_url_link'] = $this->checkout->reg_url_link; |
382 | 382 | } |
383 | - return add_query_arg( $query_args, $this->checkout->reg_page_base_url ); |
|
383 | + return add_query_arg($query_args, $this->checkout->reg_page_base_url); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -391,16 +391,16 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function reg_step_hidden_inputs() { |
393 | 393 | // hidden inputs for admin registrations |
394 | - if ( $this->checkout->admin_request ) { |
|
394 | + if ($this->checkout->admin_request) { |
|
395 | 395 | return new EE_Form_Section_Proper( |
396 | 396 | array( |
397 | 397 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
398 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
398 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
399 | 399 | 'subsections' => array( |
400 | 400 | 'next_step' => new EE_Fixed_Hidden_Input( |
401 | 401 | array( |
402 | 402 | 'html_name' => 'next_step', |
403 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
403 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
404 | 404 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
405 | 405 | ) |
406 | 406 | ) |
@@ -412,19 +412,19 @@ discard block |
||
412 | 412 | return new EE_Form_Section_Proper( |
413 | 413 | array( |
414 | 414 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
415 | - 'html_id' => 'ee-' . $this->slug() . '-hidden-inputs', |
|
415 | + 'html_id' => 'ee-'.$this->slug().'-hidden-inputs', |
|
416 | 416 | 'subsections' => array( |
417 | 417 | 'action' => new EE_Fixed_Hidden_Input( |
418 | 418 | array( |
419 | 419 | 'html_name' => 'action', |
420 | - 'html_id' => 'spco-' . $this->slug() . '-action', |
|
421 | - 'default' => empty( $this->checkout->reg_url_link ) ? 'process_reg_step' : 'update_reg_step' |
|
420 | + 'html_id' => 'spco-'.$this->slug().'-action', |
|
421 | + 'default' => empty($this->checkout->reg_url_link) ? 'process_reg_step' : 'update_reg_step' |
|
422 | 422 | ) |
423 | 423 | ), |
424 | 424 | 'next_step' => new EE_Fixed_Hidden_Input( |
425 | 425 | array( |
426 | 426 | 'html_name' => 'next_step', |
427 | - 'html_id' => 'spco-' . $this->slug() . '-next-step', |
|
427 | + 'html_id' => 'spco-'.$this->slug().'-next-step', |
|
428 | 428 | 'default' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '' |
429 | 429 | ) |
430 | 430 | ), |
@@ -455,17 +455,17 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function display_reg_form() { |
457 | 457 | $html = ''; |
458 | - if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
|
459 | - $html .= $this->checkout->admin_request ? '' : $this->reg_form->form_open( $this->reg_step_url() ); |
|
460 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
458 | + if ($this->reg_form instanceof EE_Form_Section_Proper) { |
|
459 | + $html .= $this->checkout->admin_request ? '' : $this->reg_form->form_open($this->reg_step_url()); |
|
460 | + if (EE_Registry::instance()->REQ->ajax) { |
|
461 | 461 | $this->reg_form->localize_validation_rules(); |
462 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
462 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
463 | 463 | $html .= $this->reg_form->get_html(); |
464 | 464 | } else { |
465 | 465 | $html .= $this->reg_form->get_html_and_js(); |
466 | 466 | } |
467 | - $html .= $this->checkout->admin_request ? '' :$this->reg_step_submit_button(); |
|
468 | - $html .= $this->checkout->admin_request ? '' :$this->reg_form->form_close(); |
|
467 | + $html .= $this->checkout->admin_request ? '' : $this->reg_step_submit_button(); |
|
468 | + $html .= $this->checkout->admin_request ? '' : $this->reg_form->form_close(); |
|
469 | 469 | } |
470 | 470 | return $html; |
471 | 471 | } |
@@ -477,25 +477,25 @@ discard block |
||
477 | 477 | * @return string |
478 | 478 | */ |
479 | 479 | public function reg_step_submit_button() { |
480 | - if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
480 | + if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
481 | 481 | return ''; |
482 | 482 | } |
483 | 483 | ob_start(); |
484 | - do_action( 'AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout ); |
|
484 | + do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout); |
|
485 | 485 | $html = ob_get_clean(); |
486 | 486 | // generate submit button |
487 | - $sbmt_btn = new EE_Submit_Input( array( |
|
488 | - 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
489 | - 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
487 | + $sbmt_btn = new EE_Submit_Input(array( |
|
488 | + 'html_name' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
489 | + 'html_id' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
490 | 490 | 'html_class' => 'spco-next-step-btn', |
491 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
491 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
492 | 492 | 'default' => $this->submit_button_text() |
493 | 493 | )); |
494 | - $sbmt_btn->set_button_css_attributes( TRUE, 'large' ); |
|
494 | + $sbmt_btn->set_button_css_attributes(TRUE, 'large'); |
|
495 | 495 | EE_Registry::instance()->load_helper('HTML'); |
496 | 496 | $html .= EEH_HTML::div( |
497 | 497 | $sbmt_btn->get_html_for_input(), |
498 | - 'spco-' . $this->slug() . '-whats-next-buttons-dv', |
|
498 | + 'spco-'.$this->slug().'-whats-next-buttons-dv', |
|
499 | 499 | 'spco-whats-next-buttons' |
500 | 500 | ); |
501 | 501 | return $html; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * @return string |
519 | 519 | */ |
520 | 520 | public function edit_lnk_url() { |
521 | - return add_query_arg( array( 'step' => $this->slug() ), $this->checkout->reg_page_base_url ); |
|
521 | + return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); |
|
522 | 522 | |
523 | 523 | } |
524 | 524 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | */ |
546 | 546 | function __sleep() { |
547 | 547 | // remove the reg form and the checkout |
548 | - return array_diff( array_keys( get_object_vars( $this )), array( 'reg_form', 'checkout' )); |
|
548 | + return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 |
@@ -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 ) ) { |
@@ -57,7 +57,7 @@ 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 | |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function set_hooks() { |
74 | 74 | // routing |
75 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
76 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
77 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
78 | - add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
|
79 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
80 | - add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
|
81 | - add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
|
82 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
75 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
76 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
77 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
78 | + add_action('AHEE_event_details_before_post', array('EED_Ticket_Selector', 'ticket_selector_form_open'), 10, 1); |
|
79 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
80 | + add_action('AHEE__ticket_selector_chart__template__after_ticket_selector', array('EED_Ticket_Selector', 'display_ticket_selector_submit'), 10, 1); |
|
81 | + add_action('AHEE_event_details_after_post', array('EED_Ticket_Selector', 'ticket_selector_form_close'), 10); |
|
82 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | * @return void |
92 | 92 | */ |
93 | 93 | public static function set_hooks_admin() { |
94 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
94 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
95 | 95 | |
96 | 96 | //add button for iframe code to event editor. |
97 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
97 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
98 | 98 | |
99 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
99 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * @return void |
109 | 109 | */ |
110 | 110 | public static function set_definitions() { |
111 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
112 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
111 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
112 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param object $WP |
121 | 121 | * @return void |
122 | 122 | */ |
123 | - public function run( $WP ) {} |
|
123 | + public function run($WP) {} |
|
124 | 124 | |
125 | 125 | |
126 | 126 | /** |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | public function ticket_selector_iframe() { |
133 | 133 | self::$_in_iframe = true; |
134 | 134 | /** @type EEM_Event $EEM_Event */ |
135 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
136 | - $event = $EEM_Event->get_one_by_ID( EE_Registry::instance()->REQ->get( |
|
135 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
136 | + $event = $EEM_Event->get_one_by_ID(EE_Registry::instance()->REQ->get( |
|
137 | 137 | 'event', 0 )); |
138 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
139 | - $template_args['css'] = apply_filters( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', array( |
|
140 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
141 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
142 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
143 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
144 | - ) ); |
|
145 | - |
|
146 | - $template_args['js'] = apply_filters( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', array( |
|
147 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
148 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
149 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
150 | - ) ); |
|
138 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
139 | + $template_args['css'] = apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', array( |
|
140 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
141 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
142 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
143 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
144 | + )); |
|
145 | + |
|
146 | + $template_args['js'] = apply_filters('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', array( |
|
147 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
148 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
149 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
150 | + )); |
|
151 | 151 | |
152 | 152 | EE_Registry::instance()->load_helper('Template'); |
153 | - EEH_Template::display_template( TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', $template_args ); |
|
153 | + EEH_Template::display_template(TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', $template_args); |
|
154 | 154 | exit; |
155 | 155 | } |
156 | 156 | |
@@ -167,23 +167,23 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @return string The new html string for the permalink area. |
169 | 169 | */ |
170 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
170 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
171 | 171 | //make sure this is ONLY when editing and the event id has been set. |
172 | - if ( ! empty( $id ) ) { |
|
173 | - $post = get_post( $id ); |
|
172 | + if ( ! empty($id)) { |
|
173 | + $post = get_post($id); |
|
174 | 174 | |
175 | 175 | //if NOT event then let's get out. |
176 | - if ( $post->post_type !== 'espresso_events' ) { |
|
176 | + if ($post->post_type !== 'espresso_events') { |
|
177 | 177 | return $permalink_string; |
178 | 178 | } |
179 | 179 | |
180 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
180 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
181 | 181 | |
182 | - $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' . __('Embed', 'event_espresso') . '</a> '; |
|
182 | + $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">'.__('Embed', 'event_espresso').'</a> '; |
|
183 | 183 | $permalink_string .= ' |
184 | 184 | <div id="js-ts-iframe" style="display:none"> |
185 | 185 | <div style="width:100%; height: 500px;"> |
186 | - <iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe> |
|
186 | + <iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe> |
|
187 | 187 | </div> |
188 | 188 | </div>'; |
189 | 189 | } |
@@ -203,25 +203,25 @@ discard block |
||
203 | 203 | * @param bool $view_details |
204 | 204 | * @return string |
205 | 205 | */ |
206 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
207 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
206 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
207 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
208 | 208 | // reset filter for displaying submit button |
209 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
209 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
210 | 210 | // poke and prod incoming event till it tells us what it is |
211 | - if ( $event instanceof EE_Event ) { |
|
211 | + if ($event instanceof EE_Event) { |
|
212 | 212 | self::$_event = $event; |
213 | 213 | $event_post = $event->ID(); |
214 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
214 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
215 | 215 | self::$_event = $event->EE_Event; |
216 | 216 | $event_post = $event; |
217 | - } else if ( $event instanceof WP_Post && ( ! isset( $event->EE_Event ) || ! $event->EE_Event instanceof EE_Event )) { |
|
218 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
217 | + } else if ($event instanceof WP_Post && ( ! isset($event->EE_Event) || ! $event->EE_Event instanceof EE_Event)) { |
|
218 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
219 | 219 | self::$_event = $event->EE_Event; |
220 | 220 | $event_post = $event; |
221 | 221 | } else { |
222 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
223 | - $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' ); |
|
224 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
222 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
223 | + $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'); |
|
224 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
225 | 225 | return FALSE; |
226 | 226 | } |
227 | 227 | // grab event status |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | && ( |
232 | 232 | ! self::$_event->display_ticket_selector() |
233 | 233 | || $view_details |
234 | - || post_password_required( $event_post ) |
|
234 | + || post_password_required($event_post) |
|
235 | 235 | || ( |
236 | 236 | $_event_active_status != EE_Datetime::active |
237 | 237 | && $_event_active_status != EE_Datetime::upcoming |
@@ -243,64 +243,64 @@ discard block |
||
243 | 243 | ) |
244 | 244 | ) |
245 | 245 | ) { |
246 | - return ! is_single() ? EED_Ticket_Selector::display_view_details_btn( self::$_event ) : ''; |
|
246 | + return ! is_single() ? EED_Ticket_Selector::display_view_details_btn(self::$_event) : ''; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | $template_args = array(); |
250 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', 'l F jS, Y' ); |
|
251 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', 'g:i a' ); |
|
250 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', 'l F jS, Y'); |
|
251 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', 'g:i a'); |
|
252 | 252 | |
253 | 253 | $template_args['EVT_ID'] = self::$_event->ID(); |
254 | 254 | $template_args['event'] = self::$_event; |
255 | 255 | |
256 | 256 | // is the event expired ? |
257 | 257 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
258 | - if ( $template_args['event_is_expired'] ) { |
|
259 | - 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>'; |
|
258 | + if ($template_args['event_is_expired']) { |
|
259 | + 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>'; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
263 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
264 | - if ( $template_args['max_atndz'] < 1 ) { |
|
265 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
266 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
267 | - $sales_closed_msg .= sprintf( |
|
268 | - __( '%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' ), |
|
263 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
264 | + if ($template_args['max_atndz'] < 1) { |
|
265 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
266 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
267 | + $sales_closed_msg .= sprintf( |
|
268 | + __('%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'), |
|
269 | 269 | '<div class="ee-attention" style="text-align: left;"><b>', |
270 | 270 | '</b><br />', |
271 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
271 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
272 | 272 | '</a></span></div>' |
273 | 273 | ); |
274 | 274 | } |
275 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
275 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | // get all tickets for this event ordered by the datetime |
279 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( array( |
|
280 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
281 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
279 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all(array( |
|
280 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
281 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
282 | 282 | )); |
283 | 283 | |
284 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
285 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
284 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
285 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
286 | 286 | |
287 | 287 | // redirecting to another site for registration ?? |
288 | 288 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
289 | 289 | // set up the form (but not for the admin) |
290 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
290 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
291 | 291 | // if not redirecting to another site for registration |
292 | - if ( ! $external_url ) { |
|
293 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
292 | + if ( ! $external_url) { |
|
293 | + EE_Registry::instance()->load_helper('Template'); |
|
294 | 294 | // then display the ticket selector |
295 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
295 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
296 | 296 | } else { |
297 | 297 | // if not we still need to trigger the display of the submit button |
298 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
298 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
299 | 299 | //display notice to admin that registration is external |
300 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
300 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
301 | 301 | } |
302 | 302 | // submit button and form close tag |
303 | - $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit( self::$_event->ID() ) : ''; |
|
303 | + $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit(self::$_event->ID()) : ''; |
|
304 | 304 | // set no cache headers and constants |
305 | 305 | EE_System::do_not_cache(); |
306 | 306 | |
@@ -317,26 +317,26 @@ discard block |
||
317 | 317 | * @param string $external_url |
318 | 318 | * @return string |
319 | 319 | */ |
320 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
320 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
321 | 321 | // if redirecting, we don't need any anything else |
322 | - if ( $external_url ) { |
|
323 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
324 | - $html = '<form id="" method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
325 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
326 | - foreach ( $query_args as $query_arg => $value ) { |
|
327 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
322 | + if ($external_url) { |
|
323 | + EE_Registry::instance()->load_helper('URL'); |
|
324 | + $html = '<form id="" method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
325 | + $query_args = EEH_URL::get_query_string($external_url); |
|
326 | + foreach ($query_args as $query_arg => $value) { |
|
327 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
328 | 328 | } |
329 | 329 | return $html; |
330 | 330 | } |
331 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
332 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
333 | - if ( ! $checkout_url ) { |
|
334 | - $msg = __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ); |
|
335 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
331 | + EE_Registry::instance()->load_helper('Event_View'); |
|
332 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
333 | + if ( ! $checkout_url) { |
|
334 | + $msg = __('The URL for the Event Details page could not be retrieved.', 'event_espresso'); |
|
335 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
336 | 336 | } |
337 | - $checkout_url = add_query_arg( array( 'ee' => 'process_ticket_selections' ), $checkout_url ); |
|
337 | + $checkout_url = add_query_arg(array('ee' => 'process_ticket_selections'), $checkout_url); |
|
338 | 338 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
339 | - return '<form id="" method="POST" action="' . $checkout_url . '"' . $extra_params . '>' . wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
339 | + return '<form id="" method="POST" action="'.$checkout_url.'"'.$extra_params.'>'.wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | * @return string |
352 | 352 | */ |
353 | 353 | public static function display_ticket_selector_submit() { |
354 | - if ( ! is_admin() ) { |
|
355 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
356 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', __('Register Now', 'event_espresso' )); |
|
357 | - return '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn" type="submit" value="' . $btn_text . '" /><div class="clear"><br/></div></form>'; |
|
358 | - } else if ( is_archive() ) { |
|
359 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
354 | + if ( ! is_admin()) { |
|
355 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
356 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', __('Register Now', 'event_espresso')); |
|
357 | + return '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn" type="submit" value="'.$btn_text.'" /><div class="clear"><br/></div></form>'; |
|
358 | + } else if (is_archive()) { |
|
359 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | return ''; |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | * @return string |
389 | 389 | */ |
390 | 390 | public static function display_view_details_btn() { |
391 | - if ( ! self::$_event->get_permalink() ) { |
|
392 | - $msg = __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ); |
|
393 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
391 | + if ( ! self::$_event->get_permalink()) { |
|
392 | + $msg = __('The URL for the Event Details page could not be retrieved.', 'event_espresso'); |
|
393 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
394 | 394 | } |
395 | - $view_details_btn = '<form id="" method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
396 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ) ); |
|
397 | - $view_details_btn .= '<input id="ticket-selector-submit-' . self::$_event->ID() . '-btn" class="ticket-selector-submit-btn" type="submit" value="' . $btn_text . '" /><div class="clear"><br/></div>'; |
|
395 | + $view_details_btn = '<form id="" method="POST" action="'.self::$_event->get_permalink().'">'; |
|
396 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso')); |
|
397 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn" type="submit" value="'.$btn_text.'" /><div class="clear"><br/></div>'; |
|
398 | 398 | $view_details_btn .= '</form>'; |
399 | 399 | return $view_details_btn; |
400 | 400 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | * @return array or FALSE |
413 | 413 | */ |
414 | 414 | public function process_ticket_selections() { |
415 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
415 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
416 | 416 | // check nonce |
417 | - 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' ))) { |
|
418 | - $error_msg = 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/>' ); |
|
419 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
417 | + 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'))) { |
|
418 | + $error_msg = 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/>'); |
|
419 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
420 | 420 | return FALSE; |
421 | 421 | } |
422 | 422 | // d( EE_Registry::instance()->REQ ); |
@@ -428,97 +428,97 @@ discard block |
||
428 | 428 | |
429 | 429 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
430 | 430 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
431 | - EE_Registry::instance()->load_core( 'Session' ); |
|
431 | + EE_Registry::instance()->load_core('Session'); |
|
432 | 432 | // unless otherwise requested, clear the session |
433 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
434 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
433 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
434 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
435 | 435 | } |
436 | 436 | //d( EE_Registry::instance()->SSN ); |
437 | 437 | |
438 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
438 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
439 | 439 | // do we have an event id? |
440 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' )) { |
|
440 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
441 | 441 | |
442 | 442 | // validate/sanitize data |
443 | 443 | $valid = self::_validate_post_data('add_event_to_cart'); |
444 | 444 | // d( $valid ); |
445 | 445 | |
446 | 446 | //check total tickets ordered vs max number of attendees that can register |
447 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
447 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
448 | 448 | |
449 | 449 | // ordering too many tickets !!! |
450 | 450 | $singular = 'You have attempted to purchase %s ticket.'; |
451 | 451 | $plural = 'You have attempted to purchase %s tickets.'; |
452 | - $limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] ); |
|
452 | + $limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']); |
|
453 | 453 | |
454 | 454 | $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.'; |
455 | 455 | $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.'; |
456 | - $limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] ); |
|
457 | - $error_msg = $limit_error_1 . '<br/>' . $limit_error_2; |
|
458 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
456 | + $limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']); |
|
457 | + $error_msg = $limit_error_1.'<br/>'.$limit_error_2; |
|
458 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
459 | 459 | } else { |
460 | 460 | |
461 | 461 | // all data appears to be valid |
462 | 462 | $tckts_slctd = FALSE; |
463 | 463 | $success = TRUE; |
464 | 464 | // load cart |
465 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
465 | + EE_Registry::instance()->load_core('Cart'); |
|
466 | 466 | |
467 | 467 | // cycle thru the number of data rows sent from the event listing |
468 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
468 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
469 | 469 | // does this row actually contain a ticket quantity? |
470 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
470 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
471 | 471 | // YES we have a ticket quantity |
472 | 472 | $tckts_slctd = TRUE; |
473 | 473 | // d( $valid['ticket_obj'][$x] ); |
474 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
474 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
475 | 475 | // then add ticket to cart |
476 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
476 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
477 | 477 | $success = ! $ticket_added ? FALSE : $success; |
478 | 478 | } else { |
479 | 479 | // nothing added to cart retrieved |
480 | - $error_msg = 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/>' ); |
|
481 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
480 | + $error_msg = 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/>'); |
|
481 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | } |
485 | 485 | // d( EE_Registry::instance()->CART ); |
486 | 486 | // die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE |
487 | 487 | |
488 | - if ( $tckts_slctd ) { |
|
489 | - if ( $success ) { |
|
488 | + if ($tckts_slctd) { |
|
489 | + if ($success) { |
|
490 | 490 | EE_Registry::instance()->CART->save_cart(); |
491 | 491 | EE_Registry::instance()->SSN->update(); |
492 | 492 | // just return TRUE for registrations being made from admin |
493 | - if ( is_admin() ) { |
|
493 | + if (is_admin()) { |
|
494 | 494 | return TRUE; |
495 | 495 | } |
496 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__$success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
496 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__$success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
497 | 497 | exit(); |
498 | 498 | |
499 | 499 | } else { |
500 | 500 | // nothing added to cart |
501 | - $error_msg = __( 'No tickets were added for the event.', 'event_espresso' ); |
|
502 | - EE_Error::add_attention( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
501 | + $error_msg = __('No tickets were added for the event.', 'event_espresso'); |
|
502 | + EE_Error::add_attention($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | } else { |
506 | 506 | // no ticket quantities were selected |
507 | - $error_msg = __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ); |
|
508 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
507 | + $error_msg = __('You need to select a ticket quantity before you can proceed.', 'event_espresso'); |
|
508 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | // at this point, just return if registration is being made from admin |
512 | - if ( is_admin() ) { |
|
512 | + if (is_admin()) { |
|
513 | 513 | return FALSE; |
514 | 514 | } |
515 | - if ( $valid['return_url'] ) { |
|
516 | - EE_Error::get_notices( FALSE, TRUE ); |
|
517 | - wp_safe_redirect( $valid['return_url'] ); |
|
515 | + if ($valid['return_url']) { |
|
516 | + EE_Error::get_notices(FALSE, TRUE); |
|
517 | + wp_safe_redirect($valid['return_url']); |
|
518 | 518 | exit(); |
519 | - } elseif ( isset( $event_to_add['id'] )) { |
|
520 | - EE_Error::get_notices( FALSE, TRUE ); |
|
521 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
519 | + } elseif (isset($event_to_add['id'])) { |
|
520 | + EE_Error::get_notices(FALSE, TRUE); |
|
521 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
522 | 522 | exit(); |
523 | 523 | } else { |
524 | 524 | echo EE_Error::get_notices(); |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | |
527 | 527 | } else { |
528 | 528 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
529 | - $error_msg = 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/>' ); |
|
530 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
529 | + $error_msg = 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/>'); |
|
530 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | return FALSE; |
@@ -543,18 +543,18 @@ discard block |
||
543 | 543 | * @return array or FALSE |
544 | 544 | */ |
545 | 545 | private static function _validate_post_data() { |
546 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
546 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
547 | 547 | |
548 | 548 | // start with an empty array() |
549 | 549 | $valid_data = array(); |
550 | 550 | // d( $_POST ); |
551 | 551 | //if event id is valid |
552 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
553 | - if ( $id ) { |
|
552 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
553 | + if ($id) { |
|
554 | 554 | // grab valid id |
555 | 555 | $valid_data['id'] = $id; |
556 | 556 | // grab and sanitize return-url |
557 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
557 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
558 | 558 | // array of other form names |
559 | 559 | $inputs_to_clean = array( |
560 | 560 | 'event_id' => 'tkt-slctr-event-id', |
@@ -567,22 +567,22 @@ discard block |
||
567 | 567 | // let's track the total number of tickets ordered.' |
568 | 568 | $valid_data['total_tickets'] = 0; |
569 | 569 | // cycle through $inputs_to_clean array |
570 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
570 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
571 | 571 | // check for POST data |
572 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
572 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
573 | 573 | // grab value |
574 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
574 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
575 | 575 | switch ($what) { |
576 | 576 | |
577 | 577 | // integers |
578 | 578 | case 'event_id': |
579 | - $valid_data[$what] = absint( $input_value ); |
|
579 | + $valid_data[$what] = absint($input_value); |
|
580 | 580 | // get event via the event id we put in the form |
581 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
581 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
582 | 582 | break; |
583 | 583 | case 'rows': |
584 | 584 | case 'max_atndz': |
585 | - $valid_data[$what] = absint( $input_value ); |
|
585 | + $valid_data[$what] = absint($input_value); |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | // arrays of integers |
@@ -590,27 +590,27 @@ discard block |
||
590 | 590 | // d( $input_value ); |
591 | 591 | $row_qty = $input_value; |
592 | 592 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
593 | - if( ! is_array( $row_qty )) { |
|
593 | + if ( ! is_array($row_qty)) { |
|
594 | 594 | // get number of rows |
595 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
595 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
596 | 596 | // d( $rows ); |
597 | 597 | // explode ints by the dash |
598 | - $row_qty = explode( '-', $row_qty ); |
|
599 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
600 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
601 | - $row_qty = array( $row => $qty ); |
|
598 | + $row_qty = explode('-', $row_qty); |
|
599 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
600 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
601 | + $row_qty = array($row => $qty); |
|
602 | 602 | // d( $row_qty ); |
603 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
604 | - if ( ! isset( $row_qty[$x] )) { |
|
603 | + for ($x = 1; $x <= $rows; $x++) { |
|
604 | + if ( ! isset($row_qty[$x])) { |
|
605 | 605 | $row_qty[$x] = 0; |
606 | 606 | } |
607 | 607 | } |
608 | 608 | } |
609 | - ksort( $row_qty ); |
|
609 | + ksort($row_qty); |
|
610 | 610 | // d( $row_qty ); |
611 | 611 | // cycle thru values |
612 | - foreach ( $row_qty as $qty ) { |
|
613 | - $qty = absint( $qty ); |
|
612 | + foreach ($row_qty as $qty) { |
|
613 | + $qty = absint($qty); |
|
614 | 614 | // sanitize as integers |
615 | 615 | $valid_data[$what][] = $qty; |
616 | 616 | $valid_data['total_tickets'] += $qty; |
@@ -621,19 +621,19 @@ discard block |
||
621 | 621 | case 'ticket_id': |
622 | 622 | $value_array = array(); |
623 | 623 | // cycle thru values |
624 | - foreach ( $input_value as $key=>$value ) { |
|
624 | + foreach ($input_value as $key=>$value) { |
|
625 | 625 | // allow only numbers, letters, spaces, commas and dashes |
626 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
626 | + $value_array[$key] = wp_strip_all_tags($value); |
|
627 | 627 | // get ticket via the ticket id we put in the form |
628 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
629 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
628 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
629 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
630 | 630 | } |
631 | - $valid_data[ $what ] = $value_array; |
|
631 | + $valid_data[$what] = $value_array; |
|
632 | 632 | break; |
633 | 633 | |
634 | 634 | case 'return_url' : |
635 | 635 | // grab and sanitize return-url |
636 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
636 | + $valid_data[$what] = esc_url_raw($input_value); |
|
637 | 637 | break; |
638 | 638 | |
639 | 639 | } // end switch $what |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | } else { |
644 | 644 | $error_msg = 'The event id provided was not valid'; |
645 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
645 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
646 | 646 | return FALSE; |
647 | 647 | } |
648 | 648 | |
@@ -660,24 +660,24 @@ discard block |
||
660 | 660 | * @param int $qty |
661 | 661 | * @return TRUE on success, FALSE on fail |
662 | 662 | */ |
663 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
664 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
663 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
664 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
665 | 665 | // get the number of spaces left for this datetime ticket |
666 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
666 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
667 | 667 | // compare available spaces against the number of tickets being purchased |
668 | - if ( $available_spaces >= $qty ) { |
|
668 | + if ($available_spaces >= $qty) { |
|
669 | 669 | // add event to cart |
670 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
671 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
670 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
671 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
672 | 672 | return TRUE; |
673 | 673 | } else { |
674 | 674 | return FALSE; |
675 | 675 | } |
676 | 676 | } else { |
677 | 677 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
678 | - $available_spaces = self::_ticket_datetime_availability( $ticket, TRUE ); |
|
678 | + $available_spaces = self::_ticket_datetime_availability($ticket, TRUE); |
|
679 | 679 | // greedy greedy greedy eh? |
680 | - if ( $available_spaces > 0 ) { |
|
680 | + if ($available_spaces > 0) { |
|
681 | 681 | // 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 |
682 | 682 | $error_msg = sprintf( |
683 | 683 | _n( |
@@ -689,10 +689,10 @@ discard block |
||
689 | 689 | $available_spaces, |
690 | 690 | '<br />' |
691 | 691 | ); |
692 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
692 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
693 | 693 | } else { |
694 | 694 | $error_msg = __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'); |
695 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
695 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
696 | 696 | } |
697 | 697 | return FALSE; |
698 | 698 | } |
@@ -710,22 +710,22 @@ discard block |
||
710 | 710 | * @param bool $get_original_ticket_spaces |
711 | 711 | * @return int |
712 | 712 | */ |
713 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
713 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
714 | 714 | // if the $_available_spaces array has not been set up yet... |
715 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
716 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
715 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
716 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
717 | 717 | } |
718 | 718 | $available_spaces = $ticket->qty() - $ticket->sold(); |
719 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
719 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
720 | 720 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
721 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
721 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
722 | 722 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
723 | - if ( $get_original_ticket_spaces ) { |
|
723 | + if ($get_original_ticket_spaces) { |
|
724 | 724 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
725 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
725 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
726 | 726 | } else { |
727 | 727 | // we want the updated ticket availability as stored in the "datetimes" array |
728 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
728 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
729 | 729 | } |
730 | 730 | } |
731 | 731 | } |
@@ -741,23 +741,23 @@ discard block |
||
741 | 741 | * @param EE_Ticket $ticket |
742 | 742 | * @return int |
743 | 743 | */ |
744 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
744 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
745 | 745 | // first, get all of the datetimes that are available to this ticket |
746 | 746 | $datetimes = $ticket->get_many_related( |
747 | 747 | 'Datetime', |
748 | - array( array( 'DTT_EVT_end' => array( '>=', current_time( 'mysql' ))), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
748 | + array(array('DTT_EVT_end' => array('>=', current_time('mysql'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
749 | 749 | ); |
750 | - if ( ! empty( $datetimes )) { |
|
750 | + if ( ! empty($datetimes)) { |
|
751 | 751 | // now loop thru all of the datetimes |
752 | - foreach ( $datetimes as $datetime ) { |
|
753 | - if ( $datetime instanceof EE_Datetime ) { |
|
752 | + foreach ($datetimes as $datetime) { |
|
753 | + if ($datetime instanceof EE_Datetime) { |
|
754 | 754 | // the number of spaces available for the datetime without considering individual ticket quantities |
755 | 755 | $spaces_remaining = $datetime->spaces_remaining(); |
756 | 756 | // 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 |
757 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
757 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
758 | 758 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
759 | 759 | // else just take the datetime spaces remaining, and assign to the datetimes array |
760 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
760 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
761 | 761 | } |
762 | 762 | } |
763 | 763 | } |
@@ -773,12 +773,12 @@ discard block |
||
773 | 773 | * @param int $qty |
774 | 774 | * @return int |
775 | 775 | */ |
776 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
777 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
776 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
777 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
778 | 778 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
779 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
779 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
780 | 780 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
781 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
781 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
782 | 782 | } |
783 | 783 | } |
784 | 784 | } |
@@ -795,13 +795,13 @@ discard block |
||
795 | 795 | */ |
796 | 796 | public static function load_tckt_slctr_assets() { |
797 | 797 | // add some style |
798 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
799 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
798 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
799 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
800 | 800 | wp_enqueue_style('ticket_selector'); |
801 | 801 | // make it dance |
802 | 802 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('jquery'), '', TRUE); |
803 | 803 | // wp_enqueue_script('ticket_selector'); |
804 | - wp_localize_script( 'ticket_selector', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
804 | + wp_localize_script('ticket_selector', 'eei18n', EE_Registry::$i18n_js_strings); |
|
805 | 805 | } |
806 | 806 | } |
807 | 807 | |
@@ -811,11 +811,11 @@ discard block |
||
811 | 811 | |
812 | 812 | public static function load_tckt_slctr_assets_admin() { |
813 | 813 | //iframe button js on admin event editor page |
814 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
815 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
816 | - EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso' ); |
|
817 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
818 | - wp_localize_script( 'ticket_selector_embed', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
814 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
815 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
816 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
817 | + wp_enqueue_script('ticket_selector_embed'); |
|
818 | + wp_localize_script('ticket_selector_embed', 'eei18n', EE_Registry::$i18n_js_strings); |
|
819 | 819 | } |
820 | 820 | } |
821 | 821 |
@@ -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 | * |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @access public |
95 | 95 | * @param string $title |
96 | - * @return void |
|
96 | + * @return string |
|
97 | 97 | */ |
98 | 98 | public function the_title( $title = '', $id = '' ) { |
99 | 99 | return $title; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * |
130 | 130 | * @access public |
131 | 131 | * @param string $content |
132 | - * @return void |
|
132 | + * @return string |
|
133 | 133 | */ |
134 | 134 | public function venue_location( $content ) { |
135 | 135 | return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venue_Single |
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( 'venue', 'Venue_Single', 'run' ); |
|
40 | + EE_Config::register_route('venue', 'Venue_Single', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-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,16 +72,16 @@ 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() != 'single-espresso_venues.php' ) { |
|
77 | + if (EE_Front_Controller::instance()->get_selected_template() != 'single-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 ); |
|
81 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
82 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
80 | + add_filter('the_title', array($this, 'the_title'), 100, 2); |
|
81 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
82 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
83 | 83 | // don't diplay entry meta because the existing theme will take car of that |
84 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
84 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
85 | 85 | } |
86 | 86 | return $template; |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $title |
96 | 96 | * @return void |
97 | 97 | */ |
98 | - public function the_title( $title = '', $id = '' ) { |
|
98 | + public function the_title($title = '', $id = '') { |
|
99 | 99 | return $title; |
100 | 100 | // global $post; |
101 | 101 | // return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
@@ -109,17 +109,17 @@ discard block |
||
109 | 109 | * @param string $content |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function venue_details( $content ) { |
|
112 | + public function venue_details($content) { |
|
113 | 113 | global $post; |
114 | 114 | // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
115 | 115 | // it uses the_content() for displaying the $post->post_content |
116 | 116 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
117 | 117 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
118 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
118 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
119 | 119 | // now load our template |
120 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
120 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
121 | 121 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
122 | - return ! empty( $template ) ? $template : $content; |
|
122 | + return ! empty($template) ? $template : $content; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param string $content |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - public function venue_location( $content ) { |
|
135 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
134 | + public function venue_location($content) { |
|
135 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function wp_enqueue_scripts() { |
147 | 147 | // get some style |
148 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) { |
|
148 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) { |
|
149 | 149 | // first check theme folder |
150 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
151 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
152 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
153 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
150 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
151 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
152 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
153 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
154 | 154 | } |
155 | 155 | // if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'single-espresso_venues.js' )) { |
156 | 156 | // wp_register_script( 'single-espresso_venues', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'single-espresso_venues.js', array('espresso_core'), '1.0', TRUE ); |
157 | 157 | // } else if ( is_readable( EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.js' )) { |
158 | 158 | // wp_register_script( 'single-espresso_venues', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'single-espresso_venues.js', array('espresso_core'), '1.0', TRUE ); |
159 | 159 | // } |
160 | - wp_enqueue_style( $this->theme ); |
|
160 | + wp_enqueue_style($this->theme); |
|
161 | 161 | // wp_enqueue_script( 'single-espresso_venues' ); |
162 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
163 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
164 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
162 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
163 | + EE_Registry::instance()->load_helper('Maps'); |
|
164 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -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 | * |