@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | /** @var string $default_hidden_inputs */ |
5 | 5 | ?> |
6 | 6 | <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text"> |
7 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_information_pg', sprintf( __('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>' )); ?> |
|
7 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_information_pg', sprintf(__('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>')); ?> |
|
8 | 8 | </p> |
9 | 9 | |
10 | 10 | <?php |
@@ -12,34 +12,34 @@ discard block |
||
12 | 12 | $prev_event = 0; |
13 | 13 | $prev_ticket = 0; |
14 | 14 | |
15 | -if ( count( $registrations ) > 0 ) { |
|
16 | - foreach ( $registrations as $registration ) { |
|
17 | - if ( $registration instanceof EE_Registration ) { |
|
15 | +if (count($registrations) > 0) { |
|
16 | + foreach ($registrations as $registration) { |
|
17 | + if ($registration instanceof EE_Registration) { |
|
18 | 18 | $att_nmbr++; |
19 | 19 | ?> |
20 | 20 | |
21 | - <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link();?>" class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID();?>"> |
|
21 | + <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>" class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID(); ?>"> |
|
22 | 22 | |
23 | - <?php if ( $registration->event()->ID() !== $prev_event ) { ?> |
|
23 | + <?php if ($registration->event()->ID() !== $prev_event) { ?> |
|
24 | 24 | <h4 id="event_title-<?php echo $registration->event()->ID() ?>" class="big-event-title-hdr"> |
25 | 25 | <?php echo $registration->event()->name(); ?> |
26 | 26 | </h4> |
27 | 27 | <?php } ?> |
28 | - <?php if ( $registration->ticket()->ID() !== $prev_ticket ) { ?> |
|
29 | - <?php if ( ! $revisit ) { ?> |
|
28 | + <?php if ($registration->ticket()->ID() !== $prev_ticket) { ?> |
|
29 | + <?php if ( ! $revisit) { ?> |
|
30 | 30 | <div class="spco-ticket-info-dv small-text"> |
31 | - <h5><?php _e('Details', 'event_espresso');?></h5> |
|
31 | + <h5><?php _e('Details', 'event_espresso'); ?></h5> |
|
32 | 32 | <table> |
33 | 33 | <thead> |
34 | 34 | <tr> |
35 | - <th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th> |
|
36 | - <th scope="col" width="7.5%" class="jst-rght"><?php _e('Qty', 'event_espresso');?></th> |
|
37 | - <th scope="col" width="17.5%" class="jst-rght"><?php _e('Price', 'event_espresso');?></th> |
|
38 | - <th scope="col" width="17.5%" class="jst-rght"><?php _e('Total', 'event_espresso');?></th> |
|
35 | + <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th> |
|
36 | + <th scope="col" width="7.5%" class="jst-rght"><?php _e('Qty', 'event_espresso'); ?></th> |
|
37 | + <th scope="col" width="17.5%" class="jst-rght"><?php _e('Price', 'event_espresso'); ?></th> |
|
38 | + <th scope="col" width="17.5%" class="jst-rght"><?php _e('Total', 'event_espresso'); ?></th> |
|
39 | 39 | </tr> |
40 | 40 | </thead> |
41 | 41 | <tbody> |
42 | - <?php echo $ticket_line_item[ $registration->ticket()->ID() ]; ?> |
|
42 | + <?php echo $ticket_line_item[$registration->ticket()->ID()]; ?> |
|
43 | 43 | </tbody> |
44 | 44 | </table> |
45 | 45 | </div> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | <?php |
50 | 50 | // ATTENDEE QUESTIONS |
51 | - $reg_form = EE_Template_Layout::get_subform_name( $registration->reg_url_link() ); |
|
51 | + $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link()); |
|
52 | 52 | echo ${$reg_form}; |
53 | 53 | ?> |
54 | 54 |
@@ -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 | /** |
@@ -135,28 +135,28 @@ discard block |
||
135 | 135 | $registration instanceof EE_Registration |
136 | 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()] |
|
143 | - ) |
|
144 | - ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
145 | - : 1; |
|
146 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
147 | - $this->checkout->cart->get_grand_total(), |
|
148 | - 'Ticket', |
|
149 | - array($registration->ticket()->ID()) |
|
150 | - ); |
|
151 | - $ticket_line_item = is_array($ticket_line_item) |
|
152 | - ? reset($ticket_line_item) |
|
153 | - : $ticket_line_item; |
|
154 | - $template_args['ticket_line_item'][$registration->ticket()->ID()] = |
|
155 | - $Line_Item_Display->display_line_item($ticket_line_item); |
|
156 | - } |
|
157 | - if ($registration->is_primary_registrant()) { |
|
158 | - $primary_registrant = $registration->reg_url_link(); |
|
159 | - } |
|
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 | + ) |
|
144 | + ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 |
|
145 | + : 1; |
|
146 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( |
|
147 | + $this->checkout->cart->get_grand_total(), |
|
148 | + 'Ticket', |
|
149 | + array($registration->ticket()->ID()) |
|
150 | + ); |
|
151 | + $ticket_line_item = is_array($ticket_line_item) |
|
152 | + ? reset($ticket_line_item) |
|
153 | + : $ticket_line_item; |
|
154 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = |
|
155 | + $Line_Item_Display->display_line_item($ticket_line_item); |
|
156 | + } |
|
157 | + if ($registration->is_primary_registrant()) { |
|
158 | + $primary_registrant = $registration->reg_url_link(); |
|
159 | + } |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | // print_copy_info ? |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // generate hidden input |
169 | 169 | if ( |
170 | 170 | isset( $subsections[ $primary_registrant ] ) |
171 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
171 | + && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
172 | 172 | ) { |
173 | 173 | $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
174 | 174 | } |
@@ -196,42 +196,42 @@ discard block |
||
196 | 196 | |
197 | 197 | |
198 | 198 | |
199 | - /** |
|
199 | + /** |
|
200 | 200 | * @param EE_Registration $registration |
201 | 201 | * @return EE_Form_Section_Base |
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | 204 | private function _registrations_reg_form( EE_Registration $registration ) { |
205 | 205 | static $attendee_nmbr = 1; |
206 | - $form_args = array(); |
|
206 | + $form_args = array(); |
|
207 | 207 | // verify that registration has valid event |
208 | 208 | if ( $registration->event() instanceof EE_Event ) { |
209 | 209 | $question_groups = $registration->event()->question_groups( |
210 | - array( |
|
211 | - array( |
|
212 | - 'Event.EVT_ID' => $registration->event()->ID(), |
|
213 | - 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
214 | - ), |
|
215 | - 'order_by' => array('QSG_order' => 'ASC') |
|
216 | - ) |
|
217 | - ); |
|
210 | + array( |
|
211 | + array( |
|
212 | + 'Event.EVT_ID' => $registration->event()->ID(), |
|
213 | + 'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false |
|
214 | + ), |
|
215 | + 'order_by' => array('QSG_order' => 'ASC') |
|
216 | + ) |
|
217 | + ); |
|
218 | 218 | if ( $question_groups ) { |
219 | - // array of params to pass to parent constructor |
|
220 | - $form_args = array( |
|
221 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
222 | - 'html_class' => 'ee-reg-form-attendee-dv', |
|
223 | - 'html_style' => $this->checkout->admin_request |
|
224 | - ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
225 | - : '', |
|
226 | - 'subsections' => array(), |
|
227 | - 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
228 | - array( |
|
229 | - 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
230 | - 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
231 | - ) |
|
232 | - ) |
|
233 | - ); |
|
234 | - foreach ( $question_groups as $question_group ) { |
|
219 | + // array of params to pass to parent constructor |
|
220 | + $form_args = array( |
|
221 | + 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
222 | + 'html_class' => 'ee-reg-form-attendee-dv', |
|
223 | + 'html_style' => $this->checkout->admin_request |
|
224 | + ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
|
225 | + : '', |
|
226 | + 'subsections' => array(), |
|
227 | + 'layout_strategy' => new EE_Fieldset_Section_Layout( |
|
228 | + array( |
|
229 | + 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
|
230 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
231 | + ) |
|
232 | + ) |
|
233 | + ); |
|
234 | + foreach ( $question_groups as $question_group ) { |
|
235 | 235 | if ( $question_group instanceof EE_Question_Group ) { |
236 | 236 | $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
237 | 237 | $registration, |
@@ -239,19 +239,19 @@ discard block |
||
239 | 239 | ); |
240 | 240 | } |
241 | 241 | } |
242 | - // add hidden input |
|
243 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
244 | - $registration |
|
245 | - ); |
|
246 | - // if we have question groups for additional attendees, then display the copy options |
|
242 | + // add hidden input |
|
243 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( |
|
244 | + $registration |
|
245 | + ); |
|
246 | + // if we have question groups for additional attendees, then display the copy options |
|
247 | 247 | $this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info; |
248 | - if ($registration->is_primary_registrant()) { |
|
249 | - // generate hidden input |
|
250 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
251 | - } |
|
252 | - } |
|
248 | + if ($registration->is_primary_registrant()) { |
|
249 | + // generate hidden input |
|
250 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
251 | + } |
|
252 | + } |
|
253 | 253 | } |
254 | - $attendee_nmbr++; |
|
254 | + $attendee_nmbr++; |
|
255 | 255 | return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : new EE_Form_Section_HTML(); |
256 | 256 | } |
257 | 257 | |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | if ( isset( $valid_data[ $reg_url_link ] ) ) { |
885 | 885 | // do we need to copy basic info from primary attendee ? |
886 | 886 | $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
887 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
887 | + && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
888 | 888 | ? true |
889 | 889 | : false; |
890 | 890 | // filter form input data for this registration |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | ? $form_input |
1060 | 1060 | : $form_input . '-' . $registration->reg_url_link(); |
1061 | 1061 | $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
1062 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1062 | + && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1063 | 1063 | ? true |
1064 | 1064 | : false; |
1065 | 1065 | //rename form_inputs if they are EE_Attendee properties |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | // then attempt to copy them from the primary attendee |
1180 | 1180 | if ( |
1181 | 1181 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1182 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1182 | + && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1183 | 1183 | ) { |
1184 | 1184 | return $this->checkout->primary_attendee_obj; |
1185 | 1185 | } |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | } |
1298 | 1298 | foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
1299 | 1299 | if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
1300 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1300 | + || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1301 | 1301 | ) { |
1302 | 1302 | $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
1303 | 1303 | $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,13 +127,13 @@ 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 | 138 | $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
139 | 139 | if ( ! $this->checkout->admin_request) { |
@@ -160,17 +160,17 @@ discard block |
||
160 | 160 | } |
161 | 161 | } |
162 | 162 | // print_copy_info ? |
163 | - if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) { |
|
163 | + if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) { |
|
164 | 164 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
165 | 165 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info |
166 | 166 | ? $this->_copy_attendee_info_form() |
167 | 167 | : $this->_auto_copy_attendee_info(); |
168 | 168 | // generate hidden input |
169 | 169 | if ( |
170 | - isset( $subsections[ $primary_registrant ] ) |
|
171 | - && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper |
|
170 | + isset($subsections[$primary_registrant]) |
|
171 | + && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper |
|
172 | 172 | ) { |
173 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
173 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
@@ -182,8 +182,7 @@ discard block |
||
182 | 182 | 'html_id' => $this->reg_form_name(), |
183 | 183 | 'subsections' => $subsections, |
184 | 184 | 'layout_strategy' => $this->checkout->admin_request ? |
185 | - new EE_Div_Per_Section_Layout() : |
|
186 | - new EE_Template_Layout( |
|
185 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
187 | 186 | array( |
188 | 187 | 'layout_template_file' => $this->_template, // layout_template |
189 | 188 | 'template_args' => $template_args |
@@ -201,11 +200,11 @@ discard block |
||
201 | 200 | * @return EE_Form_Section_Base |
202 | 201 | * @throws \EE_Error |
203 | 202 | */ |
204 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
203 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
205 | 204 | static $attendee_nmbr = 1; |
206 | 205 | $form_args = array(); |
207 | 206 | // verify that registration has valid event |
208 | - if ( $registration->event() instanceof EE_Event ) { |
|
207 | + if ($registration->event() instanceof EE_Event) { |
|
209 | 208 | $question_groups = $registration->event()->question_groups( |
210 | 209 | array( |
211 | 210 | array( |
@@ -215,10 +214,10 @@ discard block |
||
215 | 214 | 'order_by' => array('QSG_order' => 'ASC') |
216 | 215 | ) |
217 | 216 | ); |
218 | - if ( $question_groups ) { |
|
217 | + if ($question_groups) { |
|
219 | 218 | // array of params to pass to parent constructor |
220 | 219 | $form_args = array( |
221 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
220 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
222 | 221 | 'html_class' => 'ee-reg-form-attendee-dv', |
223 | 222 | 'html_style' => $this->checkout->admin_request |
224 | 223 | ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' |
@@ -231,9 +230,9 @@ discard block |
||
231 | 230 | ) |
232 | 231 | ) |
233 | 232 | ); |
234 | - foreach ( $question_groups as $question_group ) { |
|
235 | - if ( $question_group instanceof EE_Question_Group ) { |
|
236 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( |
|
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( |
|
237 | 236 | $registration, |
238 | 237 | $question_group |
239 | 238 | ); |
@@ -252,7 +251,7 @@ discard block |
||
252 | 251 | } |
253 | 252 | } |
254 | 253 | $attendee_nmbr++; |
255 | - return ! empty($form_args) ? new EE_Form_Section_Proper( $form_args ) : new EE_Form_Section_HTML(); |
|
254 | + return ! empty($form_args) ? new EE_Form_Section_Proper($form_args) : new EE_Form_Section_HTML(); |
|
256 | 255 | } |
257 | 256 | |
258 | 257 | |
@@ -273,7 +272,7 @@ discard block |
||
273 | 272 | // generate hidden input |
274 | 273 | return new EE_Hidden_Input( |
275 | 274 | array( |
276 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
275 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
277 | 276 | 'default' => $additional_attendee_reg_info |
278 | 277 | ) |
279 | 278 | ); |
@@ -287,26 +286,26 @@ discard block |
||
287 | 286 | * @return EE_Form_Section_Proper |
288 | 287 | * @throws \EE_Error |
289 | 288 | */ |
290 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
289 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
291 | 290 | // array of params to pass to parent constructor |
292 | 291 | $form_args = array( |
293 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
292 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
294 | 293 | 'html_class' => $this->checkout->admin_request |
295 | 294 | ? 'form-table ee-reg-form-qstn-grp-dv' |
296 | 295 | : 'ee-reg-form-qstn-grp-dv', |
297 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
296 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
298 | 297 | 'subsections' => array( |
299 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
298 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
300 | 299 | ), |
301 | 300 | 'layout_strategy' => $this->checkout->admin_request |
302 | 301 | ? new EE_Admin_Two_Column_Layout() |
303 | 302 | : new EE_Div_Per_Section_Layout() |
304 | 303 | ); |
305 | 304 | // where params |
306 | - $query_params = array( 'QST_deleted' => 0 ); |
|
305 | + $query_params = array('QST_deleted' => 0); |
|
307 | 306 | // don't load admin only questions on the frontend |
308 | - if ( ! $this->checkout->admin_request ) { |
|
309 | - $query_params['QST_admin_only'] = array( '!=', true ); |
|
307 | + if ( ! $this->checkout->admin_request) { |
|
308 | + $query_params['QST_admin_only'] = array('!=', true); |
|
310 | 309 | } |
311 | 310 | $questions = $question_group->get_many_related( |
312 | 311 | 'Question', |
@@ -328,10 +327,10 @@ discard block |
||
328 | 327 | ) |
329 | 328 | ); |
330 | 329 | // loop thru questions |
331 | - foreach ( $questions as $question ) { |
|
332 | - if( $question instanceof EE_Question ){ |
|
330 | + foreach ($questions as $question) { |
|
331 | + if ($question instanceof EE_Question) { |
|
333 | 332 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
334 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
333 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
335 | 334 | } |
336 | 335 | } |
337 | 336 | $form_args['subsections'] = apply_filters( |
@@ -352,7 +351,7 @@ discard block |
||
352 | 351 | ) |
353 | 352 | ); |
354 | 353 | // d( $form_args ); |
355 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
354 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
356 | 355 | return apply_filters( |
357 | 356 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', |
358 | 357 | $question_group_reg_form, |
@@ -369,11 +368,11 @@ discard block |
||
369 | 368 | * @param EE_Question_Group $question_group |
370 | 369 | * @return EE_Form_Section_HTML |
371 | 370 | */ |
372 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
371 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
373 | 372 | $html = ''; |
374 | 373 | // group_name |
375 | - if ( $question_group->show_group_name() && $question_group->name() !== '' ) { |
|
376 | - if ( $this->checkout->admin_request ) { |
|
374 | + if ($question_group->show_group_name() && $question_group->name() !== '') { |
|
375 | + if ($this->checkout->admin_request) { |
|
377 | 376 | $html .= EEH_HTML::br(); |
378 | 377 | $html .= EEH_HTML::h3( |
379 | 378 | $question_group->name(), |
@@ -387,7 +386,7 @@ discard block |
||
387 | 386 | } |
388 | 387 | } |
389 | 388 | // group_desc |
390 | - if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) { |
|
389 | + if ($question_group->show_group_desc() && $question_group->desc() !== '') { |
|
391 | 390 | $html .= EEH_HTML::p( |
392 | 391 | $question_group->desc(), |
393 | 392 | '', |
@@ -397,7 +396,7 @@ discard block |
||
397 | 396 | ); |
398 | 397 | |
399 | 398 | } |
400 | - return new EE_Form_Section_HTML( $html ); |
|
399 | + return new EE_Form_Section_HTML($html); |
|
401 | 400 | } |
402 | 401 | |
403 | 402 | |
@@ -407,7 +406,7 @@ discard block |
||
407 | 406 | * @return EE_Form_Section_Proper |
408 | 407 | * @throws \EE_Error |
409 | 408 | */ |
410 | - private function _copy_attendee_info_form(){ |
|
409 | + private function _copy_attendee_info_form() { |
|
411 | 410 | // array of params to pass to parent constructor |
412 | 411 | return new EE_Form_Section_Proper( |
413 | 412 | array( |
@@ -436,7 +435,7 @@ discard block |
||
436 | 435 | private function _auto_copy_attendee_info() { |
437 | 436 | return new EE_Form_Section_HTML( |
438 | 437 | EEH_Template::locate_template( |
439 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
438 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
440 | 439 | apply_filters( |
441 | 440 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', |
442 | 441 | array() |
@@ -460,32 +459,32 @@ discard block |
||
460 | 459 | $copy_attendee_info_inputs = array(); |
461 | 460 | $prev_ticket = NULL; |
462 | 461 | // grab the saved registrations from the transaction |
463 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
464 | - foreach ( $registrations as $registration ) { |
|
462 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
463 | + foreach ($registrations as $registration) { |
|
465 | 464 | // for all attendees other than the primary attendee |
466 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
465 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
467 | 466 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
468 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
467 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
469 | 468 | $item_name = $registration->ticket()->name(); |
470 | 469 | $item_name .= $registration->ticket()->description() !== '' |
471 | - ? ' - ' . $registration->ticket()->description() |
|
470 | + ? ' - '.$registration->ticket()->description() |
|
472 | 471 | : ''; |
473 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
474 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
472 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
473 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
475 | 474 | ); |
476 | 475 | $prev_ticket = $registration->ticket()->ID(); |
477 | 476 | } |
478 | 477 | |
479 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
478 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
480 | 479 | EE_Checkbox_Multi_Input( |
481 | 480 | array( |
482 | 481 | $registration->ID() => sprintf( |
483 | - __( 'Attendee #%s', 'event_espresso' ), |
|
482 | + __('Attendee #%s', 'event_espresso'), |
|
484 | 483 | $registration->count() |
485 | 484 | ) |
486 | 485 | ), |
487 | 486 | array( |
488 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
487 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
489 | 488 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
490 | 489 | 'display_html_label_text' => false |
491 | 490 | ) |
@@ -505,7 +504,7 @@ discard block |
||
505 | 504 | * @return EE_Form_Input_Base |
506 | 505 | * @throws \EE_Error |
507 | 506 | */ |
508 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
507 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
509 | 508 | // generate hidden input |
510 | 509 | return new EE_Hidden_Input( |
511 | 510 | array( |
@@ -524,7 +523,7 @@ discard block |
||
524 | 523 | * @return EE_Form_Input_Base |
525 | 524 | * @throws \EE_Error |
526 | 525 | */ |
527 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
526 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
528 | 527 | |
529 | 528 | // if this question was for an attendee detail, then check for that answer |
530 | 529 | $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( |
@@ -533,32 +532,32 @@ discard block |
||
533 | 532 | ); |
534 | 533 | $answer = $answer_value === null |
535 | 534 | ? EEM_Answer::instance()->get_one( |
536 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
535 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
537 | 536 | ) |
538 | 537 | : null; |
539 | 538 | // if NOT returning to edit an existing registration |
540 | 539 | // OR if this question is for an attendee property |
541 | 540 | // OR we still don't have an EE_Answer object |
542 | - if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) { |
|
541 | + if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) { |
|
543 | 542 | // create an EE_Answer object for storing everything in |
544 | - $answer = EE_Answer::new_instance ( array( |
|
543 | + $answer = EE_Answer::new_instance(array( |
|
545 | 544 | 'QST_ID'=> $question->ID(), |
546 | 545 | 'REG_ID'=> $registration->ID() |
547 | 546 | )); |
548 | 547 | } |
549 | 548 | // verify instance |
550 | - if( $answer instanceof EE_Answer ){ |
|
551 | - if ( ! empty( $answer_value )) { |
|
552 | - $answer->set( 'ANS_value', $answer_value ); |
|
549 | + if ($answer instanceof EE_Answer) { |
|
550 | + if ( ! empty($answer_value)) { |
|
551 | + $answer->set('ANS_value', $answer_value); |
|
553 | 552 | } |
554 | - $answer->cache( 'Question', $question ); |
|
553 | + $answer->cache('Question', $question); |
|
555 | 554 | //remember system ID had a bug where sometimes it could be null |
556 | - $answer_cache_id =$question->is_system_question() |
|
557 | - ? $question->system_ID() . '-' . $registration->reg_url_link() |
|
558 | - : $question->ID() . '-' . $registration->reg_url_link(); |
|
559 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
555 | + $answer_cache_id = $question->is_system_question() |
|
556 | + ? $question->system_ID().'-'.$registration->reg_url_link() |
|
557 | + : $question->ID().'-'.$registration->reg_url_link(); |
|
558 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
560 | 559 | } |
561 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
560 | + return $this->_generate_question_input($registration, $question, $answer); |
|
562 | 561 | |
563 | 562 | } |
564 | 563 | |
@@ -571,46 +570,46 @@ discard block |
||
571 | 570 | * @return EE_Form_Input_Base |
572 | 571 | * @throws \EE_Error |
573 | 572 | */ |
574 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
573 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
575 | 574 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
576 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
575 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
577 | 576 | add_filter( |
578 | 577 | 'FHEE__EE_Question__generate_form_input__country_options', |
579 | - array( $this, 'use_cached_countries_for_form_input' ), |
|
578 | + array($this, 'use_cached_countries_for_form_input'), |
|
580 | 579 | 10, |
581 | 580 | 4 |
582 | 581 | ); |
583 | 582 | add_filter( |
584 | 583 | 'FHEE__EE_Question__generate_form_input__state_options', |
585 | - array( $this, 'use_cached_states_for_form_input' ), |
|
584 | + array($this, 'use_cached_states_for_form_input'), |
|
586 | 585 | 10, |
587 | 586 | 4 |
588 | 587 | ); |
589 | 588 | $input_constructor_args = array( |
590 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
591 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
592 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
593 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
589 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
590 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
591 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
592 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
594 | 593 | 'html_label_class' => 'ee-reg-qstn', |
595 | 594 | ); |
596 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
597 | - if ( $answer instanceof EE_Answer && $answer->ID() ) { |
|
598 | - $input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']'; |
|
599 | - $input_constructor_args[ 'html_id' ] .= '-' . $answer->ID(); |
|
600 | - $input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID(); |
|
595 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
596 | + if ($answer instanceof EE_Answer && $answer->ID()) { |
|
597 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
598 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
599 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
601 | 600 | } |
602 | - $form_input = $question->generate_form_input( |
|
601 | + $form_input = $question->generate_form_input( |
|
603 | 602 | $registration, |
604 | 603 | $answer, |
605 | 604 | $input_constructor_args |
606 | 605 | ); |
607 | 606 | remove_filter( |
608 | 607 | 'FHEE__EE_Question__generate_form_input__country_options', |
609 | - array( $this, 'use_cached_countries_for_form_input' ) |
|
608 | + array($this, 'use_cached_countries_for_form_input') |
|
610 | 609 | ); |
611 | 610 | remove_filter( |
612 | 611 | 'FHEE__EE_Question__generate_form_input__state_options', |
613 | - array( $this, 'use_cached_states_for_form_input' ) |
|
612 | + array($this, 'use_cached_states_for_form_input') |
|
614 | 613 | ); |
615 | 614 | return $form_input; |
616 | 615 | } |
@@ -632,22 +631,22 @@ discard block |
||
632 | 631 | \EE_Registration $registration = null, |
633 | 632 | \EE_Answer $answer = null |
634 | 633 | ) { |
635 | - $country_options = array( '' => '' ); |
|
634 | + $country_options = array('' => ''); |
|
636 | 635 | // get possibly cached list of countries |
637 | 636 | $countries = $this->checkout->action === 'process_reg_step' |
638 | 637 | ? EEM_Country::instance()->get_all_countries() |
639 | 638 | : EEM_Country::instance()->get_all_active_countries(); |
640 | - if ( ! empty( $countries )) { |
|
641 | - foreach( $countries as $country ){ |
|
642 | - if ( $country instanceof EE_Country ) { |
|
643 | - $country_options[ $country->ID() ] = $country->name(); |
|
639 | + if ( ! empty($countries)) { |
|
640 | + foreach ($countries as $country) { |
|
641 | + if ($country instanceof EE_Country) { |
|
642 | + $country_options[$country->ID()] = $country->name(); |
|
644 | 643 | } |
645 | 644 | } |
646 | 645 | } |
647 | - if( $question instanceof EE_Question |
|
648 | - && $registration instanceof EE_Registration ) { |
|
646 | + if ($question instanceof EE_Question |
|
647 | + && $registration instanceof EE_Registration) { |
|
649 | 648 | $answer = EEM_Answer::instance()->get_one( |
650 | - array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) |
|
649 | + array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID())) |
|
651 | 650 | ); |
652 | 651 | } else { |
653 | 652 | $answer = EE_Answer::new_instance(); |
@@ -680,14 +679,14 @@ discard block |
||
680 | 679 | \EE_Registration $registration = null, |
681 | 680 | \EE_Answer $answer = null |
682 | 681 | ) { |
683 | - $state_options = array( '' => array( '' => '')); |
|
682 | + $state_options = array('' => array('' => '')); |
|
684 | 683 | $states = $this->checkout->action === 'process_reg_step' |
685 | 684 | ? EEM_State::instance()->get_all_states() |
686 | 685 | : EEM_State::instance()->get_all_active_states(); |
687 | - if ( ! empty( $states )) { |
|
688 | - foreach( $states as $state ){ |
|
689 | - if ( $state instanceof EE_State ) { |
|
690 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
686 | + if ( ! empty($states)) { |
|
687 | + foreach ($states as $state) { |
|
688 | + if ($state instanceof EE_State) { |
|
689 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
691 | 690 | } |
692 | 691 | } |
693 | 692 | } |
@@ -715,24 +714,24 @@ discard block |
||
715 | 714 | * @throws \EE_Error |
716 | 715 | */ |
717 | 716 | public function process_reg_step() { |
718 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
717 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
719 | 718 | // grab validated data from form |
720 | 719 | $valid_data = $this->checkout->current_step->valid_data(); |
721 | 720 | // EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
722 | 721 | // EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
723 | 722 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
724 | - if ( empty( $valid_data )) { |
|
723 | + if (empty($valid_data)) { |
|
725 | 724 | EE_Error::add_error( |
726 | - __( 'No valid question responses were received.', 'event_espresso' ), |
|
725 | + __('No valid question responses were received.', 'event_espresso'), |
|
727 | 726 | __FILE__, |
728 | 727 | __FUNCTION__, |
729 | 728 | __LINE__ |
730 | 729 | ); |
731 | 730 | return false; |
732 | 731 | } |
733 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
732 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
734 | 733 | EE_Error::add_error( |
735 | - __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), |
|
734 | + __('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), |
|
736 | 735 | __FILE__, |
737 | 736 | __FUNCTION__, |
738 | 737 | __LINE__ |
@@ -740,11 +739,11 @@ discard block |
||
740 | 739 | return false; |
741 | 740 | } |
742 | 741 | // get cached registrations |
743 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
742 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
744 | 743 | // verify we got the goods |
745 | - if ( empty( $registrations )) { |
|
744 | + if (empty($registrations)) { |
|
746 | 745 | EE_Error::add_error( |
747 | - __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), |
|
746 | + __('Your form data could not be applied to any valid registrations.', 'event_espresso'), |
|
748 | 747 | __FILE__, |
749 | 748 | __FUNCTION__, |
750 | 749 | __LINE__ |
@@ -752,15 +751,15 @@ discard block |
||
752 | 751 | return false; |
753 | 752 | } |
754 | 753 | // extract attendee info from form data and save to model objects |
755 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
754 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
756 | 755 | // if first pass thru SPCO, |
757 | 756 | // then let's check processed registrations against the total number of tickets in the cart |
758 | - if ( $registrations_processed === false ) { |
|
757 | + if ($registrations_processed === false) { |
|
759 | 758 | // but return immediately if the previous step exited early due to errors |
760 | 759 | return false; |
761 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
760 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
762 | 761 | // generate a correctly translated string for all possible singular/plural combinations |
763 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
762 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
764 | 763 | $error_msg = sprintf( |
765 | 764 | __( |
766 | 765 | 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', |
@@ -769,7 +768,7 @@ discard block |
||
769 | 768 | $this->checkout->total_ticket_count, |
770 | 769 | $registrations_processed |
771 | 770 | ); |
772 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
771 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
773 | 772 | $error_msg = sprintf( |
774 | 773 | __( |
775 | 774 | 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', |
@@ -788,17 +787,17 @@ discard block |
||
788 | 787 | $registrations_processed |
789 | 788 | ); |
790 | 789 | } |
791 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
790 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
792 | 791 | return false; |
793 | 792 | } |
794 | 793 | // mark this reg step as completed |
795 | 794 | $this->set_completed(); |
796 | 795 | $this->_set_success_message( |
797 | - __( 'The Attendee Information Step has been successfully completed.', 'event_espresso' ) |
|
796 | + __('The Attendee Information Step has been successfully completed.', 'event_espresso') |
|
798 | 797 | ); |
799 | 798 | //do action in case a plugin wants to do something with the data submitted in step 1. |
800 | 799 | //passes EE_Single_Page_Checkout, and it's posted data |
801 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
800 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
802 | 801 | return true; |
803 | 802 | } |
804 | 803 | |
@@ -812,9 +811,9 @@ discard block |
||
812 | 811 | * @return boolean | int |
813 | 812 | * @throws \EE_Error |
814 | 813 | */ |
815 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
814 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
816 | 815 | // load resources and set some defaults |
817 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
816 | + EE_Registry::instance()->load_model('Attendee'); |
|
818 | 817 | // holder for primary registrant attendee object |
819 | 818 | $this->checkout->primary_attendee_obj = NULL; |
820 | 819 | // array for tracking reg form data for the primary registrant |
@@ -831,9 +830,9 @@ discard block |
||
831 | 830 | // attendee counter |
832 | 831 | $att_nmbr = 0; |
833 | 832 | // grab the saved registrations from the transaction |
834 | - foreach ( $registrations as $registration ) { |
|
833 | + foreach ($registrations as $registration) { |
|
835 | 834 | // verify EE_Registration object |
836 | - if ( ! $registration instanceof EE_Registration ) { |
|
835 | + if ( ! $registration instanceof EE_Registration) { |
|
837 | 836 | EE_Error::add_error( |
838 | 837 | __( |
839 | 838 | 'An invalid Registration object was discovered when attempting to process your registration information.', |
@@ -848,12 +847,12 @@ discard block |
||
848 | 847 | /** @var string $reg_url_link */ |
849 | 848 | $reg_url_link = $registration->reg_url_link(); |
850 | 849 | // reg_url_link exists ? |
851 | - if ( ! empty( $reg_url_link ) ) { |
|
850 | + if ( ! empty($reg_url_link)) { |
|
852 | 851 | // should this registration be processed during this visit ? |
853 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
852 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
854 | 853 | // if NOT revisiting, then let's save the registration now, |
855 | 854 | // so that we have a REG_ID to use when generating other objects |
856 | - if ( ! $this->checkout->revisit ) { |
|
855 | + if ( ! $this->checkout->revisit) { |
|
857 | 856 | $registration->save(); |
858 | 857 | } |
859 | 858 | /** |
@@ -863,7 +862,7 @@ discard block |
||
863 | 862 | * @var bool if true is returned by the plugin then the |
864 | 863 | * registration processing is halted. |
865 | 864 | */ |
866 | - if ( apply_filters( |
|
865 | + if (apply_filters( |
|
867 | 866 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', |
868 | 867 | false, |
869 | 868 | $att_nmbr, |
@@ -871,38 +870,38 @@ discard block |
||
871 | 870 | $registrations, |
872 | 871 | $valid_data, |
873 | 872 | $this |
874 | - ) ) { |
|
873 | + )) { |
|
875 | 874 | return false; |
876 | 875 | } |
877 | 876 | |
878 | 877 | // Houston, we have a registration! |
879 | 878 | $att_nmbr++; |
880 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
879 | + $this->_attendee_data[$reg_url_link] = array(); |
|
881 | 880 | // grab any existing related answer objects |
882 | 881 | $this->_registration_answers = $registration->answers(); |
883 | 882 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
884 | - if ( isset( $valid_data[ $reg_url_link ] ) ) { |
|
883 | + if (isset($valid_data[$reg_url_link])) { |
|
885 | 884 | // do we need to copy basic info from primary attendee ? |
886 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) |
|
887 | - && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 |
|
885 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) |
|
886 | + && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 |
|
888 | 887 | ? true |
889 | 888 | : false; |
890 | 889 | // filter form input data for this registration |
891 | - $valid_data[ $reg_url_link ] = (array)apply_filters( |
|
890 | + $valid_data[$reg_url_link] = (array) apply_filters( |
|
892 | 891 | 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', |
893 | - $valid_data[ $reg_url_link ] |
|
892 | + $valid_data[$reg_url_link] |
|
894 | 893 | ); |
895 | 894 | // EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
896 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
897 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) |
|
895 | + if (isset($valid_data['primary_attendee'])) { |
|
896 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) |
|
898 | 897 | ? $valid_data['primary_attendee'] |
899 | 898 | : false; |
900 | - unset( $valid_data['primary_attendee'] ); |
|
899 | + unset($valid_data['primary_attendee']); |
|
901 | 900 | } |
902 | 901 | // now loop through our array of valid post data && process attendee reg forms |
903 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
904 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
905 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
902 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
903 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
904 | + foreach ($form_inputs as $form_input => $input_value) { |
|
906 | 905 | // \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ ); |
907 | 906 | // check for critical inputs |
908 | 907 | if ( |
@@ -916,16 +915,16 @@ discard block |
||
916 | 915 | // store a bit of data about the primary attendee |
917 | 916 | if ( |
918 | 917 | $att_nmbr === 1 |
919 | - && ! empty( $input_value ) |
|
918 | + && ! empty($input_value) |
|
920 | 919 | && $reg_url_link === $primary_registrant['line_item_id'] |
921 | 920 | ) { |
922 | - $primary_registrant[ $form_input ] = $input_value; |
|
921 | + $primary_registrant[$form_input] = $input_value; |
|
923 | 922 | } else if ( |
924 | 923 | $copy_primary |
925 | 924 | && $input_value === null |
926 | - && isset( $primary_registrant[ $form_input ] ) |
|
925 | + && isset($primary_registrant[$form_input]) |
|
927 | 926 | ) { |
928 | - $input_value = $primary_registrant[ $form_input ]; |
|
927 | + $input_value = $primary_registrant[$form_input]; |
|
929 | 928 | } |
930 | 929 | // now attempt to save the input data |
931 | 930 | if ( |
@@ -967,55 +966,55 @@ discard block |
||
967 | 966 | // have we met before? |
968 | 967 | $attendee = $this->_find_existing_attendee( |
969 | 968 | $registration, |
970 | - $this->_attendee_data[ $reg_url_link ] |
|
969 | + $this->_attendee_data[$reg_url_link] |
|
971 | 970 | ); |
972 | 971 | // did we find an already existing record for this attendee ? |
973 | - if ( $attendee instanceof EE_Attendee ) { |
|
972 | + if ($attendee instanceof EE_Attendee) { |
|
974 | 973 | $attendee = $this->_update_existing_attendee_data( |
975 | 974 | $attendee, |
976 | - $this->_attendee_data[ $reg_url_link ] |
|
975 | + $this->_attendee_data[$reg_url_link] |
|
977 | 976 | ); |
978 | 977 | } else { |
979 | 978 | // ensure critical details are set for additional attendees |
980 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 |
|
979 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 |
|
981 | 980 | ? $this->_copy_critical_attendee_details_from_primary_registrant( |
982 | - $this->_attendee_data[ $reg_url_link ] |
|
981 | + $this->_attendee_data[$reg_url_link] |
|
983 | 982 | ) |
984 | - : $this->_attendee_data[ $reg_url_link ]; |
|
983 | + : $this->_attendee_data[$reg_url_link]; |
|
985 | 984 | $attendee = $this->_create_new_attendee( |
986 | 985 | $registration, |
987 | - $this->_attendee_data[ $reg_url_link ] |
|
986 | + $this->_attendee_data[$reg_url_link] |
|
988 | 987 | ); |
989 | 988 | } |
990 | 989 | // who's #1 ? |
991 | - if ( $att_nmbr === 1 ) { |
|
990 | + if ($att_nmbr === 1) { |
|
992 | 991 | $this->checkout->primary_attendee_obj = $attendee; |
993 | 992 | } |
994 | 993 | } |
995 | 994 | // EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
996 | 995 | // add relation to registration, set attendee ID, and cache attendee |
997 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
996 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
998 | 997 | // \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ ); |
999 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
1000 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
998 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
999 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
1001 | 1000 | return false; |
1002 | 1001 | } |
1003 | 1002 | /** @type EE_Registration_Processor $registration_processor */ |
1004 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1003 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1005 | 1004 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1006 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, false ); |
|
1005 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, false); |
|
1007 | 1006 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1008 | 1007 | $this->checkout->transaction->toggle_failed_transaction_status(); |
1009 | 1008 | // if we've gotten this far, then let's save what we have |
1010 | 1009 | $registration->save(); |
1011 | 1010 | // add relation between TXN and registration |
1012 | - $this->_associate_registration_with_transaction( $registration ); |
|
1011 | + $this->_associate_registration_with_transaction($registration); |
|
1013 | 1012 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
1014 | 1013 | |
1015 | - } else { |
|
1016 | - 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__ ); |
|
1014 | + } else { |
|
1015 | + 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__); |
|
1017 | 1016 | // remove malformed data |
1018 | - unset( $valid_data[ $reg_url_link ] ); |
|
1017 | + unset($valid_data[$reg_url_link]); |
|
1019 | 1018 | return false; |
1020 | 1019 | } |
1021 | 1020 | |
@@ -1044,26 +1043,26 @@ discard block |
||
1044 | 1043 | // \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
1045 | 1044 | // allow for plugins to hook in and do their own processing of the form input. |
1046 | 1045 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
1047 | - if ( apply_filters( |
|
1046 | + if (apply_filters( |
|
1048 | 1047 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', |
1049 | 1048 | false, |
1050 | 1049 | $registration, |
1051 | 1050 | $form_input, |
1052 | 1051 | $input_value, |
1053 | 1052 | $this |
1054 | - ) ) { |
|
1053 | + )) { |
|
1055 | 1054 | return true; |
1056 | 1055 | } |
1057 | 1056 | // $answer_cache_id is the key used to find the EE_Answer we want |
1058 | 1057 | $answer_cache_id = $this->checkout->reg_url_link |
1059 | 1058 | ? $form_input |
1060 | - : $form_input . '-' . $registration->reg_url_link(); |
|
1061 | - $answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] ) |
|
1062 | - && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer |
|
1059 | + : $form_input.'-'.$registration->reg_url_link(); |
|
1060 | + $answer_is_obj = isset($this->_registration_answers[$answer_cache_id]) |
|
1061 | + && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer |
|
1063 | 1062 | ? true |
1064 | 1063 | : false; |
1065 | 1064 | //rename form_inputs if they are EE_Attendee properties |
1066 | - switch( (string)$form_input ) { |
|
1065 | + switch ((string) $form_input) { |
|
1067 | 1066 | |
1068 | 1067 | case 'state' : |
1069 | 1068 | case 'STA_ID' : |
@@ -1078,32 +1077,32 @@ discard block |
||
1078 | 1077 | break; |
1079 | 1078 | |
1080 | 1079 | default : |
1081 | - $ATT_input = 'ATT_' . $form_input; |
|
1080 | + $ATT_input = 'ATT_'.$form_input; |
|
1082 | 1081 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
1083 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false; |
|
1084 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
1082 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false; |
|
1083 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
1085 | 1084 | } |
1086 | 1085 | // EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
1087 | 1086 | // EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
1088 | 1087 | // EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
1089 | 1088 | // if this form input has a corresponding attendee property |
1090 | - if ( $attendee_property ) { |
|
1091 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
1092 | - if ( $answer_is_obj ) { |
|
1089 | + if ($attendee_property) { |
|
1090 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
1091 | + if ($answer_is_obj) { |
|
1093 | 1092 | // and delete the corresponding answer since we won't be storing this data in that object |
1094 | - $registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' ); |
|
1095 | - $this->_registration_answers[ $answer_cache_id ]->delete_permanently(); |
|
1093 | + $registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer'); |
|
1094 | + $this->_registration_answers[$answer_cache_id]->delete_permanently(); |
|
1096 | 1095 | } |
1097 | 1096 | return true; |
1098 | - } elseif ( $answer_is_obj ) { |
|
1097 | + } elseif ($answer_is_obj) { |
|
1099 | 1098 | // save this data to the answer object |
1100 | - $this->_registration_answers[ $answer_cache_id ]->set_value( $input_value ); |
|
1101 | - $result = $this->_registration_answers[ $answer_cache_id ]->save(); |
|
1099 | + $this->_registration_answers[$answer_cache_id]->set_value($input_value); |
|
1100 | + $result = $this->_registration_answers[$answer_cache_id]->save(); |
|
1102 | 1101 | return $result !== false ? true : false; |
1103 | 1102 | } else { |
1104 | - foreach ( $this->_registration_answers as $answer ) { |
|
1105 | - if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) { |
|
1106 | - $answer->set_value( $input_value ); |
|
1103 | + foreach ($this->_registration_answers as $answer) { |
|
1104 | + if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) { |
|
1105 | + $answer->set_value($input_value); |
|
1107 | 1106 | $result = $answer->save(); |
1108 | 1107 | return $result !== false ? true : false; |
1109 | 1108 | } |
@@ -1125,15 +1124,15 @@ discard block |
||
1125 | 1124 | $form_input = '', |
1126 | 1125 | $input_value = '' |
1127 | 1126 | ) { |
1128 | - if ( empty( $input_value ) ) { |
|
1127 | + if (empty($input_value)) { |
|
1129 | 1128 | // if the form input isn't marked as being required, then just return |
1130 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
1129 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
1131 | 1130 | return true; |
1132 | 1131 | } |
1133 | - switch ( $form_input ) { |
|
1132 | + switch ($form_input) { |
|
1134 | 1133 | case 'fname' : |
1135 | 1134 | EE_Error::add_error( |
1136 | - __( 'First Name is a required value.', 'event_espresso' ), |
|
1135 | + __('First Name is a required value.', 'event_espresso'), |
|
1137 | 1136 | __FILE__, |
1138 | 1137 | __FUNCTION__, |
1139 | 1138 | __LINE__ |
@@ -1142,7 +1141,7 @@ discard block |
||
1142 | 1141 | break; |
1143 | 1142 | case 'lname' : |
1144 | 1143 | EE_Error::add_error( |
1145 | - __( 'Last Name is a required value.', 'event_espresso' ), |
|
1144 | + __('Last Name is a required value.', 'event_espresso'), |
|
1146 | 1145 | __FILE__, |
1147 | 1146 | __FUNCTION__, |
1148 | 1147 | __LINE__ |
@@ -1151,7 +1150,7 @@ discard block |
||
1151 | 1150 | break; |
1152 | 1151 | case 'email' : |
1153 | 1152 | EE_Error::add_error( |
1154 | - __( 'Please enter a valid email address.', 'event_espresso' ), |
|
1153 | + __('Please enter a valid email address.', 'event_espresso'), |
|
1155 | 1154 | __FILE__, |
1156 | 1155 | __FUNCTION__, |
1157 | 1156 | __LINE__ |
@@ -1173,30 +1172,30 @@ discard block |
||
1173 | 1172 | * @return boolean|EE_Attendee |
1174 | 1173 | * @throws \EE_Error |
1175 | 1174 | */ |
1176 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1175 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1177 | 1176 | $existing_attendee = null; |
1178 | 1177 | // if none of the critical properties are set in the incoming attendee data... |
1179 | 1178 | // then attempt to copy them from the primary attendee |
1180 | 1179 | if ( |
1181 | 1180 | $this->checkout->primary_attendee_obj instanceof EE_Attendee |
1182 | - && ! isset( $attendee_data['ATT_fname'], $attendee_data['ATT_email'] ) |
|
1181 | + && ! isset($attendee_data['ATT_fname'], $attendee_data['ATT_email']) |
|
1183 | 1182 | ) { |
1184 | 1183 | return $this->checkout->primary_attendee_obj; |
1185 | 1184 | } |
1186 | 1185 | // does this attendee already exist in the db ? |
1187 | 1186 | // we're searching using a combination of first name, last name, AND email address |
1188 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) |
|
1187 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) |
|
1189 | 1188 | ? $attendee_data['ATT_fname'] |
1190 | 1189 | : ''; |
1191 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) |
|
1190 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) |
|
1192 | 1191 | ? $attendee_data['ATT_lname'] |
1193 | 1192 | : ''; |
1194 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) |
|
1193 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) |
|
1195 | 1194 | ? $attendee_data['ATT_email'] |
1196 | 1195 | : ''; |
1197 | 1196 | // but only if those have values |
1198 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
1199 | - $existing_attendee = EEM_Attendee::instance()->find_existing_attendee( array( |
|
1197 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
1198 | + $existing_attendee = EEM_Attendee::instance()->find_existing_attendee(array( |
|
1200 | 1199 | 'ATT_fname' => $ATT_fname, |
1201 | 1200 | 'ATT_lname' => $ATT_lname, |
1202 | 1201 | 'ATT_email' => $ATT_email |
@@ -1220,13 +1219,13 @@ discard block |
||
1220 | 1219 | * @return \EE_Attendee |
1221 | 1220 | * @throws \EE_Error |
1222 | 1221 | */ |
1223 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
1222 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
1224 | 1223 | // first remove fname, lname, and email from attendee data |
1225 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1224 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1226 | 1225 | // now loop thru what's left and add to attendee CPT |
1227 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1228 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1229 | - $existing_attendee->set( $property_name, $property_value ); |
|
1226 | + foreach ($attendee_data as $property_name => $property_value) { |
|
1227 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1228 | + $existing_attendee->set($property_name, $property_value); |
|
1230 | 1229 | } |
1231 | 1230 | } |
1232 | 1231 | // better save that now |
@@ -1244,11 +1243,11 @@ discard block |
||
1244 | 1243 | * @return void |
1245 | 1244 | * @throws \EE_Error |
1246 | 1245 | */ |
1247 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1246 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1248 | 1247 | // add relation to attendee |
1249 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1250 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1251 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1248 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1249 | + $registration->set_attendee_id($attendee->ID()); |
|
1250 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1252 | 1251 | } |
1253 | 1252 | |
1254 | 1253 | |
@@ -1260,10 +1259,10 @@ discard block |
||
1260 | 1259 | * @return void |
1261 | 1260 | * @throws \EE_Error |
1262 | 1261 | */ |
1263 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1262 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1264 | 1263 | // add relation to attendee |
1265 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1266 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1264 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1265 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1267 | 1266 | } |
1268 | 1267 | |
1269 | 1268 | |
@@ -1276,14 +1275,14 @@ discard block |
||
1276 | 1275 | * @return array |
1277 | 1276 | * @throws \EE_Error |
1278 | 1277 | */ |
1279 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1278 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1280 | 1279 | // bare minimum critical details include first name, last name, email address |
1281 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1280 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1282 | 1281 | // add address info to critical details? |
1283 | - if ( apply_filters( |
|
1282 | + if (apply_filters( |
|
1284 | 1283 | 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', |
1285 | 1284 | false |
1286 | - ) ) { |
|
1285 | + )) { |
|
1287 | 1286 | $address_details = array( |
1288 | 1287 | 'ATT_address', |
1289 | 1288 | 'ATT_address2', |
@@ -1293,13 +1292,13 @@ discard block |
||
1293 | 1292 | 'ATT_zip', |
1294 | 1293 | 'ATT_phone' |
1295 | 1294 | ); |
1296 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1295 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1297 | 1296 | } |
1298 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1299 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) |
|
1300 | - || empty( $attendee_data[ $critical_attendee_detail ] ) |
|
1297 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1298 | + if ( ! isset($attendee_data[$critical_attendee_detail]) |
|
1299 | + || empty($attendee_data[$critical_attendee_detail]) |
|
1301 | 1300 | ) { |
1302 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( |
|
1301 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get( |
|
1303 | 1302 | $critical_attendee_detail |
1304 | 1303 | ); |
1305 | 1304 | } |
@@ -1317,11 +1316,11 @@ discard block |
||
1317 | 1316 | * @return \EE_Attendee |
1318 | 1317 | * @throws \EE_Error |
1319 | 1318 | */ |
1320 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1319 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1321 | 1320 | // create new attendee object |
1322 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1321 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1323 | 1322 | // set author to event creator |
1324 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1323 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1325 | 1324 | $new_attendee->save(); |
1326 | 1325 | return $new_attendee; |
1327 | 1326 | } |
@@ -1338,7 +1337,7 @@ discard block |
||
1338 | 1337 | */ |
1339 | 1338 | public function update_reg_step() { |
1340 | 1339 | // save everything |
1341 | - if ( $this->process_reg_step() ) { |
|
1340 | + if ($this->process_reg_step()) { |
|
1342 | 1341 | $this->checkout->redirect = true; |
1343 | 1342 | $this->checkout->redirect_url = add_query_arg( |
1344 | 1343 | array( |
@@ -1347,7 +1346,7 @@ discard block |
||
1347 | 1346 | ), |
1348 | 1347 | $this->checkout->thank_you_page_url |
1349 | 1348 | ); |
1350 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1349 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1351 | 1350 | return true; |
1352 | 1351 | } |
1353 | 1352 | return false; |
@@ -24,116 +24,116 @@ |
||
24 | 24 | class JsonModelSchema |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * @var \EEM_Base |
|
29 | - */ |
|
30 | - protected $model; |
|
31 | - |
|
32 | - /** |
|
33 | - * JsonModelSchema constructor. |
|
34 | - * |
|
35 | - * @param \EEM_Base $model |
|
36 | - */ |
|
37 | - public function __construct(EEM_Base $model){ |
|
38 | - $this->model = $model; |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * Return the schema for a given model from a given model. |
|
43 | - * @param \EEM_Base $model |
|
44 | - * @return array |
|
45 | - */ |
|
46 | - public function getModelSchema() |
|
47 | - { |
|
48 | - return $this->getModelSchemaForRelations( |
|
49 | - $this->model->relation_settings(), |
|
50 | - $this->getModelSchemaForFields( |
|
51 | - $this->model->field_settings(), |
|
52 | - $this->getInitialSchemaStructure() |
|
53 | - ) |
|
54 | - ); |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * Get the schema for a given set of model fields. |
|
60 | - * @param \EE_Model_Field_Base[] $model_fields |
|
61 | - * @return array |
|
62 | - */ |
|
63 | - public function getModelSchemaForFields(array $model_fields, array $schema) |
|
64 | - { |
|
65 | - foreach ($model_fields as $field => $model_field) { |
|
66 | - if (! $model_field instanceof EE_Model_Field_Base) { |
|
67 | - continue; |
|
68 | - } |
|
69 | - $schema['properties'][$field] = $model_field->getSchema(); |
|
70 | - |
|
71 | - //if this is a primary key field add the primary key item |
|
72 | - if ($model_field instanceof EE_Primary_Key_Field_Base) { |
|
73 | - $schema['properties'][$field]['primary_key'] = true; |
|
74 | - } |
|
75 | - |
|
76 | - //if this is a foreign key field add the foreign key item |
|
77 | - if ($model_field instanceof EE_Foreign_Key_Field_Base) { |
|
78 | - $schema['properties'][$field]['foreign_key'] = array( |
|
79 | - 'description' => esc_html__('This is a foreign key the points to the given models.', 'event_espresso'), |
|
80 | - 'type' => 'array', |
|
81 | - 'enum' => $model_field->get_model_class_names_pointed_to() |
|
82 | - ); |
|
83 | - } |
|
84 | - } |
|
85 | - return $schema; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * Get the schema for a given set of model relations |
|
91 | - * @param EE_Model_Relation_Base[] $relations_on_model |
|
92 | - * @return array |
|
93 | - */ |
|
94 | - public function getModelSchemaForRelations(array $relations_on_model, array $schema) |
|
95 | - { |
|
96 | - foreach ($relations_on_model as $model_name => $relation) { |
|
97 | - if (! $relation instanceof EE_Model_Relation_Base) { |
|
98 | - continue; |
|
99 | - } |
|
100 | - $model_name_for_schema = $relation instanceof EE_Belongs_To_Relation |
|
101 | - ? strtolower($model_name) |
|
102 | - : EEH_Inflector::pluralize_and_lower($model_name); |
|
103 | - $schema['properties'][$model_name_for_schema] = $relation->getSchema(); |
|
104 | - $schema['properties'][$model_name_for_schema]['relation_model'] = $model_name; |
|
105 | - } |
|
106 | - return $schema; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Outputs the schema header for a model. |
|
112 | - * @param \EEM_Base $model |
|
113 | - * @return array |
|
114 | - */ |
|
115 | - public function getInitialSchemaStructure() |
|
116 | - { |
|
117 | - return array( |
|
118 | - '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
119 | - 'title' => $this->model->get_this_model_name(), |
|
120 | - 'type' => 'object', |
|
121 | - 'properties' => array() |
|
122 | - ); |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Allows one to just use the object as a string to get the json. |
|
128 | - * eg. |
|
129 | - * |
|
130 | - * $json_schema = new JsonModelSchema(EEM_Event::instance()); |
|
131 | - * echo $json_schema; //outputs the schema as a json formatted string. |
|
132 | - * |
|
133 | - * @return bool|false|mixed|string |
|
134 | - */ |
|
135 | - public function __toString() |
|
136 | - { |
|
137 | - return wp_json_encode($this->getModelSchema()); |
|
138 | - } |
|
27 | + /** |
|
28 | + * @var \EEM_Base |
|
29 | + */ |
|
30 | + protected $model; |
|
31 | + |
|
32 | + /** |
|
33 | + * JsonModelSchema constructor. |
|
34 | + * |
|
35 | + * @param \EEM_Base $model |
|
36 | + */ |
|
37 | + public function __construct(EEM_Base $model){ |
|
38 | + $this->model = $model; |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * Return the schema for a given model from a given model. |
|
43 | + * @param \EEM_Base $model |
|
44 | + * @return array |
|
45 | + */ |
|
46 | + public function getModelSchema() |
|
47 | + { |
|
48 | + return $this->getModelSchemaForRelations( |
|
49 | + $this->model->relation_settings(), |
|
50 | + $this->getModelSchemaForFields( |
|
51 | + $this->model->field_settings(), |
|
52 | + $this->getInitialSchemaStructure() |
|
53 | + ) |
|
54 | + ); |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * Get the schema for a given set of model fields. |
|
60 | + * @param \EE_Model_Field_Base[] $model_fields |
|
61 | + * @return array |
|
62 | + */ |
|
63 | + public function getModelSchemaForFields(array $model_fields, array $schema) |
|
64 | + { |
|
65 | + foreach ($model_fields as $field => $model_field) { |
|
66 | + if (! $model_field instanceof EE_Model_Field_Base) { |
|
67 | + continue; |
|
68 | + } |
|
69 | + $schema['properties'][$field] = $model_field->getSchema(); |
|
70 | + |
|
71 | + //if this is a primary key field add the primary key item |
|
72 | + if ($model_field instanceof EE_Primary_Key_Field_Base) { |
|
73 | + $schema['properties'][$field]['primary_key'] = true; |
|
74 | + } |
|
75 | + |
|
76 | + //if this is a foreign key field add the foreign key item |
|
77 | + if ($model_field instanceof EE_Foreign_Key_Field_Base) { |
|
78 | + $schema['properties'][$field]['foreign_key'] = array( |
|
79 | + 'description' => esc_html__('This is a foreign key the points to the given models.', 'event_espresso'), |
|
80 | + 'type' => 'array', |
|
81 | + 'enum' => $model_field->get_model_class_names_pointed_to() |
|
82 | + ); |
|
83 | + } |
|
84 | + } |
|
85 | + return $schema; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * Get the schema for a given set of model relations |
|
91 | + * @param EE_Model_Relation_Base[] $relations_on_model |
|
92 | + * @return array |
|
93 | + */ |
|
94 | + public function getModelSchemaForRelations(array $relations_on_model, array $schema) |
|
95 | + { |
|
96 | + foreach ($relations_on_model as $model_name => $relation) { |
|
97 | + if (! $relation instanceof EE_Model_Relation_Base) { |
|
98 | + continue; |
|
99 | + } |
|
100 | + $model_name_for_schema = $relation instanceof EE_Belongs_To_Relation |
|
101 | + ? strtolower($model_name) |
|
102 | + : EEH_Inflector::pluralize_and_lower($model_name); |
|
103 | + $schema['properties'][$model_name_for_schema] = $relation->getSchema(); |
|
104 | + $schema['properties'][$model_name_for_schema]['relation_model'] = $model_name; |
|
105 | + } |
|
106 | + return $schema; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Outputs the schema header for a model. |
|
112 | + * @param \EEM_Base $model |
|
113 | + * @return array |
|
114 | + */ |
|
115 | + public function getInitialSchemaStructure() |
|
116 | + { |
|
117 | + return array( |
|
118 | + '$schema' => 'http://json-schema.org/draft-04/schema#', |
|
119 | + 'title' => $this->model->get_this_model_name(), |
|
120 | + 'type' => 'object', |
|
121 | + 'properties' => array() |
|
122 | + ); |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Allows one to just use the object as a string to get the json. |
|
128 | + * eg. |
|
129 | + * |
|
130 | + * $json_schema = new JsonModelSchema(EEM_Event::instance()); |
|
131 | + * echo $json_schema; //outputs the schema as a json formatted string. |
|
132 | + * |
|
133 | + * @return bool|false|mixed|string |
|
134 | + */ |
|
135 | + public function __toString() |
|
136 | + { |
|
137 | + return wp_json_encode($this->getModelSchema()); |
|
138 | + } |
|
139 | 139 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('ABSPATH')) { |
2 | - exit('No direct script access allowed'); |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -40,239 +40,239 @@ discard block |
||
40 | 40 | * @since 4.0 |
41 | 41 | */ |
42 | 42 | if (function_exists('espresso_version')) { |
43 | - /** |
|
44 | - * espresso_duplicate_plugin_error |
|
45 | - * displays if more than one version of EE is activated at the same time |
|
46 | - */ |
|
47 | - function espresso_duplicate_plugin_error() |
|
48 | - { |
|
49 | - ?> |
|
43 | + /** |
|
44 | + * espresso_duplicate_plugin_error |
|
45 | + * displays if more than one version of EE is activated at the same time |
|
46 | + */ |
|
47 | + function espresso_duplicate_plugin_error() |
|
48 | + { |
|
49 | + ?> |
|
50 | 50 | <div class="error"> |
51 | 51 | <p> |
52 | 52 | <?php echo esc_html__( |
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | 61 | |
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | - if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
65 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - /** |
|
97 | - * espresso_version |
|
98 | - * Returns the plugin version |
|
99 | - * |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function espresso_version() |
|
103 | - { |
|
104 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.26.rc.005'); |
|
105 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + /** |
|
97 | + * espresso_version |
|
98 | + * Returns the plugin version |
|
99 | + * |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function espresso_version() |
|
103 | + { |
|
104 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.26.rc.005'); |
|
105 | + } |
|
106 | 106 | |
107 | - // define versions |
|
108 | - define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | - define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | - define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | - define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | - //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | - if ( ! defined('DS')) { |
|
115 | - define('DS', '/'); |
|
116 | - } |
|
117 | - if ( ! defined('PS')) { |
|
118 | - define('PS', PATH_SEPARATOR); |
|
119 | - } |
|
120 | - if ( ! defined('SP')) { |
|
121 | - define('SP', ' '); |
|
122 | - } |
|
123 | - if ( ! defined('EENL')) { |
|
124 | - define('EENL', "\n"); |
|
125 | - } |
|
126 | - define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | - // define the plugin directory and URL |
|
128 | - define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | - define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | - define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | - // main root folder paths |
|
132 | - define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | - define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | - define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | - define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | - define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | - define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | - define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | - define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | - // core system paths |
|
141 | - define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | - define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | - define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | - define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | - define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | - define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | - define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | - define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | - define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | - define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | - define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | - define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | - // gateways |
|
154 | - define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | - define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | - // asset URL paths |
|
157 | - define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | - define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | - define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | - define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | - define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | - define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | - // define upload paths |
|
164 | - $uploads = wp_upload_dir(); |
|
165 | - // define the uploads directory and URL |
|
166 | - define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | - define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | - // define the templates directory and URL |
|
169 | - define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | - define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | - // define the gateway directory and URL |
|
172 | - define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | - define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | - // languages folder/path |
|
175 | - define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | - define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | - //check for dompdf fonts in uploads |
|
178 | - if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | - } |
|
181 | - //ajax constants |
|
182 | - define( |
|
183 | - 'EE_FRONT_AJAX', |
|
184 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | - ); |
|
186 | - define( |
|
187 | - 'EE_ADMIN_AJAX', |
|
188 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | - ); |
|
190 | - //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | - //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | - //want to change its default value! or find when -1 means infinity |
|
193 | - define('EE_INF_IN_DB', -1); |
|
194 | - define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | - define('EE_DEBUG', false); |
|
196 | - /** |
|
197 | - * espresso_plugin_activation |
|
198 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
199 | - */ |
|
200 | - function espresso_plugin_activation() |
|
201 | - { |
|
202 | - update_option('ee_espresso_activation', true); |
|
203 | - } |
|
107 | + // define versions |
|
108 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
109 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
110 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
111 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
112 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
113 | + //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
|
114 | + if ( ! defined('DS')) { |
|
115 | + define('DS', '/'); |
|
116 | + } |
|
117 | + if ( ! defined('PS')) { |
|
118 | + define('PS', PATH_SEPARATOR); |
|
119 | + } |
|
120 | + if ( ! defined('SP')) { |
|
121 | + define('SP', ' '); |
|
122 | + } |
|
123 | + if ( ! defined('EENL')) { |
|
124 | + define('EENL', "\n"); |
|
125 | + } |
|
126 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
127 | + // define the plugin directory and URL |
|
128 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
129 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
130 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
131 | + // main root folder paths |
|
132 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
133 | + define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
134 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
135 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
136 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
137 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
138 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
139 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
140 | + // core system paths |
|
141 | + define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
142 | + define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
143 | + define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
144 | + define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
145 | + define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
146 | + define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
147 | + define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
148 | + define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
149 | + define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
150 | + define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
151 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
152 | + define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
153 | + // gateways |
|
154 | + define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
155 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
156 | + // asset URL paths |
|
157 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
158 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
159 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
160 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
161 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
162 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
163 | + // define upload paths |
|
164 | + $uploads = wp_upload_dir(); |
|
165 | + // define the uploads directory and URL |
|
166 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
167 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
168 | + // define the templates directory and URL |
|
169 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
170 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
171 | + // define the gateway directory and URL |
|
172 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
173 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
174 | + // languages folder/path |
|
175 | + define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
176 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
177 | + //check for dompdf fonts in uploads |
|
178 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
179 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
180 | + } |
|
181 | + //ajax constants |
|
182 | + define( |
|
183 | + 'EE_FRONT_AJAX', |
|
184 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false |
|
185 | + ); |
|
186 | + define( |
|
187 | + 'EE_ADMIN_AJAX', |
|
188 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false |
|
189 | + ); |
|
190 | + //just a handy constant occasionally needed for finding values representing infinity in the DB |
|
191 | + //you're better to use this than its straight value (currently -1) in case you ever |
|
192 | + //want to change its default value! or find when -1 means infinity |
|
193 | + define('EE_INF_IN_DB', -1); |
|
194 | + define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
195 | + define('EE_DEBUG', false); |
|
196 | + /** |
|
197 | + * espresso_plugin_activation |
|
198 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
199 | + */ |
|
200 | + function espresso_plugin_activation() |
|
201 | + { |
|
202 | + update_option('ee_espresso_activation', true); |
|
203 | + } |
|
204 | 204 | |
205 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
206 | - /** |
|
207 | - * espresso_load_error_handling |
|
208 | - * this function loads EE's class for handling exceptions and errors |
|
209 | - */ |
|
210 | - function espresso_load_error_handling() |
|
211 | - { |
|
212 | - // load debugging tools |
|
213 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
214 | - require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
215 | - EEH_Debug_Tools::instance(); |
|
216 | - } |
|
217 | - // load error handling |
|
218 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
219 | - require_once(EE_CORE . 'EE_Error.core.php'); |
|
220 | - } else { |
|
221 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
222 | - } |
|
223 | - } |
|
205 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
206 | + /** |
|
207 | + * espresso_load_error_handling |
|
208 | + * this function loads EE's class for handling exceptions and errors |
|
209 | + */ |
|
210 | + function espresso_load_error_handling() |
|
211 | + { |
|
212 | + // load debugging tools |
|
213 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
214 | + require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php'); |
|
215 | + EEH_Debug_Tools::instance(); |
|
216 | + } |
|
217 | + // load error handling |
|
218 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
219 | + require_once(EE_CORE . 'EE_Error.core.php'); |
|
220 | + } else { |
|
221 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
222 | + } |
|
223 | + } |
|
224 | 224 | |
225 | - /** |
|
226 | - * espresso_load_required |
|
227 | - * given a class name and path, this function will load that file or throw an exception |
|
228 | - * |
|
229 | - * @param string $classname |
|
230 | - * @param string $full_path_to_file |
|
231 | - * @throws EE_Error |
|
232 | - */ |
|
233 | - function espresso_load_required($classname, $full_path_to_file) |
|
234 | - { |
|
235 | - static $error_handling_loaded = false; |
|
236 | - if ( ! $error_handling_loaded) { |
|
237 | - espresso_load_error_handling(); |
|
238 | - $error_handling_loaded = true; |
|
239 | - } |
|
240 | - if (is_readable($full_path_to_file)) { |
|
241 | - require_once($full_path_to_file); |
|
242 | - } else { |
|
243 | - throw new EE_Error ( |
|
244 | - sprintf( |
|
245 | - esc_html__( |
|
246 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
247 | - 'event_espresso' |
|
248 | - ), |
|
249 | - $classname |
|
250 | - ) |
|
251 | - ); |
|
252 | - } |
|
253 | - } |
|
225 | + /** |
|
226 | + * espresso_load_required |
|
227 | + * given a class name and path, this function will load that file or throw an exception |
|
228 | + * |
|
229 | + * @param string $classname |
|
230 | + * @param string $full_path_to_file |
|
231 | + * @throws EE_Error |
|
232 | + */ |
|
233 | + function espresso_load_required($classname, $full_path_to_file) |
|
234 | + { |
|
235 | + static $error_handling_loaded = false; |
|
236 | + if ( ! $error_handling_loaded) { |
|
237 | + espresso_load_error_handling(); |
|
238 | + $error_handling_loaded = true; |
|
239 | + } |
|
240 | + if (is_readable($full_path_to_file)) { |
|
241 | + require_once($full_path_to_file); |
|
242 | + } else { |
|
243 | + throw new EE_Error ( |
|
244 | + sprintf( |
|
245 | + esc_html__( |
|
246 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
247 | + 'event_espresso' |
|
248 | + ), |
|
249 | + $classname |
|
250 | + ) |
|
251 | + ); |
|
252 | + } |
|
253 | + } |
|
254 | 254 | |
255 | - espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
256 | - espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
257 | - espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
258 | - new EE_Bootstrap(); |
|
259 | - } |
|
255 | + espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php'); |
|
256 | + espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php'); |
|
257 | + espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php'); |
|
258 | + new EE_Bootstrap(); |
|
259 | + } |
|
260 | 260 | } |
261 | 261 | if ( ! function_exists('espresso_deactivate_plugin')) { |
262 | - /** |
|
263 | - * deactivate_plugin |
|
264 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
265 | - * |
|
266 | - * @access public |
|
267 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
268 | - * @return void |
|
269 | - */ |
|
270 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
271 | - { |
|
272 | - if ( ! function_exists('deactivate_plugins')) { |
|
273 | - require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
274 | - } |
|
275 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
276 | - deactivate_plugins($plugin_basename); |
|
277 | - } |
|
262 | + /** |
|
263 | + * deactivate_plugin |
|
264 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
265 | + * |
|
266 | + * @access public |
|
267 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
268 | + * @return void |
|
269 | + */ |
|
270 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
271 | + { |
|
272 | + if ( ! function_exists('deactivate_plugins')) { |
|
273 | + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
274 | + } |
|
275 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
276 | + deactivate_plugins($plugin_basename); |
|
277 | + } |
|
278 | 278 | } |