@@ -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( |
@@ -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,15 +27,15 @@ 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_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
36 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
37 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
38 | - 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_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
36 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
37 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
38 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -45,19 +45,19 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | public static function set_hooks_admin() { |
48 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
49 | - 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 ); |
|
50 | - 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 ); |
|
51 | - add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
52 | - add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
53 | - 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 ); |
|
54 | - add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
55 | - add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
56 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
57 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
58 | - add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 ); |
|
59 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
60 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
48 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
49 | + 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); |
|
50 | + 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); |
|
51 | + add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
52 | + add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
53 | + 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); |
|
54 | + add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
55 | + add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
56 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
57 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
58 | + add_filter('FHEE__Single_Page_Checkout___check_form_submission__request_params', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
59 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
60 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * @return void |
70 | 70 | */ |
71 | 71 | public static function set_definitions() { |
72 | - define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
73 | - define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
72 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
73 | + define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param \WP $WP |
83 | 83 | * @return void |
84 | 84 | */ |
85 | - public function run( $WP ) { |
|
85 | + public function run($WP) { |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | * @return void |
111 | 111 | */ |
112 | 112 | public static function wp_enqueue_scripts() { |
113 | - wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
114 | - wp_enqueue_script( 'add_new_state' ); |
|
113 | + wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
114 | + wp_enqueue_script('add_new_state'); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,32 +124,32 @@ discard block |
||
124 | 124 | * @return string |
125 | 125 | */ |
126 | 126 | // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
127 | - public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){ |
|
127 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) { |
|
128 | 128 | // only add the 'new_state_micro_form' when displaying reg forms, |
129 | 129 | // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
130 | - $action = EE_Registry::instance()->REQ->get( 'action', '' ); |
|
131 | - if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) { |
|
130 | + $action = EE_Registry::instance()->REQ->get('action', ''); |
|
131 | + if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
132 | 132 | return $question_group_reg_form; |
133 | 133 | } |
134 | 134 | // is the "state" question in this form section? |
135 | - $input = $question_group_reg_form->get_subsection( 'state' ); |
|
135 | + $input = $question_group_reg_form->get_subsection('state'); |
|
136 | 136 | // we're only doing this for state select inputs |
137 | - if ( $input instanceof EE_State_Select_Input ) { |
|
137 | + if ($input instanceof EE_State_Select_Input) { |
|
138 | 138 | // load helpers |
139 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
139 | + EE_Registry::instance()->load_helper('HTML'); |
|
140 | 140 | // load JS |
141 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 ); |
|
141 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
142 | 142 | // grab any set values from the request |
143 | - $country_name = str_replace( 'state', 'new_state_country', $input->html_name() ); |
|
144 | - $state_name = str_replace( 'state', 'new_state_name', $input->html_name() ); |
|
145 | - $abbrv_name = str_replace( 'state', 'new_state_abbrv', $input->html_name() ); |
|
146 | - $new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() ); |
|
143 | + $country_name = str_replace('state', 'new_state_country', $input->html_name()); |
|
144 | + $state_name = str_replace('state', 'new_state_name', $input->html_name()); |
|
145 | + $abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name()); |
|
146 | + $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
147 | 147 | $country_options = array(); |
148 | 148 | $countries = EEM_Country::instance()->get_all_countries(); |
149 | - if ( ! empty( $countries )) { |
|
150 | - foreach( $countries as $country ){ |
|
151 | - if ( $country instanceof EE_Country ) { |
|
152 | - $country_options[ $country->ID() ] = $country->name(); |
|
149 | + if ( ! empty($countries)) { |
|
150 | + foreach ($countries as $country) { |
|
151 | + if ($country instanceof EE_Country) { |
|
152 | + $country_options[$country->ID()] = $country->name(); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | // add hidden input to indicate that a new state is being added |
163 | 163 | 'add_new_state' => new EE_Hidden_Input( |
164 | 164 | array( |
165 | - 'html_name' => str_replace( 'state', 'add_new_state', $input->html_name() ), |
|
166 | - 'html_id' => str_replace( 'state', 'add_new_state', $input->html_id() ), |
|
165 | + 'html_name' => str_replace('state', 'add_new_state', $input->html_name()), |
|
166 | + 'html_id' => str_replace('state', 'add_new_state', $input->html_id()), |
|
167 | 167 | 'default' => 0 |
168 | 168 | ) |
169 | 169 | ), |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | '', |
176 | 176 | __('click here to add a new state/province', 'event_espresso'), |
177 | 177 | '', |
178 | - 'display-' . $input->html_id(), |
|
178 | + 'display-'.$input->html_id(), |
|
179 | 179 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
180 | 180 | '', |
181 | - 'rel="' . $input->html_id() . '"' |
|
181 | + 'rel="'.$input->html_id().'"' |
|
182 | 182 | ) |
183 | 183 | ) |
184 | 184 | ), |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | 'add_new_state_micro_form' =>new EE_Form_Section_HTML( |
187 | 187 | apply_filters( |
188 | 188 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
189 | - EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) . |
|
190 | - 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')) . |
|
191 | - EEH_HTML::ul() . |
|
192 | - EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) . |
|
193 | - EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) . |
|
194 | - EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) . |
|
195 | - EEH_HTML::li( __('click the ADD button', 'event_espresso') ) . |
|
189 | + EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;'). |
|
190 | + 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')). |
|
191 | + EEH_HTML::ul(). |
|
192 | + EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')). |
|
193 | + EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')). |
|
194 | + EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')). |
|
195 | + EEH_HTML::li(__('click the ADD button', 'event_espresso')). |
|
196 | 196 | EEH_HTML::ulx() |
197 | 197 | ) |
198 | 198 | ), |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | $country_options, |
202 | 202 | array( |
203 | 203 | 'html_name' => $country_name, |
204 | - 'html_id' => str_replace( 'state', 'new_state_country', $input->html_id() ), |
|
205 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
204 | + 'html_id' => str_replace('state', 'new_state_country', $input->html_id()), |
|
205 | + 'html_class' => $input->html_class().' new-state-country', |
|
206 | 206 | 'html_label_text' => __('New State/Province Country', 'event_espresso'), |
207 | - 'default' => EE_Registry::instance()->REQ->get( $country_name, '' ), |
|
207 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
208 | 208 | 'required' => false |
209 | 209 | ) |
210 | 210 | ), |
@@ -212,23 +212,23 @@ discard block |
||
212 | 212 | 'new_state_name' => new EE_Text_Input( |
213 | 213 | array( |
214 | 214 | 'html_name' => $state_name, |
215 | - 'html_id' => str_replace( 'state', 'new_state_name', $input->html_id() ), |
|
216 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
215 | + 'html_id' => str_replace('state', 'new_state_name', $input->html_id()), |
|
216 | + 'html_class' => $input->html_class().' new-state-state', |
|
217 | 217 | 'html_label_text' => __('New State/Province Name', 'event_espresso'), |
218 | - 'default' => EE_Registry::instance()->REQ->get( $state_name, '' ), |
|
218 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
219 | 219 | 'required' => false |
220 | 220 | ) |
221 | 221 | ), |
222 | - 'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ), |
|
222 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
223 | 223 | // NEW STATE NAME |
224 | 224 | 'new_state_abbrv' => new EE_Text_Input( |
225 | 225 | array( |
226 | 226 | 'html_name' => $abbrv_name, |
227 | - 'html_id' => str_replace( 'state', 'new_state_abbrv', $input->html_id() ), |
|
228 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
227 | + 'html_id' => str_replace('state', 'new_state_abbrv', $input->html_id()), |
|
228 | + 'html_class' => $input->html_class().' new-state-abbrv', |
|
229 | 229 | 'html_label_text' => __('New State/Province Abbreviation', 'event_espresso'), |
230 | 230 | 'html_other_attributes' => 'size="24"', |
231 | - 'default' => EE_Registry::instance()->REQ->get( $abbrv_name, '' ), |
|
231 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
232 | 232 | 'required' => false |
233 | 233 | ) |
234 | 234 | ), |
@@ -236,26 +236,26 @@ discard block |
||
236 | 236 | 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
237 | 237 | apply_filters( |
238 | 238 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
239 | - EEH_HTML::nbsp(3) . |
|
240 | - 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 . '"' ) |
|
239 | + EEH_HTML::nbsp(3). |
|
240 | + 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.'"') |
|
241 | 241 | ) |
242 | 242 | ), |
243 | 243 | // extra info |
244 | 244 | 'add_new_state_extra' => new EE_Form_Section_HTML( |
245 | 245 | apply_filters( |
246 | 246 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
247 | - EEH_HTML::br(2) . |
|
248 | - EEH_HTML::div( '', '', 'small-text' ) . |
|
249 | - EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) . |
|
250 | - EEH_HTML::br() . |
|
247 | + EEH_HTML::br(2). |
|
248 | + EEH_HTML::div('', '', 'small-text'). |
|
249 | + EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')). |
|
250 | + EEH_HTML::br(). |
|
251 | 251 | sprintf( |
252 | 252 | __('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'), |
253 | - 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' ) |
|
254 | - ) . |
|
255 | - EEH_HTML::divx() . |
|
256 | - EEH_HTML::br() . |
|
257 | - 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() . '"' ) . |
|
258 | - EEH_HTML::divx() . |
|
253 | + 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') |
|
254 | + ). |
|
255 | + EEH_HTML::divx(). |
|
256 | + EEH_HTML::br(). |
|
257 | + 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().'"'). |
|
258 | + EEH_HTML::divx(). |
|
259 | 259 | EEH_HTML::br() |
260 | 260 | ) |
261 | 261 | ) |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | ) |
264 | 264 | ) |
265 | 265 | ); |
266 | - $question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'country' ); |
|
266 | + $question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'country'); |
|
267 | 267 | } |
268 | 268 | return $question_group_reg_form; |
269 | 269 | } |
@@ -280,41 +280,41 @@ discard block |
||
280 | 280 | */ |
281 | 281 | public static function add_new_state() { |
282 | 282 | $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
283 | - if ( $REQ->is_set( 'add_new_state' ) && $REQ->get( 'add_new_state' ) == 1 ) { |
|
283 | + if ($REQ->is_set('add_new_state') && $REQ->get('add_new_state') == 1) { |
|
284 | 284 | EE_Registry::instance()->load_model('State'); |
285 | 285 | // grab country ISO code, new state name, and new state abbreviation |
286 | - $state_country = $REQ->is_set( 'new_state_country' ) ? sanitize_text_field( $REQ->get( 'new_state_country' )) : FALSE; |
|
287 | - $state_name = $REQ->is_set( 'new_state_name' ) ? sanitize_text_field( $REQ->get( 'new_state_name' )) : FALSE; |
|
288 | - $state_abbr = $REQ->is_set( 'new_state_abbrv' ) ? sanitize_text_field( $REQ->get( 'new_state_abbrv' )) : FALSE; |
|
286 | + $state_country = $REQ->is_set('new_state_country') ? sanitize_text_field($REQ->get('new_state_country')) : FALSE; |
|
287 | + $state_name = $REQ->is_set('new_state_name') ? sanitize_text_field($REQ->get('new_state_name')) : FALSE; |
|
288 | + $state_abbr = $REQ->is_set('new_state_abbrv') ? sanitize_text_field($REQ->get('new_state_abbrv')) : FALSE; |
|
289 | 289 | |
290 | 290 | //echo '<h4>$state_country : ' . $state_country . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
291 | 291 | //echo '<h4>$state_name : ' . $state_name . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
292 | 292 | //echo '<h4>$state_abbr : ' . $state_abbr . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
293 | 293 | |
294 | - if ( $state_country && $state_name && $state_abbr ) { |
|
295 | - $new_state = EED_Add_New_State::save_new_state_to_db( array( |
|
296 | - 'CNT_ISO'=> strtoupper( $state_country ), |
|
297 | - 'STA_abbrev' => strtoupper( $state_abbr ), |
|
298 | - 'STA_name' => ucwords( $state_name ), |
|
294 | + if ($state_country && $state_name && $state_abbr) { |
|
295 | + $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
296 | + 'CNT_ISO'=> strtoupper($state_country), |
|
297 | + 'STA_abbrev' => strtoupper($state_abbr), |
|
298 | + 'STA_name' => ucwords($state_name), |
|
299 | 299 | 'STA_active' => FALSE |
300 | 300 | )); |
301 | 301 | |
302 | - if ( $new_state instanceof EE_State ) { |
|
302 | + if ($new_state instanceof EE_State) { |
|
303 | 303 | // clean house |
304 | - EE_Registry::instance()->REQ->un_set( 'add_new_state' ); |
|
305 | - EE_Registry::instance()->REQ->un_set( 'new_state_country' ); |
|
306 | - EE_Registry::instance()->REQ->un_set( 'new_state_name' ); |
|
307 | - EE_Registry::instance()->REQ->un_set( 'new_state_abbrv' ); |
|
304 | + EE_Registry::instance()->REQ->un_set('add_new_state'); |
|
305 | + EE_Registry::instance()->REQ->un_set('new_state_country'); |
|
306 | + EE_Registry::instance()->REQ->un_set('new_state_name'); |
|
307 | + EE_Registry::instance()->REQ->un_set('new_state_abbrv'); |
|
308 | 308 | |
309 | 309 | // get any existing new states |
310 | 310 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
311 | 311 | 'new_states' |
312 | 312 | ); |
313 | - $new_states[ $new_state->ID() ] = $new_state; |
|
314 | - EE_Registry::instance()->SSN->set_session_data( array( 'new_states' => $new_states )); |
|
313 | + $new_states[$new_state->ID()] = $new_state; |
|
314 | + EE_Registry::instance()->SSN->set_session_data(array('new_states' => $new_states)); |
|
315 | 315 | |
316 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
317 | - echo json_encode( array( |
|
316 | + if (EE_Registry::instance()->REQ->ajax) { |
|
317 | + echo json_encode(array( |
|
318 | 318 | 'success' => TRUE, |
319 | 319 | 'id' => $new_state->ID(), |
320 | 320 | 'name' => $new_state->name(), |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | } else { |
332 | - $error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' ); |
|
333 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
334 | - echo json_encode( array( 'error' => $error )); |
|
332 | + $error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso'); |
|
333 | + if (EE_Registry::instance()->REQ->ajax) { |
|
334 | + echo json_encode(array('error' => $error)); |
|
335 | 335 | exit(); |
336 | 336 | } else { |
337 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
337 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | * @param array $request_params |
353 | 353 | * @return array |
354 | 354 | */ |
355 | - public static function filter_checkout_request_params ( $request_params ) { |
|
356 | - foreach ( $request_params as $form_section ) { |
|
357 | - if ( is_array( $form_section )) { |
|
358 | - EED_Add_New_State::unset_new_state_request_params( $form_section ); |
|
359 | - EED_Add_New_State::filter_checkout_request_params( $form_section ); |
|
355 | + public static function filter_checkout_request_params($request_params) { |
|
356 | + foreach ($request_params as $form_section) { |
|
357 | + if (is_array($form_section)) { |
|
358 | + EED_Add_New_State::unset_new_state_request_params($form_section); |
|
359 | + EED_Add_New_State::filter_checkout_request_params($form_section); |
|
360 | 360 | } |
361 | 361 | } |
362 | 362 | return $request_params; |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | * @param array $request_params |
372 | 372 | * @return boolean |
373 | 373 | */ |
374 | - public static function unset_new_state_request_params ( $request_params ) { |
|
375 | - unset( $request_params[ 'new_state_micro_form' ] ); |
|
376 | - unset( $request_params[ 'add_new_state' ] ); |
|
377 | - unset( $request_params[ 'new_state_country' ] ); |
|
378 | - unset( $request_params[ 'new_state_name' ] ); |
|
379 | - unset( $request_params[ 'new_state_abbrv' ] ); |
|
374 | + public static function unset_new_state_request_params($request_params) { |
|
375 | + unset($request_params['new_state_micro_form']); |
|
376 | + unset($request_params['add_new_state']); |
|
377 | + unset($request_params['new_state_country']); |
|
378 | + unset($request_params['new_state_name']); |
|
379 | + unset($request_params['new_state_abbrv']); |
|
380 | 380 | return $request_params; |
381 | 381 | } |
382 | 382 | |
@@ -389,26 +389,26 @@ discard block |
||
389 | 389 | * @param array $props_n_values |
390 | 390 | * @return boolean |
391 | 391 | */ |
392 | - public static function save_new_state_to_db ( $props_n_values = array() ) { |
|
392 | + public static function save_new_state_to_db($props_n_values = array()) { |
|
393 | 393 | // 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' ); |
394 | - $existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 )); |
|
395 | - if ( ! empty( $existing_state )) { |
|
396 | - return array_pop( $existing_state ); |
|
394 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
395 | + if ( ! empty($existing_state)) { |
|
396 | + return array_pop($existing_state); |
|
397 | 397 | } |
398 | - $new_state = EE_State::new_instance( $props_n_values ); |
|
399 | - if ( $new_state instanceof EE_State ) { |
|
398 | + $new_state = EE_State::new_instance($props_n_values); |
|
399 | + if ($new_state instanceof EE_State) { |
|
400 | 400 | // if not non-ajax admin |
401 | - $new_state_key = $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
401 | + $new_state_key = $new_state->country_iso().'-'.$new_state->abbrev(); |
|
402 | 402 | $new_state_notice = sprintf( |
403 | - __( '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 |
|
404 | - added to dropdown select lists in forms.', 'event_espresso' ), |
|
405 | - '<b>' . $new_state->name() . '</b>', |
|
406 | - '<b>' . $new_state->abbrev() . '</b>', |
|
407 | - '<b>' . $new_state->country()->name() . '</b>', |
|
408 | - '<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 | + __('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 |
|
404 | + added to dropdown select lists in forms.', 'event_espresso'), |
|
405 | + '<b>'.$new_state->name().'</b>', |
|
406 | + '<b>'.$new_state->abbrev().'</b>', |
|
407 | + '<b>'.$new_state->country()->name().'</b>', |
|
408 | + '<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>', |
|
409 | 409 | '<br />' |
410 | 410 | ); |
411 | - EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice ); |
|
411 | + EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
412 | 412 | $new_state->save(); |
413 | 413 | EEM_State::instance()->reset_cached_states(); |
414 | 414 | return $new_state; |
@@ -427,22 +427,22 @@ discard block |
||
427 | 427 | * @param array $cols_n_values |
428 | 428 | * @return boolean |
429 | 429 | */ |
430 | - public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) { |
|
431 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE; |
|
432 | - if ( ! $CNT_ISO ) { |
|
433 | - EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
430 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) { |
|
431 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE; |
|
432 | + if ( ! $CNT_ISO) { |
|
433 | + EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
434 | 434 | } |
435 | - $STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
436 | - if ( ! $STA_abbrev && ! empty( $STA_ID )) { |
|
437 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
438 | - if ( $state instanceof EE_State ) { |
|
435 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
436 | + if ( ! $STA_abbrev && ! empty($STA_ID)) { |
|
437 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
438 | + if ($state instanceof EE_State) { |
|
439 | 439 | $STA_abbrev = $state->abbrev(); |
440 | 440 | } |
441 | 441 | } |
442 | - if ( ! $STA_abbrev ) { |
|
443 | - EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
442 | + if ( ! $STA_abbrev) { |
|
443 | + EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
444 | 444 | } |
445 | - EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE ); |
|
445 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -458,19 +458,19 @@ discard block |
||
458 | 458 | * @param $answer |
459 | 459 | * @return bool |
460 | 460 | */ |
461 | - public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
462 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) { |
|
461 | + public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
462 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) { |
|
463 | 463 | $STA_ID = $answer->value(); |
464 | - if ( ! empty( $STA_ID ) ) { |
|
465 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
466 | - if ( $state instanceof EE_State ) { |
|
464 | + if ( ! empty($STA_ID)) { |
|
465 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
466 | + if ($state instanceof EE_State) { |
|
467 | 467 | $country = $state->country(); |
468 | - if ( $country instanceof EE_Country ) { |
|
469 | - if ( ! isset( $state_options[ $country->name() ] )) { |
|
470 | - $state_options[ $country->name() ] = array(); |
|
468 | + if ($country instanceof EE_Country) { |
|
469 | + if ( ! isset($state_options[$country->name()])) { |
|
470 | + $state_options[$country->name()] = array(); |
|
471 | 471 | } |
472 | - if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) { |
|
473 | - $state_options[ $country->name() ][ $STA_ID ] = $state->name(); |
|
472 | + if ( ! isset($state_options[$country->name()][$STA_ID])) { |
|
473 | + $state_options[$country->name()][$STA_ID] = $state->name(); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | } |
@@ -492,14 +492,14 @@ discard block |
||
492 | 492 | * @param $answer |
493 | 493 | * @return bool |
494 | 494 | */ |
495 | - public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
496 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) { |
|
495 | + public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
496 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) { |
|
497 | 497 | $CNT_ISO = $answer->value(); |
498 | - if ( ! empty( $CNT_ISO ) ) { |
|
499 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
500 | - if ( $country instanceof EE_Country ) { |
|
501 | - if ( ! isset( $country_options[ $CNT_ISO ] ) ) { |
|
502 | - $country_options[ $CNT_ISO ] = $country->name(); |
|
498 | + if ( ! empty($CNT_ISO)) { |
|
499 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
500 | + if ($country instanceof EE_Country) { |
|
501 | + if ( ! isset($country_options[$CNT_ISO])) { |
|
502 | + $country_options[$CNT_ISO] = $country->name(); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | } |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @param EE_State[] $state_options |
517 | 517 | * @return boolean |
518 | 518 | */ |
519 | - public static function state_options( $state_options = array() ) { |
|
519 | + public static function state_options($state_options = array()) { |
|
520 | 520 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
521 | 521 | 'new_states' |
522 | 522 | ); |
523 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
524 | - foreach ( $new_states as $new_state ) { |
|
523 | + if (is_array($new_states) && ! empty($new_states)) { |
|
524 | + foreach ($new_states as $new_state) { |
|
525 | 525 | if ( |
526 | 526 | $new_state instanceof EE_State |
527 | 527 | && $new_state->country() instanceof EE_Country |
528 | 528 | ) { |
529 | - $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name(); |
|
529 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } |
@@ -542,17 +542,17 @@ discard block |
||
542 | 542 | * @param EE_Country[] $country_options |
543 | 543 | * @return boolean |
544 | 544 | */ |
545 | - public static function country_options( $country_options = array() ) { |
|
545 | + public static function country_options($country_options = array()) { |
|
546 | 546 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
547 | 547 | 'new_states' |
548 | 548 | ); |
549 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
550 | - foreach ( $new_states as $new_state ) { |
|
549 | + if (is_array($new_states) && ! empty($new_states)) { |
|
550 | + foreach ($new_states as $new_state) { |
|
551 | 551 | if ( |
552 | 552 | $new_state instanceof EE_State |
553 | 553 | && $new_state->country() instanceof EE_Country |
554 | 554 | ) { |
555 | - $country_options[ $new_state->country()->ID() ] = $new_state->country()->name(); |
|
555 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
556 | 556 | } |
557 | 557 | } |
558 | 558 | } |
@@ -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( EE_Registry::instance()->CFG->core->event_cpt_slug, '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(EE_Registry::instance()->CFG->core->event_cpt_slug, '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,26 +96,26 @@ 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 ); |
|
118 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -147,30 +147,30 @@ discard block |
||
147 | 147 | * @param string $template |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public function template_include( $template = '' ) { |
|
150 | + public function template_include($template = '') { |
|
151 | 151 | // ensure valid EE_Events_Archive_Config() object exists |
152 | 152 | // EED_Events_Archive::_set_config(); |
153 | 153 | // don't add content filter for dedicated EE child themes or private posts |
154 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | - if ( ! EEH_Template::is_espresso_theme() ) { |
|
154 | + EE_Registry::instance()->load_helper('Template'); |
|
155 | + if ( ! EEH_Template::is_espresso_theme()) { |
|
156 | 156 | // add status banner ? |
157 | - if ( $this->config()->display_status_banner ) { |
|
158 | - add_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
157 | + if ($this->config()->display_status_banner) { |
|
158 | + add_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
159 | 159 | } |
160 | 160 | // if NOT a custom template |
161 | - if ( EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php' ) { |
|
161 | + if (EE_Front_Controller::instance()->get_selected_template() != 'archive-espresso_events.php') { |
|
162 | 162 | // don't display entry meta because the existing theme will take care of that |
163 | - add_filter( 'FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true' ); |
|
163 | + add_filter('FHEE__EED_Events_Archive__template_include__events_list_active', '__return_true'); |
|
164 | 164 | // load functions.php file for the theme (loaded by WP if using child theme) |
165 | 165 | EEH_Template::load_espresso_theme_functions(); |
166 | 166 | // because we don't know if the theme is using the_excerpt() |
167 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
167 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
168 | 168 | // or the_content |
169 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
169 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
170 | 170 | // and just in case they are running get_the_excerpt() which DESTROYS things |
171 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
171 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
172 | 172 | // don't display entry meta because the existing theme will take care of that |
173 | - add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
173 | + add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | * @param string $excerpt |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - public static function get_the_excerpt( $excerpt = '' ) { |
|
190 | - if ( post_password_required() ) { |
|
189 | + public static function get_the_excerpt($excerpt = '') { |
|
190 | + if (post_password_required()) { |
|
191 | 191 | return $excerpt; |
192 | 192 | } |
193 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
194 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
195 | - return EED_Events_Archive::event_details( $excerpt ); |
|
193 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
194 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
195 | + return EED_Events_Archive::event_details($excerpt); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @param string $id |
206 | 206 | * @return string |
207 | 207 | */ |
208 | - public static function the_title( $title = '', $id = '' ) { |
|
208 | + public static function the_title($title = '', $id = '') { |
|
209 | 209 | global $post; |
210 | - if ( $post instanceof WP_Post ) { |
|
211 | - return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title : $title; |
|
210 | + if ($post instanceof WP_Post) { |
|
211 | + return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title; |
|
212 | 212 | } |
213 | 213 | return $title; |
214 | 214 | } |
@@ -222,33 +222,33 @@ discard block |
||
222 | 222 | * @param string $content |
223 | 223 | * @return string |
224 | 224 | */ |
225 | - public static function event_details( $content ) { |
|
225 | + public static function event_details($content) { |
|
226 | 226 | |
227 | 227 | global $post; |
228 | 228 | $template = ''; |
229 | 229 | if ( |
230 | 230 | $post->post_type == 'espresso_events' |
231 | - && ! apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', FALSE ) |
|
231 | + && ! apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', FALSE) |
|
232 | 232 | && ! post_password_required() |
233 | 233 | ) { |
234 | 234 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
235 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
236 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
237 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
235 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
236 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
237 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
238 | 238 | //now add additional content depending on whether event is using the_excerpt() or the_content() |
239 | 239 | EED_Events_Archive::_add_additional_excerpt_filters(); |
240 | 240 | EED_Events_Archive::_add_additional_content_filters(); |
241 | 241 | // now load our template |
242 | - $template = EEH_Template::locate_template( 'content-espresso_events-details.php' ); |
|
242 | + $template = EEH_Template::locate_template('content-espresso_events-details.php'); |
|
243 | 243 | // re-add our main filters (or else the next event won't have them) |
244 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
245 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
246 | - add_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
244 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
245 | + add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
246 | + add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
247 | 247 | // but remove the other filters so that they don't get applied to the next post |
248 | 248 | EED_Events_Archive::_remove_additional_events_archive_filters(); |
249 | 249 | } |
250 | 250 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
251 | - return ! empty( $template ) ? $template : $content; |
|
251 | + return ! empty($template) ? $template : $content; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | * @return void |
261 | 261 | */ |
262 | 262 | private static function _add_additional_excerpt_filters() { |
263 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
264 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
265 | - add_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
263 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
264 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
265 | + add_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @return void |
275 | 275 | */ |
276 | 276 | private static function _add_additional_content_filters() { |
277 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
278 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
279 | - add_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
277 | + add_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
278 | + add_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
279 | + add_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | * @param string $content |
289 | 289 | * @return string |
290 | 290 | */ |
291 | - public static function event_datetimes( $content ) { |
|
292 | - if ( post_password_required() ) { |
|
291 | + public static function event_datetimes($content) { |
|
292 | + if (post_password_required()) { |
|
293 | 293 | return $content; |
294 | 294 | } |
295 | - return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content; |
|
295 | + return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | * @param string $content |
303 | 303 | * @return string |
304 | 304 | */ |
305 | - public static function event_tickets( $content ) { |
|
306 | - if ( post_password_required() ) { |
|
305 | + public static function event_tickets($content) { |
|
306 | + if (post_password_required()) { |
|
307 | 307 | return $content; |
308 | 308 | } |
309 | - return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content; |
|
309 | + return EEH_Template::locate_template('content-espresso_events-tickets.php').$content; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -316,11 +316,11 @@ discard block |
||
316 | 316 | * @param string $content |
317 | 317 | * @return string |
318 | 318 | */ |
319 | - public static function event_venues( $content ) { |
|
320 | - if ( post_password_required() ) { |
|
319 | + public static function event_venues($content) { |
|
320 | + if (post_password_required()) { |
|
321 | 321 | return $content; |
322 | 322 | } |
323 | - return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' ); |
|
323 | + return $content.EEH_Template::locate_template('content-espresso_events-venues.php'); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | * @return void |
331 | 331 | */ |
332 | 332 | private static function _remove_additional_events_archive_filters() { |
333 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
334 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
335 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
336 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
337 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
338 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
333 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
334 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
335 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
336 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
337 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
338 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
339 | 339 | } |
340 | 340 | /** |
341 | 341 | * remove_all_events_archive_filters |
@@ -344,18 +344,18 @@ discard block |
||
344 | 344 | * @return void |
345 | 345 | */ |
346 | 346 | public static function remove_all_events_archive_filters() { |
347 | - remove_filter( 'get_the_excerpt', array( 'EED_Events_Archive', 'get_the_excerpt' ), 1, 1 ); |
|
348 | - remove_filter( 'the_title', array( 'EED_Events_Archive', 'the_title' ), 100, 2 ); |
|
349 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
350 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
351 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
352 | - remove_filter( 'the_excerpt', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
353 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_details' ), 100, 1 ); |
|
354 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_datetimes' ), 110, 1 ); |
|
355 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_tickets' ), 120, 1 ); |
|
356 | - remove_filter( 'the_content', array( 'EED_Events_Archive', 'event_venues' ), 130, 1 ); |
|
347 | + remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); |
|
348 | + remove_filter('the_title', array('EED_Events_Archive', 'the_title'), 100, 2); |
|
349 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
350 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
351 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
352 | + remove_filter('the_excerpt', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
353 | + remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); |
|
354 | + remove_filter('the_content', array('EED_Events_Archive', 'event_datetimes'), 110, 1); |
|
355 | + remove_filter('the_content', array('EED_Events_Archive', 'event_tickets'), 120, 1); |
|
356 | + remove_filter('the_content', array('EED_Events_Archive', 'event_venues'), 130, 1); |
|
357 | 357 | // don't display entry meta because the existing theme will take care of that |
358 | - remove_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' ); |
|
358 | + remove_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false'); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -370,15 +370,15 @@ discard block |
||
370 | 370 | * @return void |
371 | 371 | */ |
372 | 372 | public function load_event_list_assets() { |
373 | - do_action( 'AHEE__EED_Events_Archive__before_load_assets' ); |
|
374 | - add_filter( 'FHEE_load_EE_Session', '__return_true' ); |
|
375 | - add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
376 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
377 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
378 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
379 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
373 | + do_action('AHEE__EED_Events_Archive__before_load_assets'); |
|
374 | + add_filter('FHEE_load_EE_Session', '__return_true'); |
|
375 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
376 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
377 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
378 | + EE_Registry::instance()->load_helper('Maps'); |
|
379 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
380 | 380 | } |
381 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
381 | + EE_Registry::instance()->load_helper('Event_View'); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -394,14 +394,14 @@ discard block |
||
394 | 394 | */ |
395 | 395 | public function wp_enqueue_scripts() { |
396 | 396 | // get some style |
397 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', FALSE ) ) { |
|
397 | + if (apply_filters('FHEE_enable_default_espresso_css', FALSE)) { |
|
398 | 398 | // first check uploads folder |
399 | - EE_Registry::instance()->load_helper( 'File' ); |
|
400 | - if ( EEH_File::is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
401 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' )); |
|
399 | + EE_Registry::instance()->load_helper('File'); |
|
400 | + if (EEH_File::is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
401 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
402 | 402 | } else { |
403 | 403 | } |
404 | - wp_enqueue_style( $this->theme ); |
|
404 | + wp_enqueue_style($this->theme); |
|
405 | 405 | |
406 | 406 | } |
407 | 407 | } |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public static function template_settings_form() { |
421 | 421 | $template_settings = EE_Registry::instance()->CFG->template_settings; |
422 | - $template_settings->EED_Events_Archive = isset( $template_settings->EED_Events_Archive ) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
423 | - $template_settings->EED_Events_Archive = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive ); |
|
422 | + $template_settings->EED_Events_Archive = isset($template_settings->EED_Events_Archive) ? $template_settings->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
423 | + $template_settings->EED_Events_Archive = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $template_settings->EED_Events_Archive); |
|
424 | 424 | $events_archive_settings = array( |
425 | 425 | 'display_status_banner' => 0, |
426 | 426 | 'display_description' => 1, |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | 'display_venue' => 0, |
430 | 430 | 'display_expired_events' => 0 |
431 | 431 | ); |
432 | - $events_archive_settings = array_merge( $events_archive_settings, (array)$template_settings->EED_Events_Archive ); |
|
433 | - EEH_Template::display_template( EVENTS_ARCHIVE_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $events_archive_settings ); |
|
432 | + $events_archive_settings = array_merge($events_archive_settings, (array) $template_settings->EED_Events_Archive); |
|
433 | + EEH_Template::display_template(EVENTS_ARCHIVE_TEMPLATES_PATH.'admin-event-list-settings.template.php', $events_archive_settings); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | * @param EE_Request_Handler $REQ |
447 | 447 | * @return EE_Template_Config |
448 | 448 | */ |
449 | - public static function update_template_settings( $CFG, $REQ ) { |
|
449 | + public static function update_template_settings($CFG, $REQ) { |
|
450 | 450 | $CFG->EED_Events_Archive = new EE_Events_Archive_Config(); |
451 | 451 | // unless we are resetting the config... |
452 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
453 | - $CFG->EED_Events_Archive->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
454 | - $CFG->EED_Events_Archive->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
455 | - $CFG->EED_Events_Archive->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
456 | - $CFG->EED_Events_Archive->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
457 | - $CFG->EED_Events_Archive->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
458 | - $CFG->EED_Events_Archive->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; } |
|
452 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
453 | + $CFG->EED_Events_Archive->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
454 | + $CFG->EED_Events_Archive->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
455 | + $CFG->EED_Events_Archive->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
456 | + $CFG->EED_Events_Archive->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
457 | + $CFG->EED_Events_Archive->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
458 | + $CFG->EED_Events_Archive->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; } |
|
459 | 459 | return $CFG; |
460 | 460 | } |
461 | 461 | |
@@ -468,10 +468,10 @@ discard block |
||
468 | 468 | * @param string $extra_class |
469 | 469 | * @return string |
470 | 470 | */ |
471 | - public static function event_list_css( $extra_class = '' ) { |
|
472 | - $event_list_css = ! empty( $extra_class ) ? array( $extra_class ) : array(); |
|
471 | + public static function event_list_css($extra_class = '') { |
|
472 | + $event_list_css = ! empty($extra_class) ? array($extra_class) : array(); |
|
473 | 473 | $event_list_css[] = 'espresso-event-list-event'; |
474 | - return implode( ' ', $event_list_css ); |
|
474 | + return implode(' ', $event_list_css); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -498,9 +498,9 @@ discard block |
||
498 | 498 | * @param $value |
499 | 499 | * @return bool |
500 | 500 | */ |
501 | - public static function display_description( $value ) { |
|
501 | + public static function display_description($value) { |
|
502 | 502 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
503 | - $display_description= isset( $config->display_description ) ? $config->display_description : 1; |
|
503 | + $display_description = isset($config->display_description) ? $config->display_description : 1; |
|
504 | 504 | return $display_description === $value ? TRUE : FALSE; |
505 | 505 | } |
506 | 506 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | */ |
514 | 514 | public static function display_ticket_selector() { |
515 | 515 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
516 | - return isset( $config->display_ticket_selector ) && $config->display_ticket_selector ? TRUE : FALSE; |
|
516 | + return isset($config->display_ticket_selector) && $config->display_ticket_selector ? TRUE : FALSE; |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | |
@@ -525,9 +525,9 @@ discard block |
||
525 | 525 | * @return bool |
526 | 526 | */ |
527 | 527 | public static function display_venue() { |
528 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
528 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
529 | 529 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
530 | - return isset( $config->display_venue ) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
530 | + return isset($config->display_venue) && $config->display_venue && EEH_Venue_View::venue_name() ? TRUE : FALSE; |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | */ |
540 | 540 | public static function display_datetimes() { |
541 | 541 | $config = EE_Registry::instance()->CFG->template_settings->EED_Events_Archive; |
542 | - return isset( $config->display_datetimes ) && $config->display_datetimes ? TRUE : FALSE; |
|
542 | + return isset($config->display_datetimes) && $config->display_datetimes ? TRUE : FALSE; |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @return string |
555 | 555 | */ |
556 | 556 | public static function event_list_title() { |
557 | - return apply_filters( 'FHEE__archive_espresso_events_template__upcoming_events_h1', __( 'Upcoming Events', 'event_espresso' )); |
|
557 | + return apply_filters('FHEE__archive_espresso_events_template__upcoming_events_h1', __('Upcoming Events', 'event_espresso')); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | /** |
564 | 564 | * @since 4.4.0 |
565 | 565 | */ |
566 | - public static function _doing_it_wrong_notice( $function = '' ) { |
|
566 | + public static function _doing_it_wrong_notice($function = '') { |
|
567 | 567 | EE_Error::doing_it_wrong( |
568 | 568 | __FUNCTION__, |
569 | 569 | sprintf( |
570 | - __( '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' ), |
|
570 | + __('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'), |
|
571 | 571 | $function, |
572 | 572 | '<br />', |
573 | 573 | '4.6.0' |
@@ -583,107 +583,107 @@ discard block |
||
583 | 583 | * @since 4.4.0 |
584 | 584 | */ |
585 | 585 | public function get_post_data() { |
586 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
586 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
587 | 587 | EEH_Event_Query::set_query_params(); |
588 | 588 | } |
589 | 589 | /** |
590 | 590 | * @deprecated |
591 | 591 | * @since 4.4.0 |
592 | 592 | */ |
593 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
594 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
595 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
596 | - return EEH_Event_Query::posts_fields( $SQL, $wp_query ); |
|
593 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
594 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
595 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
596 | + return EEH_Event_Query::posts_fields($SQL, $wp_query); |
|
597 | 597 | } |
598 | 598 | /** |
599 | 599 | * @deprecated |
600 | 600 | * @since 4.4.0 |
601 | 601 | */ |
602 | - public static function posts_fields_sql_for_orderby( $orderby_params = array() ) { |
|
603 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
604 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
605 | - return EEH_Event_Query::posts_fields_sql_for_orderby( $orderby_params ); |
|
602 | + public static function posts_fields_sql_for_orderby($orderby_params = array()) { |
|
603 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
604 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
605 | + return EEH_Event_Query::posts_fields_sql_for_orderby($orderby_params); |
|
606 | 606 | } |
607 | 607 | /** |
608 | 608 | * @deprecated |
609 | 609 | * @since 4.4.0 |
610 | 610 | */ |
611 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
612 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
613 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
614 | - return EEH_Event_Query::posts_join( $SQL, $wp_query ); |
|
611 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
612 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
613 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
614 | + return EEH_Event_Query::posts_join($SQL, $wp_query); |
|
615 | 615 | } |
616 | 616 | /** |
617 | 617 | * @deprecated |
618 | 618 | * @since 4.4.0 |
619 | 619 | */ |
620 | - public static function posts_join_sql_for_terms( $join_terms = NULL ) { |
|
621 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
622 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
623 | - return EEH_Event_Query::posts_join_sql_for_terms( $join_terms ); |
|
620 | + public static function posts_join_sql_for_terms($join_terms = NULL) { |
|
621 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
622 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
623 | + return EEH_Event_Query::posts_join_sql_for_terms($join_terms); |
|
624 | 624 | } |
625 | 625 | /** |
626 | 626 | * @deprecated |
627 | 627 | * @since 4.4.0 |
628 | 628 | */ |
629 | - public static function posts_join_for_orderby( $orderby_params = array() ) { |
|
630 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
631 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
632 | - return EEH_Event_Query::posts_join_for_orderby( $orderby_params ); |
|
629 | + public static function posts_join_for_orderby($orderby_params = array()) { |
|
630 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
631 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
632 | + return EEH_Event_Query::posts_join_for_orderby($orderby_params); |
|
633 | 633 | } |
634 | 634 | /** |
635 | 635 | * @deprecated |
636 | 636 | * @since 4.4.0 |
637 | 637 | */ |
638 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
639 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
640 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
641 | - return EEH_Event_Query::posts_where( $SQL, $wp_query ); |
|
638 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
639 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
640 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
641 | + return EEH_Event_Query::posts_where($SQL, $wp_query); |
|
642 | 642 | } |
643 | 643 | /** |
644 | 644 | * @deprecated |
645 | 645 | * @since 4.4.0 |
646 | 646 | */ |
647 | - public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) { |
|
648 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
649 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
650 | - return EEH_Event_Query::posts_where_sql_for_show_expired( $show_expired ); |
|
647 | + public static function posts_where_sql_for_show_expired($show_expired = FALSE) { |
|
648 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
649 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
650 | + return EEH_Event_Query::posts_where_sql_for_show_expired($show_expired); |
|
651 | 651 | } |
652 | 652 | /** |
653 | 653 | * @deprecated |
654 | 654 | * @since 4.4.0 |
655 | 655 | */ |
656 | - public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) { |
|
657 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
658 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
659 | - return EEH_Event_Query::posts_where_sql_for_event_category_slug( $event_category_slug ); |
|
656 | + public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) { |
|
657 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
658 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
659 | + return EEH_Event_Query::posts_where_sql_for_event_category_slug($event_category_slug); |
|
660 | 660 | } |
661 | 661 | /** |
662 | 662 | * @deprecated |
663 | 663 | * @since 4.4.0 |
664 | 664 | */ |
665 | - public static function posts_where_sql_for_event_list_month( $month = NULL ) { |
|
666 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
667 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
668 | - return EEH_Event_Query::posts_where_sql_for_event_list_month( $month ); |
|
665 | + public static function posts_where_sql_for_event_list_month($month = NULL) { |
|
666 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
667 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
668 | + return EEH_Event_Query::posts_where_sql_for_event_list_month($month); |
|
669 | 669 | } |
670 | 670 | /** |
671 | 671 | * @deprecated |
672 | 672 | * @since 4.4.0 |
673 | 673 | */ |
674 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
675 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
676 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
677 | - return EEH_Event_Query::posts_orderby( $SQL, $wp_query ); |
|
674 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
675 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
676 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
677 | + return EEH_Event_Query::posts_orderby($SQL, $wp_query); |
|
678 | 678 | } |
679 | 679 | /** |
680 | 680 | * @deprecated |
681 | 681 | * @since 4.4.0 |
682 | 682 | */ |
683 | - public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) { |
|
684 | - EE_Registry::instance()->load_helper( 'Event_Query' ); |
|
685 | - EED_Events_Archive::_doing_it_wrong_notice( __FUNCTION__ ); |
|
686 | - return EEH_Event_Query::posts_orderby_sql( $orderby_params, $sort ); |
|
683 | + public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') { |
|
684 | + EE_Registry::instance()->load_helper('Event_Query'); |
|
685 | + EED_Events_Archive::_doing_it_wrong_notice(__FUNCTION__); |
|
686 | + return EEH_Event_Query::posts_orderby_sql($orderby_params, $sort); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | * @param string $extra_class |
715 | 715 | * @return string |
716 | 716 | */ |
717 | -function espresso_event_list_css( $extra_class = '' ) { |
|
718 | - return EED_Events_Archive::event_list_css( $extra_class ); |
|
717 | +function espresso_event_list_css($extra_class = '') { |
|
718 | + return EED_Events_Archive::event_list_css($extra_class); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | /** |
@@ -729,14 +729,14 @@ discard block |
||
729 | 729 | * @return bool |
730 | 730 | */ |
731 | 731 | function espresso_display_full_description_in_event_list() { |
732 | - return EED_Events_Archive::display_description( 2 ); |
|
732 | + return EED_Events_Archive::display_description(2); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | /** |
736 | 736 | * @return bool |
737 | 737 | */ |
738 | 738 | function espresso_display_excerpt_in_event_list() { |
739 | - return EED_Events_Archive::display_description( 1 ); |
|
739 | + return EED_Events_Archive::display_description(1); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | /** |
@@ -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( |
@@ -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', 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', 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', 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', 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,15 +414,15 @@ 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 | 423 | |
424 | 424 | |
425 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
425 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
426 | 426 | |
427 | 427 | //get all registrations so we make sure we send messages for the right status. |
428 | 428 | $all_registrations = $registration->transaction()->registrations(); |
@@ -431,19 +431,19 @@ discard block |
||
431 | 431 | $statuses_sent = array(); |
432 | 432 | |
433 | 433 | //loop through registrations and trigger messages once per status. |
434 | - foreach ( $all_registrations as $reg ) { |
|
434 | + foreach ($all_registrations as $reg) { |
|
435 | 435 | |
436 | 436 | //already triggered? |
437 | - if ( in_array( $reg->status_ID(), $statuses_sent ) ) { |
|
437 | + if (in_array($reg->status_ID(), $statuses_sent)) { |
|
438 | 438 | continue; |
439 | 439 | } |
440 | 440 | |
441 | - $message_type = self::_get_reg_status_array( $reg->status_ID() ); |
|
442 | - if ( EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
441 | + $message_type = self::_get_reg_status_array($reg->status_ID()); |
|
442 | + if (EEH_MSG_Template::is_mt_active($message_type)) { |
|
443 | 443 | self::_load_controller(); |
444 | 444 | |
445 | 445 | //send away, send away, uhhuh |
446 | - if ( self::$_EEMSG->send_message( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ) ) { |
|
446 | + if (self::$_EEMSG->send_message($message_type, array($registration->transaction(), null, $reg->status_ID()))) { |
|
447 | 447 | // DEBUG LOG |
448 | 448 | // self::log( |
449 | 449 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -462,9 +462,9 @@ discard block |
||
462 | 462 | } |
463 | 463 | |
464 | 464 | //now send summary (registration_summary) if active |
465 | - if ( EEH_MSG_Template::is_mt_active( 'registration_summary' ) ) { |
|
465 | + if (EEH_MSG_Template::is_mt_active('registration_summary')) { |
|
466 | 466 | self::_load_controller(); |
467 | - if ( self::$_EEMSG->send_message( 'registration_summary', array( $registration->transaction(), null ) ) ) { |
|
467 | + if (self::$_EEMSG->send_message('registration_summary', array($registration->transaction(), null))) { |
|
468 | 468 | // DEBUG LOG |
469 | 469 | // self::log( |
470 | 470 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -490,39 +490,39 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @return bool true = send away, false = nope halt the presses. |
492 | 492 | */ |
493 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
493 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
494 | 494 | //self::log( |
495 | 495 | // __CLASS__, __FUNCTION__, __LINE__, |
496 | 496 | // $registration->transaction(), |
497 | 497 | // array( '$extra_details' => $extra_details ) |
498 | 498 | //); |
499 | 499 | // currently only using this to send messages for the primary registrant |
500 | - if ( ! $registration->is_primary_registrant() ) { |
|
500 | + if ( ! $registration->is_primary_registrant()) { |
|
501 | 501 | return false; |
502 | 502 | } |
503 | 503 | // first we check if we're in admin and not doing front ajax |
504 | - if ( is_admin() && ! EE_FRONT_AJAX ) { |
|
504 | + if (is_admin() && ! EE_FRONT_AJAX) { |
|
505 | 505 | //make sure appropriate admin params are set for sending messages |
506 | - if ( empty( $_REQUEST[ 'txn_reg_status_change' ][ 'send_notifications' ] ) || ! absint( $_REQUEST[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
506 | + if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { |
|
507 | 507 | //no messages sent please. |
508 | 508 | return false; |
509 | 509 | } |
510 | 510 | } else { |
511 | 511 | // frontend request (either regular or via AJAX) |
512 | 512 | // TXN is NOT finalized ? |
513 | - if ( ! isset( $extra_details[ 'finalized' ] ) || $extra_details[ 'finalized' ] === false ) { |
|
513 | + if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) { |
|
514 | 514 | return false; |
515 | 515 | } |
516 | 516 | // return visit but nothing changed ??? |
517 | 517 | if ( |
518 | - isset( $extra_details[ 'revisit' ], $extra_details[ 'status_updates' ] ) && |
|
519 | - $extra_details[ 'revisit' ] && ! $extra_details[ 'status_updates' ] |
|
518 | + isset($extra_details['revisit'], $extra_details['status_updates']) && |
|
519 | + $extra_details['revisit'] && ! $extra_details['status_updates'] |
|
520 | 520 | ) { |
521 | 521 | return false; |
522 | 522 | } |
523 | 523 | // NOT sending messages && reg status is something other than "Not-Approved" |
524 | 524 | if ( |
525 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
525 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
526 | 526 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
527 | 527 | ) { |
528 | 528 | return false; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | * @param string $reg_status |
541 | 541 | * @return array |
542 | 542 | */ |
543 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
543 | + protected static function _get_reg_status_array($reg_status = '') { |
|
544 | 544 | $reg_status_array = array( |
545 | 545 | EEM_Registration::status_id_approved => 'registration', |
546 | 546 | EEM_Registration::status_id_pending_payment => 'pending_approval', |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | EEM_Registration::status_id_cancelled => 'cancelled_registration', |
549 | 549 | EEM_Registration::status_id_declined => 'declined_registration' |
550 | 550 | ); |
551 | - return isset( $reg_status_array[ $reg_status ] ) ? $reg_status_array[ $reg_status ] : $reg_status_array; |
|
551 | + return isset($reg_status_array[$reg_status]) ? $reg_status_array[$reg_status] : $reg_status_array; |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @return string|bool The payment message type slug matching the status or false if no match. |
562 | 562 | */ |
563 | - protected static function _get_payment_message_type( $payment_status ) { |
|
563 | + protected static function _get_payment_message_type($payment_status) { |
|
564 | 564 | $matches = array( |
565 | 565 | EEM_Payment::status_id_approved => 'payment', |
566 | 566 | EEM_Payment::status_id_pending => 'payment_pending', |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | EEM_Payment::status_id_failed => 'payment_failed' |
570 | 570 | ); |
571 | 571 | |
572 | - return isset( $matches[$payment_status] ) ? $matches[$payment_status] : false; |
|
572 | + return isset($matches[$payment_status]) ? $matches[$payment_status] : false; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -582,22 +582,22 @@ discard block |
||
582 | 582 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
583 | 583 | * @return bool success/fail |
584 | 584 | */ |
585 | - public static function process_resend( $req_data ) { |
|
585 | + public static function process_resend($req_data) { |
|
586 | 586 | $regs_to_send = array(); |
587 | 587 | |
588 | 588 | //first let's make sure we have the reg id (needed for resending!); |
589 | - if ( ! isset( $req_data['_REG_ID'] ) ) { |
|
590 | - EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
589 | + if ( ! isset($req_data['_REG_ID'])) { |
|
590 | + EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | |
594 | 594 | //if $req_data['_REG_ID'] is an array then let's group the registrations by transaction and reg status |
595 | 595 | // so we can only trigger messages per group. |
596 | - if ( is_array( $req_data['_REG_ID'] ) ) { |
|
597 | - foreach ( $req_data['_REG_ID'] as $reg_id ) { |
|
598 | - $reg = EE_Registry::instance()->load_model( 'Registration' )->get_one_by_ID( $reg_id ); |
|
599 | - if ( ! $reg instanceof EE_Registration ) { |
|
600 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) ); |
|
596 | + if (is_array($req_data['_REG_ID'])) { |
|
597 | + foreach ($req_data['_REG_ID'] as $reg_id) { |
|
598 | + $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($reg_id); |
|
599 | + if ( ! $reg instanceof EE_Registration) { |
|
600 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'])); |
|
601 | 601 | return false; |
602 | 602 | } |
603 | 603 | $regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg; |
@@ -605,11 +605,11 @@ discard block |
||
605 | 605 | } else { |
606 | 606 | //we have a single registration id, so let's see if we can get a EE_Registration from it, and if so set it up for sending. |
607 | 607 | //get reg object from reg_id |
608 | - $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID( $req_data['_REG_ID'] ); |
|
608 | + $reg = EE_Registry::instance()->load_model('Registration')->get_one_by_ID($req_data['_REG_ID']); |
|
609 | 609 | |
610 | 610 | //if no reg object then send error |
611 | - if ( ! $reg instanceof EE_Registration ) { |
|
612 | - EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'] ) ); |
|
611 | + if ( ! $reg instanceof EE_Registration) { |
|
612 | + EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $req_data['_REG_ID'])); |
|
613 | 613 | return false; |
614 | 614 | } |
615 | 615 | |
@@ -621,26 +621,26 @@ discard block |
||
621 | 621 | $active_mts = self::$_EEMSG->get_active_message_types(); |
622 | 622 | $success = false; |
623 | 623 | //loop through and send! |
624 | - foreach( $regs_to_send as $status_group ) { |
|
625 | - foreach ( $status_group as $status_id => $registrations ) { |
|
626 | - if ( ! in_array( $status_match_array[ $status_id ], $active_mts ) ) { |
|
624 | + foreach ($regs_to_send as $status_group) { |
|
625 | + foreach ($status_group as $status_id => $registrations) { |
|
626 | + if ( ! in_array($status_match_array[$status_id], $active_mts)) { |
|
627 | 627 | EE_Error::add_error( |
628 | 628 | sprintf( |
629 | 629 | __('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'), |
630 | - $status_match_array[ $reg->status_ID() ], |
|
631 | - '<a href="' . admin_url('admin.php?page=espresso_messages&action=settings') . '">', |
|
630 | + $status_match_array[$reg->status_ID()], |
|
631 | + '<a href="'.admin_url('admin.php?page=espresso_messages&action=settings').'">', |
|
632 | 632 | '</a>' |
633 | 633 | ) |
634 | 634 | ); |
635 | 635 | return false; |
636 | 636 | } |
637 | 637 | |
638 | - if ( self::$_EEMSG->send_message( $status_match_array[$status_id], array( $registrations, $status_id ) ) ) { |
|
638 | + if (self::$_EEMSG->send_message($status_match_array[$status_id], array($registrations, $status_id))) { |
|
639 | 639 | EE_Error::overwrite_success(); |
640 | - EE_Error::add_success( __('The message for this registration has been re-sent', 'event_espresso') ); |
|
640 | + EE_Error::add_success(__('The message for this registration has been re-sent', 'event_espresso')); |
|
641 | 641 | $success = true; |
642 | 642 | } else { |
643 | - EE_Error::add_error( __('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
643 | + EE_Error::add_error(__('Something went wrong and the message for this registration was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
644 | 644 | } |
645 | 645 | } |
646 | 646 | } |
@@ -662,12 +662,12 @@ discard block |
||
662 | 662 | * @param EE_Payment $payment EE_payment object |
663 | 663 | * @return bool success/fail |
664 | 664 | */ |
665 | - public static function process_admin_payment( $success = TRUE, EE_Payment $payment ) { |
|
665 | + public static function process_admin_payment($success = TRUE, EE_Payment $payment) { |
|
666 | 666 | //we need to get the transaction object |
667 | 667 | $transaction = $payment->transaction(); |
668 | - if ( $transaction instanceof EE_Transaction ) { |
|
669 | - $data = array( $transaction, $payment ); |
|
670 | - $message_type = self::_get_payment_message_type( $payment->STS_ID() ); |
|
668 | + if ($transaction instanceof EE_Transaction) { |
|
669 | + $data = array($transaction, $payment); |
|
670 | + $message_type = self::_get_payment_message_type($payment->STS_ID()); |
|
671 | 671 | |
672 | 672 | //if payment amount is less than 0 then switch to payment_refund message type. |
673 | 673 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -678,18 +678,18 @@ discard block |
||
678 | 678 | self::_load_controller(); |
679 | 679 | //verify this message type is present and active. If it isn't then no message is sent. |
680 | 680 | $active_mts = self::$_EEMSG->get_active_message_types(); |
681 | - $message_type = in_array( $message_type, $active_mts ) ? $message_type : false; |
|
681 | + $message_type = in_array($message_type, $active_mts) ? $message_type : false; |
|
682 | 682 | |
683 | 683 | |
684 | - if ( $message_type ) { |
|
684 | + if ($message_type) { |
|
685 | 685 | |
686 | - $success = self::$_EEMSG->send_message( $message_type, $data ); |
|
687 | - if ( ! $success ) { |
|
688 | - EE_Error::add_error( __('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
686 | + $success = self::$_EEMSG->send_message($message_type, $data); |
|
687 | + if ( ! $success) { |
|
688 | + EE_Error::add_error(__('Something went wrong and the payment confirmation was NOT resent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | } else { |
692 | - 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__ ); |
|
692 | + 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__); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | } |
@@ -707,9 +707,9 @@ discard block |
||
707 | 707 | * @param int $grp_id a specific message template group id. |
708 | 708 | * @return void |
709 | 709 | */ |
710 | - public static function send_newsletter_message( $contacts, $grp_id ) { |
|
710 | + public static function send_newsletter_message($contacts, $grp_id) { |
|
711 | 711 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
712 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
712 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
713 | 713 | |
714 | 714 | self::_load_controller(); |
715 | 715 | self::$_EEMSG->send_message('newsletter', $contacts); |
@@ -727,10 +727,10 @@ discard block |
||
727 | 727 | * @param string $message_type |
728 | 728 | * @return string |
729 | 729 | */ |
730 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
730 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
731 | 731 | EE_Registry::instance()->load_helper('MSG_Template'); |
732 | 732 | // whitelist $messenger |
733 | - switch ( $messenger ) { |
|
733 | + switch ($messenger) { |
|
734 | 734 | case 'pdf' : |
735 | 735 | $sending_messenger = 'pdf'; |
736 | 736 | $generating_messenger = 'html'; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | break; |
743 | 743 | } |
744 | 744 | // whitelist $message_type |
745 | - switch ( $message_type ) { |
|
745 | + switch ($message_type) { |
|
746 | 746 | case 'receipt' : |
747 | 747 | $message_type = 'receipt'; |
748 | 748 | break; |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | break; |
753 | 753 | } |
754 | 754 | // verify that both the messenger AND the message type are active |
755 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type )) { |
|
755 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
756 | 756 | //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?) |
757 | 757 | $template_query_params = array( |
758 | 758 | 'MTP_is_active' => TRUE, |
@@ -761,16 +761,16 @@ discard block |
||
761 | 761 | 'Event.EVT_ID' => $registration->event_ID() |
762 | 762 | ); |
763 | 763 | //get the message template group. |
764 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
764 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
765 | 765 | //if we don't have an EE_Message_Template_Group then return |
766 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
766 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
767 | 767 | // remove EVT_ID from query params so that global templates get picked up |
768 | - unset( $template_query_params[ 'Event.EVT_ID' ] ); |
|
768 | + unset($template_query_params['Event.EVT_ID']); |
|
769 | 769 | //get global template as the fallback |
770 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params )); |
|
770 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
771 | 771 | } |
772 | 772 | //if we don't have an EE_Message_Template_Group then return |
773 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
773 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
774 | 774 | return ''; |
775 | 775 | } |
776 | 776 | // generate the URL |
@@ -800,17 +800,17 @@ discard block |
||
800 | 800 | * @param array $info |
801 | 801 | * @param bool $display_request |
802 | 802 | */ |
803 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
803 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
804 | 804 | EE_Registry::instance()->load_helper('Debug_Tools'); |
805 | - if ( WP_DEBUG && false ) { |
|
806 | - if ( $transaction instanceof EE_Transaction ) { |
|
805 | + if (WP_DEBUG && false) { |
|
806 | + if ($transaction instanceof EE_Transaction) { |
|
807 | 807 | // don't serialize objects |
808 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
809 | - $info[ 'TXN_status' ] = $transaction->status_ID(); |
|
810 | - $info[ 'TXN_reg_steps' ] = $transaction->reg_steps(); |
|
811 | - if ( $transaction->ID() ) { |
|
812 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
813 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
808 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
809 | + $info['TXN_status'] = $transaction->status_ID(); |
|
810 | + $info['TXN_reg_steps'] = $transaction->reg_steps(); |
|
811 | + if ($transaction->ID()) { |
|
812 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
813 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | } |
@@ -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 | } |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * process_registration_from_admin |
297 | 297 | * |
298 | 298 | * @access public |
299 | - * @return int |
|
299 | + * @return EE_Transaction |
|
300 | 300 | */ |
301 | 301 | public static function process_registration_from_admin() { |
302 | 302 | EED_Single_Page_Checkout::load_reg_steps(); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | * _get_transaction_and_cart_for_previous_visit |
631 | 631 | * |
632 | 632 | * @access private |
633 | - * @return mixed EE_Transaction|NULL |
|
633 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
634 | 634 | */ |
635 | 635 | private function _get_transaction_and_cart_for_previous_visit() { |
636 | 636 | /** @var $TXN_model EEM_Transaction */ |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
688 | 688 | * |
689 | 689 | * @access private |
690 | - * @return EE_Transaction |
|
690 | + * @return EE_Attendee|null |
|
691 | 691 | */ |
692 | 692 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
693 | 693 | // if there's no transaction, then this is the FIRST visit to SPCO |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
714 | 714 | * |
715 | 715 | * @access private |
716 | - * @return mixed EE_Transaction|NULL |
|
716 | + * @return EE_Attendee|null EE_Transaction|NULL |
|
717 | 717 | */ |
718 | 718 | private function _initialize_transaction() { |
719 | 719 | try { |
@@ -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 | * |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,31 +198,31 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // load EE_SPCO_Reg_Step base class |
205 | 205 | // EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class' ); |
206 | 206 | // filter list of reg_steps |
207 | - $reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() ); |
|
207 | + $reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps()); |
|
208 | 208 | // sort by key (order) |
209 | - ksort( $reg_steps_to_load ); |
|
209 | + ksort($reg_steps_to_load); |
|
210 | 210 | // loop through folders |
211 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
211 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
212 | 212 | // we need a |
213 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
213 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
214 | 214 | // copy over to the reg_steps_array |
215 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
215 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
216 | 216 | // register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now ) |
217 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
217 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
218 | 218 | // add AJAX or other hooks |
219 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
219 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
220 | 220 | // setup autoloaders if necessary |
221 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
221 | + if ( ! class_exists($reg_step['class_name'])) { |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
223 | 223 | } |
224 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
225 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
224 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
225 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | } |
@@ -241,28 +241,28 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public static function get_reg_steps() { |
243 | 243 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
244 | - if ( empty( $reg_steps )) { |
|
244 | + if (empty($reg_steps)) { |
|
245 | 245 | $reg_steps = array( |
246 | 246 | 10 => array( |
247 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
247 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
248 | 248 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
249 | 249 | 'slug' => 'attendee_information', |
250 | 250 | 'has_hooks' => FALSE |
251 | 251 | ), |
252 | 252 | 20 => array( |
253 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
253 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
254 | 254 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
255 | 255 | 'slug' => 'registration_confirmation', |
256 | 256 | 'has_hooks' => FALSE |
257 | 257 | ), |
258 | 258 | 30 => array( |
259 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
259 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
260 | 260 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
261 | 261 | 'slug' => 'payment_options', |
262 | 262 | 'has_hooks' => TRUE |
263 | 263 | ), |
264 | 264 | 999 => array( |
265 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
265 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
266 | 266 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
267 | 267 | 'slug' => 'finalize_registration', |
268 | 268 | 'has_hooks' => FALSE |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public static function registration_checkout_for_admin() { |
284 | 284 | EED_Single_Page_Checkout::load_reg_steps(); |
285 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
286 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
287 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
285 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
286 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
287 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
288 | 288 | EED_Single_Page_Checkout::instance()->_initialize(); |
289 | 289 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
290 | 290 | return EE_Registry::instance()->REQ->get_output(); |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public static function process_registration_from_admin() { |
302 | 302 | EED_Single_Page_Checkout::load_reg_steps(); |
303 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
304 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
305 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
303 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
304 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
305 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
306 | 306 | EED_Single_Page_Checkout::instance()->_initialize(); |
307 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
308 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
309 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
310 | - if ( $final_reg_step->process_reg_step() ) { |
|
307 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
308 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
309 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
310 | + if ($final_reg_step->process_reg_step()) { |
|
311 | 311 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
312 | 312 | } |
313 | 313 | } |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * @param WP_Query $WP_Query |
325 | 325 | * @return void |
326 | 326 | */ |
327 | - public function run( $WP_Query ) { |
|
328 | - if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) { |
|
327 | + public function run($WP_Query) { |
|
328 | + if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) { |
|
329 | 329 | $this->_initialize(); |
330 | 330 | } |
331 | 331 | } |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * @param WP_Query $WP_Query |
341 | 341 | * @return void |
342 | 342 | */ |
343 | - public static function init( $WP_Query ) { |
|
344 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
343 | + public static function init($WP_Query) { |
|
344 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -355,32 +355,32 @@ discard block |
||
355 | 355 | */ |
356 | 356 | private function _initialize() { |
357 | 357 | // ensure SPCO doesn't run twice |
358 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
358 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
359 | 359 | return; |
360 | 360 | } |
361 | 361 | // setup the EE_Checkout object |
362 | 362 | $this->checkout = $this->_initialize_checkout(); |
363 | 363 | // filter checkout |
364 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
364 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
365 | 365 | // get the $_GET |
366 | 366 | $this->_get_request_vars(); |
367 | 367 | // filter continue_reg |
368 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
368 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
369 | 369 | // load the reg steps array |
370 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
370 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
371 | 371 | EED_Single_Page_Checkout::$_initialized = true; |
372 | 372 | return; |
373 | 373 | } |
374 | 374 | // set the current step |
375 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
375 | + $this->checkout->set_current_step($this->checkout->step); |
|
376 | 376 | // and the next step |
377 | 377 | $this->checkout->set_next_step(); |
378 | 378 | // was there already a valid transaction in the checkout from the session ? |
379 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
379 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
380 | 380 | // get transaction from db or session |
381 | 381 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
382 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
383 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
382 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
383 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
384 | 384 | // add some style and make it dance |
385 | 385 | $this->checkout->transaction = EE_Transaction::new_instance(); |
386 | 386 | $this->add_styles_and_scripts(); |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | return; |
389 | 389 | } |
390 | 390 | // and the registrations for the transaction |
391 | - $this->_get_registrations( $this->checkout->transaction ); |
|
391 | + $this->_get_registrations($this->checkout->transaction); |
|
392 | 392 | } |
393 | 393 | // verify that everything has been setup correctly |
394 | - if ( ! $this->_final_verifications() ) { |
|
394 | + if ( ! $this->_final_verifications()) { |
|
395 | 395 | EED_Single_Page_Checkout::$_initialized = true; |
396 | 396 | return; |
397 | 397 | } |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | // set no cache headers and constants |
417 | 417 | EE_System::do_not_cache(); |
418 | 418 | // add anchor |
419 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
419 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
420 | 420 | // remove transaction lock |
421 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
421 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -435,20 +435,20 @@ discard block |
||
435 | 435 | // look in session for existing checkout |
436 | 436 | $checkout = EE_Registry::instance()->SSN->checkout(); |
437 | 437 | // verify |
438 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
438 | + if ( ! $checkout instanceof EE_Checkout) { |
|
439 | 439 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
440 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
440 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
441 | 441 | // verify again |
442 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
443 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
442 | + if ( ! $checkout instanceof EE_Checkout) { |
|
443 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
444 | 444 | } |
445 | 445 | } else { |
446 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
447 | - wp_safe_redirect( $checkout->redirect_url ); |
|
446 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
447 | + wp_safe_redirect($checkout->redirect_url); |
|
448 | 448 | exit(); |
449 | 449 | } |
450 | 450 | } |
451 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
451 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
452 | 452 | // reset anything that needs a clean slate for each request |
453 | 453 | $checkout->reset_for_current_request(); |
454 | 454 | return $checkout; |
@@ -466,22 +466,22 @@ discard block |
||
466 | 466 | // load classes |
467 | 467 | EED_Single_Page_Checkout::load_request_handler(); |
468 | 468 | //make sure this request is marked as belonging to EE |
469 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
469 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
470 | 470 | // which step is being requested ? |
471 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
471 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
472 | 472 | // which step is being edited ? |
473 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
473 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
474 | 474 | // and what we're doing on the current step |
475 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
475 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
476 | 476 | // returning to edit ? |
477 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
477 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
478 | 478 | // or some other kind of revisit ? |
479 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
479 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
480 | 480 | // and whether or not to generate a reg form for this request |
481 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
481 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
482 | 482 | // and whether or not to process a reg form submission for this request |
483 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
484 | - $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
483 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
484 | + $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
485 | 485 | //$this->_display_request_vars(); |
486 | 486 | } |
487 | 487 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | * @return void |
495 | 495 | */ |
496 | 496 | protected function _display_request_vars() { |
497 | - if ( ! WP_DEBUG ) { |
|
497 | + if ( ! WP_DEBUG) { |
|
498 | 498 | return; |
499 | 499 | } |
500 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
501 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
502 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
503 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
504 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
505 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
506 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
507 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
500 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
501 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
502 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
503 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
504 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
505 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
506 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
507 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | * @return array |
519 | 519 | */ |
520 | 520 | private function _get_first_step() { |
521 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
522 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
521 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
522 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | |
@@ -535,37 +535,37 @@ discard block |
||
535 | 535 | private function _load_and_instantiate_reg_steps() { |
536 | 536 | // have reg_steps already been instantiated ? |
537 | 537 | if ( |
538 | - empty( $this->checkout->reg_steps ) || |
|
539 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
538 | + empty($this->checkout->reg_steps) || |
|
539 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
540 | 540 | ) { |
541 | 541 | // if not, then loop through raw reg steps array |
542 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
543 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
542 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
543 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
544 | 544 | return false; |
545 | 545 | } |
546 | 546 | } |
547 | 547 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
548 | 548 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
549 | 549 | // skip the registration_confirmation page ? |
550 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
550 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
551 | 551 | // just remove it from the reg steps array |
552 | - $this->checkout->remove_reg_step( 'registration_confirmation' ); |
|
553 | - } else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( $this->checkout->reg_steps['registration_confirmation'] )) { |
|
552 | + $this->checkout->remove_reg_step('registration_confirmation'); |
|
553 | + } else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) { |
|
554 | 554 | // set the order to something big like 100 |
555 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
555 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
556 | 556 | } |
557 | 557 | // filter the array for good luck |
558 | - $this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps ); |
|
558 | + $this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps); |
|
559 | 559 | // finally re-sort based on the reg step class order properties |
560 | 560 | $this->checkout->sort_reg_steps(); |
561 | 561 | } else { |
562 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
562 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
563 | 563 | // set all current step stati to FALSE |
564 | - $reg_step->set_is_current_step( FALSE ); |
|
564 | + $reg_step->set_is_current_step(FALSE); |
|
565 | 565 | } |
566 | 566 | } |
567 | - if ( empty( $this->checkout->reg_steps )) { |
|
568 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
567 | + if (empty($this->checkout->reg_steps)) { |
|
568 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
569 | 569 | return false; |
570 | 570 | } |
571 | 571 | // make reg step details available to JS |
@@ -583,34 +583,34 @@ discard block |
||
583 | 583 | * @param int $order |
584 | 584 | * @return bool |
585 | 585 | */ |
586 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
586 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
587 | 587 | |
588 | 588 | // we need a file_path, class_name, and slug to add a reg step |
589 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
589 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
590 | 590 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
591 | - if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) { |
|
591 | + if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') { |
|
592 | 592 | return true; |
593 | 593 | } |
594 | 594 | // instantiate step class using file path and class name |
595 | - $reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE ); |
|
595 | + $reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE); |
|
596 | 596 | // did we gets the goods ? |
597 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
597 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
598 | 598 | // set reg step order based on config |
599 | - $reg_step_obj->set_order( $order ); |
|
599 | + $reg_step_obj->set_order($order); |
|
600 | 600 | // add instantiated reg step object to the master reg steps array |
601 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
601 | + $this->checkout->add_reg_step($reg_step_obj); |
|
602 | 602 | } else { |
603 | - EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
603 | + EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
604 | 604 | return false; |
605 | 605 | } |
606 | 606 | } else { |
607 | - if ( WP_DEBUG ) { |
|
607 | + if (WP_DEBUG) { |
|
608 | 608 | EE_Error::add_error( |
609 | 609 | sprintf( |
610 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
611 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
612 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
613 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
610 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
611 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
612 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
613 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
614 | 614 | '<ul>', |
615 | 615 | '<li>', |
616 | 616 | '</li>', |
@@ -634,16 +634,16 @@ discard block |
||
634 | 634 | */ |
635 | 635 | private function _get_transaction_and_cart_for_previous_visit() { |
636 | 636 | /** @var $TXN_model EEM_Transaction */ |
637 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
637 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
638 | 638 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
639 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
639 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
640 | 640 | // verify transaction |
641 | - if ( $transaction instanceof EE_Transaction ) { |
|
641 | + if ($transaction instanceof EE_Transaction) { |
|
642 | 642 | // and get the cart that was used for that transaction |
643 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
643 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
644 | 644 | return $transaction; |
645 | 645 | } else { |
646 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
646 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
647 | 647 | return NULL; |
648 | 648 | } |
649 | 649 | } |
@@ -657,11 +657,11 @@ discard block |
||
657 | 657 | * @param EE_Transaction $transaction |
658 | 658 | * @return EE_Cart |
659 | 659 | */ |
660 | - private function _get_cart_for_transaction( $transaction ) { |
|
661 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
660 | + private function _get_cart_for_transaction($transaction) { |
|
661 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
662 | 662 | // verify cart |
663 | - if ( ! $cart instanceof EE_Cart ) { |
|
664 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
663 | + if ( ! $cart instanceof EE_Cart) { |
|
664 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
665 | 665 | } |
666 | 666 | return $cart; |
667 | 667 | } |
@@ -676,8 +676,8 @@ discard block |
||
676 | 676 | * @param EE_Transaction $transaction |
677 | 677 | * @return EE_Cart |
678 | 678 | */ |
679 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
680 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
679 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
680 | + return EE_Cart::get_cart_from_txn($transaction); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | |
@@ -692,17 +692,17 @@ discard block |
||
692 | 692 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
693 | 693 | // if there's no transaction, then this is the FIRST visit to SPCO |
694 | 694 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
695 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
695 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
696 | 696 | // and then create a new transaction |
697 | 697 | $transaction = $this->_initialize_transaction(); |
698 | 698 | // verify transaction |
699 | - if ( $transaction instanceof EE_Transaction ) { |
|
699 | + if ($transaction instanceof EE_Transaction) { |
|
700 | 700 | // save it so that we have an ID for other objects to use |
701 | 701 | $transaction->save(); |
702 | 702 | // and save TXN data to the cart |
703 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
703 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
704 | 704 | } else { |
705 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
705 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
706 | 706 | } |
707 | 707 | return $transaction; |
708 | 708 | } |
@@ -722,15 +722,15 @@ discard block |
||
722 | 722 | // grab the cart grand total |
723 | 723 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
724 | 724 | // create new TXN |
725 | - return EE_Transaction::new_instance( array( |
|
725 | + return EE_Transaction::new_instance(array( |
|
726 | 726 | 'TXN_timestamp' => time(), |
727 | 727 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
728 | 728 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
729 | 729 | 'TXN_paid' => 0, |
730 | 730 | 'STS_ID' => EEM_Transaction::failed_status_code, |
731 | 731 | )); |
732 | - } catch( Exception $e ) { |
|
733 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
732 | + } catch (Exception $e) { |
|
733 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
734 | 734 | } |
735 | 735 | return NULL; |
736 | 736 | } |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param EE_Transaction $transaction |
745 | 745 | * @return EE_Cart |
746 | 746 | */ |
747 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
747 | + private function _get_registrations(EE_Transaction $transaction) { |
|
748 | 748 | // first step: grab the registrants { : o |
749 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
749 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
750 | 750 | // verify registrations have been set |
751 | - if ( empty( $registrations )) { |
|
751 | + if (empty($registrations)) { |
|
752 | 752 | // if no cached registrations, then check the db |
753 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
753 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
754 | 754 | // still nothing ? well as long as this isn't a revisit |
755 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
755 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
756 | 756 | // generate new registrations from scratch |
757 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
757 | + $registrations = $this->_initialize_registrations($transaction); |
|
758 | 758 | } |
759 | 759 | } |
760 | 760 | // sort by their original registration order |
761 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
761 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
762 | 762 | // then loop thru the array |
763 | - foreach ( $registrations as $registration ) { |
|
763 | + foreach ($registrations as $registration) { |
|
764 | 764 | // verify each registration |
765 | - if ( $registration instanceof EE_Registration ) { |
|
765 | + if ($registration instanceof EE_Registration) { |
|
766 | 766 | // we display all attendee info for the primary registrant |
767 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
767 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
768 | 768 | $this->checkout->primary_revisit = TRUE; |
769 | 769 | break; |
770 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
770 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
771 | 771 | // but hide info if it doesn't belong to you |
772 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
772 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
773 | 773 | } |
774 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
774 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
775 | 775 | } |
776 | 776 | } |
777 | 777 | } |
@@ -785,17 +785,17 @@ discard block |
||
785 | 785 | * @param EE_Transaction $transaction |
786 | 786 | * @return array |
787 | 787 | */ |
788 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
788 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
789 | 789 | $att_nmbr = 0; |
790 | 790 | $registrations = array(); |
791 | - if ( $transaction instanceof EE_Transaction ) { |
|
791 | + if ($transaction instanceof EE_Transaction) { |
|
792 | 792 | /** @type EE_Registration_Processor $registration_processor */ |
793 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
793 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
794 | 794 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
795 | 795 | // now let's add the cart items to the $transaction |
796 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
796 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
797 | 797 | //do the following for each ticket of this type they selected |
798 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
798 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
799 | 799 | $att_nmbr++; |
800 | 800 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
801 | 801 | $line_item, |
@@ -803,12 +803,12 @@ discard block |
||
803 | 803 | $att_nmbr, |
804 | 804 | $this->checkout->total_ticket_count |
805 | 805 | ); |
806 | - if ( $registration instanceof EE_Registration ) { |
|
807 | - $registrations[ $registration->ID() ] = $registration; |
|
806 | + if ($registration instanceof EE_Registration) { |
|
807 | + $registrations[$registration->ID()] = $registration; |
|
808 | 808 | } |
809 | 809 | } |
810 | 810 | } |
811 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
811 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
812 | 812 | } |
813 | 813 | return $registrations; |
814 | 814 | } |
@@ -823,12 +823,12 @@ discard block |
||
823 | 823 | * @param EE_Registration $reg_B |
824 | 824 | * @return array() |
825 | 825 | */ |
826 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
826 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
827 | 827 | // this shouldn't ever happen within the same TXN, but oh well |
828 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
828 | + if ($reg_A->count() == $reg_B->count()) { |
|
829 | 829 | return 0; |
830 | 830 | } |
831 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
831 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -843,29 +843,29 @@ discard block |
||
843 | 843 | */ |
844 | 844 | private function _final_verifications() { |
845 | 845 | // filter checkout |
846 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
846 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
847 | 847 | //verify that current step is still set correctly |
848 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
849 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
849 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
850 | 850 | return false; |
851 | 851 | } |
852 | 852 | // if returning to SPCO, then verify that primary registrant is set |
853 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
853 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
854 | 854 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
855 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
856 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
855 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
856 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
857 | 857 | return false; |
858 | 858 | } |
859 | 859 | $valid_registrant = null; |
860 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
861 | - if ( $registration instanceof EE_Registration ) { |
|
862 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
860 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
861 | + if ($registration instanceof EE_Registration) { |
|
862 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
863 | 863 | $valid_registrant = $registration; |
864 | 864 | } |
865 | 865 | } |
866 | 866 | } |
867 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
868 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
867 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
868 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
869 | 869 | return false; |
870 | 870 | } |
871 | 871 | } |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | */ |
886 | 886 | private function _initialize_reg_steps() { |
887 | 887 | /** @type EE_Transaction_Processor $transaction_processor */ |
888 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
888 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
889 | 889 | // call set_reg_step_initiated ??? |
890 | 890 | if ( |
891 | 891 | // first time visiting SPCO ? |
@@ -894,24 +894,24 @@ discard block |
||
894 | 894 | && $this->checkout->action === 'display_spco_reg_step' |
895 | 895 | ) { |
896 | 896 | // set the start time for this reg step |
897 | - if ( ! $transaction_processor->set_reg_step_initiated( $this->checkout->transaction, $this->checkout->current_step->slug() ) ) { |
|
898 | - if ( WP_DEBUG ) { |
|
899 | - EE_Error::add_error( sprintf(__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ), $this->checkout->current_step->name() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
897 | + if ( ! $transaction_processor->set_reg_step_initiated($this->checkout->transaction, $this->checkout->current_step->slug())) { |
|
898 | + if (WP_DEBUG) { |
|
899 | + EE_Error::add_error(sprintf(__('The "%1$s" registration step was not initialized properly.', 'event_espresso'), $this->checkout->current_step->name()), __FILE__, __FUNCTION__, __LINE__); |
|
900 | 900 | } |
901 | 901 | }; |
902 | 902 | } |
903 | 903 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
904 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
904 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
905 | 905 | $reg_step->initialize_reg_step(); |
906 | 906 | // i18n |
907 | 907 | $reg_step->translate_js_strings(); |
908 | - if ( $reg_step->is_current_step() ) { |
|
908 | + if ($reg_step->is_current_step()) { |
|
909 | 909 | // the text that appears on the reg step form submit button |
910 | 910 | $reg_step->set_submit_button_text(); |
911 | 911 | } |
912 | 912 | } |
913 | 913 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
914 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
914 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | |
@@ -924,39 +924,39 @@ discard block |
||
924 | 924 | */ |
925 | 925 | private function _check_form_submission() { |
926 | 926 | //does this request require the reg form to be generated ? |
927 | - if ( $this->checkout->generate_reg_form ) { |
|
927 | + if ($this->checkout->generate_reg_form) { |
|
928 | 928 | // ever heard that song by Blue Rodeo ? |
929 | 929 | try { |
930 | 930 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
931 | 931 | // if not displaying a form, then check for form submission |
932 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
932 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
933 | 933 | // clear out any old data in case this step is being run again |
934 | - $this->checkout->current_step->set_valid_data( array() ); |
|
934 | + $this->checkout->current_step->set_valid_data(array()); |
|
935 | 935 | // capture submitted form data |
936 | 936 | $this->checkout->current_step->reg_form->receive_form_submission( |
937 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
937 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
938 | 938 | ); |
939 | 939 | // validate submitted form data |
940 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
940 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
941 | 941 | // thou shall not pass !!! |
942 | 942 | $this->checkout->continue_reg = FALSE; |
943 | 943 | // any form validation errors? |
944 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
944 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
945 | 945 | $submission_error_messages = array(); |
946 | 946 | // bad, bad, bad registrant |
947 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
948 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
949 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
947 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
948 | + if ($validation_error instanceof EE_Validation_Error) { |
|
949 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
950 | 950 | } |
951 | 951 | } |
952 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
952 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
953 | 953 | } |
954 | 954 | // well not really... what will happen is we'll just get redirected back to redo the current step |
955 | 955 | $this->go_to_next_step(); |
956 | 956 | return; |
957 | 957 | } |
958 | 958 | } |
959 | - } catch( EE_Error $e ) { |
|
959 | + } catch (EE_Error $e) { |
|
960 | 960 | $e->get_error(); |
961 | 961 | } |
962 | 962 | } |
@@ -972,38 +972,38 @@ discard block |
||
972 | 972 | */ |
973 | 973 | private function _process_form_action() { |
974 | 974 | // what cha wanna do? |
975 | - switch( $this->checkout->action ) { |
|
975 | + switch ($this->checkout->action) { |
|
976 | 976 | // AJAX next step reg form |
977 | 977 | case 'display_spco_reg_step' : |
978 | 978 | $this->checkout->redirect = FALSE; |
979 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
980 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
979 | + if (EE_Registry::instance()->REQ->ajax) { |
|
980 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
981 | 981 | } |
982 | 982 | break; |
983 | 983 | |
984 | 984 | default : |
985 | 985 | // meh... do one of those other steps first |
986 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
986 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
987 | 987 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
988 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
988 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
989 | 989 | // call action on current step |
990 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
990 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
991 | 991 | // good registrant, you get to proceed |
992 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
993 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
994 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
992 | + if ($this->checkout->current_step->success_message() != '') { |
|
993 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
994 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
995 | 995 | } |
996 | 996 | } |
997 | 997 | // pack it up, pack it in... |
998 | 998 | $this->_setup_redirect(); |
999 | 999 | } |
1000 | 1000 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1001 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1001 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1002 | 1002 | |
1003 | 1003 | } else { |
1004 | 1004 | EE_Error::add_error( |
1005 | 1005 | sprintf( |
1006 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1006 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1007 | 1007 | $this->checkout->action, |
1008 | 1008 | $this->checkout->current_step->name() |
1009 | 1009 | ), |
@@ -1027,10 +1027,10 @@ discard block |
||
1027 | 1027 | * @return void |
1028 | 1028 | */ |
1029 | 1029 | public function add_styles_and_scripts() { |
1030 | - if ( $this->checkout->admin_request ) { |
|
1031 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1030 | + if ($this->checkout->admin_request) { |
|
1031 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1032 | 1032 | } else { |
1033 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1033 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1034 | 1034 | } |
1035 | 1035 | } |
1036 | 1036 | |
@@ -1046,45 +1046,45 @@ discard block |
||
1046 | 1046 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1047 | 1047 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1048 | 1048 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1049 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1050 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1051 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1049 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1050 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1051 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1052 | 1052 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1053 | 1053 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1054 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1055 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1054 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1055 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1056 | 1056 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1057 | 1057 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1058 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1059 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1060 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1061 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1062 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1063 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1064 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1065 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1066 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1067 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1068 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1069 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1070 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1071 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1058 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1059 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1060 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1061 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1062 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1063 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1064 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1065 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1066 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1067 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1068 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1069 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1070 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1071 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1072 | 1072 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1073 | - __( '%1$sWe\'re sorry, but you\'re registration time has expired |
|
1073 | + __('%1$sWe\'re sorry, but you\'re registration time has expired |
|
1074 | 1074 | .%2$s%3$s%4$sIf you still wish to complete your registration, please |
1075 | 1075 | return to the %5$sEvent List%6$sEvent List%7$s and reselect your |
1076 | 1076 | tickets if available. Please except our apologies for any inconvenience this |
1077 | - may have caused.%8$s', 'event_espresso' ), |
|
1077 | + may have caused.%8$s', 'event_espresso'), |
|
1078 | 1078 | '<h4 class="important-notice">', |
1079 | 1079 | '</h4>', |
1080 | 1080 | '<br />', |
1081 | 1081 | '<p>', |
1082 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1082 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1083 | 1083 | '">', |
1084 | 1084 | '</a>', |
1085 | 1085 | '</p>' |
1086 | 1086 | ); |
1087 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1087 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | |
@@ -1097,28 +1097,28 @@ discard block |
||
1097 | 1097 | */ |
1098 | 1098 | public function enqueue_styles_and_scripts() { |
1099 | 1099 | // load css |
1100 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1101 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1100 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1101 | + wp_enqueue_style('single_page_checkout'); |
|
1102 | 1102 | // i18n |
1103 | 1103 | $this->translate_js_strings(); |
1104 | 1104 | // load JS |
1105 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1106 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1107 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1108 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1109 | - wp_localize_script( 'single_page_checkout', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1105 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1106 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1107 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1108 | + wp_enqueue_script('single_page_checkout'); |
|
1109 | + wp_localize_script('single_page_checkout', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1110 | 1110 | |
1111 | 1111 | /** |
1112 | 1112 | * global action hook for enqueueing styles and scripts with |
1113 | 1113 | * spco calls. |
1114 | 1114 | */ |
1115 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1115 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1116 | 1116 | |
1117 | 1117 | /** |
1118 | 1118 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1119 | 1119 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1120 | 1120 | */ |
1121 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1121 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1122 | 1122 | |
1123 | 1123 | // add css and JS for current step |
1124 | 1124 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1134,28 +1134,28 @@ discard block |
||
1134 | 1134 | */ |
1135 | 1135 | private function _display_spco_reg_form() { |
1136 | 1136 | // if registering via the admin, just display the reg form for the current step |
1137 | - if ( $this->checkout->admin_request ) { |
|
1138 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1137 | + if ($this->checkout->admin_request) { |
|
1138 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1139 | 1139 | } else { |
1140 | 1140 | // add powered by EE msg |
1141 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1141 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1142 | 1142 | $this->checkout->registration_form = new EE_Form_Section_Proper( |
1143 | 1143 | array( |
1144 | 1144 | 'name' => 'single-page-checkout', |
1145 | 1145 | 'html_id' => 'ee-single-page-checkout-dv', |
1146 | 1146 | 'layout_strategy' => new EE_Template_Layout( |
1147 | 1147 | array( |
1148 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1148 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1149 | 1149 | 'template_args' => array( |
1150 | - 'empty_cart' => count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params )) < 1 ? TRUE : FALSE, |
|
1150 | + 'empty_cart' => count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? TRUE : FALSE, |
|
1151 | 1151 | 'revisit' => $this->checkout->revisit, |
1152 | 1152 | 'reg_steps' => $this->checkout->reg_steps, |
1153 | 1153 | 'next_step' => $this->checkout->next_step instanceof EE_SPCO_Reg_Step ? $this->checkout->next_step->slug() : '', |
1154 | 1154 | 'empty_msg' => apply_filters( |
1155 | 1155 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1156 | 1156 | sprintf( |
1157 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1158 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1157 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1158 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1159 | 1159 | '">', |
1160 | 1160 | '</a>' |
1161 | 1161 | ) |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $this->checkout->get_registration_time_limit(), |
1165 | 1165 | 'session_expiration' => gmdate( |
1166 | 1166 | 'M d, Y H:i:s', |
1167 | - EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) |
|
1167 | + EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS) |
|
1168 | 1168 | ) |
1169 | 1169 | ) |
1170 | 1170 | ) |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | ) |
1173 | 1173 | ); |
1174 | 1174 | // load template and add to output sent that gets filtered into the_content() |
1175 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1175 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1176 | 1176 | } |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1186,8 +1186,8 @@ discard block |
||
1186 | 1186 | * @internal param string $label |
1187 | 1187 | * @return string |
1188 | 1188 | */ |
1189 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1190 | - if ( $next_step == 'finalize_registration' ) { |
|
1189 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1190 | + if ($next_step == 'finalize_registration') { |
|
1191 | 1191 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1192 | 1192 | } |
1193 | 1193 | } |
@@ -1201,18 +1201,18 @@ discard block |
||
1201 | 1201 | * @return string |
1202 | 1202 | */ |
1203 | 1203 | public static function display_registration_footer() { |
1204 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1205 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1206 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' ); |
|
1207 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1204 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1205 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1206 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/'); |
|
1207 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1208 | 1208 | echo apply_filters( |
1209 | 1209 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1210 | 1210 | sprintf( |
1211 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1212 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1211 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1212 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1213 | 1213 | '" target="_blank">', |
1214 | 1214 | '</a>', |
1215 | - '<a href="' . $url . '" title="', |
|
1215 | + '<a href="'.$url.'" title="', |
|
1216 | 1216 | '" target="_blank">', |
1217 | 1217 | '</a></div>' |
1218 | 1218 | ) |
@@ -1243,12 +1243,12 @@ discard block |
||
1243 | 1243 | * @return array |
1244 | 1244 | */ |
1245 | 1245 | private function _setup_redirect() { |
1246 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1246 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1247 | 1247 | $this->checkout->redirect = TRUE; |
1248 | - if ( empty( $this->checkout->redirect_url )) { |
|
1248 | + if (empty($this->checkout->redirect_url)) { |
|
1249 | 1249 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1250 | 1250 | } |
1251 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1251 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1252 | 1252 | } |
1253 | 1253 | } |
1254 | 1254 | |
@@ -1261,12 +1261,12 @@ discard block |
||
1261 | 1261 | * @return void |
1262 | 1262 | */ |
1263 | 1263 | public function go_to_next_step() { |
1264 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1264 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1265 | 1265 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1266 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1266 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1267 | 1267 | } |
1268 | 1268 | // just return for these conditions |
1269 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1269 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1270 | 1270 | return; |
1271 | 1271 | } |
1272 | 1272 | // AJAX response |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | */ |
1288 | 1288 | protected function _handle_json_response() { |
1289 | 1289 | // if this is an ajax request |
1290 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1290 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1291 | 1291 | // DEBUG LOG |
1292 | 1292 | //$this->checkout->log( |
1293 | 1293 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1297,10 +1297,10 @@ discard block |
||
1297 | 1297 | // 'continue_reg' => $this->checkout->continue_reg, |
1298 | 1298 | // ) |
1299 | 1299 | //); |
1300 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1301 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1300 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1301 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1302 | 1302 | // just send the ajax ( |
1303 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1303 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1304 | 1304 | $this->unlock_transaction(); |
1305 | 1305 | echo $json_response; |
1306 | 1306 | exit(); |
@@ -1317,9 +1317,9 @@ discard block |
||
1317 | 1317 | */ |
1318 | 1318 | protected function _handle_html_redirects() { |
1319 | 1319 | // going somewhere ? |
1320 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1320 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1321 | 1321 | // store notices in a transient |
1322 | - EE_Error::get_notices( false, true, true ); |
|
1322 | + EE_Error::get_notices(false, true, true); |
|
1323 | 1323 | $this->unlock_transaction(); |
1324 | 1324 | // DEBUG LOG |
1325 | 1325 | //$this->checkout->log( |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | // 'headers_list' => headers_list(), |
1331 | 1331 | // ) |
1332 | 1332 | //); |
1333 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1333 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1334 | 1334 | exit(); |
1335 | 1335 | } |
1336 | 1336 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | /** |
253 | 253 | * returns true if ANY reg status was updated during checkout |
254 | - * @return array |
|
254 | + * @return boolean|null |
|
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | 257 | foreach ( $this->reg_status_updated as $reg_status ) { |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | /** |
277 | 277 | * @param $REG_ID |
278 | - * @param $reg_status |
|
278 | + * @param boolean $reg_status |
|
279 | 279 | */ |
280 | 280 | public function set_reg_status_updated( $REG_ID, $reg_status ) { |
281 | 281 | $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * reset_reg_steps |
531 | 531 | * |
532 | 532 | * @access public |
533 | - * @return bool |
|
533 | + * @return boolean|null |
|
534 | 534 | */ |
535 | 535 | public function reset_reg_steps() { |
536 | 536 | $this->sort_reg_steps(); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | * stores whether any updates were made to the TXN or it's related registrations |
644 | 644 | * |
645 | 645 | * @access public |
646 | - * @return bool |
|
646 | + * @return boolean|null |
|
647 | 647 | */ |
648 | 648 | public function track_transaction_and_registration_status_updates() { |
649 | 649 | // verify the transaction |
@@ -991,6 +991,7 @@ discard block |
||
991 | 991 | * |
992 | 992 | * @param string | int $reg_cache_ID |
993 | 993 | * @param EE_Registration $registration |
994 | + * @param integer $reg_cache_ID |
|
994 | 995 | * @return void |
995 | 996 | */ |
996 | 997 | protected function _refresh_registration( $reg_cache_ID, $registration ) { |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_Checkout |
|
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_Checkout |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_Checkout { |
15 | 15 | |
16 | 16 | /** |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url(); |
243 | 243 | $this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url(); |
244 | 244 | $this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url(); |
245 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE ); |
|
245 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE); |
|
246 | 246 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax; |
247 | - $this->reg_cache_where_params = array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
247 | + $this->reg_cache_where_params = array('order_by' => array('REG_count' => 'ASC')); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | * @return array |
255 | 255 | */ |
256 | 256 | public function any_reg_status_updated() { |
257 | - foreach ( $this->reg_status_updated as $reg_status ) { |
|
258 | - if ( $reg_status ) { |
|
257 | + foreach ($this->reg_status_updated as $reg_status) { |
|
258 | + if ($reg_status) { |
|
259 | 259 | return true; |
260 | 260 | } |
261 | 261 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param $REG_ID |
268 | 268 | * @return array |
269 | 269 | */ |
270 | - public function reg_status_updated( $REG_ID ) { |
|
271 | - return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false; |
|
270 | + public function reg_status_updated($REG_ID) { |
|
271 | + return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | * @param $REG_ID |
278 | 278 | * @param $reg_status |
279 | 279 | */ |
280 | - public function set_reg_status_updated( $REG_ID, $reg_status ) { |
|
281 | - $this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN ); |
|
280 | + public function set_reg_status_updated($REG_ID, $reg_status) { |
|
281 | + $this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * can ONLY be set by the Finalize_Registration reg step |
300 | 300 | */ |
301 | 301 | public function set_exit_spco() { |
302 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
302 | + if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
303 | 303 | $this->exit_spco = true; |
304 | 304 | } |
305 | 305 | } |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function reset_for_current_request() { |
318 | 318 | $this->process_form_submission = FALSE; |
319 | - $this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true ); |
|
319 | + $this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true); |
|
320 | 320 | $this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax; |
321 | 321 | $this->continue_reg = true; |
322 | 322 | $this->redirect = false; |
323 | 323 | // don't reset the cached redirect form if we're about to be asked to display it !!! |
324 | - if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) { |
|
324 | + if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') { |
|
325 | 325 | $this->redirect_form = ''; |
326 | 326 | } |
327 | 327 | $this->redirect_url = ''; |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | * @param EE_SPCO_Reg_Step $reg_step_obj |
339 | 339 | * @return void |
340 | 340 | */ |
341 | - public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) { |
|
342 | - $this->reg_steps[ $reg_step_obj->slug() ] = $reg_step_obj; |
|
341 | + public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) { |
|
342 | + $this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -351,13 +351,13 @@ discard block |
||
351 | 351 | * @param string $reg_step_slug |
352 | 352 | * @return void |
353 | 353 | */ |
354 | - public function remove_reg_step( $reg_step_slug = '' ) { |
|
355 | - unset( $this->reg_steps[ $reg_step_slug ] ); |
|
356 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
354 | + public function remove_reg_step($reg_step_slug = '') { |
|
355 | + unset($this->reg_steps[$reg_step_slug]); |
|
356 | + if ($this->transaction instanceof EE_Transaction) { |
|
357 | 357 | /** @type EE_Transaction_Processor $transaction_processor */ |
358 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
358 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
359 | 359 | // now remove reg step from TXN and save |
360 | - $transaction_processor->remove_reg_step( $this->transaction, $reg_step_slug ); |
|
360 | + $transaction_processor->remove_reg_step($this->transaction, $reg_step_slug); |
|
361 | 361 | $this->transaction->save(); |
362 | 362 | } |
363 | 363 | } |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | * @param int $order |
373 | 373 | * @return void |
374 | 374 | */ |
375 | - public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) { |
|
376 | - if ( isset( $this->reg_steps[ $reg_step_slug ] )) { |
|
377 | - $this->reg_steps[ $reg_step_slug ]->set_order( $order ); |
|
375 | + public function set_reg_step_order($reg_step_slug = '', $order = 100) { |
|
376 | + if (isset($this->reg_steps[$reg_step_slug])) { |
|
377 | + $this->reg_steps[$reg_step_slug]->set_order($order); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -387,25 +387,25 @@ discard block |
||
387 | 387 | * @param string $current_step |
388 | 388 | * @return void |
389 | 389 | */ |
390 | - public function set_current_step( $current_step ) { |
|
390 | + public function set_current_step($current_step) { |
|
391 | 391 | // grab what step we're on |
392 | - $this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps ); |
|
392 | + $this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps); |
|
393 | 393 | // verify instance |
394 | - if ( $this->current_step instanceof EE_SPCO_Reg_Step ) { |
|
394 | + if ($this->current_step instanceof EE_SPCO_Reg_Step) { |
|
395 | 395 | // we don't want to repeat completed steps if this is the first time through SPCO |
396 | - if ( $this->continue_reg && $this->current_step->completed() && ! $this->revisit ) { |
|
396 | + if ($this->continue_reg && $this->current_step->completed() && ! $this->revisit) { |
|
397 | 397 | // so advance to the next step |
398 | 398 | $this->set_next_step(); |
399 | - if ( $this->next_step instanceof EE_SPCO_Reg_Step ) { |
|
399 | + if ($this->next_step instanceof EE_SPCO_Reg_Step) { |
|
400 | 400 | // and attempt to set it as the current step |
401 | - $this->set_current_step( $this->next_step->slug() ); |
|
401 | + $this->set_current_step($this->next_step->slug()); |
|
402 | 402 | } |
403 | 403 | return; |
404 | 404 | } |
405 | - $this->current_step->set_is_current_step( TRUE ); |
|
405 | + $this->current_step->set_is_current_step(TRUE); |
|
406 | 406 | } else { |
407 | 407 | EE_Error::add_error( |
408 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
408 | + __('The current step could not be set.', 'event_espresso'), |
|
409 | 409 | __FILE__, __FUNCTION__, __LINE__ |
410 | 410 | ); |
411 | 411 | } |
@@ -422,20 +422,20 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function set_next_step() { |
424 | 424 | // set pointer to start of array |
425 | - reset( $this->reg_steps ); |
|
425 | + reset($this->reg_steps); |
|
426 | 426 | // if there is more than one step |
427 | - if ( count( $this->reg_steps ) > 1 ) { |
|
427 | + if (count($this->reg_steps) > 1) { |
|
428 | 428 | // advance to the current step and set pointer |
429 | - while ( key( $this->reg_steps ) != $this->current_step->slug() && key( $this->reg_steps ) != '' ) { |
|
430 | - next( $this->reg_steps ); |
|
429 | + while (key($this->reg_steps) != $this->current_step->slug() && key($this->reg_steps) != '') { |
|
430 | + next($this->reg_steps); |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | // advance one more spot ( if it exists ) |
434 | - $this->next_step = next( $this->reg_steps ); |
|
434 | + $this->next_step = next($this->reg_steps); |
|
435 | 435 | // verify instance |
436 | - $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
436 | + $this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL; |
|
437 | 437 | // then back to current step to reset |
438 | - prev( $this->reg_steps ); |
|
438 | + prev($this->reg_steps); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * @return EE_SPCO_Reg_Step | null |
450 | 450 | */ |
451 | 451 | public function get_next_reg_step() { |
452 | - $next = next( $this->reg_steps ); |
|
453 | - prev( $this->reg_steps ); |
|
452 | + $next = next($this->reg_steps); |
|
453 | + prev($this->reg_steps); |
|
454 | 454 | return $next instanceof EE_SPCO_Reg_Step ? $next : null; |
455 | 455 | } |
456 | 456 | |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * @return EE_SPCO_Reg_Step | null |
466 | 466 | */ |
467 | 467 | public function get_prev_reg_step() { |
468 | - $prev = prev( $this->reg_steps ); |
|
469 | - next( $this->reg_steps ); |
|
468 | + $prev = prev($this->reg_steps); |
|
469 | + next($this->reg_steps); |
|
470 | 470 | return $prev instanceof EE_SPCO_Reg_Step ? $prev : null; |
471 | 471 | } |
472 | 472 | |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | * @return void |
480 | 480 | */ |
481 | 481 | public function sort_reg_steps() { |
482 | - $reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' ); |
|
483 | - uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback )); |
|
482 | + $reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback'); |
|
483 | + uasort($this->reg_steps, array($this, $reg_step_sorting_callback)); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -493,17 +493,17 @@ discard block |
||
493 | 493 | * @param EE_SPCO_Reg_Step $reg_step_B |
494 | 494 | * @return array() |
495 | 495 | */ |
496 | - public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) { |
|
496 | + public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) { |
|
497 | 497 | // send finalize_registration step to the end of the array |
498 | - if ( $reg_step_A->slug() == 'finalize_registration' ) { |
|
498 | + if ($reg_step_A->slug() == 'finalize_registration') { |
|
499 | 499 | return 1; |
500 | - } else if ( $reg_step_B->slug() == 'finalize_registration' ) { |
|
500 | + } else if ($reg_step_B->slug() == 'finalize_registration') { |
|
501 | 501 | return -1; |
502 | 502 | } |
503 | - if ( $reg_step_A->order() == $reg_step_B->order() ) { |
|
503 | + if ($reg_step_A->order() == $reg_step_B->order()) { |
|
504 | 504 | return 0; |
505 | 505 | } |
506 | - return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1; |
|
506 | + return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1; |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | * @return void |
516 | 516 | */ |
517 | 517 | public function set_reg_step_JSON_info() { |
518 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array(); |
|
518 | + EE_Registry::$i18n_js_strings['reg_steps'] = array(); |
|
519 | 519 | // pass basic reg step data to JS |
520 | - foreach ( $this->reg_steps as $reg_step ) { |
|
521 | - EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug(); |
|
520 | + foreach ($this->reg_steps as $reg_step) { |
|
521 | + EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug(); |
|
522 | 522 | } |
523 | 523 | // reset reg step html |
524 | 524 | // $this->json_response->set_reg_step_html( '' ); |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | */ |
535 | 535 | public function reset_reg_steps() { |
536 | 536 | $this->sort_reg_steps(); |
537 | - $this->set_current_step( EE_Registry::instance()->REQ->get( 'step' )); |
|
537 | + $this->set_current_step(EE_Registry::instance()->REQ->get('step')); |
|
538 | 538 | $this->set_next_step(); |
539 | 539 | // the text that appears on the reg step form submit button |
540 | 540 | $this->current_step->set_submit_button_text(); |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | */ |
552 | 552 | public function get_registration_time_limit() { |
553 | 553 | |
554 | - $registration_time_limit = (float)( EE_Registry::instance() ->SSN->expiration() - time() ); |
|
554 | + $registration_time_limit = (float) (EE_Registry::instance() ->SSN->expiration() - time()); |
|
555 | 555 | $time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s'; |
556 | - $registration_time_limit = gmdate( $time_limit_format, $registration_time_limit ); |
|
556 | + $registration_time_limit = gmdate($time_limit_format, $registration_time_limit); |
|
557 | 557 | return apply_filters( |
558 | 558 | 'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit', |
559 | 559 | $registration_time_limit |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | // overpaid TXN |
574 | 574 | // free TXN ( total = 0.00 ) |
575 | 575 | // then payment required is TRUE |
576 | - return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE; |
|
576 | + return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | */ |
587 | 587 | public function initialize_txn_reg_steps_array() { |
588 | 588 | $txn_reg_steps_array = array(); |
589 | - foreach ( $this->reg_steps as $reg_step ) { |
|
590 | - $txn_reg_steps_array[ $reg_step->slug() ] = FALSE; |
|
589 | + foreach ($this->reg_steps as $reg_step) { |
|
590 | + $txn_reg_steps_array[$reg_step->slug()] = FALSE; |
|
591 | 591 | } |
592 | 592 | return $txn_reg_steps_array; |
593 | 593 | } |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | public function update_txn_reg_steps_array() { |
604 | 604 | $updated = FALSE; |
605 | 605 | /** @type EE_Transaction_Processor $transaction_processor */ |
606 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
607 | - foreach ( $this->reg_steps as $reg_step ) { |
|
608 | - if ( $reg_step->completed() ) { |
|
609 | - $updated = $transaction_processor->set_reg_step_completed( $this->transaction, $reg_step->slug() ) ? TRUE : $updated; |
|
606 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
607 | + foreach ($this->reg_steps as $reg_step) { |
|
608 | + if ($reg_step->completed()) { |
|
609 | + $updated = $transaction_processor->set_reg_step_completed($this->transaction, $reg_step->slug()) ? TRUE : $updated; |
|
610 | 610 | } |
611 | 611 | } |
612 | - if ( $updated ) { |
|
612 | + if ($updated) { |
|
613 | 613 | $this->transaction->save(); |
614 | 614 | } |
615 | 615 | return $updated; |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | * @return void |
625 | 625 | */ |
626 | 626 | public function stash_transaction_and_checkout() { |
627 | - if ( ! $this->revisit ) { |
|
627 | + if ( ! $this->revisit) { |
|
628 | 628 | $this->update_txn_reg_steps_array(); |
629 | 629 | } |
630 | 630 | $this->track_transaction_and_registration_status_updates(); |
631 | 631 | // save all data to the db, but suppress errors |
632 | 632 | //$this->save_all_data( FALSE ); |
633 | 633 | // cache the checkout in the session |
634 | - EE_Registry::instance()->SSN->set_checkout( $this ); |
|
634 | + EE_Registry::instance()->SSN->set_checkout($this); |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | |
@@ -647,21 +647,21 @@ discard block |
||
647 | 647 | */ |
648 | 648 | public function track_transaction_and_registration_status_updates() { |
649 | 649 | // verify the transaction |
650 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
650 | + if ($this->transaction instanceof EE_Transaction) { |
|
651 | 651 | /** @type EE_Transaction_Payments $transaction_payments */ |
652 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
652 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
653 | 653 | /** @type EE_Transaction_Processor $transaction_processor */ |
654 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
654 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
655 | 655 | // has there been a TXN status change during this checkout? |
656 | - if ( $transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated() ) { |
|
656 | + if ($transaction_payments->txn_status_updated() || $transaction_processor->txn_status_updated()) { |
|
657 | 657 | $this->txn_status_updated = true; |
658 | 658 | } |
659 | 659 | /** @type EE_Registration_Processor $registration_processor */ |
660 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
660 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
661 | 661 | // grab the saved registrations from the transaction |
662 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
663 | - if ( $registration_processor->reg_status_updated( $registration->ID() ) ) { |
|
664 | - $this->set_reg_status_updated( $registration->ID(), true ); |
|
662 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
663 | + if ($registration_processor->reg_status_updated($registration->ID())) { |
|
664 | + $this->set_reg_status_updated($registration->ID(), true); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | } |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | * @param EE_Registration $registration |
684 | 684 | * @return bool |
685 | 685 | */ |
686 | - public function visit_allows_processing_of_this_registration( EE_Registration $registration ) { |
|
687 | - return ! $this->revisit || $this->primary_revisit || ( $this->revisit && $this->reg_url_link == $registration->reg_url_link() ) ? TRUE : FALSE; |
|
686 | + public function visit_allows_processing_of_this_registration(EE_Registration $registration) { |
|
687 | + return ! $this->revisit || $this->primary_revisit || ($this->revisit && $this->reg_url_link == $registration->reg_url_link()) ? TRUE : FALSE; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -709,18 +709,18 @@ discard block |
||
709 | 709 | * @param bool $show_errors |
710 | 710 | * @return bool |
711 | 711 | */ |
712 | - public function save_all_data( $show_errors = TRUE ) { |
|
712 | + public function save_all_data($show_errors = TRUE) { |
|
713 | 713 | // verify the transaction |
714 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
714 | + if ($this->transaction instanceof EE_Transaction) { |
|
715 | 715 | // save to ensure that TXN has ID |
716 | 716 | $this->transaction->save(); |
717 | 717 | // grab the saved registrations from the transaction |
718 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) { |
|
719 | - $this->_save_registration( $registration, $show_errors ); |
|
718 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) { |
|
719 | + $this->_save_registration($registration, $show_errors); |
|
720 | 720 | } |
721 | 721 | } else { |
722 | - if ( $show_errors ) { |
|
723 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
722 | + if ($show_errors) { |
|
723 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
724 | 724 | } |
725 | 725 | return FALSE; |
726 | 726 | } |
@@ -735,32 +735,32 @@ discard block |
||
735 | 735 | * @param bool $show_errors |
736 | 736 | * @return void |
737 | 737 | */ |
738 | - private function _save_registration( $registration, $show_errors = TRUE ) { |
|
738 | + private function _save_registration($registration, $show_errors = TRUE) { |
|
739 | 739 | // verify object |
740 | - if ( $registration instanceof EE_Registration ) { |
|
740 | + if ($registration instanceof EE_Registration) { |
|
741 | 741 | // should this registration be processed during this visit ? |
742 | - if ( $this->visit_allows_processing_of_this_registration( $registration ) ) { |
|
742 | + if ($this->visit_allows_processing_of_this_registration($registration)) { |
|
743 | 743 | //set TXN ID |
744 | - if ( ! $registration->transaction_ID() ) { |
|
745 | - $registration->set_transaction_id( $this->transaction->ID() ); |
|
744 | + if ( ! $registration->transaction_ID()) { |
|
745 | + $registration->set_transaction_id($this->transaction->ID()); |
|
746 | 746 | } |
747 | 747 | // verify and save the attendee |
748 | - $this->_save_registration_attendee( $registration, $show_errors ); |
|
748 | + $this->_save_registration_attendee($registration, $show_errors); |
|
749 | 749 | // save answers to reg form questions |
750 | - $this->_save_registration_answers( $registration, $show_errors ); |
|
750 | + $this->_save_registration_answers($registration, $show_errors); |
|
751 | 751 | // save changes |
752 | 752 | $registration->save(); |
753 | 753 | // update txn cache |
754 | - if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) { |
|
755 | - if ( $show_errors ) { |
|
756 | - EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
754 | + if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) { |
|
755 | + if ($show_errors) { |
|
756 | + EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
757 | 757 | } |
758 | 758 | } |
759 | 759 | } |
760 | 760 | } else { |
761 | - if ( $show_errors ) { |
|
761 | + if ($show_errors) { |
|
762 | 762 | EE_Error::add_error( |
763 | - __( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
763 | + __('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
764 | 764 | __FILE__, __FUNCTION__, __LINE__ |
765 | 765 | ); |
766 | 766 | } |
@@ -776,26 +776,26 @@ discard block |
||
776 | 776 | * @param bool $show_errors |
777 | 777 | * @return void |
778 | 778 | */ |
779 | - private function _save_registration_attendee( $registration, $show_errors = TRUE ) { |
|
780 | - if ( $registration->attendee() instanceof EE_Attendee ) { |
|
779 | + private function _save_registration_attendee($registration, $show_errors = TRUE) { |
|
780 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
781 | 781 | // save so that ATT has ID |
782 | 782 | $registration->attendee()->save(); |
783 | - if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() )) { |
|
784 | - if ( $show_errors ) { |
|
783 | + if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) { |
|
784 | + if ($show_errors) { |
|
785 | 785 | EE_Error::add_error( |
786 | - __( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ), |
|
786 | + __('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'), |
|
787 | 787 | __FILE__, __FUNCTION__, __LINE__ |
788 | 788 | ); |
789 | 789 | } |
790 | 790 | } |
791 | 791 | } else { |
792 | - if ( $show_errors ) { |
|
792 | + if ($show_errors) { |
|
793 | 793 | ob_start(); |
794 | - var_dump( $registration->attendee() ); |
|
794 | + var_dump($registration->attendee()); |
|
795 | 795 | EE_Error::add_error( |
796 | 796 | sprintf( |
797 | 797 | '%1$s||%1$s $attendee = %2$s', |
798 | - __( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
798 | + __('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
799 | 799 | ob_get_clean() |
800 | 800 | ), |
801 | 801 | __FILE__, __FUNCTION__, __LINE__ |
@@ -813,25 +813,25 @@ discard block |
||
813 | 813 | * @param bool $show_errors |
814 | 814 | * @return void |
815 | 815 | */ |
816 | - private function _save_registration_answers( $registration, $show_errors = TRUE ) { |
|
816 | + private function _save_registration_answers($registration, $show_errors = TRUE) { |
|
817 | 817 | // now save the answers |
818 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
818 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
819 | 819 | // verify object |
820 | - if ( $answer instanceof EE_Answer ) { |
|
821 | - $answer->set_registration( $registration->ID() ); |
|
820 | + if ($answer instanceof EE_Answer) { |
|
821 | + $answer->set_registration($registration->ID()); |
|
822 | 822 | $answer->save(); |
823 | - if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) { |
|
824 | - if ( $show_errors ) { |
|
823 | + if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { |
|
824 | + if ($show_errors) { |
|
825 | 825 | EE_Error::add_error( |
826 | - __( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ), |
|
826 | + __('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), |
|
827 | 827 | __FILE__, __FUNCTION__, __LINE__ |
828 | 828 | ); |
829 | 829 | } |
830 | 830 | } |
831 | 831 | } else { |
832 | - if ( $show_errors ) { |
|
832 | + if ($show_errors) { |
|
833 | 833 | EE_Error::add_error( |
834 | - __( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ), |
|
834 | + __('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), |
|
835 | 835 | __FILE__, __FUNCTION__, __LINE__ |
836 | 836 | ); |
837 | 837 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * @param bool $from_db |
850 | 850 | * @return bool |
851 | 851 | */ |
852 | - public function refresh_all_entities( $from_db = false ) { |
|
852 | + public function refresh_all_entities($from_db = false) { |
|
853 | 853 | $from_db = $this->current_step->is_final_step() || $this->action == 'process_gateway_response' ? true : $from_db; |
854 | 854 | //$this->log( |
855 | 855 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -870,11 +870,11 @@ discard block |
||
870 | 870 | */ |
871 | 871 | protected function refresh_from_db() { |
872 | 872 | // verify the transaction |
873 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
873 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
874 | 874 | // pull fresh TXN data from the db |
875 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() ); |
|
875 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); |
|
876 | 876 | // update EE_Checkout's cached primary_attendee object |
877 | - $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction ); |
|
877 | + $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); |
|
878 | 878 | // update EE_Checkout's cached payment object |
879 | 879 | $payment = $this->transaction->last_payment(); |
880 | 880 | $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; |
@@ -882,15 +882,15 @@ discard block |
||
882 | 882 | $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; |
883 | 883 | $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; |
884 | 884 | //now refresh the cart, based on the TXN |
885 | - $this->cart = EE_Cart::get_cart_from_txn( $this->transaction ); |
|
885 | + $this->cart = EE_Cart::get_cart_from_txn($this->transaction); |
|
886 | 886 | // verify and update the cart because inaccurate totals are not so much fun |
887 | - if ( $this->cart instanceof EE_Cart ) { |
|
887 | + if ($this->cart instanceof EE_Cart) { |
|
888 | 888 | $this->cart->get_grand_total()->recalculate_total_including_taxes(); |
889 | 889 | } else { |
890 | - $this->cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
890 | + $this->cart = EE_Registry::instance()->load_core('Cart'); |
|
891 | 891 | } |
892 | 892 | } else { |
893 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
893 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
894 | 894 | return FALSE; |
895 | 895 | } |
896 | 896 | return TRUE; |
@@ -904,24 +904,24 @@ discard block |
||
904 | 904 | * @param EE_Transaction $transaction |
905 | 905 | * @return EE_Attendee | null |
906 | 906 | */ |
907 | - protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) { |
|
907 | + protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) { |
|
908 | 908 | |
909 | 909 | $primary_attendee_obj = null; |
910 | 910 | // grab the saved registrations from the transaction |
911 | - foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) { |
|
911 | + foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) { |
|
912 | 912 | // verify object |
913 | - if ( $registration instanceof EE_Registration ) { |
|
913 | + if ($registration instanceof EE_Registration) { |
|
914 | 914 | $attendee = $registration->attendee(); |
915 | 915 | // verify object |
916 | - if ( $attendee instanceof EE_Attendee ) { |
|
916 | + if ($attendee instanceof EE_Attendee) { |
|
917 | 917 | // maybe cache primary_attendee_obj ? |
918 | - if ( $registration->is_primary_registrant() ) { |
|
918 | + if ($registration->is_primary_registrant()) { |
|
919 | 919 | $primary_attendee_obj = $attendee; |
920 | 920 | } |
921 | 921 | } |
922 | 922 | } else { |
923 | 923 | EE_Error::add_error( |
924 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
924 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } |
@@ -941,43 +941,43 @@ discard block |
||
941 | 941 | */ |
942 | 942 | protected function refresh_entity_map() { |
943 | 943 | // verify the transaction |
944 | - if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) { |
|
944 | + if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { |
|
945 | 945 | // never cache payment info |
946 | - $this->transaction->clear_cache( 'Payment' ); |
|
946 | + $this->transaction->clear_cache('Payment'); |
|
947 | 947 | /** @type EE_Transaction_Processor $transaction_processor */ |
948 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
948 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
949 | 949 | // is the Payment Options Reg Step completed ? |
950 | - if ( $transaction_processor->reg_step_completed( $this->transaction, 'payment_options' ) ) { |
|
950 | + if ($transaction_processor->reg_step_completed($this->transaction, 'payment_options')) { |
|
951 | 951 | // then check for payments and update TXN accordingly |
952 | 952 | /** @type EE_Transaction_Payments $transaction_payments */ |
953 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
954 | - $transaction_payments->calculate_total_payments_and_update_status( $this->transaction ); |
|
953 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
954 | + $transaction_payments->calculate_total_payments_and_update_status($this->transaction); |
|
955 | 955 | } |
956 | 956 | // grab the saved registrations from the transaction |
957 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration ) { |
|
958 | - $this->_refresh_registration( $reg_cache_ID, $registration ); |
|
957 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration) { |
|
958 | + $this->_refresh_registration($reg_cache_ID, $registration); |
|
959 | 959 | } |
960 | 960 | // make sure our cached TXN is added to the model entity mapper |
961 | - $this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction ); |
|
961 | + $this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction); |
|
962 | 962 | |
963 | 963 | } else { |
964 | - EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
964 | + EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
965 | 965 | return FALSE; |
966 | 966 | } |
967 | 967 | // verify and update the cart because inaccurate totals are not so much fun |
968 | - if ( $this->cart instanceof EE_Cart ) { |
|
968 | + if ($this->cart instanceof EE_Cart) { |
|
969 | 969 | $grand_total = $this->cart->get_grand_total(); |
970 | - if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) { |
|
970 | + if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) { |
|
971 | 971 | $grand_total->recalculate_total_including_taxes(); |
972 | 972 | $grand_total = $grand_total->get_model()->refresh_entity_map_with( |
973 | 973 | $this->cart->get_grand_total()->ID(), |
974 | 974 | $this->cart->get_grand_total() |
975 | 975 | ); |
976 | 976 | } |
977 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
978 | - $this->cart = EE_Cart::instance( $grand_total ); |
|
977 | + if ($grand_total instanceof EE_Line_Item) { |
|
978 | + $this->cart = EE_Cart::instance($grand_total); |
|
979 | 979 | } else { |
980 | - EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
980 | + EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
981 | 981 | return false; |
982 | 982 | } |
983 | 983 | } |
@@ -993,19 +993,19 @@ discard block |
||
993 | 993 | * @param EE_Registration $registration |
994 | 994 | * @return void |
995 | 995 | */ |
996 | - protected function _refresh_registration( $reg_cache_ID, $registration ) { |
|
996 | + protected function _refresh_registration($reg_cache_ID, $registration) { |
|
997 | 997 | |
998 | 998 | // verify object |
999 | - if ( $registration instanceof EE_Registration ) { |
|
999 | + if ($registration instanceof EE_Registration) { |
|
1000 | 1000 | // update the entity mapper attendee |
1001 | - $this->_refresh_registration_attendee( $registration ); |
|
1001 | + $this->_refresh_registration_attendee($registration); |
|
1002 | 1002 | // update the entity mapper answers for reg form questions |
1003 | - $this->_refresh_registration_answers( $registration ); |
|
1003 | + $this->_refresh_registration_answers($registration); |
|
1004 | 1004 | // make sure the cached registration is added to the model entity mapper |
1005 | - $registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration ); |
|
1005 | + $registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration); |
|
1006 | 1006 | } else { |
1007 | 1007 | EE_Error::add_error( |
1008 | - __( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1008 | + __('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1009 | 1009 | __FILE__, __FUNCTION__, __LINE__ |
1010 | 1010 | ); |
1011 | 1011 | } |
@@ -1019,15 +1019,15 @@ discard block |
||
1019 | 1019 | * @param EE_Registration $registration |
1020 | 1020 | * @return void |
1021 | 1021 | */ |
1022 | - protected function _refresh_registration_attendee( $registration ) { |
|
1022 | + protected function _refresh_registration_attendee($registration) { |
|
1023 | 1023 | |
1024 | 1024 | $attendee = $registration->attendee(); |
1025 | 1025 | // verify object |
1026 | - if ( $attendee instanceof EE_Attendee && $attendee->ID() ) { |
|
1026 | + if ($attendee instanceof EE_Attendee && $attendee->ID()) { |
|
1027 | 1027 | // make sure the cached attendee is added to the model entity mapper |
1028 | - $registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee ); |
|
1028 | + $registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee); |
|
1029 | 1029 | // maybe cache primary_attendee_obj ? |
1030 | - if ( $registration->is_primary_registrant() ) { |
|
1030 | + if ($registration->is_primary_registrant()) { |
|
1031 | 1031 | $this->primary_attendee_obj = $attendee; |
1032 | 1032 | } |
1033 | 1033 | } |
@@ -1041,19 +1041,19 @@ discard block |
||
1041 | 1041 | * @param EE_Registration $registration |
1042 | 1042 | * @return void |
1043 | 1043 | */ |
1044 | - protected function _refresh_registration_answers( $registration ) { |
|
1044 | + protected function _refresh_registration_answers($registration) { |
|
1045 | 1045 | |
1046 | 1046 | // now update the answers |
1047 | - foreach ( $registration->answers() as $cache_key => $answer ) { |
|
1047 | + foreach ($registration->answers() as $cache_key => $answer) { |
|
1048 | 1048 | // verify object |
1049 | - if ( $answer instanceof EE_Answer ) { |
|
1050 | - if ( $answer->ID() ) { |
|
1049 | + if ($answer instanceof EE_Answer) { |
|
1050 | + if ($answer->ID()) { |
|
1051 | 1051 | // make sure the cached answer is added to the model entity mapper |
1052 | - $answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer ); |
|
1052 | + $answer->get_model()->refresh_entity_map_with($answer->ID(), $answer); |
|
1053 | 1053 | } |
1054 | 1054 | } else { |
1055 | 1055 | EE_Error::add_error( |
1056 | - __( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ), |
|
1056 | + __('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'), |
|
1057 | 1057 | __FILE__, __FUNCTION__, __LINE__ |
1058 | 1058 | ); |
1059 | 1059 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object |
1069 | 1069 | */ |
1070 | 1070 | function __wakeup() { |
1071 | - foreach ( $this->reg_steps as $reg_step ) { |
|
1071 | + foreach ($this->reg_steps as $reg_step) { |
|
1072 | 1072 | $reg_step->checkout = $this; |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1084,11 +1084,11 @@ discard block |
||
1084 | 1084 | * @param array $info |
1085 | 1085 | * @param bool $display_request |
1086 | 1086 | */ |
1087 | - function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) { |
|
1088 | - if ( WP_DEBUG && false ) { |
|
1089 | - $debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() ); |
|
1087 | + function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { |
|
1088 | + if (WP_DEBUG && false) { |
|
1089 | + $debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array()); |
|
1090 | 1090 | $default_data = array( |
1091 | - $class => $func . '() : ' . $line, |
|
1091 | + $class => $func.'() : '.$line, |
|
1092 | 1092 | 'request->step' => $this->step, |
1093 | 1093 | 'request->action' => $this->action, |
1094 | 1094 | 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? |
@@ -1100,24 +1100,24 @@ discard block |
||
1100 | 1100 | 'reg_url_link' => $this->reg_url_link, |
1101 | 1101 | 'REQ' => $display_request ? $_REQUEST : '', |
1102 | 1102 | ); |
1103 | - if ( $this->transaction instanceof EE_Transaction ) { |
|
1104 | - $default_data[ 'TXN_status' ] = $this->transaction->status_ID(); |
|
1105 | - $default_data[ 'TXN_reg_steps' ] = $this->transaction->reg_steps(); |
|
1106 | - foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) { |
|
1107 | - $default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID(); |
|
1103 | + if ($this->transaction instanceof EE_Transaction) { |
|
1104 | + $default_data['TXN_status'] = $this->transaction->status_ID(); |
|
1105 | + $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); |
|
1106 | + foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { |
|
1107 | + $default_data['registrations'][$REG_ID] = $registration->status_ID(); |
|
1108 | 1108 | } |
1109 | - if ( $this->transaction->ID() ) { |
|
1110 | - $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); |
|
1109 | + if ($this->transaction->ID()) { |
|
1110 | + $TXN_ID = 'EE_Transaction: '.$this->transaction->ID(); |
|
1111 | 1111 | // don't serialize objects |
1112 | - $info = $this->_strip_objects( $info ); |
|
1113 | - if ( ! isset( $debug_data[ $TXN_ID ] ) ) { |
|
1114 | - $debug_data[ $TXN_ID ] = array(); |
|
1112 | + $info = $this->_strip_objects($info); |
|
1113 | + if ( ! isset($debug_data[$TXN_ID])) { |
|
1114 | + $debug_data[$TXN_ID] = array(); |
|
1115 | 1115 | } |
1116 | - $debug_data[ $TXN_ID ][ microtime() ] = array_merge( |
|
1116 | + $debug_data[$TXN_ID][microtime()] = array_merge( |
|
1117 | 1117 | $default_data, |
1118 | 1118 | $info |
1119 | 1119 | ); |
1120 | - update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data ); |
|
1120 | + update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data); |
|
1121 | 1121 | } |
1122 | 1122 | } |
1123 | 1123 | } |
@@ -1130,23 +1130,23 @@ discard block |
||
1130 | 1130 | * @param array $info |
1131 | 1131 | * @return array |
1132 | 1132 | */ |
1133 | - function _strip_objects( $info = array() ) { |
|
1134 | - foreach ( $info as $key => $value ) { |
|
1135 | - if ( is_array( $value )) { |
|
1136 | - $info[ $key ] = $this->_strip_objects( $value ); |
|
1137 | - } else if ( is_object( $value ) ) { |
|
1138 | - $object_class = get_class( $value ); |
|
1139 | - $info[ $object_class ] = array(); |
|
1140 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0; |
|
1141 | - if ( method_exists( $value, 'status' ) ) { |
|
1142 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
1143 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
1144 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
1133 | + function _strip_objects($info = array()) { |
|
1134 | + foreach ($info as $key => $value) { |
|
1135 | + if (is_array($value)) { |
|
1136 | + $info[$key] = $this->_strip_objects($value); |
|
1137 | + } else if (is_object($value)) { |
|
1138 | + $object_class = get_class($value); |
|
1139 | + $info[$object_class] = array(); |
|
1140 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0; |
|
1141 | + if (method_exists($value, 'status')) { |
|
1142 | + $info[$object_class]['status'] = $value->status(); |
|
1143 | + } else if (method_exists($value, 'status_ID')) { |
|
1144 | + $info[$object_class]['status'] = $value->status_ID(); |
|
1145 | 1145 | } |
1146 | - unset( $info[ $key ] ); |
|
1146 | + unset($info[$key]); |
|
1147 | 1147 | } |
1148 | 1148 | } |
1149 | - return (array)$info; |
|
1149 | + return (array) $info; |
|
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 |
@@ -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 | ), |
@@ -456,9 +456,9 @@ discard block |
||
456 | 456 | * @param array $actions |
457 | 457 | * @return void |
458 | 458 | */ |
459 | - public function generate_reg_form_for_actions( $actions = array() ) { |
|
460 | - $actions = array_merge( array( 'generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step' ), $actions ); |
|
461 | - $this->checkout->generate_reg_form = in_array( $this->checkout->action, $actions ) ? TRUE : FALSE; |
|
459 | + public function generate_reg_form_for_actions($actions = array()) { |
|
460 | + $actions = array_merge(array('generate_reg_form', 'display_spco_reg_step', 'process_reg_step', 'update_reg_step'), $actions); |
|
461 | + $this->checkout->generate_reg_form = in_array($this->checkout->action, $actions) ? TRUE : FALSE; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function display_reg_form() { |
470 | 470 | $html = ''; |
471 | - if ( $this->reg_form instanceof EE_Form_Section_Proper ) { |
|
472 | - $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open( $this->reg_step_url() ) : ''; |
|
473 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
471 | + if ($this->reg_form instanceof EE_Form_Section_Proper) { |
|
472 | + $html .= ! $this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : ''; |
|
473 | + if (EE_Registry::instance()->REQ->ajax) { |
|
474 | 474 | $this->reg_form->localize_validation_rules(); |
475 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
475 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
476 | 476 | $html .= $this->reg_form->get_html(); |
477 | 477 | } else { |
478 | 478 | $html .= $this->reg_form->get_html_and_js(); |
@@ -490,26 +490,26 @@ discard block |
||
490 | 490 | * @return string |
491 | 491 | */ |
492 | 492 | public function reg_step_submit_button() { |
493 | - if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
493 | + if ( ! $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
494 | 494 | return ''; |
495 | 495 | } |
496 | 496 | ob_start(); |
497 | - do_action( 'AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout ); |
|
497 | + do_action('AHEE__before_spco_whats_next_buttons', $this->slug(), $this->checkout->next_step->slug(), $this->checkout); |
|
498 | 498 | $html = ob_get_clean(); |
499 | 499 | // generate submit button |
500 | - $sbmt_btn = new EE_Submit_Input( array( |
|
501 | - 'html_name' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
502 | - 'html_id' => 'spco-go-to-step-' . $this->checkout->next_step->slug(), |
|
500 | + $sbmt_btn = new EE_Submit_Input(array( |
|
501 | + 'html_name' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
502 | + 'html_id' => 'spco-go-to-step-'.$this->checkout->next_step->slug(), |
|
503 | 503 | 'html_class' => 'spco-next-step-btn', |
504 | - 'other_html_attributes' => ' rel="' . $this->slug() . '"', |
|
504 | + 'other_html_attributes' => ' rel="'.$this->slug().'"', |
|
505 | 505 | 'default' => $this->submit_button_text() |
506 | 506 | )); |
507 | - $sbmt_btn->set_button_css_attributes( TRUE, 'large' ); |
|
507 | + $sbmt_btn->set_button_css_attributes(TRUE, 'large'); |
|
508 | 508 | $sbmt_btn_html = $sbmt_btn->get_html_for_input(); |
509 | 509 | EE_Registry::instance()->load_helper('HTML'); |
510 | 510 | $html .= EEH_HTML::div( |
511 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this ), |
|
512 | - 'spco-' . $this->slug() . '-whats-next-buttons-dv', |
|
511 | + apply_filters('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', $sbmt_btn_html, $this), |
|
512 | + 'spco-'.$this->slug().'-whats-next-buttons-dv', |
|
513 | 513 | 'spco-whats-next-buttons' |
514 | 514 | ); |
515 | 515 | return $html; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @return string |
533 | 533 | */ |
534 | 534 | public function edit_lnk_url() { |
535 | - return add_query_arg( array( 'step' => $this->slug() ), $this->checkout->reg_page_base_url ); |
|
535 | + return add_query_arg(array('step' => $this->slug()), $this->checkout->reg_page_base_url); |
|
536 | 536 | |
537 | 537 | } |
538 | 538 | |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | */ |
555 | 555 | public function update_checkout() { |
556 | 556 | // grab the cart grand total and reset TXN total |
557 | - $this->checkout->transaction->set_total( $this->checkout->cart->get_cart_grand_total() ); |
|
557 | + $this->checkout->transaction->set_total($this->checkout->cart->get_cart_grand_total()); |
|
558 | 558 | $this->checkout->stash_transaction_and_checkout(); |
559 | 559 | } |
560 | 560 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | function __sleep() { |
571 | 571 | // remove the reg form and the checkout |
572 | - return array_diff( array_keys( get_object_vars( $this )), array( 'reg_form', 'checkout' )); |
|
572 | + return array_diff(array_keys(get_object_vars($this)), array('reg_form', 'checkout')); |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | /** |
65 | - * @return boolean |
|
65 | + * @return boolean|null |
|
66 | 66 | */ |
67 | 67 | public function initialize_reg_step() { |
68 | 68 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * _auto_copy_attendee_info |
343 | 343 | * |
344 | 344 | * @access public |
345 | - * @return EE_Form_Section_Proper |
|
345 | + * @return EE_Form_Section_HTML |
|
346 | 346 | */ |
347 | 347 | private function _auto_copy_attendee_info() { |
348 | 348 | return new EE_Form_Section_HTML( |
@@ -456,6 +456,7 @@ discard block |
||
456 | 456 | * @param EE_Registration $registration |
457 | 457 | * @param EE_Question $question |
458 | 458 | * @param mixed EE_Answer|NULL $answer |
459 | + * @param EE_Answer $answer |
|
459 | 460 | * @return EE_Form_Input_Base |
460 | 461 | */ |
461 | 462 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -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_Attendee_Information |
|
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_Attendee_Information |
|
5 | + * |
|
6 | + * Description |
|
7 | + * |
|
8 | + * @package Event Espresso |
|
9 | + * @subpackage core |
|
10 | + * @author Brent Christensen |
|
11 | + * @since 4.5.0 |
|
12 | + * |
|
13 | + */ |
|
14 | 14 | class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step { |
15 | 15 | |
16 | 16 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | case EEM_Question::QST_type_text : |
508 | 508 | if( $identifier == 'email' ){ |
509 | 509 | return new EE_Email_Input( $input_constructor_args ); |
510 | - }else{ |
|
510 | + } else{ |
|
511 | 511 | return new EE_Text_Input( $input_constructor_args ); |
512 | 512 | } |
513 | 513 | break; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 794 | |
795 | - } else { |
|
795 | + } else { |
|
796 | 796 | EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
797 | 797 | // remove malformed data |
798 | 798 | unset( $valid_data[ $reg_url_link ] ); |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | * @param EE_Checkout $checkout |
33 | 33 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
34 | 34 | */ |
35 | - public function __construct( EE_Checkout $checkout ) { |
|
35 | + public function __construct(EE_Checkout $checkout) { |
|
36 | 36 | $this->_slug = 'attendee_information'; |
37 | 37 | $this->_name = __('Attendee Information', 'event_espresso'); |
38 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
38 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
39 | 39 | $this->checkout = $checkout; |
40 | 40 | $this->_reset_success_message(); |
41 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
41 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
48 | 48 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
49 | 49 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
50 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
50 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
51 | 51 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
52 | 52 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | EEH_Autoloader::register_line_item_display_autoloaders(); |
80 | 80 | $Line_Item_Display = new EE_Line_Item_Display(); |
81 | 81 | // calculate taxes |
82 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
82 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
83 | 83 | EE_Registry::instance()->load_helper('Line_Item'); |
84 | 84 | /** @var $subsections EE_Form_Section_Proper[] */ |
85 | 85 | $subsections = array( |
@@ -91,33 +91,33 @@ discard block |
||
91 | 91 | 'ticket_count' => array() |
92 | 92 | ); |
93 | 93 | // grab the saved registrations from the transaction |
94 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
95 | - if ( $registrations ) { |
|
96 | - foreach ( $registrations as $registration ) { |
|
97 | - if ( $registration instanceof EE_Registration ) { |
|
94 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
95 | + if ($registrations) { |
|
96 | + foreach ($registrations as $registration) { |
|
97 | + if ($registration instanceof EE_Registration) { |
|
98 | 98 | // can this registration be processed during this visit ? |
99 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
100 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
101 | - if ( ! $this->checkout->admin_request ) { |
|
102 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
103 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
104 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
105 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
106 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
99 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
100 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
101 | + if ( ! $this->checkout->admin_request) { |
|
102 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
103 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
104 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
105 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
106 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
107 | 107 | } |
108 | - if ( $registration->is_primary_registrant() ) { |
|
108 | + if ($registration->is_primary_registrant()) { |
|
109 | 109 | $primary_registrant = $registration->reg_url_link(); |
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | 114 | // print_copy_info ? |
115 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
115 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
116 | 116 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
117 | 117 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
118 | 118 | // generate hidden input |
119 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
120 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options ); |
|
119 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
120 | + $subsections[$primary_registrant]->add_subsections($copy_options); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -129,8 +129,7 @@ discard block |
||
129 | 129 | 'html_id' => $this->reg_form_name(), |
130 | 130 | 'subsections' => $subsections, |
131 | 131 | 'layout_strategy' => $this->checkout->admin_request ? |
132 | - new EE_Div_Per_Section_Layout() : |
|
133 | - new EE_Template_Layout( |
|
132 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
134 | 133 | array( |
135 | 134 | 'layout_template_file' => $this->_template, // layout_template |
136 | 135 | 'template_args' => $template_args |
@@ -147,61 +146,61 @@ discard block |
||
147 | 146 | * @param EE_Registration $registration |
148 | 147 | * @return EE_Form_Section_Proper |
149 | 148 | */ |
150 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
151 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
149 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
150 | + EE_Registry::instance()->load_helper('Template'); |
|
152 | 151 | static $attendee_nmbr = 1; |
153 | 152 | // array of params to pass to parent constructor |
154 | 153 | $form_args = array( |
155 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
154 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
156 | 155 | 'html_class' => 'ee-reg-form-attendee-dv', |
157 | 156 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
158 | 157 | 'subsections' => array(), |
159 | 158 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
160 | 159 | array( |
161 | 160 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
162 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
161 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
163 | 162 | ) |
164 | 163 | ) |
165 | 164 | ); |
166 | 165 | // verify that registration has valid event |
167 | - if ( $registration->event() instanceof EE_Event ) { |
|
166 | + if ($registration->event() instanceof EE_Event) { |
|
168 | 167 | $query_params = array( |
169 | 168 | array( |
170 | 169 | 'Event.EVT_ID' => $registration->event()->ID(), |
171 | 170 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
172 | 171 | ), |
173 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
172 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
174 | 173 | ); |
175 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
176 | - if ( $question_groups ) { |
|
177 | - foreach ( $question_groups as $question_group ) { |
|
178 | - if ( $question_group instanceof EE_Question_Group ) { |
|
179 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
174 | + $question_groups = $registration->event()->question_groups($query_params); |
|
175 | + if ($question_groups) { |
|
176 | + foreach ($question_groups as $question_group) { |
|
177 | + if ($question_group instanceof EE_Question_Group) { |
|
178 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
180 | 179 | // add hidden input |
181 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
180 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
182 | 181 | } |
183 | 182 | } |
184 | 183 | // if we have question groups for additional attendees, then display the copy options |
185 | 184 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
186 | 185 | } else { |
187 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
186 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
188 | 187 | EEH_Template::locate_template( |
189 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
190 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
188 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
189 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
191 | 190 | TRUE, |
192 | 191 | TRUE |
193 | 192 | ) |
194 | 193 | ); |
195 | 194 | // add hidden input |
196 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
195 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
197 | 196 | } |
198 | 197 | } |
199 | - if ( $registration->is_primary_registrant() ) { |
|
198 | + if ($registration->is_primary_registrant()) { |
|
200 | 199 | // generate hidden input |
201 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
200 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
202 | 201 | } |
203 | 202 | $attendee_nmbr++; |
204 | - return new EE_Form_Section_Proper( $form_args ); |
|
203 | + return new EE_Form_Section_Proper($form_args); |
|
205 | 204 | } |
206 | 205 | |
207 | 206 | |
@@ -214,11 +213,11 @@ discard block |
||
214 | 213 | * @param bool $additional_attendee_reg_info |
215 | 214 | * @return EE_Form_Input_Base |
216 | 215 | */ |
217 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
216 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
218 | 217 | // generate hidden input |
219 | 218 | return new EE_Hidden_Input( |
220 | 219 | array( |
221 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
220 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
222 | 221 | 'default' => $additional_attendee_reg_info |
223 | 222 | ) |
224 | 223 | ); |
@@ -231,22 +230,22 @@ discard block |
||
231 | 230 | * @param EE_Question_Group $question_group |
232 | 231 | * @return EE_Form_Section_Proper |
233 | 232 | */ |
234 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
233 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
235 | 234 | // array of params to pass to parent constructor |
236 | 235 | $form_args = array( |
237 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
236 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
238 | 237 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
239 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
238 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
240 | 239 | 'subsections' => array( |
241 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
240 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
242 | 241 | ), |
243 | 242 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
244 | 243 | ); |
245 | 244 | // where params |
246 | - $query_params = array( 'QST_deleted' => 0 ); |
|
245 | + $query_params = array('QST_deleted' => 0); |
|
247 | 246 | // don't load admin only questions on the frontend |
248 | - if ( ! $this->checkout->admin_request ) { |
|
249 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
247 | + if ( ! $this->checkout->admin_request) { |
|
248 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
250 | 249 | } |
251 | 250 | $questions = $question_group->get_many_related( |
252 | 251 | 'Question', |
@@ -258,21 +257,21 @@ discard block |
||
258 | 257 | ) |
259 | 258 | ); |
260 | 259 | // filter for additional content before questions |
261 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
260 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
262 | 261 | // loop thru questions |
263 | - foreach ( $questions as $question ) { |
|
264 | - if( $question instanceof EE_Question ){ |
|
262 | + foreach ($questions as $question) { |
|
263 | + if ($question instanceof EE_Question) { |
|
265 | 264 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
266 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
265 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
267 | 266 | } |
268 | 267 | } |
269 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
268 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
270 | 269 | |
271 | 270 | // filter for additional content after questions |
272 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
271 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
273 | 272 | // d( $form_args ); |
274 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
275 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
273 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
274 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
276 | 275 | } |
277 | 276 | |
278 | 277 | |
@@ -282,12 +281,12 @@ discard block |
||
282 | 281 | * @param EE_Question_Group $question_group |
283 | 282 | * @return EE_Form_Section_HTML |
284 | 283 | */ |
285 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
284 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
286 | 285 | $html = ''; |
287 | 286 | // group_name |
288 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
287 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
289 | 288 | EE_Registry::instance()->load_helper('HTML'); |
290 | - if ( $this->checkout->admin_request ) { |
|
289 | + if ($this->checkout->admin_request) { |
|
291 | 290 | $html .= EEH_HTML::br(); |
292 | 291 | $html .= EEH_HTML::h3( |
293 | 292 | $question_group->name(), |
@@ -301,7 +300,7 @@ discard block |
||
301 | 300 | } |
302 | 301 | } |
303 | 302 | // group_desc |
304 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
303 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
305 | 304 | $html .= EEH_HTML::p( |
306 | 305 | $question_group->desc(), |
307 | 306 | '', |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | ); |
310 | 309 | |
311 | 310 | } |
312 | - return new EE_Form_Section_HTML( $html ); |
|
311 | + return new EE_Form_Section_HTML($html); |
|
313 | 312 | } |
314 | 313 | |
315 | 314 | |
@@ -318,14 +317,14 @@ discard block |
||
318 | 317 | * @access public |
319 | 318 | * @return EE_Form_Section_Proper |
320 | 319 | */ |
321 | - private function _copy_attendee_info_form(){ |
|
320 | + private function _copy_attendee_info_form() { |
|
322 | 321 | // array of params to pass to parent constructor |
323 | 322 | return new EE_Form_Section_Proper( |
324 | 323 | array( |
325 | 324 | 'subsections' => $this->_copy_attendee_info_inputs(), |
326 | 325 | 'layout_strategy' => new EE_Template_Layout( |
327 | 326 | array( |
328 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
327 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
329 | 328 | 'begin_template_file' => NULL, |
330 | 329 | 'input_template_file' => NULL, |
331 | 330 | 'subsection_template_file' => NULL, |
@@ -347,8 +346,8 @@ discard block |
||
347 | 346 | private function _auto_copy_attendee_info() { |
348 | 347 | return new EE_Form_Section_HTML( |
349 | 348 | EEH_Template::locate_template( |
350 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
351 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
349 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
350 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
352 | 351 | TRUE, |
353 | 352 | TRUE |
354 | 353 | ) |
@@ -367,25 +366,25 @@ discard block |
||
367 | 366 | $copy_attendee_info_inputs = array(); |
368 | 367 | $prev_ticket = NULL; |
369 | 368 | // grab the saved registrations from the transaction |
370 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
371 | - foreach ( $registrations as $registration ) { |
|
369 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
370 | + foreach ($registrations as $registration) { |
|
372 | 371 | // for all attendees other than the primary attendee |
373 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
372 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
374 | 373 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
375 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
374 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
376 | 375 | $item_name = $registration->ticket()->name(); |
377 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
378 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
379 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
376 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
377 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
378 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
380 | 379 | ); |
381 | 380 | $prev_ticket = $registration->ticket()->ID(); |
382 | 381 | } |
383 | 382 | |
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
385 | 384 | EE_Checkbox_Multi_Input( |
386 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
385 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
387 | 386 | array( |
388 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
387 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
389 | 388 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
390 | 389 | 'display_html_label_text' => FALSE |
391 | 390 | ) |
@@ -404,7 +403,7 @@ discard block |
||
404 | 403 | * @param EE_Registration $registration |
405 | 404 | * @return EE_Form_Input_Base |
406 | 405 | */ |
407 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
406 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
408 | 407 | // generate hidden input |
409 | 408 | return new EE_Hidden_Input( |
410 | 409 | array( |
@@ -422,31 +421,31 @@ discard block |
||
422 | 421 | * @param EE_Question $question |
423 | 422 | * @return EE_Form_Input_Base |
424 | 423 | */ |
425 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
424 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
426 | 425 | |
427 | 426 | // if this question was for an attendee detail, then check for that answer |
428 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->ID() ); |
|
427 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->ID()); |
|
429 | 428 | $answer = $answer_value === null |
430 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
429 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
431 | 430 | : null; |
432 | 431 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
433 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
432 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
434 | 433 | // create an EE_Answer object for storing everything in |
435 | - $answer = EE_Answer::new_instance ( array( |
|
434 | + $answer = EE_Answer::new_instance(array( |
|
436 | 435 | 'QST_ID'=> $question->ID(), |
437 | 436 | 'REG_ID'=> $registration->ID() |
438 | 437 | )); |
439 | 438 | } |
440 | 439 | // verify instance |
441 | - if( $answer instanceof EE_Answer ){ |
|
442 | - if ( ! empty( $answer_value )) { |
|
443 | - $answer->set( 'ANS_value', $answer_value ); |
|
440 | + if ($answer instanceof EE_Answer) { |
|
441 | + if ( ! empty($answer_value)) { |
|
442 | + $answer->set('ANS_value', $answer_value); |
|
444 | 443 | } |
445 | - $answer->cache( 'Question', $question ); |
|
446 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
447 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
444 | + $answer->cache('Question', $question); |
|
445 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
446 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
448 | 447 | } |
449 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
448 | + return $this->_generate_question_input($registration, $question, $answer); |
|
450 | 449 | |
451 | 450 | } |
452 | 451 | |
@@ -458,7 +457,7 @@ discard block |
||
458 | 457 | * @param mixed EE_Answer|NULL $answer |
459 | 458 | * @return EE_Form_Input_Base |
460 | 459 | */ |
461 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
460 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
462 | 461 | // d( $registration ); |
463 | 462 | // d( $question ); |
464 | 463 | // d( $answer ); |
@@ -481,95 +480,95 @@ discard block |
||
481 | 480 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
482 | 481 | |
483 | 482 | $input_constructor_args = array( |
484 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
485 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
486 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
483 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
484 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
485 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
487 | 486 | 'required' => $question->required() ? TRUE : FALSE, |
488 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
487 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
489 | 488 | 'html_label_class' => 'ee-reg-qstn', |
490 | 489 | 'html_label_text' => $question->display_text(), |
491 | 490 | 'required_validation_error_message' => $question->required_text() |
492 | 491 | ); |
493 | 492 | // has this question been answered ? |
494 | - if ( $answer instanceof EE_Answer ) { |
|
495 | - if ( $answer->ID() ) { |
|
496 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
497 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
498 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
493 | + if ($answer instanceof EE_Answer) { |
|
494 | + if ($answer->ID()) { |
|
495 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
496 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
497 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
499 | 498 | } |
500 | 499 | $input_constructor_args['default'] = $answer->value(); |
501 | 500 | } |
502 | 501 | //add "-lbl" to the end of the label id |
503 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
502 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
504 | 503 | |
505 | - switch ( $question->type() ) { |
|
504 | + switch ($question->type()) { |
|
506 | 505 | // Text |
507 | 506 | case EEM_Question::QST_type_text : |
508 | - if( $identifier == 'email' ){ |
|
509 | - return new EE_Email_Input( $input_constructor_args ); |
|
510 | - }else{ |
|
511 | - return new EE_Text_Input( $input_constructor_args ); |
|
507 | + if ($identifier == 'email') { |
|
508 | + return new EE_Email_Input($input_constructor_args); |
|
509 | + } else { |
|
510 | + return new EE_Text_Input($input_constructor_args); |
|
512 | 511 | } |
513 | 512 | break; |
514 | 513 | // Textarea |
515 | 514 | case EEM_Question::QST_type_textarea : |
516 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
515 | + return new EE_Text_Area_Input($input_constructor_args); |
|
517 | 516 | break; |
518 | 517 | // Radio Buttons |
519 | 518 | case EEM_Question::QST_type_radio : |
520 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
519 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
521 | 520 | break; |
522 | 521 | // Dropdown |
523 | 522 | case EEM_Question::QST_type_dropdown : |
524 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
523 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
525 | 524 | break; |
526 | 525 | // State Dropdown |
527 | 526 | case EEM_Question::QST_type_state : |
528 | - $state_options = array( '' => array( '' => '')); |
|
527 | + $state_options = array('' => array('' => '')); |
|
529 | 528 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
530 | - if ( ! empty( $states )) { |
|
531 | - foreach( $states as $state ){ |
|
532 | - if ( $state instanceof EE_State ) { |
|
533 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
529 | + if ( ! empty($states)) { |
|
530 | + foreach ($states as $state) { |
|
531 | + if ($state instanceof EE_State) { |
|
532 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
534 | 533 | } |
535 | 534 | } |
536 | 535 | } |
537 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
538 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
536 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
537 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
539 | 538 | break; |
540 | 539 | // Country Dropdown |
541 | 540 | case EEM_Question::QST_type_country : |
542 | - $country_options = array( '' => '' ); |
|
541 | + $country_options = array('' => ''); |
|
543 | 542 | // get possibly cached list of countries |
544 | 543 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
545 | - if ( ! empty( $countries )) { |
|
546 | - foreach( $countries as $country ){ |
|
547 | - if ( $country instanceof EE_Country ) { |
|
548 | - $country_options[ $country->ID() ] = $country->name(); |
|
544 | + if ( ! empty($countries)) { |
|
545 | + foreach ($countries as $country) { |
|
546 | + if ($country instanceof EE_Country) { |
|
547 | + $country_options[$country->ID()] = $country->name(); |
|
549 | 548 | } |
550 | 549 | } |
551 | 550 | } |
552 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
553 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
551 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
552 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
554 | 553 | break; |
555 | 554 | // Checkboxes |
556 | 555 | case EEM_Question::QST_type_checkbox : |
557 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
556 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
558 | 557 | break; |
559 | 558 | // Date |
560 | 559 | case EEM_Question::QST_type_date : |
561 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
560 | + return new EE_Datepicker_Input($input_constructor_args); |
|
562 | 561 | break; |
563 | 562 | case EEM_Question::QST_type_html_textarea : |
564 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
565 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
566 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
563 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
564 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
565 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
567 | 566 | return $input; |
568 | 567 | // fallback |
569 | 568 | default : |
570 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
571 | - if( ! $default_input ){ |
|
572 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
569 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
570 | + if ( ! $default_input) { |
|
571 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
573 | 572 | } |
574 | 573 | return $default_input; |
575 | 574 | } |
@@ -594,65 +593,65 @@ discard block |
||
594 | 593 | */ |
595 | 594 | public function process_reg_step() { |
596 | 595 | |
597 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
596 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
598 | 597 | // grab validated data from form |
599 | 598 | $valid_data = $this->checkout->current_step->valid_data(); |
600 | 599 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
601 | 600 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
602 | 601 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
603 | - if ( empty( $valid_data )) { |
|
604 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
602 | + if (empty($valid_data)) { |
|
603 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
605 | 604 | return FALSE; |
606 | 605 | } |
607 | 606 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
608 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
609 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
607 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
608 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
610 | 609 | return FALSE; |
611 | 610 | } |
612 | 611 | // get cached registrations |
613 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
612 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
614 | 613 | // verify we got the goods |
615 | - if ( empty( $registrations )) { |
|
616 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
614 | + if (empty($registrations)) { |
|
615 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
617 | 616 | return FALSE; |
618 | 617 | } |
619 | 618 | // extract attendee info from form data and save to model objects |
620 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
619 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
621 | 620 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
622 | - if ( $registrations_processed === FALSE ) { |
|
621 | + if ($registrations_processed === FALSE) { |
|
623 | 622 | // but return immediately if the previous step exited early due to errors |
624 | 623 | return FALSE; |
625 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
624 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
626 | 625 | // generate a correctly translated string for all possible singular/plural combinations |
627 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
626 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
628 | 627 | $error_msg = sprintf( |
629 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
628 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
630 | 629 | $this->checkout->total_ticket_count, |
631 | 630 | $registrations_processed |
632 | 631 | ); |
633 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
632 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
634 | 633 | $error_msg = sprintf( |
635 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
634 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
636 | 635 | $this->checkout->total_ticket_count, |
637 | 636 | $registrations_processed |
638 | 637 | ); |
639 | 638 | } else { |
640 | 639 | $error_msg = sprintf( |
641 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
640 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
642 | 641 | $this->checkout->total_ticket_count, |
643 | 642 | $registrations_processed |
644 | 643 | ); |
645 | 644 | |
646 | 645 | } |
647 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
646 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
648 | 647 | return FALSE; |
649 | 648 | } |
650 | 649 | // mark this reg step as completed |
651 | 650 | $this->checkout->current_step->set_completed(); |
652 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
651 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
653 | 652 | //do action in case a plugin wants to do something with the data submitted in step 1. |
654 | 653 | //passes EE_Single_Page_Checkout, and it's posted data |
655 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
654 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
656 | 655 | return TRUE; |
657 | 656 | |
658 | 657 | } |
@@ -666,9 +665,9 @@ discard block |
||
666 | 665 | * @param array $valid_data |
667 | 666 | * @return boolean | int |
668 | 667 | */ |
669 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
668 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
670 | 669 | // load resources and set some defaults |
671 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
670 | + EE_Registry::instance()->load_model('Attendee'); |
|
672 | 671 | // holder for primary registrant attendee object |
673 | 672 | $this->checkout->primary_attendee_obj = NULL; |
674 | 673 | // array for tracking reg form data for the primary registrant |
@@ -685,19 +684,19 @@ discard block |
||
685 | 684 | // attendee counter |
686 | 685 | $att_nmbr = 0; |
687 | 686 | // grab the saved registrations from the transaction |
688 | - foreach ( $registrations as $registration ) { |
|
687 | + foreach ($registrations as $registration) { |
|
689 | 688 | // verify EE_Registration object |
690 | - if ( ! $registration instanceof EE_Registration ) { |
|
691 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
689 | + if ( ! $registration instanceof EE_Registration) { |
|
690 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
692 | 691 | return FALSE; |
693 | 692 | } |
694 | 693 | $reg_url_link = $registration->reg_url_link(); |
695 | 694 | // reg_url_link exists ? |
696 | - if ( $reg_url_link ) { |
|
695 | + if ($reg_url_link) { |
|
697 | 696 | // should this registration be processed during this visit ? |
698 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
697 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
699 | 698 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
700 | - if ( ! $this->checkout->revisit ) { |
|
699 | + if ( ! $this->checkout->revisit) { |
|
701 | 700 | $registration->save(); |
702 | 701 | } |
703 | 702 | |
@@ -708,41 +707,41 @@ discard block |
||
708 | 707 | * @var bool if TRUE is returned by the plugin then the |
709 | 708 | * registration processing is halted. |
710 | 709 | */ |
711 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
710 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
712 | 711 | return FALSE; |
713 | 712 | } |
714 | 713 | |
715 | 714 | // Houston, we have a registration! |
716 | 715 | $att_nmbr++; |
717 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
716 | + $this->_attendee_data[$reg_url_link] = array(); |
|
718 | 717 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
719 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
718 | + if (isset($valid_data[$reg_url_link])) { |
|
720 | 719 | // do we need to copy basic info from primary attendee ? |
721 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
720 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
722 | 721 | // filter form input data for this registration |
723 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
722 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
724 | 723 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
725 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
726 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
727 | - unset( $valid_data['primary_attendee'] ); |
|
724 | + if (isset($valid_data['primary_attendee'])) { |
|
725 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
726 | + unset($valid_data['primary_attendee']); |
|
728 | 727 | } |
729 | 728 | // now loop through our array of valid post data && process attendee reg forms |
730 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
731 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
732 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
729 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
730 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
731 | + foreach ($form_inputs as $form_input => $input_value) { |
|
733 | 732 | // check for critical inputs |
734 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
733 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
735 | 734 | return FALSE; |
736 | 735 | } |
737 | 736 | // store a bit of data about the primary attendee |
738 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
739 | - $primary_registrant[ $form_input ] = $input_value; |
|
740 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
741 | - $input_value = $primary_registrant[ $form_input ]; |
|
737 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
738 | + $primary_registrant[$form_input] = $input_value; |
|
739 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
740 | + $input_value = $primary_registrant[$form_input]; |
|
742 | 741 | } |
743 | 742 | // now attempt to save the input data |
744 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
745 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
743 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
744 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
746 | 745 | return FALSE; |
747 | 746 | } |
748 | 747 | } |
@@ -751,51 +750,51 @@ discard block |
||
751 | 750 | } |
752 | 751 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
753 | 752 | // this registration does not require additional attendee information ? |
754 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
753 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
755 | 754 | // just copy the primary registrant |
756 | 755 | $attendee = $this->checkout->primary_attendee_obj; |
757 | 756 | } else { |
758 | 757 | // have we met before? |
759 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
758 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
760 | 759 | // did we find an already existing record for this attendee ? |
761 | - if ( $attendee instanceof EE_Attendee ) { |
|
762 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
760 | + if ($attendee instanceof EE_Attendee) { |
|
761 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
763 | 762 | } else { |
764 | 763 | // ensure critical details are set for additional attendees |
765 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
766 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
764 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
765 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
767 | 766 | } |
768 | 767 | // who's #1 ? |
769 | - if ( $att_nmbr == 1 ) { |
|
768 | + if ($att_nmbr == 1) { |
|
770 | 769 | $this->checkout->primary_attendee_obj = $attendee; |
771 | 770 | } |
772 | 771 | } |
773 | 772 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
774 | 773 | // add relation to registration, set attendee ID, and cache attendee |
775 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
776 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
777 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
774 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
775 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
776 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
778 | 777 | return FALSE; |
779 | 778 | } |
780 | 779 | /** @type EE_Registration_Processor $registration_processor */ |
781 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
780 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
782 | 781 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
783 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
782 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
784 | 783 | /** @type EE_Transaction_Processor $transaction_processor */ |
785 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
784 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
786 | 785 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
787 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
786 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
788 | 787 | // if we've gotten this far, then let's save what we have |
789 | 788 | $registration->save(); |
790 | 789 | // add relation between TXN and registration |
791 | - $this->_associate_registration_with_transaction( $registration ); |
|
790 | + $this->_associate_registration_with_transaction($registration); |
|
792 | 791 | |
793 | 792 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
794 | 793 | |
795 | - } else { |
|
796 | - EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
794 | + } else { |
|
795 | + EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 796 | // remove malformed data |
798 | - unset( $valid_data[ $reg_url_link ] ); |
|
797 | + unset($valid_data[$reg_url_link]); |
|
799 | 798 | return FALSE; |
800 | 799 | } |
801 | 800 | |
@@ -813,22 +812,22 @@ discard block |
||
813 | 812 | * @param string $input_value |
814 | 813 | * @return boolean |
815 | 814 | */ |
816 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
815 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
817 | 816 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
818 | 817 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
819 | 818 | // allow for plugins to hook in and do their own processing of the form input. |
820 | 819 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
821 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
820 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
822 | 821 | return TRUE; |
823 | 822 | } |
824 | 823 | |
825 | 824 | // grab related answer objects |
826 | 825 | $answers = $registration->answers(); |
827 | 826 | // $answer_cache_id is the key used to find the EE_Answer we want |
828 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
829 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
827 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
828 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
830 | 829 | //rename form_inputs if they are EE_Attendee properties |
831 | - switch( (string)$form_input ) { |
|
830 | + switch ((string) $form_input) { |
|
832 | 831 | |
833 | 832 | case 'state' : |
834 | 833 | case 'STA_ID' : |
@@ -843,32 +842,32 @@ discard block |
||
843 | 842 | break; |
844 | 843 | |
845 | 844 | default : |
846 | - $ATT_input = 'ATT_' . $form_input; |
|
845 | + $ATT_input = 'ATT_'.$form_input; |
|
847 | 846 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
848 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
849 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
847 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
848 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
850 | 849 | } |
851 | 850 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
852 | 851 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
853 | 852 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
854 | 853 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
855 | 854 | // if this form input has a corresponding attendee property |
856 | - if ( $attendee_property ) { |
|
857 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
858 | - if ( $answer_is_obj ) { |
|
855 | + if ($attendee_property) { |
|
856 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
857 | + if ($answer_is_obj) { |
|
859 | 858 | // and delete the corresponding answer since we won't be storing this data in that object |
860 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
859 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
861 | 860 | } |
862 | 861 | return TRUE; |
863 | - } elseif ( $answer_is_obj ) { |
|
862 | + } elseif ($answer_is_obj) { |
|
864 | 863 | // save this data to the answer object |
865 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
866 | - $result = $answers[ $answer_cache_id ]->save(); |
|
864 | + $answers[$answer_cache_id]->set_value($input_value); |
|
865 | + $result = $answers[$answer_cache_id]->save(); |
|
867 | 866 | return $result !== false ? true : false; |
868 | 867 | } else { |
869 | - foreach ( $answers as $answer ) { |
|
870 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
871 | - $answer->set_value( $input_value ); |
|
868 | + foreach ($answers as $answer) { |
|
869 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
870 | + $answer->set_value($input_value); |
|
872 | 871 | $result = $answer->save(); |
873 | 872 | return $result !== false ? true : false; |
874 | 873 | } |
@@ -886,29 +885,29 @@ discard block |
||
886 | 885 | * @param string $input_value |
887 | 886 | * @return boolean |
888 | 887 | */ |
889 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
890 | - if ( empty( $input_value )) { |
|
891 | - switch( $form_input ) { |
|
888 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
889 | + if (empty($input_value)) { |
|
890 | + switch ($form_input) { |
|
892 | 891 | case 'fname' : |
893 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
892 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
894 | 893 | return FALSE; |
895 | 894 | break; |
896 | 895 | case 'lname' : |
897 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
896 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
898 | 897 | return FALSE; |
899 | 898 | break; |
900 | 899 | case 'email' : |
901 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
900 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
902 | 901 | return FALSE; |
903 | 902 | break; |
904 | 903 | } |
905 | - } else if ( $form_input === 'email' ) { |
|
904 | + } else if ($form_input === 'email') { |
|
906 | 905 | // clean the email address |
907 | - $valid_email = sanitize_email( $input_value ); |
|
906 | + $valid_email = sanitize_email($input_value); |
|
908 | 907 | // check if it matches |
909 | - if ( $input_value != $valid_email ) { |
|
908 | + if ($input_value != $valid_email) { |
|
910 | 909 | // whoops!!! |
911 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
910 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
912 | 911 | return FALSE; |
913 | 912 | } |
914 | 913 | } |
@@ -936,14 +935,14 @@ discard block |
||
936 | 935 | * @param array $attendee_data |
937 | 936 | * @return boolean |
938 | 937 | */ |
939 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
938 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
940 | 939 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
941 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
942 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
943 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
940 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
941 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
942 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
944 | 943 | // but only if those have values |
945 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
946 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
944 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
945 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
947 | 946 | 'ATT_fname' => $ATT_fname, |
948 | 947 | 'ATT_lname' => $ATT_lname, |
949 | 948 | 'ATT_email' => $ATT_email |
@@ -951,7 +950,7 @@ discard block |
||
951 | 950 | } else { |
952 | 951 | $existing_attendee = NULL; |
953 | 952 | } |
954 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
953 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
955 | 954 | } |
956 | 955 | |
957 | 956 | |
@@ -963,13 +962,13 @@ discard block |
||
963 | 962 | * @param array $attendee_data |
964 | 963 | * @return \EE_Attendee |
965 | 964 | */ |
966 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
965 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
967 | 966 | // first remove fname, lname, and email from attendee data |
968 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
967 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
969 | 968 | // now loop thru what's left and add to attendee CPT |
970 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
971 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
972 | - $existing_attendee->set( $property_name, $property_value ); |
|
969 | + foreach ($attendee_data as $property_name => $property_value) { |
|
970 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
971 | + $existing_attendee->set($property_name, $property_value); |
|
973 | 972 | } |
974 | 973 | } |
975 | 974 | // better save that now |
@@ -986,11 +985,11 @@ discard block |
||
986 | 985 | * @param EE_Attendee $attendee |
987 | 986 | * @return void |
988 | 987 | */ |
989 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
988 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
990 | 989 | // add relation to attendee |
991 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
992 | - $registration->set_attendee_id( $attendee->ID() ); |
|
993 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
990 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
991 | + $registration->set_attendee_id($attendee->ID()); |
|
992 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
994 | 993 | } |
995 | 994 | |
996 | 995 | |
@@ -1001,10 +1000,10 @@ discard block |
||
1001 | 1000 | * @param EE_Registration $registration |
1002 | 1001 | * @return void |
1003 | 1002 | */ |
1004 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1003 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1005 | 1004 | // add relation to attendee |
1006 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1007 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1005 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1006 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1008 | 1007 | } |
1009 | 1008 | |
1010 | 1009 | |
@@ -1016,17 +1015,17 @@ discard block |
||
1016 | 1015 | * @param array $attendee_data |
1017 | 1016 | * @return array |
1018 | 1017 | */ |
1019 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1018 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1020 | 1019 | // bare minimum critical details include first name, last name, email address |
1021 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1020 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1022 | 1021 | // add address info to critical details? |
1023 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1024 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1025 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1022 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1023 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1024 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1026 | 1025 | } |
1027 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1028 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1029 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1026 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1027 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1028 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1030 | 1029 | } |
1031 | 1030 | } |
1032 | 1031 | return $attendee_data; |
@@ -1041,11 +1040,11 @@ discard block |
||
1041 | 1040 | * @param array $attendee_data |
1042 | 1041 | * @return \EE_Attendee |
1043 | 1042 | */ |
1044 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1043 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1045 | 1044 | // create new attendee object |
1046 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1045 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1047 | 1046 | // set author to event creator |
1048 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1047 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1049 | 1048 | $new_attendee->save(); |
1050 | 1049 | return $new_attendee; |
1051 | 1050 | } |
@@ -1061,7 +1060,7 @@ discard block |
||
1061 | 1060 | */ |
1062 | 1061 | public function update_reg_step() { |
1063 | 1062 | // save everything |
1064 | - if ( $this->process_reg_step() ) { |
|
1063 | + if ($this->process_reg_step()) { |
|
1065 | 1064 | $this->checkout->redirect = TRUE; |
1066 | 1065 | $this->checkout->redirect_url = add_query_arg( |
1067 | 1066 | array( |
@@ -1070,7 +1069,7 @@ discard block |
||
1070 | 1069 | ), |
1071 | 1070 | $this->checkout->thank_you_page_url |
1072 | 1071 | ); |
1073 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1072 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1074 | 1073 | return TRUE; |
1075 | 1074 | } |
1076 | 1075 | return FALSE; |