@@ -808,7 +808,7 @@ |
||
808 | 808 | |
809 | 809 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
810 | 810 | |
811 | - } else { |
|
811 | + } else { |
|
812 | 812 | 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__ ); |
813 | 813 | // remove malformed data |
814 | 814 | unset( $valid_data[ $reg_url_link ] ); |
@@ -588,6 +588,7 @@ discard block |
||
588 | 588 | * @param EE_Registration $registration |
589 | 589 | * @param EE_Question $question |
590 | 590 | * @param mixed EE_Answer|NULL $answer |
591 | + * @param EE_Answer $answer |
|
591 | 592 | * @return EE_Form_Input_Base |
592 | 593 | * @throws \EE_Error |
593 | 594 | */ |
@@ -1190,7 +1191,7 @@ discard block |
||
1190 | 1191 | * |
1191 | 1192 | * @param EE_Registration $registration |
1192 | 1193 | * @param array $attendee_data |
1193 | - * @return boolean|EE_Attendee |
|
1194 | + * @return EE_Attendee |
|
1194 | 1195 | * @throws \EE_Error |
1195 | 1196 | */ |
1196 | 1197 | private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * |
|
4 | - * Class EE_SPCO_Reg_Step_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 | /** |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | // generate hidden input |
170 | 170 | if ( |
171 | 171 | isset( $subsections[ $primary_registrant ] ) |
172 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
172 | + && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
173 | 173 | ) { |
174 | 174 | $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
175 | 175 | } |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | if ( isset( $valid_data[ $reg_url_link ] ) ) { |
905 | 905 | // do we need to copy basic info from primary attendee ? |
906 | 906 | $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
907 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
907 | + && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
908 | 908 | ? true |
909 | 909 | : false; |
910 | 910 | // filter form input data for this registration |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | ? $form_input |
1080 | 1080 | : $form_input . '-' . $registration->reg_url_link(); |
1081 | 1081 | $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
1082 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1082 | + && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1083 | 1083 | ? true |
1084 | 1084 | : false; |
1085 | 1085 | //rename form_inputs if they are EE_Attendee properties |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | // then attempt to copy them from the primary attendee |
1200 | 1200 | if ( |
1201 | 1201 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1202 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1202 | + && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1203 | 1203 | ) { |
1204 | 1204 | return $this->checkout->primary_attendee_obj; |
1205 | 1205 | } |
@@ -1317,7 +1317,7 @@ discard block |
||
1317 | 1317 | } |
1318 | 1318 | foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
1319 | 1319 | if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
1320 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1320 | + || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1321 | 1321 | ) { |
1322 | 1322 | $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
1323 | 1323 | $critical_attendee_detail |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | * @access public |
42 | 42 | * @param EE_Checkout $checkout |
43 | 43 | */ |
44 | - public function __construct( EE_Checkout $checkout ) { |
|
44 | + public function __construct(EE_Checkout $checkout) { |
|
45 | 45 | $this->_slug = 'attendee_information'; |
46 | 46 | $this->_name = __('Attendee Information', 'event_espresso'); |
47 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
47 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
48 | 48 | $this->checkout = $checkout; |
49 | 49 | $this->_reset_success_message(); |
50 | 50 | $this->set_instructions( |
51 | - __( 'Please answer the following registration questions before proceeding.', 'event_espresso' ) |
|
51 | + __('Please answer the following registration questions before proceeding.', 'event_espresso') |
|
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | 56 | |
57 | 57 | public function translate_js_strings() { |
58 | - EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' ); |
|
58 | + EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
|
59 | 59 | EE_Registry::$i18n_js_strings['required_multi_field'] = __( |
60 | 60 | ' is a required question. Please enter a value for at least one of the options.', |
61 | 61 | 'event_espresso' |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | // calculate taxes |
116 | 116 | $Line_Item_Display->display_line_item( |
117 | 117 | $this->checkout->cart->get_grand_total(), |
118 | - array( 'set_tax_rate' => true ) |
|
118 | + array('set_tax_rate' => true) |
|
119 | 119 | ); |
120 | 120 | /** @var $subsections EE_Form_Section_Proper[] */ |
121 | 121 | $subsections = array( |
@@ -127,51 +127,51 @@ discard block |
||
127 | 127 | 'ticket_count' => array() |
128 | 128 | ); |
129 | 129 | // grab the saved registrations from the transaction |
130 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
131 | - if ( $registrations ) { |
|
132 | - foreach ( $registrations as $registration ) { |
|
130 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
131 | + if ($registrations) { |
|
132 | + foreach ($registrations as $registration) { |
|
133 | 133 | // can this registration be processed during this visit ? |
134 | 134 | if ( |
135 | 135 | $registration instanceof EE_Registration |
136 | - && $this->checkout->visit_allows_processing_of_this_registration( $registration ) |
|
136 | + && $this->checkout->visit_allows_processing_of_this_registration($registration) |
|
137 | 137 | ) { |
138 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
139 | - if ( ! $this->checkout->admin_request ) { |
|
140 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
141 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( |
|
142 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] |
|
138 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
139 | + if ( ! $this->checkout->admin_request) { |
|
140 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
141 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset( |
|
142 | + $template_args['ticket_count'][$registration->ticket()->ID()] |
|
143 | 143 | ) |
144 | - ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 |
|
144 | + ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
145 | 145 | : 1; |
146 | 146 | $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
147 | 147 | $this->checkout->cart->get_grand_total(), |
148 | 148 | 'Ticket', |
149 | - array( $registration->ticket()->ID() ) |
|
149 | + array($registration->ticket()->ID()) |
|
150 | 150 | ); |
151 | - $ticket_line_item = is_array( $ticket_line_item ) |
|
152 | - ? reset( $ticket_line_item ) |
|
151 | + $ticket_line_item = is_array($ticket_line_item) |
|
152 | + ? reset($ticket_line_item) |
|
153 | 153 | : $ticket_line_item; |
154 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( |
|
154 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item( |
|
155 | 155 | $ticket_line_item |
156 | 156 | ); |
157 | 157 | } |
158 | - if ( $registration->is_primary_registrant() ) { |
|
158 | + if ($registration->is_primary_registrant()) { |
|
159 | 159 | $primary_registrant = $registration->reg_url_link(); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
163 | 163 | // print_copy_info ? |
164 | - if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) { |
|
164 | + if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) { |
|
165 | 165 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
166 | 166 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info |
167 | 167 | ? $this->_copy_attendee_info_form() |
168 | 168 | : $this->_auto_copy_attendee_info(); |
169 | 169 | // generate hidden input |
170 | 170 | if ( |
171 | - isset( $subsections[ $primary_registrant ] ) |
|
172 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
171 | + isset($subsections[$primary_registrant]) |
|
172 | + && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper |
|
173 | 173 | ) { |
174 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
174 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
@@ -183,8 +183,7 @@ discard block |
||
183 | 183 | 'html_id' => $this->reg_form_name(), |
184 | 184 | 'subsections' => $subsections, |
185 | 185 | 'layout_strategy' => $this->checkout->admin_request ? |
186 | - new EE_Div_Per_Section_Layout() : |
|
187 | - new EE_Template_Layout( |
|
186 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
188 | 187 | array( |
189 | 188 | 'layout_template_file' => $this->_template, // layout_template |
190 | 189 | 'template_args' => $template_args |
@@ -202,11 +201,11 @@ discard block |
||
202 | 201 | * @return EE_Form_Section_Proper |
203 | 202 | * @throws \EE_Error |
204 | 203 | */ |
205 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
204 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
206 | 205 | static $attendee_nmbr = 1; |
207 | 206 | // array of params to pass to parent constructor |
208 | 207 | $form_args = array( |
209 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
208 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
210 | 209 | 'html_class' => 'ee-reg-form-attendee-dv', |
211 | 210 | 'html_style' => $this->checkout->admin_request |
212 | 211 | ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
@@ -215,24 +214,24 @@ discard block |
||
215 | 214 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
216 | 215 | array( |
217 | 216 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
218 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
217 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
219 | 218 | ) |
220 | 219 | ) |
221 | 220 | ); |
222 | 221 | // verify that registration has valid event |
223 | - if ( $registration->event() instanceof EE_Event ) { |
|
222 | + if ($registration->event() instanceof EE_Event) { |
|
224 | 223 | $query_params = array( |
225 | 224 | array( |
226 | 225 | 'Event.EVT_ID' => $registration->event()->ID(), |
227 | 226 | 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
228 | 227 | ), |
229 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
228 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
230 | 229 | ); |
231 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
232 | - if ( $question_groups ) { |
|
233 | - foreach ( $question_groups as $question_group ) { |
|
234 | - if ( $question_group instanceof EE_Question_Group ) { |
|
235 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
|
230 | + $question_groups = $registration->event()->question_groups($query_params); |
|
231 | + if ($question_groups) { |
|
232 | + foreach ($question_groups as $question_group) { |
|
233 | + if ($question_group instanceof EE_Question_Group) { |
|
234 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form( |
|
236 | 235 | $registration, |
237 | 236 | $question_group |
238 | 237 | ); |
@@ -245,10 +244,10 @@ discard block |
||
245 | 244 | // if we have question groups for additional attendees, then display the copy options |
246 | 245 | $this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info; |
247 | 246 | } else { |
248 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link( |
|
249 | - ) ] = new EE_Form_Section_HTML( |
|
247 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link( |
|
248 | + )] = new EE_Form_Section_HTML( |
|
250 | 249 | EEH_Template::locate_template( |
251 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
250 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
252 | 251 | apply_filters( |
253 | 252 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', |
254 | 253 | array() |
@@ -267,12 +266,12 @@ discard block |
||
267 | 266 | |
268 | 267 | } |
269 | 268 | } |
270 | - if ( $registration->is_primary_registrant() ) { |
|
269 | + if ($registration->is_primary_registrant()) { |
|
271 | 270 | // generate hidden input |
272 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
271 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
273 | 272 | } |
274 | 273 | $attendee_nmbr++; |
275 | - return new EE_Form_Section_Proper( $form_args ); |
|
274 | + return new EE_Form_Section_Proper($form_args); |
|
276 | 275 | } |
277 | 276 | |
278 | 277 | |
@@ -293,7 +292,7 @@ discard block |
||
293 | 292 | // generate hidden input |
294 | 293 | return new EE_Hidden_Input( |
295 | 294 | array( |
296 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
295 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
297 | 296 | 'default' => $additional_attendee_reg_info |
298 | 297 | ) |
299 | 298 | ); |
@@ -307,26 +306,26 @@ discard block |
||
307 | 306 | * @return EE_Form_Section_Proper |
308 | 307 | * @throws \EE_Error |
309 | 308 | */ |
310 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
309 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
311 | 310 | // array of params to pass to parent constructor |
312 | 311 | $form_args = array( |
313 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
312 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
314 | 313 | 'html_class' => $this->checkout->admin_request |
315 | 314 | ? 'form-table ee-reg-form-qstn-grp-dv' |
316 | 315 | : 'ee-reg-form-qstn-grp-dv', |
317 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
316 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
318 | 317 | 'subsections' => array( |
319 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
318 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
320 | 319 | ), |
321 | 320 | 'layout_strategy' => $this->checkout->admin_request |
322 | 321 | ? new EE_Admin_Two_Column_Layout() |
323 | 322 | : new EE_Div_Per_Section_Layout() |
324 | 323 | ); |
325 | 324 | // where params |
326 | - $query_params = array( 'QST_deleted' => 0 ); |
|
325 | + $query_params = array('QST_deleted' => 0); |
|
327 | 326 | // don't load admin only questions on the frontend |
328 | - if ( ! $this->checkout->admin_request ) { |
|
329 | - $query_params['QST_admin_only'] = array( '!=', true ); |
|
327 | + if ( ! $this->checkout->admin_request) { |
|
328 | + $query_params['QST_admin_only'] = array('!=', true); |
|
330 | 329 | } |
331 | 330 | $questions = $question_group->get_many_related( |
332 | 331 | 'Question', |
@@ -348,10 +347,10 @@ discard block |
||
348 | 347 | ) |
349 | 348 | ); |
350 | 349 | // loop thru questions |
351 | - foreach ( $questions as $question ) { |
|
352 | - if( $question instanceof EE_Question ){ |
|
350 | + foreach ($questions as $question) { |
|
351 | + if ($question instanceof EE_Question) { |
|
353 | 352 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
354 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
353 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
355 | 354 | } |
356 | 355 | } |
357 | 356 | $form_args['subsections'] = apply_filters( |
@@ -372,7 +371,7 @@ discard block |
||
372 | 371 | ) |
373 | 372 | ); |
374 | 373 | // d( $form_args ); |
375 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
374 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
376 | 375 | return apply_filters( |
377 | 376 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
378 | 377 | $question_group_reg_form, |
@@ -389,11 +388,11 @@ discard block |
||
389 | 388 | * @param EE_Question_Group $question_group |
390 | 389 | * @return EE_Form_Section_HTML |
391 | 390 | */ |
392 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
391 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
393 | 392 | $html = ''; |
394 | 393 | // group_name |
395 | - if ( $question_group->show_group_name() && $question_group->name() !== '' ) { |
|
396 | - if ( $this->checkout->admin_request ) { |
|
394 | + if ($question_group->show_group_name() && $question_group->name() !== '') { |
|
395 | + if ($this->checkout->admin_request) { |
|
397 | 396 | $html .= EEH_HTML::br(); |
398 | 397 | $html .= EEH_HTML::h3( |
399 | 398 | $question_group->name(), |
@@ -407,7 +406,7 @@ discard block |
||
407 | 406 | } |
408 | 407 | } |
409 | 408 | // group_desc |
410 | - if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) { |
|
409 | + if ($question_group->show_group_desc() && $question_group->desc() !== '') { |
|
411 | 410 | $html .= EEH_HTML::p( |
412 | 411 | $question_group->desc(), |
413 | 412 | '', |
@@ -417,7 +416,7 @@ discard block |
||
417 | 416 | ); |
418 | 417 | |
419 | 418 | } |
420 | - return new EE_Form_Section_HTML( $html ); |
|
419 | + return new EE_Form_Section_HTML($html); |
|
421 | 420 | } |
422 | 421 | |
423 | 422 | |
@@ -427,7 +426,7 @@ discard block |
||
427 | 426 | * @return EE_Form_Section_Proper |
428 | 427 | * @throws \EE_Error |
429 | 428 | */ |
430 | - private function _copy_attendee_info_form(){ |
|
429 | + private function _copy_attendee_info_form() { |
|
431 | 430 | // array of params to pass to parent constructor |
432 | 431 | return new EE_Form_Section_Proper( |
433 | 432 | array( |
@@ -456,7 +455,7 @@ discard block |
||
456 | 455 | private function _auto_copy_attendee_info() { |
457 | 456 | return new EE_Form_Section_HTML( |
458 | 457 | EEH_Template::locate_template( |
459 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
458 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
460 | 459 | apply_filters( |
461 | 460 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', |
462 | 461 | array() |
@@ -480,32 +479,32 @@ discard block |
||
480 | 479 | $copy_attendee_info_inputs = array(); |
481 | 480 | $prev_ticket = NULL; |
482 | 481 | // grab the saved registrations from the transaction |
483 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
484 | - foreach ( $registrations as $registration ) { |
|
482 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
483 | + foreach ($registrations as $registration) { |
|
485 | 484 | // for all attendees other than the primary attendee |
486 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
485 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
487 | 486 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
488 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
487 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
489 | 488 | $item_name = $registration->ticket()->name(); |
490 | 489 | $item_name .= $registration->ticket()->description() !== '' |
491 | - ? ' - ' . $registration->ticket()->description() |
|
490 | + ? ' - '.$registration->ticket()->description() |
|
492 | 491 | : ''; |
493 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
494 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
492 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
493 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
495 | 494 | ); |
496 | 495 | $prev_ticket = $registration->ticket()->ID(); |
497 | 496 | } |
498 | 497 | |
499 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
498 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
500 | 499 | EE_Checkbox_Multi_Input( |
501 | 500 | array( |
502 | 501 | $registration->ID() => sprintf( |
503 | - __( 'Attendee #%s', 'event_espresso' ), |
|
502 | + __('Attendee #%s', 'event_espresso'), |
|
504 | 503 | $registration->count() |
505 | 504 | ) |
506 | 505 | ), |
507 | 506 | array( |
508 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
507 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
509 | 508 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
510 | 509 | 'display_html_label_text' => false |
511 | 510 | ) |
@@ -525,7 +524,7 @@ discard block |
||
525 | 524 | * @return EE_Form_Input_Base |
526 | 525 | * @throws \EE_Error |
527 | 526 | */ |
528 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
527 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
529 | 528 | // generate hidden input |
530 | 529 | return new EE_Hidden_Input( |
531 | 530 | array( |
@@ -544,7 +543,7 @@ discard block |
||
544 | 543 | * @return EE_Form_Input_Base |
545 | 544 | * @throws \EE_Error |
546 | 545 | */ |
547 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
546 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
548 | 547 | |
549 | 548 | // if this question was for an attendee detail, then check for that answer |
550 | 549 | $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( |
@@ -553,32 +552,32 @@ discard block |
||
553 | 552 | ); |
554 | 553 | $answer = $answer_value === null |
555 | 554 | ? EEM_Answer::instance()->get_one( |
556 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
555 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
557 | 556 | ) |
558 | 557 | : null; |
559 | 558 | // if NOT returning to edit an existing registration |
560 | 559 | // OR if this question is for an attendee property |
561 | 560 | // OR we still don't have an EE_Answer object |
562 | - if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) { |
|
561 | + if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { |
|
563 | 562 | // create an EE_Answer object for storing everything in |
564 | - $answer = EE_Answer::new_instance ( array( |
|
563 | + $answer = EE_Answer::new_instance(array( |
|
565 | 564 | 'QST_ID'=> $question->ID(), |
566 | 565 | 'REG_ID'=> $registration->ID() |
567 | 566 | )); |
568 | 567 | } |
569 | 568 | // verify instance |
570 | - if( $answer instanceof EE_Answer ){ |
|
571 | - if ( ! empty( $answer_value )) { |
|
572 | - $answer->set( 'ANS_value', $answer_value ); |
|
569 | + if ($answer instanceof EE_Answer) { |
|
570 | + if ( ! empty($answer_value)) { |
|
571 | + $answer->set('ANS_value', $answer_value); |
|
573 | 572 | } |
574 | - $answer->cache( 'Question', $question ); |
|
573 | + $answer->cache('Question', $question); |
|
575 | 574 | //remember system ID had a bug where sometimes it could be null |
576 | - $answer_cache_id =$question->is_system_question() |
|
577 | - ? $question->system_ID() . '-' . $registration->reg_url_link() |
|
578 | - : $question->ID() . '-' . $registration->reg_url_link(); |
|
579 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
575 | + $answer_cache_id = $question->is_system_question() |
|
576 | + ? $question->system_ID().'-'.$registration->reg_url_link() |
|
577 | + : $question->ID().'-'.$registration->reg_url_link(); |
|
578 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
580 | 579 | } |
581 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
580 | + return $this->_generate_question_input($registration, $question, $answer); |
|
582 | 581 | |
583 | 582 | } |
584 | 583 | |
@@ -591,46 +590,46 @@ discard block |
||
591 | 590 | * @return EE_Form_Input_Base |
592 | 591 | * @throws \EE_Error |
593 | 592 | */ |
594 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
593 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
595 | 594 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
596 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
595 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
597 | 596 | add_filter( |
598 | 597 | 'FHEE__EE_Question__generate_form_input__country_options', |
599 | - array( $this, 'use_cached_countries_for_form_input' ), |
|
598 | + array($this, 'use_cached_countries_for_form_input'), |
|
600 | 599 | 10, |
601 | 600 | 4 |
602 | 601 | ); |
603 | 602 | add_filter( |
604 | 603 | 'FHEE__EE_Question__generate_form_input__state_options', |
605 | - array( $this, 'use_cached_states_for_form_input' ), |
|
604 | + array($this, 'use_cached_states_for_form_input'), |
|
606 | 605 | 10, |
607 | 606 | 4 |
608 | 607 | ); |
609 | 608 | $input_constructor_args = array( |
610 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
611 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
612 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
613 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
609 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
610 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
611 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
612 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
614 | 613 | 'html_label_class' => 'ee-reg-qstn', |
615 | 614 | ); |
616 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
617 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
618 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
619 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
620 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
615 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
616 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
617 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
618 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
619 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
621 | 620 | } |
622 | - $form_input = $question->generate_form_input( |
|
621 | + $form_input = $question->generate_form_input( |
|
623 | 622 | $registration, |
624 | 623 | $answer, |
625 | 624 | $input_constructor_args |
626 | 625 | ); |
627 | 626 | remove_filter( |
628 | 627 | 'FHEE__EE_Question__generate_form_input__country_options', |
629 | - array( $this, 'use_cached_countries_for_form_input' ) |
|
628 | + array($this, 'use_cached_countries_for_form_input') |
|
630 | 629 | ); |
631 | 630 | remove_filter( |
632 | 631 | 'FHEE__EE_Question__generate_form_input__state_options', |
633 | - array( $this, 'use_cached_states_for_form_input' ) |
|
632 | + array($this, 'use_cached_states_for_form_input') |
|
634 | 633 | ); |
635 | 634 | return $form_input; |
636 | 635 | } |
@@ -652,22 +651,22 @@ discard block |
||
652 | 651 | \EE_Registration $registration = null, |
653 | 652 | \EE_Answer $answer = null |
654 | 653 | ) { |
655 | - $country_options = array( '' => '' ); |
|
654 | + $country_options = array('' => ''); |
|
656 | 655 | // get possibly cached list of countries |
657 | 656 | $countries = $this->checkout->action === 'process_reg_step' |
658 | 657 | ? EEM_Country::instance()->get_all_countries() |
659 | 658 | : EEM_Country::instance()->get_all_active_countries(); |
660 | - if ( ! empty( $countries )) { |
|
661 | - foreach( $countries as $country ){ |
|
662 | - if ( $country instanceof EE_Country ) { |
|
663 | - $country_options[ $country->ID() ] = $country->name(); |
|
659 | + if ( ! empty($countries)) { |
|
660 | + foreach ($countries as $country) { |
|
661 | + if ($country instanceof EE_Country) { |
|
662 | + $country_options[$country->ID()] = $country->name(); |
|
664 | 663 | } |
665 | 664 | } |
666 | 665 | } |
667 | - if( $question instanceof EE_Question |
|
668 | - && $registration instanceof EE_Registration ) { |
|
666 | + if ($question instanceof EE_Question |
|
667 | + && $registration instanceof EE_Registration) { |
|
669 | 668 | $answer = EEM_Answer::instance()->get_one( |
670 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
669 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
671 | 670 | ); |
672 | 671 | } else { |
673 | 672 | $answer = EE_Answer::new_instance(); |
@@ -700,14 +699,14 @@ discard block |
||
700 | 699 | \EE_Registration $registration = null, |
701 | 700 | \EE_Answer $answer = null |
702 | 701 | ) { |
703 | - $state_options = array( '' => array( '' => '')); |
|
702 | + $state_options = array('' => array('' => '')); |
|
704 | 703 | $states = $this->checkout->action === 'process_reg_step' |
705 | 704 | ? EEM_State::instance()->get_all_states() |
706 | 705 | : EEM_State::instance()->get_all_active_states(); |
707 | - if ( ! empty( $states )) { |
|
708 | - foreach( $states as $state ){ |
|
709 | - if ( $state instanceof EE_State ) { |
|
710 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
706 | + if ( ! empty($states)) { |
|
707 | + foreach ($states as $state) { |
|
708 | + if ($state instanceof EE_State) { |
|
709 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
711 | 710 | } |
712 | 711 | } |
713 | 712 | } |
@@ -735,24 +734,24 @@ discard block |
||
735 | 734 | * @throws \EE_Error |
736 | 735 | */ |
737 | 736 | public function process_reg_step() { |
738 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
737 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
739 | 738 | // grab validated data from form |
740 | 739 | $valid_data = $this->checkout->current_step->valid_data(); |
741 | 740 | // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
742 | 741 | // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
743 | 742 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
744 | - if ( empty( $valid_data )) { |
|
743 | + if (empty($valid_data)) { |
|
745 | 744 | EE_Error::add_error( |
746 | - __( 'No valid question responses were received.', 'event_espresso' ), |
|
745 | + __('No valid question responses were received.', 'event_espresso'), |
|
747 | 746 | __FILE__, |
748 | 747 | __FUNCTION__, |
749 | 748 | __LINE__ |
750 | 749 | ); |
751 | 750 | return false; |
752 | 751 | } |
753 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
752 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
754 | 753 | EE_Error::add_error( |
755 | - __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), |
|
754 | + __('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), |
|
756 | 755 | __FILE__, |
757 | 756 | __FUNCTION__, |
758 | 757 | __LINE__ |
@@ -760,11 +759,11 @@ discard block |
||
760 | 759 | return false; |
761 | 760 | } |
762 | 761 | // get cached registrations |
763 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
762 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
764 | 763 | // verify we got the goods |
765 | - if ( empty( $registrations )) { |
|
764 | + if (empty($registrations)) { |
|
766 | 765 | EE_Error::add_error( |
767 | - __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), |
|
766 | + __('Your form data could not be applied to any valid registrations.', 'event_espresso'), |
|
768 | 767 | __FILE__, |
769 | 768 | __FUNCTION__, |
770 | 769 | __LINE__ |
@@ -772,15 +771,15 @@ discard block |
||
772 | 771 | return false; |
773 | 772 | } |
774 | 773 | // extract attendee info from form data and save to model objects |
775 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
774 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
776 | 775 | // if first pass thru SPCO, |
777 | 776 | // then let's check processed registrations against the total number of tickets in the cart |
778 | - if ( $registrations_processed === false ) { |
|
777 | + if ($registrations_processed === false) { |
|
779 | 778 | // but return immediately if the previous step exited early due to errors |
780 | 779 | return false; |
781 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
780 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
782 | 781 | // generate a correctly translated string for all possible singular/plural combinations |
783 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
782 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
784 | 783 | $error_msg = sprintf( |
785 | 784 | __( |
786 | 785 | 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', |
@@ -789,7 +788,7 @@ discard block |
||
789 | 788 | $this->checkout->total_ticket_count, |
790 | 789 | $registrations_processed |
791 | 790 | ); |
792 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
791 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
793 | 792 | $error_msg = sprintf( |
794 | 793 | __( |
795 | 794 | 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', |
@@ -808,17 +807,17 @@ discard block |
||
808 | 807 | $registrations_processed |
809 | 808 | ); |
810 | 809 | } |
811 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
810 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
812 | 811 | return false; |
813 | 812 | } |
814 | 813 | // mark this reg step as completed |
815 | 814 | $this->set_completed(); |
816 | 815 | $this->_set_success_message( |
817 | - __( 'The Attendee Information Step has been successfully completed.', 'event_espresso' ) |
|
816 | + __('The Attendee Information Step has been successfully completed.', 'event_espresso') |
|
818 | 817 | ); |
819 | 818 | //do action in case a plugin wants to do something with the data submitted in step 1. |
820 | 819 | //passes EE_Single_Page_Checkout, and it's posted data |
821 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
820 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
822 | 821 | return true; |
823 | 822 | } |
824 | 823 | |
@@ -832,9 +831,9 @@ discard block |
||
832 | 831 | * @return boolean | int |
833 | 832 | * @throws \EE_Error |
834 | 833 | */ |
835 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
834 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
836 | 835 | // load resources and set some defaults |
837 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
836 | + EE_Registry::instance()->load_model('Attendee'); |
|
838 | 837 | // holder for primary registrant attendee object |
839 | 838 | $this->checkout->primary_attendee_obj = NULL; |
840 | 839 | // array for tracking reg form data for the primary registrant |
@@ -851,9 +850,9 @@ discard block |
||
851 | 850 | // attendee counter |
852 | 851 | $att_nmbr = 0; |
853 | 852 | // grab the saved registrations from the transaction |
854 | - foreach ( $registrations as $registration ) { |
|
853 | + foreach ($registrations as $registration) { |
|
855 | 854 | // verify EE_Registration object |
856 | - if ( ! $registration instanceof EE_Registration ) { |
|
855 | + if ( ! $registration instanceof EE_Registration) { |
|
857 | 856 | EE_Error::add_error( |
858 | 857 | __( |
859 | 858 | 'An invalid Registration object was discovered when attempting to process your registration information.', |
@@ -868,12 +867,12 @@ discard block |
||
868 | 867 | /** @var string $reg_url_link */ |
869 | 868 | $reg_url_link = $registration->reg_url_link(); |
870 | 869 | // reg_url_link exists ? |
871 | - if ( ! empty( $reg_url_link ) ) { |
|
870 | + if ( ! empty($reg_url_link)) { |
|
872 | 871 | // should this registration be processed during this visit ? |
873 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
872 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
874 | 873 | // if NOT revisiting, then let's save the registration now, |
875 | 874 | // so that we have a REG_ID to use when generating other objects |
876 | - if ( ! $this->checkout->revisit ) { |
|
875 | + if ( ! $this->checkout->revisit) { |
|
877 | 876 | $registration->save(); |
878 | 877 | } |
879 | 878 | /** |
@@ -883,7 +882,7 @@ discard block |
||
883 | 882 | * @var bool if true is returned by the plugin then the |
884 | 883 | * registration processing is halted. |
885 | 884 | */ |
886 | - if ( apply_filters( |
|
885 | + if (apply_filters( |
|
887 | 886 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', |
888 | 887 | false, |
889 | 888 | $att_nmbr, |
@@ -891,38 +890,38 @@ discard block |
||
891 | 890 | $registrations, |
892 | 891 | $valid_data, |
893 | 892 | $this |
894 | - ) ) { |
|
893 | + )) { |
|
895 | 894 | return false; |
896 | 895 | } |
897 | 896 | |
898 | 897 | // Houston, we have a registration! |
899 | 898 | $att_nmbr++; |
900 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
899 | + $this->_attendee_data[$reg_url_link] = array(); |
|
901 | 900 | // grab any existing related answer objects |
902 | 901 | $this->_registration_answers = $registration->answers(); |
903 | 902 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
904 | - if ( isset( $valid_data[ $reg_url_link ] ) ) { |
|
903 | + if (isset($valid_data[$reg_url_link])) { |
|
905 | 904 | // do we need to copy basic info from primary attendee ? |
906 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
|
907 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
905 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) |
|
906 | + && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 |
|
908 | 907 | ? true |
909 | 908 | : false; |
910 | 909 | // filter form input data for this registration |
911 | - $valid_data[ $reg_url_link ] = (array)apply_filters( |
|
910 | + $valid_data[$reg_url_link] = (array) apply_filters( |
|
912 | 911 | 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
913 | - $valid_data[ $reg_url_link ] |
|
912 | + $valid_data[$reg_url_link] |
|
914 | 913 | ); |
915 | 914 | // EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
916 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
917 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) |
|
915 | + if (isset($valid_data['primary_attendee'])) { |
|
916 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) |
|
918 | 917 | ? $valid_data['primary_attendee'] |
919 | 918 | : false; |
920 | - unset( $valid_data['primary_attendee'] ); |
|
919 | + unset($valid_data['primary_attendee']); |
|
921 | 920 | } |
922 | 921 | // now loop through our array of valid post data && process attendee reg forms |
923 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
924 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
925 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
922 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
923 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
924 | + foreach ($form_inputs as $form_input => $input_value) { |
|
926 | 925 | // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ ); |
927 | 926 | // check for critical inputs |
928 | 927 | if ( |
@@ -936,16 +935,16 @@ discard block |
||
936 | 935 | // store a bit of data about the primary attendee |
937 | 936 | if ( |
938 | 937 | $att_nmbr === 1 |
939 | - && ! empty( $input_value ) |
|
938 | + && ! empty($input_value) |
|
940 | 939 | && $reg_url_link === $primary_registrant['line_item_id'] |
941 | 940 | ) { |
942 | - $primary_registrant[ $form_input ] = $input_value; |
|
941 | + $primary_registrant[$form_input] = $input_value; |
|
943 | 942 | } else if ( |
944 | 943 | $copy_primary |
945 | 944 | && $input_value === null |
946 | - && isset( $primary_registrant[ $form_input ] ) |
|
945 | + && isset($primary_registrant[$form_input]) |
|
947 | 946 | ) { |
948 | - $input_value = $primary_registrant[ $form_input ]; |
|
947 | + $input_value = $primary_registrant[$form_input]; |
|
949 | 948 | } |
950 | 949 | // now attempt to save the input data |
951 | 950 | if ( |
@@ -987,55 +986,55 @@ discard block |
||
987 | 986 | // have we met before? |
988 | 987 | $attendee = $this->_find_existing_attendee( |
989 | 988 | $registration, |
990 | - $this->_attendee_data[ $reg_url_link ] |
|
989 | + $this->_attendee_data[$reg_url_link] |
|
991 | 990 | ); |
992 | 991 | // did we find an already existing record for this attendee ? |
993 | - if ( $attendee instanceof EE_Attendee ) { |
|
992 | + if ($attendee instanceof EE_Attendee) { |
|
994 | 993 | $attendee = $this->_update_existing_attendee_data( |
995 | 994 | $attendee, |
996 | - $this->_attendee_data[ $reg_url_link ] |
|
995 | + $this->_attendee_data[$reg_url_link] |
|
997 | 996 | ); |
998 | 997 | } else { |
999 | 998 | // ensure critical details are set for additional attendees |
1000 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 |
|
999 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 |
|
1001 | 1000 | ? $this->_copy_critical_attendee_details_from_primary_registrant( |
1002 | - $this->_attendee_data[ $reg_url_link ] |
|
1001 | + $this->_attendee_data[$reg_url_link] |
|
1003 | 1002 | ) |
1004 | - : $this->_attendee_data[ $reg_url_link ]; |
|
1003 | + : $this->_attendee_data[$reg_url_link]; |
|
1005 | 1004 | $attendee = $this->_create_new_attendee( |
1006 | 1005 | $registration, |
1007 | - $this->_attendee_data[ $reg_url_link ] |
|
1006 | + $this->_attendee_data[$reg_url_link] |
|
1008 | 1007 | ); |
1009 | 1008 | } |
1010 | 1009 | // who's #1 ? |
1011 | - if ( $att_nmbr === 1 ) { |
|
1010 | + if ($att_nmbr === 1) { |
|
1012 | 1011 | $this->checkout->primary_attendee_obj = $attendee; |
1013 | 1012 | } |
1014 | 1013 | } |
1015 | 1014 | // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
1016 | 1015 | // add relation to registration, set attendee ID, and cache attendee |
1017 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
1016 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
1018 | 1017 | // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ ); |
1019 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
1020 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1018 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
1019 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
1021 | 1020 | return false; |
1022 | 1021 | } |
1023 | 1022 | /** @type EE_Registration_Processor $registration_processor */ |
1024 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1023 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1025 | 1024 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1026 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
1025 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, false); |
|
1027 | 1026 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1028 | 1027 | $this->checkout->transaction->toggle_failed_transaction_status(); |
1029 | 1028 | // if we've gotten this far, then let's save what we have |
1030 | 1029 | $registration->save(); |
1031 | 1030 | // add relation between TXN and registration |
1032 | - $this->_associate_registration_with_transaction( $registration ); |
|
1031 | + $this->_associate_registration_with_transaction($registration); |
|
1033 | 1032 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
1034 | 1033 | |
1035 | - } else { |
|
1036 | - 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__ ); |
|
1034 | + } else { |
|
1035 | + 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__); |
|
1037 | 1036 | // remove malformed data |
1038 | - unset( $valid_data[ $reg_url_link ] ); |
|
1037 | + unset($valid_data[$reg_url_link]); |
|
1039 | 1038 | return false; |
1040 | 1039 | } |
1041 | 1040 | |
@@ -1064,26 +1063,26 @@ discard block |
||
1064 | 1063 | // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
1065 | 1064 | // allow for plugins to hook in and do their own processing of the form input. |
1066 | 1065 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
1067 | - if ( apply_filters( |
|
1066 | + if (apply_filters( |
|
1068 | 1067 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', |
1069 | 1068 | false, |
1070 | 1069 | $registration, |
1071 | 1070 | $form_input, |
1072 | 1071 | $input_value, |
1073 | 1072 | $this |
1074 | - ) ) { |
|
1073 | + )) { |
|
1075 | 1074 | return true; |
1076 | 1075 | } |
1077 | 1076 | // $answer_cache_id is the key used to find the EE_Answer we want |
1078 | 1077 | $answer_cache_id = $this->checkout->reg_url_link |
1079 | 1078 | ? $form_input |
1080 | - : $form_input . '-' . $registration->reg_url_link(); |
|
1081 | - $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
|
1082 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1079 | + : $form_input.'-'.$registration->reg_url_link(); |
|
1080 | + $answer_is_obj = isset($this->_registration_answers[$answer_cache_id]) |
|
1081 | + && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer |
|
1083 | 1082 | ? true |
1084 | 1083 | : false; |
1085 | 1084 | //rename form_inputs if they are EE_Attendee properties |
1086 | - switch( (string)$form_input ) { |
|
1085 | + switch ((string) $form_input) { |
|
1087 | 1086 | |
1088 | 1087 | case 'state' : |
1089 | 1088 | case 'STA_ID' : |
@@ -1098,32 +1097,32 @@ discard block |
||
1098 | 1097 | break; |
1099 | 1098 | |
1100 | 1099 | default : |
1101 | - $ATT_input = 'ATT_' . $form_input; |
|
1100 | + $ATT_input = 'ATT_'.$form_input; |
|
1102 | 1101 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
1103 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false; |
|
1104 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
1102 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false; |
|
1103 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
1105 | 1104 | } |
1106 | 1105 | // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
1107 | 1106 | // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
1108 | 1107 | // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
1109 | 1108 | // if this form input has a corresponding attendee property |
1110 | - if ( $attendee_property ) { |
|
1111 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
1112 | - if ( $answer_is_obj ) { |
|
1109 | + if ($attendee_property) { |
|
1110 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
1111 | + if ($answer_is_obj) { |
|
1113 | 1112 | // and delete the corresponding answer since we won't be storing this data in that object |
1114 | - $registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' ); |
|
1115 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently(); |
|
1113 | + $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer'); |
|
1114 | + $this->_registration_answers[$answer_cache_id]->delete_permanently(); |
|
1116 | 1115 | } |
1117 | 1116 | return true; |
1118 | - } elseif ( $answer_is_obj ) { |
|
1117 | + } elseif ($answer_is_obj) { |
|
1119 | 1118 | // save this data to the answer object |
1120 | - $this->_registration_answers[ $answer_cache_id ]->set_value( $input_value ); |
|
1121 | - $result = $this->_registration_answers[ $answer_cache_id ]->save(); |
|
1119 | + $this->_registration_answers[$answer_cache_id]->set_value($input_value); |
|
1120 | + $result = $this->_registration_answers[$answer_cache_id]->save(); |
|
1122 | 1121 | return $result !== false ? true : false; |
1123 | 1122 | } else { |
1124 | - foreach ( $this->_registration_answers as $answer ) { |
|
1125 | - if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) { |
|
1126 | - $answer->set_value( $input_value ); |
|
1123 | + foreach ($this->_registration_answers as $answer) { |
|
1124 | + if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { |
|
1125 | + $answer->set_value($input_value); |
|
1127 | 1126 | $result = $answer->save(); |
1128 | 1127 | return $result !== false ? true : false; |
1129 | 1128 | } |
@@ -1145,15 +1144,15 @@ discard block |
||
1145 | 1144 | $form_input = '', |
1146 | 1145 | $input_value = '' |
1147 | 1146 | ) { |
1148 | - if ( empty( $input_value ) ) { |
|
1147 | + if (empty($input_value)) { |
|
1149 | 1148 | // if the form input isn't marked as being required, then just return |
1150 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
1149 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
1151 | 1150 | return true; |
1152 | 1151 | } |
1153 | - switch ( $form_input ) { |
|
1152 | + switch ($form_input) { |
|
1154 | 1153 | case 'fname' : |
1155 | 1154 | EE_Error::add_error( |
1156 | - __( 'First Name is a required value.', 'event_espresso' ), |
|
1155 | + __('First Name is a required value.', 'event_espresso'), |
|
1157 | 1156 | __FILE__, |
1158 | 1157 | __FUNCTION__, |
1159 | 1158 | __LINE__ |
@@ -1162,7 +1161,7 @@ discard block |
||
1162 | 1161 | break; |
1163 | 1162 | case 'lname' : |
1164 | 1163 | EE_Error::add_error( |
1165 | - __( 'Last Name is a required value.', 'event_espresso' ), |
|
1164 | + __('Last Name is a required value.', 'event_espresso'), |
|
1166 | 1165 | __FILE__, |
1167 | 1166 | __FUNCTION__, |
1168 | 1167 | __LINE__ |
@@ -1171,7 +1170,7 @@ discard block |
||
1171 | 1170 | break; |
1172 | 1171 | case 'email' : |
1173 | 1172 | EE_Error::add_error( |
1174 | - __( 'Please enter a valid email address.', 'event_espresso' ), |
|
1173 | + __('Please enter a valid email address.', 'event_espresso'), |
|
1175 | 1174 | __FILE__, |
1176 | 1175 | __FUNCTION__, |
1177 | 1176 | __LINE__ |
@@ -1193,30 +1192,30 @@ discard block |
||
1193 | 1192 | * @return boolean|EE_Attendee |
1194 | 1193 | * @throws \EE_Error |
1195 | 1194 | */ |
1196 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1195 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1197 | 1196 | $existing_attendee = null; |
1198 | 1197 | // if none of the critical properties are set in the incoming attendee data... |
1199 | 1198 | // then attempt to copy them from the primary attendee |
1200 | 1199 | if ( |
1201 | 1200 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1202 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1201 | + && ! isset($attendee_data['ATT_fname'], $attendee_data['ATT_email']) |
|
1203 | 1202 | ) { |
1204 | 1203 | return $this->checkout->primary_attendee_obj; |
1205 | 1204 | } |
1206 | 1205 | // does this attendee already exist in the db ? |
1207 | 1206 | // we're searching using a combination of first name, last name, AND email address |
1208 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) |
|
1207 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) |
|
1209 | 1208 | ? $attendee_data['ATT_fname'] |
1210 | 1209 | : ''; |
1211 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) |
|
1210 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) |
|
1212 | 1211 | ? $attendee_data['ATT_lname'] |
1213 | 1212 | : ''; |
1214 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) |
|
1213 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) |
|
1215 | 1214 | ? $attendee_data['ATT_email'] |
1216 | 1215 | : ''; |
1217 | 1216 | // but only if those have values |
1218 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
1219 | - $existing_attendee = EEM_Attendee::instance()->find_existing_attendee( array( |
|
1217 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
1218 | + $existing_attendee = EEM_Attendee::instance()->find_existing_attendee(array( |
|
1220 | 1219 | 'ATT_fname' => $ATT_fname, |
1221 | 1220 | 'ATT_lname' => $ATT_lname, |
1222 | 1221 | 'ATT_email' => $ATT_email |
@@ -1240,13 +1239,13 @@ discard block |
||
1240 | 1239 | * @return \EE_Attendee |
1241 | 1240 | * @throws \EE_Error |
1242 | 1241 | */ |
1243 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
1242 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
1244 | 1243 | // first remove fname, lname, and email from attendee data |
1245 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1244 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1246 | 1245 | // now loop thru what's left and add to attendee CPT |
1247 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1248 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1249 | - $existing_attendee->set( $property_name, $property_value ); |
|
1246 | + foreach ($attendee_data as $property_name => $property_value) { |
|
1247 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1248 | + $existing_attendee->set($property_name, $property_value); |
|
1250 | 1249 | } |
1251 | 1250 | } |
1252 | 1251 | // better save that now |
@@ -1264,11 +1263,11 @@ discard block |
||
1264 | 1263 | * @return void |
1265 | 1264 | * @throws \EE_Error |
1266 | 1265 | */ |
1267 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1266 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1268 | 1267 | // add relation to attendee |
1269 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1270 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1271 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1268 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1269 | + $registration->set_attendee_id($attendee->ID()); |
|
1270 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1272 | 1271 | } |
1273 | 1272 | |
1274 | 1273 | |
@@ -1280,10 +1279,10 @@ discard block |
||
1280 | 1279 | * @return void |
1281 | 1280 | * @throws \EE_Error |
1282 | 1281 | */ |
1283 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1282 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1284 | 1283 | // add relation to attendee |
1285 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1286 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1284 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1285 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1287 | 1286 | } |
1288 | 1287 | |
1289 | 1288 | |
@@ -1296,14 +1295,14 @@ discard block |
||
1296 | 1295 | * @return array |
1297 | 1296 | * @throws \EE_Error |
1298 | 1297 | */ |
1299 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1298 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1300 | 1299 | // bare minimum critical details include first name, last name, email address |
1301 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1300 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1302 | 1301 | // add address info to critical details? |
1303 | - if ( apply_filters( |
|
1302 | + if (apply_filters( |
|
1304 | 1303 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', |
1305 | 1304 | false |
1306 | - ) ) { |
|
1305 | + )) { |
|
1307 | 1306 | $address_details = array( |
1308 | 1307 | 'ATT_address', |
1309 | 1308 | 'ATT_address2', |
@@ -1313,13 +1312,13 @@ discard block |
||
1313 | 1312 | 'ATT_zip', |
1314 | 1313 | 'ATT_phone' |
1315 | 1314 | ); |
1316 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1315 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1317 | 1316 | } |
1318 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1319 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
|
1320 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1317 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1318 | + if ( ! isset($attendee_data[$critical_attendee_detail]) |
|
1319 | + || empty($attendee_data[$critical_attendee_detail]) |
|
1321 | 1320 | ) { |
1322 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
|
1321 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get( |
|
1323 | 1322 | $critical_attendee_detail |
1324 | 1323 | ); |
1325 | 1324 | } |
@@ -1337,11 +1336,11 @@ discard block |
||
1337 | 1336 | * @return \EE_Attendee |
1338 | 1337 | * @throws \EE_Error |
1339 | 1338 | */ |
1340 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1339 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1341 | 1340 | // create new attendee object |
1342 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1341 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1343 | 1342 | // set author to event creator |
1344 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1343 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1345 | 1344 | $new_attendee->save(); |
1346 | 1345 | return $new_attendee; |
1347 | 1346 | } |
@@ -1358,7 +1357,7 @@ discard block |
||
1358 | 1357 | */ |
1359 | 1358 | public function update_reg_step() { |
1360 | 1359 | // save everything |
1361 | - if ( $this->process_reg_step() ) { |
|
1360 | + if ($this->process_reg_step()) { |
|
1362 | 1361 | $this->checkout->redirect = true; |
1363 | 1362 | $this->checkout->redirect_url = add_query_arg( |
1364 | 1363 | array( |
@@ -1367,7 +1366,7 @@ discard block |
||
1367 | 1366 | ), |
1368 | 1367 | $this->checkout->thank_you_page_url |
1369 | 1368 | ); |
1370 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1369 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1371 | 1370 | return true; |
1372 | 1371 | } |
1373 | 1372 | return false; |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venue_Single |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venue', 'Venue_Single', 'run' ); |
|
40 | + EE_Config::register_route('venue', 'Venue_Single', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
82 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
83 | 83 | // don't display entry meta because the existing theme will take car of that |
84 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
84 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
85 | 85 | } |
86 | 86 | return $template; |
87 | 87 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param string $title |
96 | 96 | * @return string |
97 | 97 | */ |
98 | - public function the_title( $title = '' ) { |
|
98 | + public function the_title($title = '') { |
|
99 | 99 | return $title; |
100 | 100 | } |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $content |
108 | 108 | * @return string |
109 | 109 | */ |
110 | - public function venue_details( $content ) { |
|
110 | + public function venue_details($content) { |
|
111 | 111 | global $post; |
112 | 112 | if ( |
113 | 113 | $post->post_type == 'espresso_venues' |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | // it uses the_content() for displaying the $post->post_content |
118 | 118 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
119 | 119 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
120 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
120 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
121 | 121 | // add filters we want |
122 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
122 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
123 | 123 | // now load our template |
124 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
124 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
125 | 125 | // remove other filters we added so they won't get applied to the next post |
126 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
126 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | 127 | } |
128 | 128 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
129 | - return ! empty( $template ) ? $template : $content; |
|
129 | + return ! empty($template) ? $template : $content; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param string $content |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function venue_location( $content ) { |
|
142 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
141 | + public function venue_location($content) { |
|
142 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function wp_enqueue_scripts() { |
154 | 154 | // get some style |
155 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) { |
|
155 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) { |
|
156 | 156 | // first check theme folder |
157 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
158 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
159 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
160 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
157 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
158 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
159 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
160 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
161 | 161 | } |
162 | - wp_enqueue_style( $this->theme ); |
|
163 | - if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) { |
|
164 | - add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 ); |
|
162 | + wp_enqueue_style($this->theme); |
|
163 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
164 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Venues_Archive |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks() { |
40 | - EE_Config::register_route( 'venues', 'Venues_Archive', 'run' ); |
|
40 | + EE_Config::register_route('venues', 'Venues_Archive', 'run'); |
|
41 | 41 | // EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' ); |
42 | 42 | } |
43 | 43 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @access public |
59 | 59 | * @param \WP $WP |
60 | 60 | */ |
61 | - public function run( $WP ) { |
|
61 | + public function run($WP) { |
|
62 | 62 | // check what template is loaded |
63 | - add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 ); |
|
64 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 ); |
|
63 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
64 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @param string $template |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function template_include( $template ) { |
|
76 | + public function template_include($template) { |
|
77 | 77 | // not a custom template? |
78 | - if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) { |
|
78 | + if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') { |
|
79 | 79 | EEH_Template::load_espresso_theme_functions(); |
80 | 80 | // then add extra event data via hooks |
81 | - add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 ); |
|
81 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
82 | 82 | // don't know if theme uses the_excerpt |
83 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
83 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
84 | 84 | // or the_content |
85 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
85 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
86 | 86 | // don't display entry meta because the existing theme will take care of that |
87 | - add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' ); |
|
87 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
88 | 88 | } |
89 | 89 | return $template; |
90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $title |
99 | 99 | * @return string |
100 | 100 | */ |
101 | - public function the_title( $title = '' ) { |
|
101 | + public function the_title($title = '') { |
|
102 | 102 | return $title; |
103 | 103 | } |
104 | 104 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param string $content |
111 | 111 | * @return string |
112 | 112 | */ |
113 | - public function venue_details( $content ) { |
|
113 | + public function venue_details($content) { |
|
114 | 114 | global $post; |
115 | 115 | if ( |
116 | 116 | $post->post_type == 'espresso_venues' |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | // it uses the_content() for displaying the $post->post_content |
121 | 121 | // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
122 | 122 | // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
123 | - remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
124 | - remove_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
123 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
124 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
125 | 125 | // add filters we want |
126 | - add_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
127 | - add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
126 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
127 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
128 | 128 | // now load our template |
129 | - $template = EEH_Template::locate_template( 'content-espresso_venues-details.php' ); |
|
129 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
130 | 130 | //now add our filter back in, plus some others |
131 | - add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 ); |
|
132 | - add_filter( 'the_content', array( $this, 'venue_details' ), 100 ); |
|
131 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
132 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
133 | 133 | // remove other filters we added so they won't get applied to the next post |
134 | - remove_filter( 'the_content', array( $this, 'venue_location' ), 110 ); |
|
135 | - remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 ); |
|
134 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
135 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
136 | 136 | // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
137 | 137 | } |
138 | - return ! empty( $template ) ? $template : $content; |
|
138 | + return ! empty($template) ? $template : $content; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $content |
148 | 148 | * @return string |
149 | 149 | */ |
150 | - public function venue_location( $content ) { |
|
151 | - return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' ); |
|
150 | + public function venue_location($content) { |
|
151 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function wp_enqueue_scripts() { |
164 | 164 | // get some style |
165 | - if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) { |
|
165 | + if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) { |
|
166 | 166 | // first check theme folder |
167 | - if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) { |
|
168 | - wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
169 | - } else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) { |
|
170 | - wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
167 | + if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) { |
|
168 | + wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
169 | + } else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) { |
|
170 | + wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default')); |
|
171 | 171 | } |
172 | - wp_enqueue_style( $this->theme ); |
|
172 | + wp_enqueue_style($this->theme); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Bank extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Bank extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $this->_pretty_name = __("Bank", 'event_espresso'); |
39 | 39 | parent::__construct($pm_instance); |
40 | 40 | $this->_default_button_url = $this->file_url().'lib'.DS.'bank-logo.png'; |
41 | - $this->_default_description = __( 'Make payment using an electronic funds transfer from your bank.', 'event_espresso' ); |
|
41 | + $this->_default_description = __('Make payment using an electronic funds transfer from your bank.', 'event_espresso'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @param \EE_Transaction $transaction |
49 | 49 | * @return NULL |
50 | 50 | */ |
51 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
51 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
52 | 52 | return NULL; |
53 | 53 | } |
54 | 54 | |
@@ -62,17 +62,17 @@ discard block |
||
62 | 62 | return new EE_Payment_Method_Form(array( |
63 | 63 | 'extra_meta_inputs'=>array( |
64 | 64 | 'page_title'=>new EE_Text_Input(array( |
65 | - 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
65 | + 'html_label_text'=> sprintf(__("Title %s", "event_espresso"), $this->get_help_tab_link()), |
|
66 | 66 | 'default'=> __("Electronic Funds Transfers", 'event_espresso') |
67 | 67 | )), |
68 | - 'payment_instructions'=>new EE_Text_Area_Input( array( |
|
69 | - 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | - 'html_help_text' => __( 'Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso' ), |
|
68 | + 'payment_instructions'=>new EE_Text_Area_Input(array( |
|
69 | + 'html_label_text'=> sprintf(__("Payment Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
70 | + 'html_help_text' => __('Provide instructions on how registrants can send the bank draft payment. Eg, mention your account name, bank account number, bank name, bank routing code, and bank address, etc.', 'event_espresso'), |
|
71 | 71 | 'default'=> sprintf( |
72 | 72 | __('Please initiate an electronic payment using the following bank information: %1$sAccount Owner: Luke Skywalker%1$sBank Account # 1234567890%1$sBank Name: Rebellion Bank%1$sRouting Number: 12345%1$sBank Address: 12345 Wookie Rd., Planet Corellian.%1$sPayment must be received within 48 hours of event date.', 'event_espresso'), |
73 | 73 | "\n" |
74 | 74 | ), |
75 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
75 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
76 | 76 | )), |
77 | 77 | ), |
78 | 78 | 'exclude'=>array('PMD_debug_mode') |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @see EE_PMT_Base::help_tabs_config() |
87 | 87 | * @return array |
88 | 88 | */ |
89 | - public function help_tabs_config(){ |
|
89 | + public function help_tabs_config() { |
|
90 | 90 | return array( |
91 | 91 | $this->get_help_tab_name() => array( |
92 | 92 | 'title' => __('Bank Draft Settings', 'event_espresso'), |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * Other gateways may want to override this, such as offline gateways. |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function payment_overview_content(EE_Payment $payment){ |
|
106 | + public function payment_overview_content(EE_Payment $payment) { |
|
107 | 107 | EE_Registry::instance()->load_helper('Template'); |
108 | 108 | $extra_meta_for_payment_method = $this->_pm_instance->all_extra_meta_array(); |
109 | 109 | $template_vars = array_merge( |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ), |
116 | 116 | $extra_meta_for_payment_method); |
117 | 117 | return EEH_Template::locate_template( |
118 | - 'payment_methods' . DS . 'Bank'. DS . 'templates' . DS . 'bank_payment_details_content.template.php', |
|
118 | + 'payment_methods'.DS.'Bank'.DS.'templates'.DS.'bank_payment_details_content.template.php', |
|
119 | 119 | $template_vars); |
120 | 120 | } |
121 | 121 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_PMT_Invoice extends EE_PMT_Base{ |
|
28 | +class EE_PMT_Invoice extends EE_PMT_Base { |
|
29 | 29 | |
30 | 30 | |
31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function __construct($pm_instance = NULL) { |
38 | 38 | $this->_pretty_name = __("Invoice", 'event_espresso'); |
39 | 39 | $this->_default_description = sprintf( |
40 | - __( 'After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.%1$sPlease note that event spaces will not be reserved until payment is received in full, and any remaining tickets could be sold to others in the meantime.%2$s%3$s', 'event_espresso' ), |
|
40 | + __('After clicking "Finalize Registration", you will be given instructions on how to access your invoice and complete your payment.%1$sPlease note that event spaces will not be reserved until payment is received in full, and any remaining tickets could be sold to others in the meantime.%2$s%3$s', 'event_espresso'), |
|
41 | 41 | '<br />', |
42 | 42 | '<span class="important-notice">', |
43 | 43 | '</span>' |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param \EE_Transaction $transaction |
54 | 54 | * @return NULL |
55 | 55 | */ |
56 | - public function generate_new_billing_form( EE_Transaction $transaction = NULL ) { |
|
56 | + public function generate_new_billing_form(EE_Transaction $transaction = NULL) { |
|
57 | 57 | return NULL; |
58 | 58 | } |
59 | 59 | |
@@ -66,53 +66,53 @@ discard block |
||
66 | 66 | public function generate_new_settings_form() { |
67 | 67 | $pdf_payee_input_name = 'pdf_payee_name'; |
68 | 68 | $confirmation_text_input_name = 'page_confirmation_text'; |
69 | - $form = new EE_Payment_Method_Form(array( |
|
69 | + $form = new EE_Payment_Method_Form(array( |
|
70 | 70 | // 'payment_method_type' => $this, |
71 | 71 | 'extra_meta_inputs'=>array( |
72 | 72 | $pdf_payee_input_name => new EE_Text_Input(array( |
73 | - 'html_label_text' => sprintf( __( 'Payee Name %s', 'event_espresso' ), $this->get_help_tab_link()) |
|
73 | + 'html_label_text' => sprintf(__('Payee Name %s', 'event_espresso'), $this->get_help_tab_link()) |
|
74 | 74 | )), |
75 | 75 | 'pdf_payee_email' => new EE_Email_Input(array( |
76 | - 'html_label_text' => sprintf( __( 'Payee Email %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
76 | + 'html_label_text' => sprintf(__('Payee Email %s', 'event_espresso'), $this->get_help_tab_link()), |
|
77 | 77 | )), |
78 | 78 | 'pdf_payee_tax_number' => new EE_Text_Input(array( |
79 | - 'html_label_text' => sprintf( __( 'Payee Tax Number %s', 'event_espresso' ), $this->get_help_tab_link()), |
|
79 | + 'html_label_text' => sprintf(__('Payee Tax Number %s', 'event_espresso'), $this->get_help_tab_link()), |
|
80 | 80 | )), |
81 | - 'pdf_payee_address' => new EE_Text_Area_Input( array( |
|
82 | - 'html_label_text' => sprintf( __( 'Payee Address %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
83 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
81 | + 'pdf_payee_address' => new EE_Text_Area_Input(array( |
|
82 | + 'html_label_text' => sprintf(__('Payee Address %s', 'event_espresso'), $this->get_help_tab_link()), |
|
83 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
84 | 84 | )), |
85 | 85 | 'pdf_instructions'=>new EE_Text_Area_Input(array( |
86 | - 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
86 | + 'html_label_text'=> sprintf(__("Instructions %s", "event_espresso"), $this->get_help_tab_link()), |
|
87 | 87 | 'default'=> __("Please send this invoice with payment attached to the address above, or use the payment link below. Payment must be received within 48 hours of event date.", 'event_espresso'), |
88 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
88 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
89 | 89 | )), |
90 | 90 | 'pdf_logo_image'=>new EE_Admin_File_Uploader_Input(array( |
91 | - 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
91 | + 'html_label_text'=> sprintf(__("Logo Image %s", "event_espresso"), $this->get_help_tab_link()), |
|
92 | 92 | 'default'=> EE_Config::instance()->organization->logo_url, |
93 | 93 | 'html_help_text'=> __("(Logo for the top left of the invoice)", 'event_espresso'), |
94 | 94 | )), |
95 | 95 | $confirmation_text_input_name =>new EE_Text_Area_Input(array( |
96 | - 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
96 | + 'html_label_text'=> sprintf(__("Confirmation Text %s", "event_espresso"), $this->get_help_tab_link()), |
|
97 | 97 | 'default'=> __("Payment must be received within 48 hours of event date. Details about where to send payment is included on the invoice.", 'event_espresso'), |
98 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
98 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
99 | 99 | )), |
100 | 100 | 'page_extra_info'=>new EE_Text_Area_Input(array( |
101 | - 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
102 | - 'validation_strategies' => array( new EE_Full_HTML_Validation_Strategy() ), |
|
101 | + 'html_label_text'=> sprintf(__("Extra Info %s", "event_espresso"), $this->get_help_tab_link()), |
|
102 | + 'validation_strategies' => array(new EE_Full_HTML_Validation_Strategy()), |
|
103 | 103 | )), |
104 | 104 | ), |
105 | 105 | 'include'=>array( |
106 | - 'PMD_ID', 'PMD_name','PMD_desc','PMD_admin_name','PMD_admin_desc', 'PMD_type','PMD_slug', 'PMD_open_by_default','PMD_button_url','PMD_scope','Currency','PMD_order', |
|
107 | - $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions','pdf_logo_image', |
|
106 | + 'PMD_ID', 'PMD_name', 'PMD_desc', 'PMD_admin_name', 'PMD_admin_desc', 'PMD_type', 'PMD_slug', 'PMD_open_by_default', 'PMD_button_url', 'PMD_scope', 'Currency', 'PMD_order', |
|
107 | + $pdf_payee_input_name, 'pdf_payee_email', 'pdf_payee_tax_number', 'pdf_payee_address', 'pdf_instructions', 'pdf_logo_image', |
|
108 | 108 | $confirmation_text_input_name, 'page_extra_info'), |
109 | 109 | )); |
110 | 110 | $form->add_subsections( |
111 | - array( 'header1' => new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_display.template.php' )), |
|
111 | + array('header1' => new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_display.template.php')), |
|
112 | 112 | $pdf_payee_input_name |
113 | 113 | ); |
114 | 114 | $form->add_subsections( |
115 | - array( 'header2'=>new EE_Form_Section_HTML_From_Template( 'payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php' )), |
|
115 | + array('header2'=>new EE_Form_Section_HTML_From_Template('payment_methods/Invoice/templates/invoice_settings_header_gateway.template.php')), |
|
116 | 116 | $confirmation_text_input_name |
117 | 117 | ); |
118 | 118 | return $form; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @see EE_PMT_Base::help_tabs_config() |
126 | 126 | * @return array |
127 | 127 | */ |
128 | - public function help_tabs_config(){ |
|
128 | + public function help_tabs_config() { |
|
129 | 129 | return array( |
130 | 130 | $this->get_help_tab_name() => array( |
131 | 131 | 'title' => __('Invoice Settings', 'event_espresso'), |
@@ -143,17 +143,17 @@ discard block |
||
143 | 143 | * @param \EE_Payment $payment |
144 | 144 | * @return string |
145 | 145 | */ |
146 | - public function payment_overview_content( EE_Payment $payment ){ |
|
146 | + public function payment_overview_content(EE_Payment $payment) { |
|
147 | 147 | EE_Registry::instance()->load_helper('Template'); |
148 | 148 | return EEH_Template::locate_template( |
149 | - 'payment_methods' . DS . 'Invoice'. DS . 'templates'.DS.'invoice_payment_details_content.template.php', |
|
149 | + 'payment_methods'.DS.'Invoice'.DS.'templates'.DS.'invoice_payment_details_content.template.php', |
|
150 | 150 | array_merge( |
151 | 151 | array( |
152 | 152 | 'payment_method' => $this->_pm_instance, |
153 | 153 | 'payment' => $payment, |
154 | 154 | 'page_confirmation_text' => '', |
155 | 155 | 'page_extra_info' => '', |
156 | - 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url( 'html' ) |
|
156 | + 'invoice_url' => $payment->transaction()->primary_registration()->invoice_url('html') |
|
157 | 157 | ), |
158 | 158 | $this->_pm_instance->all_extra_meta_array() |
159 | 159 | ) |
@@ -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 | * |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | * @param WP $WP |
52 | 52 | * @return void |
53 | 53 | */ |
54 | - public function run( WP $WP ) { |
|
55 | - if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) { |
|
54 | + public function run(WP $WP) { |
|
55 | + if (did_action('pre_get_posts') && did_action('send_headers')) { |
|
56 | 56 | global $wp_query; |
57 | 57 | EED_Single_Page_Checkout::load_reg_steps(); |
58 | - EED_Single_Page_Checkout::init( $wp_query ); |
|
58 | + EED_Single_Page_Checkout::init($wp_query); |
|
59 | 59 | } else { |
60 | 60 | // 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 |
61 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
61 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
62 | 62 | // this will trigger the EED_Single_Page_Checkout module's run() method during the pre_get_posts hook point, |
63 | 63 | // this allows us to initialize things, enqueue assets, etc, |
64 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'init' ), 10, 1 ); |
|
64 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'init'), 10, 1); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param array $attributes |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - public function process_shortcode( $attributes = array() ) { |
|
77 | + public function process_shortcode($attributes = array()) { |
|
78 | 78 | return EE_Registry::instance()->REQ->get_output(); |
79 | 79 | } |
80 | 80 |
@@ -6,11 +6,11 @@ |
||
6 | 6 | <li class="ticket-registration"> |
7 | 7 | <table class="registration-details"> |
8 | 8 | <tr class="odd"> |
9 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
9 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
10 | 10 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
11 | 11 | </tr> |
12 | 12 | <tr> |
13 | - <th><?php _e("Registration Code:", "event_espresso");?></th> |
|
13 | + <th><?php _e("Registration Code:", "event_espresso"); ?></th> |
|
14 | 14 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
15 | 15 | </tr> |
16 | 16 | </table> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @param EE_Line_Item $line_item |
18 | 18 | * @param array $options |
19 | - * @return mixed |
|
19 | + * @return string |
|
20 | 20 | */ |
21 | 21 | public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
22 | 22 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param EE_Line_Item $line_item |
96 | 96 | * @param array $options |
97 | - * @return mixed |
|
97 | + * @return string |
|
98 | 98 | */ |
99 | 99 | private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
100 | 100 | // start of row |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param EE_Line_Item $line_item |
125 | 125 | * @param array $options |
126 | - * @return mixed |
|
126 | + * @return string |
|
127 | 127 | */ |
128 | 128 | private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
129 | 129 | // start of row |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param EE_Line_Item $line_item |
155 | 155 | * @param array $options |
156 | - * @return mixed |
|
156 | + * @return string |
|
157 | 157 | */ |
158 | 158 | private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
159 | 159 | // start of row |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param EE_Line_Item $line_item |
180 | 180 | * @param string $text |
181 | 181 | * @param array $options |
182 | - * @return mixed |
|
182 | + * @return string |
|
183 | 183 | */ |
184 | 184 | private function _total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
185 | 185 | // colspan |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * _separator_row |
204 | 204 | * |
205 | 205 | * @param array $options |
206 | - * @return mixed |
|
206 | + * @return string |
|
207 | 207 | */ |
208 | 208 | private function _separator_row( $options = array() ) { |
209 | 209 | // colspan |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param array $options |
50 | 50 | * @return mixed |
51 | 51 | */ |
52 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
52 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
53 | 53 | |
54 | 54 | $html = ''; |
55 | 55 | // set some default options and merge with incoming |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr', |
61 | 61 | 'total_tr_css_class' => 'admin-primary-mbox-total-tr' |
62 | 62 | ); |
63 | - $options = array_merge( $default_options, (array)$options ); |
|
63 | + $options = array_merge($default_options, (array) $options); |
|
64 | 64 | |
65 | - switch( $line_item->type() ) { |
|
65 | + switch ($line_item->type()) { |
|
66 | 66 | |
67 | 67 | case EEM_Line_Item::type_line_item: |
68 | 68 | // item row |
69 | - $html .= $this->_item_row( $line_item, $options ); |
|
69 | + $html .= $this->_item_row($line_item, $options); |
|
70 | 70 | break; |
71 | 71 | |
72 | 72 | case EEM_Line_Item::type_sub_line_item: |
73 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
73 | + $html .= $this->_sub_item_row($line_item, $options); |
|
74 | 74 | break; |
75 | 75 | |
76 | 76 | case EEM_Line_Item::type_sub_total: |
77 | - if ( $line_item->quantity() === 0 ) { |
|
77 | + if ($line_item->quantity() === 0) { |
|
78 | 78 | return $html; |
79 | 79 | } |
80 | 80 | //loop through children |
81 | 81 | $child_line_items = $line_item->children(); |
82 | 82 | //loop through children |
83 | - foreach ( $child_line_items as $child_line_item ) { |
|
83 | + foreach ($child_line_items as $child_line_item) { |
|
84 | 84 | //recursively feed children back into this method |
85 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
85 | + $html .= $this->display_line_item($child_line_item, $options); |
|
86 | 86 | } |
87 | - $html .= $this->_sub_total_row( $line_item, $options ); |
|
87 | + $html .= $this->_sub_total_row($line_item, $options); |
|
88 | 88 | break; |
89 | 89 | |
90 | 90 | case EEM_Line_Item::type_tax: |
91 | - if ( $this->_show_taxes ) { |
|
92 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
91 | + if ($this->_show_taxes) { |
|
92 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
93 | 93 | } |
94 | 94 | break; |
95 | 95 | |
96 | 96 | case EEM_Line_Item::type_tax_sub_total: |
97 | - foreach( $line_item->children() as $child_line_item ) { |
|
98 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax ) { |
|
99 | - $this->display_line_item( $child_line_item, $options ); |
|
97 | + foreach ($line_item->children() as $child_line_item) { |
|
98 | + if ($child_line_item->type() == EEM_Line_Item::type_tax) { |
|
99 | + $this->display_line_item($child_line_item, $options); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | break; |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | $children = $line_item->children(); |
109 | 109 | |
110 | 110 | // loop thru all non-tax child line items |
111 | - foreach( $children as $child_line_item ) { |
|
112 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
111 | + foreach ($children as $child_line_item) { |
|
112 | + $html .= $this->display_line_item($child_line_item, $options); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $html .= $this->_taxes_html; |
116 | - $html .= $this->_total_row( $line_item, $options ); |
|
117 | - if ( $options['use_table_wrapper'] ) { |
|
118 | - $html = $this->_table_header( $options ) . $html . $this->_table_footer( $options ); |
|
116 | + $html .= $this->_total_row($line_item, $options); |
|
117 | + if ($options['use_table_wrapper']) { |
|
118 | + $html = $this->_table_header($options).$html.$this->_table_footer($options); |
|
119 | 119 | } |
120 | 120 | break; |
121 | 121 | |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | * @param array $options |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - protected function _table_header( $options ) { |
|
136 | - $html = EEH_HTML::table( '','', $options['table_css_class'] ); |
|
135 | + protected function _table_header($options) { |
|
136 | + $html = EEH_HTML::table('', '', $options['table_css_class']); |
|
137 | 137 | $html .= EEH_HTML::thead(); |
138 | 138 | $html .= EEH_HTML::tr(); |
139 | - $html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' ); |
|
140 | - $html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' ); |
|
141 | - $html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' ); |
|
142 | - $html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' ); |
|
143 | - $html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' ); |
|
139 | + $html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left'); |
|
140 | + $html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left'); |
|
141 | + $html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr'); |
|
142 | + $html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr'); |
|
143 | + $html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr'); |
|
144 | 144 | $html .= EEH_HTML::tbody(); |
145 | 145 | return $html; |
146 | 146 | } |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * @param array $options array of options for the table. |
153 | 153 | * @return string |
154 | 154 | */ |
155 | - protected function _table_footer( $options ) { |
|
156 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex(); |
|
155 | + protected function _table_footer($options) { |
|
156 | + return EEH_HTML::tbodyx().EEH_HTML::tablex(); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | * @param array $options |
166 | 166 | * @return mixed |
167 | 167 | */ |
168 | - protected function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
168 | + protected function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
169 | 169 | $line_item_related_object = $line_item->get_object(); |
170 | 170 | $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null; |
171 | 171 | // start of row |
172 | 172 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
173 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
173 | + $html = EEH_HTML::tr('', '', $row_class); |
|
174 | 174 | |
175 | 175 | |
176 | 176 | //Name Column |
@@ -178,45 +178,45 @@ discard block |
||
178 | 178 | |
179 | 179 | //related object scope. |
180 | 180 | $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : ''; |
181 | - $parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
181 | + $parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name; |
|
182 | 182 | $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : ''; |
183 | 183 | |
184 | 184 | |
185 | 185 | $name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name(); |
186 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html; |
|
186 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html; |
|
187 | 187 | $name_html .= $line_item->is_taxable() ? ' *' : ''; |
188 | 188 | //maybe preface with icon? |
189 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html; |
|
190 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>'; |
|
191 | - $name_html .= sprintf( |
|
192 | - _x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
189 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html; |
|
190 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>'; |
|
191 | + $name_html .= sprintf( |
|
192 | + _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), |
|
193 | 193 | '<span class="ee-line-item-related-parent-object">', |
194 | - $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ), |
|
195 | - $parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name, |
|
194 | + $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'), |
|
195 | + $parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name, |
|
196 | 196 | '</span>' |
197 | 197 | ); |
198 | - $html .= EEH_HTML::td( $name_html, '', 'jst-left' ); |
|
198 | + $html .= EEH_HTML::td($name_html, '', 'jst-left'); |
|
199 | 199 | //Type Column |
200 | 200 | $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : ''; |
201 | - $type_html .= $this->_get_cancellations( $line_item ); |
|
201 | + $type_html .= $this->_get_cancellations($line_item); |
|
202 | 202 | $type_html .= $line_item->OBJ_type() ? '<br />' : ''; |
203 | 203 | $code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : ''; |
204 | - $type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : ''; |
|
205 | - $html .= EEH_HTML::td( $type_html, '', 'jst-left' ); |
|
204 | + $type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : ''; |
|
205 | + $html .= EEH_HTML::td($type_html, '', 'jst-left'); |
|
206 | 206 | |
207 | 207 | |
208 | 208 | //Amount Column |
209 | - if ( $line_item->is_percent() ) { |
|
210 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' ); |
|
209 | + if ($line_item->is_percent()) { |
|
210 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght'); |
|
211 | 211 | } else { |
212 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' ); |
|
212 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | //QTY column |
216 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' ); |
|
216 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght'); |
|
217 | 217 | |
218 | 218 | //total column |
219 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
219 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
220 | 220 | |
221 | 221 | //finish things off and return |
222 | 222 | $html .= EEH_HTML::trx(); |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | * @param EE_Line_Item $line_item |
232 | 232 | * @return string |
233 | 233 | */ |
234 | - protected function _get_cancellations( EE_Line_Item $line_item ) { |
|
234 | + protected function _get_cancellations(EE_Line_Item $line_item) { |
|
235 | 235 | $html = ''; |
236 | 236 | $cancellations = $line_item->get_cancellations(); |
237 | - $cancellation = reset( $cancellations ); |
|
237 | + $cancellation = reset($cancellations); |
|
238 | 238 | // \EEH_Debug_Tools::printr( $cancellation, '$cancellation', __FILE__, __LINE__ ); |
239 | - if ( $cancellation instanceof EE_Line_Item ) { |
|
239 | + if ($cancellation instanceof EE_Line_Item) { |
|
240 | 240 | $html .= ' <span class="ee-line-item-id">'; |
241 | 241 | $html .= sprintf( |
242 | 242 | _n( |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * @param array $options |
262 | 262 | * @return mixed |
263 | 263 | */ |
264 | - protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
264 | + protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
265 | 265 | //for now we're not showing sub-items |
266 | 266 | return ''; |
267 | 267 | } |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | * @param array $options |
276 | 276 | * @return mixed |
277 | 277 | */ |
278 | - protected function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
278 | + protected function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
279 | 279 | // start of row |
280 | - $html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' ); |
|
280 | + $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); |
|
281 | 281 | // name th |
282 | - $html .= EEH_HTML::th( $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '', 'jst-rght', '', ' colspan="4"' ); |
|
282 | + $html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"'); |
|
283 | 283 | // total th |
284 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
284 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
285 | 285 | // end of row |
286 | 286 | $html .= EEH_HTML::trx(); |
287 | 287 | return $html; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * @param array $options |
299 | 299 | * @return mixed |
300 | 300 | */ |
301 | - protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
301 | + protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
302 | 302 | //currently not showing subtotal row |
303 | 303 | return ''; |
304 | 304 | } |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | * @param array $options |
313 | 313 | * @return mixed |
314 | 314 | */ |
315 | - protected function _total_row( EE_Line_Item $line_item, $options = array() ) { |
|
315 | + protected function _total_row(EE_Line_Item $line_item, $options = array()) { |
|
316 | 316 | // start of row |
317 | - $html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' ); |
|
317 | + $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); |
|
318 | 318 | // Total th label |
319 | - $total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' ); |
|
320 | - $html .= EEH_HTML::th( $total_label, '', 'jst-rght', '', ' colspan="4"' ); |
|
319 | + $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); |
|
320 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"'); |
|
321 | 321 | // total th |
322 | 322 | |
323 | - $html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' ); |
|
323 | + $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght'); |
|
324 | 324 | // end of row |
325 | 325 | $html .= EEH_HTML::trx(); |
326 | 326 | return $html; |
@@ -767,7 +767,7 @@ |
||
767 | 767 | * Takes care of setting up the addressee object(s) for the primary attendee. |
768 | 768 | * |
769 | 769 | * @access protected |
770 | - * @return array of EE_Addressee objects |
|
770 | + * @return EE_Messages_Addressee[] of EE_Addressee objects |
|
771 | 771 | */ |
772 | 772 | protected function _primary_attendee_addressees() { |
773 | 773 | $aee = $this->_default_addressee_data; |
@@ -864,8 +864,8 @@ |
||
864 | 864 | //set the attendee array to blank on each loop; |
865 | 865 | $aee = array(); |
866 | 866 | if ( isset( $this->_data->reg_obj ) |
867 | - && ( $this->_data->reg_obj->attendee_ID() != $att_id ) |
|
868 | - && $this->_single_message |
|
867 | + && ( $this->_data->reg_obj->attendee_ID() != $att_id ) |
|
868 | + && $this->_single_message |
|
869 | 869 | ) { |
870 | 870 | continue; |
871 | 871 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * EE_Base_Class_Object |
275 | 275 | * @return mixed ( EE_Base_Class||EE_Base_Class[] ) |
276 | 276 | */ |
277 | - abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id ); |
|
277 | + abstract protected function _get_data_for_context($context, EE_Registration $registration, $id); |
|
278 | 278 | |
279 | 279 | |
280 | 280 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @deprecated 4.9.0 |
302 | 302 | * @return int |
303 | 303 | */ |
304 | - protected function _get_id_for_msg_url( $context, EE_Registration $registration ) { |
|
304 | + protected function _get_id_for_msg_url($context, EE_Registration $registration) { |
|
305 | 305 | return 0; |
306 | 306 | } |
307 | 307 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * sending. |
331 | 331 | * @since 4.9.0 |
332 | 332 | */ |
333 | - public function do_messenger_hooks( $messenger = null ) { |
|
333 | + public function do_messenger_hooks($messenger = null) { |
|
334 | 334 | $this->_active_messenger = $messenger; |
335 | 335 | $this->_do_messenger_hooks(); |
336 | 336 | } |
@@ -379,10 +379,10 @@ discard block |
||
379 | 379 | * @param mixed $data This sets the data property for the message type with the incoming data used for generating. |
380 | 380 | * @return string (the reference for the data handler) (will be an empty string if could not be determined). |
381 | 381 | */ |
382 | - public function get_data_handler( $data ) { |
|
382 | + public function get_data_handler($data) { |
|
383 | 383 | $this->_data = $data; |
384 | 384 | $this->_set_data_handler(); |
385 | - return apply_filters( 'FHEE__EE_message_type__get_data_handler', $this->_data_handler, $this ); |
|
385 | + return apply_filters('FHEE__EE_message_type__get_data_handler', $this->_data_handler, $this); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -419,26 +419,26 @@ discard block |
||
419 | 419 | * @deprecated 4.9.0 Likely 4.9.10 or 4.10.0 will remove this method completely |
420 | 420 | * @return string generated url |
421 | 421 | */ |
422 | - public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) { |
|
422 | + public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) { |
|
423 | 423 | //validate context |
424 | 424 | //valid context? |
425 | - if ( ! isset( $this->_contexts[ $context ] ) ) { |
|
425 | + if ( ! isset($this->_contexts[$context])) { |
|
426 | 426 | throw new EE_Error( |
427 | 427 | sprintf( |
428 | - __( 'The context %s is not a valid context for %s.', 'event_espresso' ), |
|
428 | + __('The context %s is not a valid context for %s.', 'event_espresso'), |
|
429 | 429 | $context, |
430 | - get_class( $this ) |
|
430 | + get_class($this) |
|
431 | 431 | ) |
432 | 432 | ); |
433 | 433 | } |
434 | 434 | //valid sending_messenger? |
435 | 435 | $not_valid_msgr = false; |
436 | - foreach ( $this->_with_messengers as $generating => $sendings ) { |
|
437 | - if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === false ) { |
|
436 | + foreach ($this->_with_messengers as $generating => $sendings) { |
|
437 | + if (empty($sendings) || array_search($sending_messenger, $sendings) === false) { |
|
438 | 438 | $not_valid_msgr = true; |
439 | 439 | } |
440 | 440 | } |
441 | - if ( $not_valid_msgr ) { |
|
441 | + if ($not_valid_msgr) { |
|
442 | 442 | throw new EE_Error( |
443 | 443 | sprintf( |
444 | 444 | __( |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | 'event_espresso' |
447 | 447 | ), |
448 | 448 | $sending_messenger, |
449 | - get_class( $this ) |
|
449 | + get_class($this) |
|
450 | 450 | ) |
451 | 451 | ); |
452 | 452 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $this->name, |
458 | 458 | $registration, |
459 | 459 | $this->_GRP_ID, |
460 | - $this->_get_id_for_msg_url( $context, $registration ) |
|
460 | + $this->_get_id_for_msg_url($context, $registration) |
|
461 | 461 | ); |
462 | 462 | } |
463 | 463 | |
@@ -476,26 +476,26 @@ discard block |
||
476 | 476 | * EE_Base_Class_Object |
477 | 477 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
478 | 478 | */ |
479 | - public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) { |
|
479 | + public function get_data_for_context($context, EE_Registration $registration, $id = 0) { |
|
480 | 480 | //valid context? |
481 | - if ( ! isset( $this->_contexts[ $context ] ) ) { |
|
481 | + if ( ! isset($this->_contexts[$context])) { |
|
482 | 482 | throw new EE_Error( |
483 | 483 | sprintf( |
484 | - __( 'The context %s is not a valid context for %s.', 'event_espresso' ), |
|
484 | + __('The context %s is not a valid context for %s.', 'event_espresso'), |
|
485 | 485 | $context, |
486 | - get_class( $this ) |
|
486 | + get_class($this) |
|
487 | 487 | ) |
488 | 488 | ); |
489 | 489 | } |
490 | 490 | //get data and apply global and class specific filters on it. |
491 | 491 | $data = apply_filters( |
492 | 492 | 'FHEE__EE_message_type__get_data_for_context__data', |
493 | - $this->_get_data_for_context( $context, $registration, $id ), |
|
493 | + $this->_get_data_for_context($context, $registration, $id), |
|
494 | 494 | $this |
495 | 495 | ); |
496 | - $data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this ); |
|
496 | + $data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this); |
|
497 | 497 | //if empty then something went wrong! |
498 | - if ( empty( $data ) ) { |
|
498 | + if (empty($data)) { |
|
499 | 499 | throw new EE_Error( |
500 | 500 | sprintf( |
501 | 501 | __( |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | */ |
540 | 540 | protected function _set_with_messengers() { |
541 | 541 | $this->_with_messengers = array( |
542 | - 'email' => array( 'html' ), |
|
542 | + 'email' => array('html'), |
|
543 | 543 | ); |
544 | 544 | } |
545 | 545 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | */ |
554 | 554 | public function with_messengers() { |
555 | 555 | return apply_filters( |
556 | - 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), |
|
556 | + 'FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), |
|
557 | 557 | $this->_with_messengers |
558 | 558 | ); |
559 | 559 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $messengers = array() |
581 | 581 | ) { |
582 | 582 | //we can also further refine the context by action (if present). |
583 | - return $this->_get_admin_page_content( $page, $action, $extra, $messengers ); |
|
583 | + return $this->_get_admin_page_content($page, $action, $extra, $messengers); |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | |
@@ -615,10 +615,10 @@ discard block |
||
615 | 615 | public function get_master_templates() { |
616 | 616 | //first class specific filter then filter that by the global filter. |
617 | 617 | $master_templates = apply_filters( |
618 | - 'FHEE__' . get_class( $this ) . '__get_master_templates', |
|
618 | + 'FHEE__'.get_class($this).'__get_master_templates', |
|
619 | 619 | $this->_master_templates |
620 | 620 | ); |
621 | - return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this ); |
|
621 | + return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -632,20 +632,20 @@ discard block |
||
632 | 632 | * @return array An array indexed by context where each context is an array of EE_Messages_Addressee objects for |
633 | 633 | * that context |
634 | 634 | */ |
635 | - public function get_addressees( EE_Messages_incoming_data $data, $context = '' ) { |
|
635 | + public function get_addressees(EE_Messages_incoming_data $data, $context = '') { |
|
636 | 636 | //override _data |
637 | 637 | $this->_data = $data; |
638 | 638 | $addressees = array(); |
639 | 639 | //if incoming context then limit to that context |
640 | - if ( ! empty( $context ) ) { |
|
641 | - $cntxt = ! empty( $this->_contexts[ $context ] ) ? $this->_contexts[ $context ] : ''; |
|
642 | - if ( ! empty( $cntxt ) ) { |
|
640 | + if ( ! empty($context)) { |
|
641 | + $cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : ''; |
|
642 | + if ( ! empty($cntxt)) { |
|
643 | 643 | $this->_contexts = array(); |
644 | - $this->_contexts[ $context ] = $cntxt; |
|
644 | + $this->_contexts[$context] = $cntxt; |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 | $this->_set_default_addressee_data(); |
648 | - if ( $this->_process_data() ) { |
|
648 | + if ($this->_process_data()) { |
|
649 | 649 | $addressees = $this->_addressees; |
650 | 650 | } |
651 | 651 | return $addressees; |
@@ -661,14 +661,14 @@ discard block |
||
661 | 661 | */ |
662 | 662 | protected function _process_data() { |
663 | 663 | //at a minimum, we NEED EE_Attendee objects. |
664 | - if ( empty( $this->_data->attendees ) ) { |
|
665 | - return false; //there's no data to process! |
|
664 | + if (empty($this->_data->attendees)) { |
|
665 | + return false; //there's no data to process! |
|
666 | 666 | } |
667 | 667 | // process addressees for each context. Child classes will have to have methods for |
668 | 668 | // each context defined to handle the processing of the data object within them |
669 | - foreach ( $this->_contexts as $context => $details ) { |
|
670 | - $xpctd_method = '_' . $context . '_addressees'; |
|
671 | - if ( ! method_exists( $this, $xpctd_method ) ) { |
|
669 | + foreach ($this->_contexts as $context => $details) { |
|
670 | + $xpctd_method = '_'.$context.'_addressees'; |
|
671 | + if ( ! method_exists($this, $xpctd_method)) { |
|
672 | 672 | throw new EE_Error( |
673 | 673 | sprintf( |
674 | 674 | __( |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | ) |
681 | 681 | ); |
682 | 682 | } |
683 | - $this->_addressees[ $context ] = call_user_func( array( $this, $xpctd_method ) ); |
|
683 | + $this->_addressees[$context] = call_user_func(array($this, $xpctd_method)); |
|
684 | 684 | } |
685 | 685 | return true; //data was processed successfully. |
686 | 686 | } |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | 'grand_total_line_item' => $this->_data->grand_total_line_item, |
703 | 703 | 'txn' => $this->_data->txn, |
704 | 704 | 'payments' => $this->_data->payments, |
705 | - 'payment' => isset( $this->_data->payment ) && $this->_data->payment instanceof EE_Payment |
|
705 | + 'payment' => isset($this->_data->payment) && $this->_data->payment instanceof EE_Payment |
|
706 | 706 | ? $this->_data->payment |
707 | 707 | : null, |
708 | 708 | 'reg_objs' => $this->_data->reg_objs, |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | 'txn_status' => $this->_data->txn_status, |
716 | 716 | 'total_ticket_count' => $this->_data->total_ticket_count, |
717 | 717 | ); |
718 | - if ( is_array( $this->_data->primary_attendee_data ) ) { |
|
718 | + if (is_array($this->_data->primary_attendee_data)) { |
|
719 | 719 | $this->_default_addressee_data = array_merge( |
720 | 720 | $this->_default_addressee_data, |
721 | 721 | $this->_data->primary_attendee_data |
@@ -759,24 +759,24 @@ discard block |
||
759 | 759 | 'messenger', |
760 | 760 | ); |
761 | 761 | $contexts = $this->get_contexts(); |
762 | - foreach ( $contexts as $context => $details ) { |
|
763 | - $this->_valid_shortcodes[ $context ] = $all_shortcodes; |
|
762 | + foreach ($contexts as $context => $details) { |
|
763 | + $this->_valid_shortcodes[$context] = $all_shortcodes; |
|
764 | 764 | //make sure non admin context does not include the event_author shortcodes |
765 | - if ( $context != 'admin' ) { |
|
766 | - if ( ( $key = array_search( 'event_author', $this->_valid_shortcodes[ $context ] ) ) !== false ) { |
|
767 | - unset( $this->_valid_shortcodes[ $context ][ $key ] ); |
|
765 | + if ($context != 'admin') { |
|
766 | + if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) { |
|
767 | + unset($this->_valid_shortcodes[$context][$key]); |
|
768 | 768 | } |
769 | 769 | } |
770 | 770 | } |
771 | 771 | // make sure admin context does not include the recipient_details shortcodes |
772 | 772 | // IF we have admin context hooked in message types might not have that context. |
773 | - if ( ! empty( $this->_valid_shortcodes['admin'] ) ) { |
|
774 | - if ( ( $key = array_search( 'recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false ) { |
|
775 | - unset( $this->_valid_shortcodes['admin'][ $key ] ); |
|
773 | + if ( ! empty($this->_valid_shortcodes['admin'])) { |
|
774 | + if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) { |
|
775 | + unset($this->_valid_shortcodes['admin'][$key]); |
|
776 | 776 | } |
777 | 777 | //make sure admin context does not include the recipient_details shortcodes |
778 | - if ( ( $key = array_search( 'recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false ) { |
|
779 | - unset( $this->_valid_shortcodes['admin'][ $key ] ); |
|
778 | + if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) { |
|
779 | + unset($this->_valid_shortcodes['admin'][$key]); |
|
780 | 780 | } |
781 | 781 | } |
782 | 782 | } |
@@ -789,9 +789,9 @@ discard block |
||
789 | 789 | * @param array $new_config array of valid shortcodes (by context) |
790 | 790 | * @return void sets valid_shortcodes property |
791 | 791 | */ |
792 | - public function reset_valid_shortcodes_config( $new_config ) { |
|
793 | - foreach ( $new_config as $context => $shortcodes ) { |
|
794 | - $this->_valid_shortcodes[ $context ] = $shortcodes; |
|
792 | + public function reset_valid_shortcodes_config($new_config) { |
|
793 | + foreach ($new_config as $context => $shortcodes) { |
|
794 | + $this->_valid_shortcodes[$context] = $shortcodes; |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
@@ -808,13 +808,13 @@ discard block |
||
808 | 808 | $addressees = array(); |
809 | 809 | // first we need to get the event admin user id for all the events |
810 | 810 | // and setup an addressee object for each unique admin user. |
811 | - foreach ( $this->_data->events as $line_ref => $event ) { |
|
812 | - $admin_id = $this->_get_event_admin_id( $event['ID'] ); |
|
811 | + foreach ($this->_data->events as $line_ref => $event) { |
|
812 | + $admin_id = $this->_get_event_admin_id($event['ID']); |
|
813 | 813 | //make sure we are just including the events that belong to this admin! |
814 | - $admin_events[ $admin_id ][ $line_ref ] = $event; |
|
814 | + $admin_events[$admin_id][$line_ref] = $event; |
|
815 | 815 | } |
816 | 816 | //k now we can loop through the event_admins and setup the addressee data. |
817 | - foreach ( $admin_events as $admin_id => $event_details ) { |
|
817 | + foreach ($admin_events as $admin_id => $event_details) { |
|
818 | 818 | $aee = array( |
819 | 819 | 'user_id' => $admin_id, |
820 | 820 | 'events' => $event_details, |
@@ -822,8 +822,8 @@ discard block |
||
822 | 822 | 'recipient_id' => $admin_id, |
823 | 823 | 'recipient_type' => 'WP_User', |
824 | 824 | ); |
825 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
826 | - $addressees[] = new EE_Messages_Addressee( $aee ); |
|
825 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
826 | + $addressees[] = new EE_Messages_Addressee($aee); |
|
827 | 827 | } |
828 | 828 | return $addressees; |
829 | 829 | } |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | $aee['recipient_id'] = $aee['primary_att_obj'] instanceof EE_Attendee ? $aee['primary_att_obj']->ID() : 0; |
844 | 844 | $aee['recipient_type'] = 'Attendee'; |
845 | 845 | //great now we can instantiate the $addressee object and return (as an array); |
846 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
846 | + $add[] = new EE_Messages_Addressee($aee); |
|
847 | 847 | return $add; |
848 | 848 | } |
849 | 849 | |
@@ -860,25 +860,25 @@ discard block |
||
860 | 860 | //we just have to loop through the attendees. We'll also set the attached events for each attendee. |
861 | 861 | //use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we? |
862 | 862 | $already_processed = array(); |
863 | - foreach ( $this->_data->attendees as $att_id => $details ) { |
|
863 | + foreach ($this->_data->attendees as $att_id => $details) { |
|
864 | 864 | //set the attendee array to blank on each loop; |
865 | 865 | $aee = array(); |
866 | - if ( isset( $this->_data->reg_obj ) |
|
867 | - && ( $this->_data->reg_obj->attendee_ID() != $att_id ) |
|
866 | + if (isset($this->_data->reg_obj) |
|
867 | + && ($this->_data->reg_obj->attendee_ID() != $att_id) |
|
868 | 868 | && $this->_single_message |
869 | 869 | ) { |
870 | 870 | continue; |
871 | 871 | } |
872 | 872 | // is $this->_regs_for_sending present? |
873 | 873 | // If so, let's make sure we ONLY generate addressee for registrations in that array. |
874 | - if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
|
875 | - $regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] ); |
|
876 | - if ( empty( $regs_allowed ) ) { |
|
874 | + if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) { |
|
875 | + $regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']); |
|
876 | + if (empty($regs_allowed)) { |
|
877 | 877 | continue; |
878 | 878 | } |
879 | 879 | } |
880 | 880 | if ( |
881 | - in_array( $details['attendee_email'], $already_processed ) |
|
881 | + in_array($details['attendee_email'], $already_processed) |
|
882 | 882 | && apply_filters( |
883 | 883 | 'FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', |
884 | 884 | true, |
@@ -889,14 +889,14 @@ discard block |
||
889 | 889 | continue; |
890 | 890 | } |
891 | 891 | $already_processed[] = $details['attendee_email']; |
892 | - foreach ( $details as $item => $value ) { |
|
893 | - $aee[ $item ] = $value; |
|
894 | - if ( $item == 'line_ref' ) { |
|
895 | - foreach ( $value as $event_id ) { |
|
896 | - $aee['events'][ $event_id ] = $this->_data->events[ $event_id ]; |
|
892 | + foreach ($details as $item => $value) { |
|
893 | + $aee[$item] = $value; |
|
894 | + if ($item == 'line_ref') { |
|
895 | + foreach ($value as $event_id) { |
|
896 | + $aee['events'][$event_id] = $this->_data->events[$event_id]; |
|
897 | 897 | } |
898 | 898 | } |
899 | - if ( $item == 'attendee_email' ) { |
|
899 | + if ($item == 'attendee_email') { |
|
900 | 900 | $aee['attendee_email'] = $value; |
901 | 901 | } |
902 | 902 | /*if ( $item == 'registration_id' ) { |
@@ -905,13 +905,13 @@ discard block |
||
905 | 905 | } |
906 | 906 | // note the FIRST reg object in this array is the one |
907 | 907 | // we'll use for this attendee as the primary registration for this attendee. |
908 | - $aee['reg_obj'] = reset( $this->_data->attendees[ $att_id ]['reg_objs'] ); |
|
908 | + $aee['reg_obj'] = reset($this->_data->attendees[$att_id]['reg_objs']); |
|
909 | 909 | $aee['attendees'] = $this->_data->attendees; |
910 | 910 | $aee['recipient_id'] = $att_id; |
911 | 911 | $aee['recipient_type'] = 'Attendee'; |
912 | 912 | //merge in the primary attendee data |
913 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
914 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
913 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
914 | + $add[] = new EE_Messages_Addressee($aee); |
|
915 | 915 | } |
916 | 916 | return $add; |
917 | 917 | } |
@@ -922,8 +922,8 @@ discard block |
||
922 | 922 | * @param $event_id |
923 | 923 | * @return int |
924 | 924 | */ |
925 | - protected function _get_event_admin_id( $event_id ) { |
|
926 | - $event = EEM_Event::instance()->get_one_by_ID( $event_id ); |
|
925 | + protected function _get_event_admin_id($event_id) { |
|
926 | + $event = EEM_Event::instance()->get_one_by_ID($event_id); |
|
927 | 927 | return $event instanceof EE_Event ? $event->wp_user() : 0; |
928 | 928 | } |
929 | 929 |