@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * _auto_copy_attendee_info |
349 | 349 | * |
350 | 350 | * @access public |
351 | - * @return EE_Form_Section_Proper |
|
351 | + * @return EE_Form_Section_HTML |
|
352 | 352 | */ |
353 | 353 | private function _auto_copy_attendee_info() { |
354 | 354 | return new EE_Form_Section_HTML( |
@@ -462,6 +462,7 @@ discard block |
||
462 | 462 | * @param EE_Registration $registration |
463 | 463 | * @param EE_Question $question |
464 | 464 | * @param mixed EE_Answer|NULL $answer |
465 | + * @param EE_Answer $answer |
|
465 | 466 | * @return EE_Form_Input_Base |
466 | 467 | */ |
467 | 468 | private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | * @param EE_Checkout $checkout |
38 | 38 | * @return \EE_SPCO_Reg_Step_Attendee_Information |
39 | 39 | */ |
40 | - public function __construct( EE_Checkout $checkout ) { |
|
40 | + public function __construct(EE_Checkout $checkout) { |
|
41 | 41 | $this->_slug = 'attendee_information'; |
42 | 42 | $this->_name = __('Attendee Information', 'event_espresso'); |
43 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php'; |
|
43 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php'; |
|
44 | 44 | $this->checkout = $checkout; |
45 | 45 | $this->_reset_success_message(); |
46 | - $this->set_instructions( __('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
46 | + $this->set_instructions(__('Please answer the following registration questions before proceeding.', 'event_espresso')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso'); |
53 | 53 | EE_Registry::$i18n_js_strings['required_multi_field'] = __(' is a required question. Please enter a value for at least one of the options.', 'event_espresso'); |
54 | 54 | EE_Registry::$i18n_js_strings['answer_required_questions'] = __('Please answer all required questions correctly before proceeding.', 'event_espresso'); |
55 | - EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf( __('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>' ); |
|
55 | + EE_Registry::$i18n_js_strings['attendee_info_copied'] = sprintf(__('The attendee information was successfully copied.%sPlease ensure the rest of the registration form is completed before proceeding.', 'event_espresso'), '<br/>'); |
|
56 | 56 | EE_Registry::$i18n_js_strings['attendee_info_copy_error'] = __('An unknown error occurred on the server while attempting to copy the attendee information. Please refresh the page and try again.', 'event_espresso'); |
57 | 57 | EE_Registry::$i18n_js_strings['enter_valid_email'] = __('You must enter a valid email address.', 'event_espresso'); |
58 | 58 | EE_Registry::$i18n_js_strings['valid_email_and_questions'] = __('You must enter a valid email address and answer all other required questions before you can proceed.', 'event_espresso'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | EEH_Autoloader::register_line_item_display_autoloaders(); |
86 | 86 | $Line_Item_Display = new EE_Line_Item_Display(); |
87 | 87 | // calculate taxes |
88 | - $Line_Item_Display->display_line_item( $this->checkout->cart->get_grand_total(), array( 'set_tax_rate' => true ) ); |
|
88 | + $Line_Item_Display->display_line_item($this->checkout->cart->get_grand_total(), array('set_tax_rate' => true)); |
|
89 | 89 | EE_Registry::instance()->load_helper('Line_Item'); |
90 | 90 | /** @var $subsections EE_Form_Section_Proper[] */ |
91 | 91 | $subsections = array( |
@@ -97,33 +97,33 @@ discard block |
||
97 | 97 | 'ticket_count' => array() |
98 | 98 | ); |
99 | 99 | // grab the saved registrations from the transaction |
100 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
101 | - if ( $registrations ) { |
|
102 | - foreach ( $registrations as $registration ) { |
|
103 | - if ( $registration instanceof EE_Registration ) { |
|
100 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
101 | + if ($registrations) { |
|
102 | + foreach ($registrations as $registration) { |
|
103 | + if ($registration instanceof EE_Registration) { |
|
104 | 104 | // can this registration be processed during this visit ? |
105 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
106 | - $subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration ); |
|
107 | - if ( ! $this->checkout->admin_request ) { |
|
108 | - $template_args['registrations'][ $registration->reg_url_link() ] = $registration; |
|
109 | - $template_args['ticket_count'][ $registration->ticket()->ID() ] = isset( $template_args['ticket_count'][ $registration->ticket()->ID() ] ) ? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1 : 1; |
|
110 | - $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs( $this->checkout->cart->get_grand_total(), 'Ticket', array( $registration->ticket()->ID() ) ); |
|
111 | - $ticket_line_item = is_array( $ticket_line_item ) ? reset( $ticket_line_item ) : $ticket_line_item; |
|
112 | - $template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item( $ticket_line_item ); |
|
105 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
106 | + $subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration); |
|
107 | + if ( ! $this->checkout->admin_request) { |
|
108 | + $template_args['registrations'][$registration->reg_url_link()] = $registration; |
|
109 | + $template_args['ticket_count'][$registration->ticket()->ID()] = isset($template_args['ticket_count'][$registration->ticket()->ID()]) ? $template_args['ticket_count'][$registration->ticket()->ID()] + 1 : 1; |
|
110 | + $ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs($this->checkout->cart->get_grand_total(), 'Ticket', array($registration->ticket()->ID())); |
|
111 | + $ticket_line_item = is_array($ticket_line_item) ? reset($ticket_line_item) : $ticket_line_item; |
|
112 | + $template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item($ticket_line_item); |
|
113 | 113 | } |
114 | - if ( $registration->is_primary_registrant() ) { |
|
114 | + if ($registration->is_primary_registrant()) { |
|
115 | 115 | $primary_registrant = $registration->reg_url_link(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | } |
120 | 120 | // print_copy_info ? |
121 | - if ( $primary_registrant && count( $registrations ) > 1 && ! $this->checkout->admin_request ) { |
|
121 | + if ($primary_registrant && count($registrations) > 1 && ! $this->checkout->admin_request) { |
|
122 | 122 | // TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info |
123 | 123 | $copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info ? $this->_copy_attendee_info_form() : $this->_auto_copy_attendee_info(); |
124 | 124 | // generate hidden input |
125 | - if ( isset( $subsections[ $primary_registrant ] ) && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper ) { |
|
126 | - $subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false ); |
|
125 | + if (isset($subsections[$primary_registrant]) && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper) { |
|
126 | + $subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,8 +135,7 @@ discard block |
||
135 | 135 | 'html_id' => $this->reg_form_name(), |
136 | 136 | 'subsections' => $subsections, |
137 | 137 | 'layout_strategy' => $this->checkout->admin_request ? |
138 | - new EE_Div_Per_Section_Layout() : |
|
139 | - new EE_Template_Layout( |
|
138 | + new EE_Div_Per_Section_Layout() : new EE_Template_Layout( |
|
140 | 139 | array( |
141 | 140 | 'layout_template_file' => $this->_template, // layout_template |
142 | 141 | 'template_args' => $template_args |
@@ -153,61 +152,61 @@ discard block |
||
153 | 152 | * @param EE_Registration $registration |
154 | 153 | * @return EE_Form_Section_Proper |
155 | 154 | */ |
156 | - private function _registrations_reg_form( EE_Registration $registration ) { |
|
157 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
155 | + private function _registrations_reg_form(EE_Registration $registration) { |
|
156 | + EE_Registry::instance()->load_helper('Template'); |
|
158 | 157 | static $attendee_nmbr = 1; |
159 | 158 | // array of params to pass to parent constructor |
160 | 159 | $form_args = array( |
161 | - 'html_id' => 'ee-registration-' . $registration->reg_url_link(), |
|
160 | + 'html_id' => 'ee-registration-'.$registration->reg_url_link(), |
|
162 | 161 | 'html_class' => 'ee-reg-form-attendee-dv', |
163 | 162 | 'html_style' => $this->checkout->admin_request ? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;' : '', |
164 | 163 | 'subsections' => array(), |
165 | 164 | 'layout_strategy' => new EE_Fieldset_Section_Layout( |
166 | 165 | array( |
167 | 166 | 'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text', |
168 | - 'legend_text' => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr ) |
|
167 | + 'legend_text' => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr) |
|
169 | 168 | ) |
170 | 169 | ) |
171 | 170 | ); |
172 | 171 | // verify that registration has valid event |
173 | - if ( $registration->event() instanceof EE_Event ) { |
|
172 | + if ($registration->event() instanceof EE_Event) { |
|
174 | 173 | $query_params = array( |
175 | 174 | array( |
176 | 175 | 'Event.EVT_ID' => $registration->event()->ID(), |
177 | 176 | 'Event_Question_Group.EQG_primary' => $registration->count() == 1 ? TRUE : FALSE |
178 | 177 | ), |
179 | - 'order_by'=>array( 'QSG_order'=>'ASC' ) |
|
178 | + 'order_by'=>array('QSG_order'=>'ASC') |
|
180 | 179 | ); |
181 | - $question_groups = $registration->event()->question_groups( $query_params ); |
|
182 | - if ( $question_groups ) { |
|
183 | - foreach ( $question_groups as $question_group ) { |
|
184 | - if ( $question_group instanceof EE_Question_Group ) { |
|
185 | - $form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form( $registration, $question_group ); |
|
180 | + $question_groups = $registration->event()->question_groups($query_params); |
|
181 | + if ($question_groups) { |
|
182 | + foreach ($question_groups as $question_group) { |
|
183 | + if ($question_group instanceof EE_Question_Group) { |
|
184 | + $form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form($registration, $question_group); |
|
186 | 185 | // add hidden input |
187 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration ); |
|
186 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration); |
|
188 | 187 | } |
189 | 188 | } |
190 | 189 | // if we have question groups for additional attendees, then display the copy options |
191 | 190 | $this->_print_copy_info = $attendee_nmbr > 1 ? TRUE : $this->_print_copy_info; |
192 | 191 | } else { |
193 | - $form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link() ] = new EE_Form_Section_HTML( |
|
192 | + $form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link()] = new EE_Form_Section_HTML( |
|
194 | 193 | EEH_Template::locate_template( |
195 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php', |
|
196 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
194 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php', |
|
195 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args', array()), |
|
197 | 196 | TRUE, |
198 | 197 | TRUE |
199 | 198 | ) |
200 | 199 | ); |
201 | 200 | // add hidden input |
202 | - $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input( $registration, FALSE ); |
|
201 | + $form_args['subsections']['additional_attendee_reg_info'] = $this->_additional_attendee_reg_info_input($registration, FALSE); |
|
203 | 202 | } |
204 | 203 | } |
205 | - if ( $registration->is_primary_registrant() ) { |
|
204 | + if ($registration->is_primary_registrant()) { |
|
206 | 205 | // generate hidden input |
207 | - $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration ); |
|
206 | + $form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration); |
|
208 | 207 | } |
209 | 208 | $attendee_nmbr++; |
210 | - return new EE_Form_Section_Proper( $form_args ); |
|
209 | + return new EE_Form_Section_Proper($form_args); |
|
211 | 210 | } |
212 | 211 | |
213 | 212 | |
@@ -220,11 +219,11 @@ discard block |
||
220 | 219 | * @param bool $additional_attendee_reg_info |
221 | 220 | * @return EE_Form_Input_Base |
222 | 221 | */ |
223 | - private function _additional_attendee_reg_info_input( EE_Registration $registration, $additional_attendee_reg_info = TRUE ){ |
|
222 | + private function _additional_attendee_reg_info_input(EE_Registration $registration, $additional_attendee_reg_info = TRUE) { |
|
224 | 223 | // generate hidden input |
225 | 224 | return new EE_Hidden_Input( |
226 | 225 | array( |
227 | - 'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(), |
|
226 | + 'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(), |
|
228 | 227 | 'default' => $additional_attendee_reg_info |
229 | 228 | ) |
230 | 229 | ); |
@@ -237,22 +236,22 @@ discard block |
||
237 | 236 | * @param EE_Question_Group $question_group |
238 | 237 | * @return EE_Form_Section_Proper |
239 | 238 | */ |
240 | - private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){ |
|
239 | + private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) { |
|
241 | 240 | // array of params to pass to parent constructor |
242 | 241 | $form_args = array( |
243 | - 'html_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier(), |
|
242 | + 'html_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier(), |
|
244 | 243 | 'html_class' => $this->checkout->admin_request ? 'form-table ee-reg-form-qstn-grp-dv' : 'ee-reg-form-qstn-grp-dv', |
245 | - 'html_label_id' => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl', |
|
244 | + 'html_label_id' => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl', |
|
246 | 245 | 'subsections' => array( |
247 | - 'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group ) |
|
246 | + 'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group) |
|
248 | 247 | ), |
249 | 248 | 'layout_strategy' => $this->checkout->admin_request ? new EE_Admin_Two_Column_Layout() : new EE_Div_Per_Section_Layout() |
250 | 249 | ); |
251 | 250 | // where params |
252 | - $query_params = array( 'QST_deleted' => 0 ); |
|
251 | + $query_params = array('QST_deleted' => 0); |
|
253 | 252 | // don't load admin only questions on the frontend |
254 | - if ( ! $this->checkout->admin_request ) { |
|
255 | - $query_params['QST_admin_only'] = array( '!=', TRUE ); |
|
253 | + if ( ! $this->checkout->admin_request) { |
|
254 | + $query_params['QST_admin_only'] = array('!=', TRUE); |
|
256 | 255 | } |
257 | 256 | $questions = $question_group->get_many_related( |
258 | 257 | 'Question', |
@@ -264,21 +263,21 @@ discard block |
||
264 | 263 | ) |
265 | 264 | ); |
266 | 265 | // filter for additional content before questions |
267 | - $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this )); |
|
266 | + $form_args['subsections']['reg_form_questions_before'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '', $registration, $question_group, $this)); |
|
268 | 267 | // loop thru questions |
269 | - foreach ( $questions as $question ) { |
|
270 | - if( $question instanceof EE_Question ){ |
|
268 | + foreach ($questions as $question) { |
|
269 | + if ($question instanceof EE_Question) { |
|
271 | 270 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
272 | - $form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question ); |
|
271 | + $form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question); |
|
273 | 272 | } |
274 | 273 | } |
275 | - $form_args['subsections'] = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this ); |
|
274 | + $form_args['subsections'] = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__question_group_reg_form__subsections_array', $form_args['subsections'], $registration, $question_group, $this); |
|
276 | 275 | |
277 | 276 | // filter for additional content after questions |
278 | - $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML( apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this )); |
|
277 | + $form_args['subsections']['reg_form_questions_after'] = new EE_Form_Section_HTML(apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '', $registration, $question_group, $this)); |
|
279 | 278 | // d( $form_args ); |
280 | - $question_group_reg_form = new EE_Form_Section_Proper( $form_args ); |
|
281 | - return apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this ); |
|
279 | + $question_group_reg_form = new EE_Form_Section_Proper($form_args); |
|
280 | + return apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', $question_group_reg_form, $registration, $question_group, $this); |
|
282 | 281 | } |
283 | 282 | |
284 | 283 | |
@@ -288,12 +287,12 @@ discard block |
||
288 | 287 | * @param EE_Question_Group $question_group |
289 | 288 | * @return EE_Form_Section_HTML |
290 | 289 | */ |
291 | - private function _question_group_header( EE_Question_Group $question_group ){ |
|
290 | + private function _question_group_header(EE_Question_Group $question_group) { |
|
292 | 291 | $html = ''; |
293 | 292 | // group_name |
294 | - if ( $question_group->show_group_name() && $question_group->name() != '' ) { |
|
293 | + if ($question_group->show_group_name() && $question_group->name() != '') { |
|
295 | 294 | EE_Registry::instance()->load_helper('HTML'); |
296 | - if ( $this->checkout->admin_request ) { |
|
295 | + if ($this->checkout->admin_request) { |
|
297 | 296 | $html .= EEH_HTML::br(); |
298 | 297 | $html .= EEH_HTML::h3( |
299 | 298 | $question_group->name(), |
@@ -307,7 +306,7 @@ discard block |
||
307 | 306 | } |
308 | 307 | } |
309 | 308 | // group_desc |
310 | - if ( $question_group->show_group_desc() && $question_group->desc() != '' ) { |
|
309 | + if ($question_group->show_group_desc() && $question_group->desc() != '') { |
|
311 | 310 | $html .= EEH_HTML::p( |
312 | 311 | $question_group->desc(), |
313 | 312 | '', |
@@ -315,7 +314,7 @@ discard block |
||
315 | 314 | ); |
316 | 315 | |
317 | 316 | } |
318 | - return new EE_Form_Section_HTML( $html ); |
|
317 | + return new EE_Form_Section_HTML($html); |
|
319 | 318 | } |
320 | 319 | |
321 | 320 | |
@@ -324,14 +323,14 @@ discard block |
||
324 | 323 | * @access public |
325 | 324 | * @return EE_Form_Section_Proper |
326 | 325 | */ |
327 | - private function _copy_attendee_info_form(){ |
|
326 | + private function _copy_attendee_info_form() { |
|
328 | 327 | // array of params to pass to parent constructor |
329 | 328 | return new EE_Form_Section_Proper( |
330 | 329 | array( |
331 | 330 | 'subsections' => $this->_copy_attendee_info_inputs(), |
332 | 331 | 'layout_strategy' => new EE_Template_Layout( |
333 | 332 | array( |
334 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'copy_attendee_info.template.php', // layout_template |
|
333 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'copy_attendee_info.template.php', // layout_template |
|
335 | 334 | 'begin_template_file' => NULL, |
336 | 335 | 'input_template_file' => NULL, |
337 | 336 | 'subsection_template_file' => NULL, |
@@ -353,8 +352,8 @@ discard block |
||
353 | 352 | private function _auto_copy_attendee_info() { |
354 | 353 | return new EE_Form_Section_HTML( |
355 | 354 | EEH_Template::locate_template( |
356 | - SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php', |
|
357 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
355 | + SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php', |
|
356 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args', array()), |
|
358 | 357 | TRUE, |
359 | 358 | TRUE |
360 | 359 | ) |
@@ -373,25 +372,25 @@ discard block |
||
373 | 372 | $copy_attendee_info_inputs = array(); |
374 | 373 | $prev_ticket = NULL; |
375 | 374 | // grab the saved registrations from the transaction |
376 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
377 | - foreach ( $registrations as $registration ) { |
|
375 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
376 | + foreach ($registrations as $registration) { |
|
378 | 377 | // for all attendees other than the primary attendee |
379 | - if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) { |
|
378 | + if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) { |
|
380 | 379 | // if this is a new ticket OR if this is the very first additional attendee after the primary attendee |
381 | - if ( $registration->ticket()->ID() !== $prev_ticket ) { |
|
380 | + if ($registration->ticket()->ID() !== $prev_ticket) { |
|
382 | 381 | $item_name = $registration->ticket()->name(); |
383 | - $item_name .= $registration->ticket()->description() != '' ? ' - ' . $registration->ticket()->description() : ''; |
|
384 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML( |
|
385 | - '<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>' |
|
382 | + $item_name .= $registration->ticket()->description() != '' ? ' - '.$registration->ticket()->description() : ''; |
|
383 | + $copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML( |
|
384 | + '<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>' |
|
386 | 385 | ); |
387 | 386 | $prev_ticket = $registration->ticket()->ID(); |
388 | 387 | } |
389 | 388 | |
390 | - $copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new |
|
389 | + $copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new |
|
391 | 390 | EE_Checkbox_Multi_Input( |
392 | - array( $registration->ID() => sprintf( __('Attendee #%s', 'event_espresso'), $registration->count() )), |
|
391 | + array($registration->ID() => sprintf(__('Attendee #%s', 'event_espresso'), $registration->count())), |
|
393 | 392 | array( |
394 | - 'html_id' => 'spco-copy-attendee-chk-' . $registration->reg_url_link(), |
|
393 | + 'html_id' => 'spco-copy-attendee-chk-'.$registration->reg_url_link(), |
|
395 | 394 | 'html_class' => 'spco-copy-attendee-chk ee-do-not-validate', |
396 | 395 | 'display_html_label_text' => FALSE |
397 | 396 | ) |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param EE_Registration $registration |
411 | 410 | * @return EE_Form_Input_Base |
412 | 411 | */ |
413 | - private function _additional_primary_registrant_inputs( EE_Registration $registration ){ |
|
412 | + private function _additional_primary_registrant_inputs(EE_Registration $registration) { |
|
414 | 413 | // generate hidden input |
415 | 414 | return new EE_Hidden_Input( |
416 | 415 | array( |
@@ -428,31 +427,31 @@ discard block |
||
428 | 427 | * @param EE_Question $question |
429 | 428 | * @return EE_Form_Input_Base |
430 | 429 | */ |
431 | - public function reg_form_question( EE_Registration $registration, EE_Question $question ){ |
|
430 | + public function reg_form_question(EE_Registration $registration, EE_Question $question) { |
|
432 | 431 | |
433 | 432 | // if this question was for an attendee detail, then check for that answer |
434 | - $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value( $registration, $question->system_ID() ); |
|
433 | + $answer_value = EEM_Answer::instance()->get_attendee_property_answer_value($registration, $question->system_ID()); |
|
435 | 434 | $answer = $answer_value === null |
436 | - ? EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) ) ) |
|
435 | + ? EEM_Answer::instance()->get_one(array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))) |
|
437 | 436 | : null; |
438 | 437 | // if NOT returning to edit an existing registration OR if this question is for an attendee property OR we still don't have an EE_Answer object |
439 | - if( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer ) { |
|
438 | + if ( ! $registration->reg_url_link() || $answer_value || ! $answer instanceof EE_Answer) { |
|
440 | 439 | // create an EE_Answer object for storing everything in |
441 | - $answer = EE_Answer::new_instance ( array( |
|
440 | + $answer = EE_Answer::new_instance(array( |
|
442 | 441 | 'QST_ID'=> $question->ID(), |
443 | 442 | 'REG_ID'=> $registration->ID() |
444 | 443 | )); |
445 | 444 | } |
446 | 445 | // verify instance |
447 | - if( $answer instanceof EE_Answer ){ |
|
448 | - if ( ! empty( $answer_value )) { |
|
449 | - $answer->set( 'ANS_value', $answer_value ); |
|
446 | + if ($answer instanceof EE_Answer) { |
|
447 | + if ( ! empty($answer_value)) { |
|
448 | + $answer->set('ANS_value', $answer_value); |
|
450 | 449 | } |
451 | - $answer->cache( 'Question', $question ); |
|
452 | - $answer_cache_id =$question->system_ID() != NULL ? $question->system_ID() . '-' . $registration->reg_url_link() : $question->ID() . '-' . $registration->reg_url_link(); |
|
453 | - $registration->cache( 'Answer', $answer, $answer_cache_id ); |
|
450 | + $answer->cache('Question', $question); |
|
451 | + $answer_cache_id = $question->system_ID() != NULL ? $question->system_ID().'-'.$registration->reg_url_link() : $question->ID().'-'.$registration->reg_url_link(); |
|
452 | + $registration->cache('Answer', $answer, $answer_cache_id); |
|
454 | 453 | } |
455 | - return $this->_generate_question_input( $registration, $question, $answer ); |
|
454 | + return $this->_generate_question_input($registration, $question, $answer); |
|
456 | 455 | |
457 | 456 | } |
458 | 457 | |
@@ -464,7 +463,7 @@ discard block |
||
464 | 463 | * @param mixed EE_Answer|NULL $answer |
465 | 464 | * @return EE_Form_Input_Base |
466 | 465 | */ |
467 | - private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){ |
|
466 | + private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) { |
|
468 | 467 | // d( $registration ); |
469 | 468 | // d( $question ); |
470 | 469 | // d( $answer ); |
@@ -487,29 +486,29 @@ discard block |
||
487 | 486 | $identifier = $question->is_system_question() ? $question->system_ID() : $question->ID(); |
488 | 487 | |
489 | 488 | $input_constructor_args = array( |
490 | - 'html_name' => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']', |
|
491 | - 'html_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
492 | - 'html_class' => 'ee-reg-qstn ee-reg-qstn-' . $identifier, |
|
489 | + 'html_name' => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']', |
|
490 | + 'html_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
491 | + 'html_class' => 'ee-reg-qstn ee-reg-qstn-'.$identifier, |
|
493 | 492 | 'required' => $question->required() ? TRUE : FALSE, |
494 | - 'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier, |
|
493 | + 'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier, |
|
495 | 494 | 'html_label_class' => 'ee-reg-qstn', |
496 | 495 | 'html_label_text' => $question->display_text(), |
497 | 496 | 'required_validation_error_message' => $question->required_text() |
498 | 497 | ); |
499 | 498 | // has this question been answered ? |
500 | - if ( $answer instanceof EE_Answer ) { |
|
501 | - if ( $answer->ID() ) { |
|
502 | - $input_constructor_args['html_name'] .= '[' . $answer->ID() . ']'; |
|
503 | - $input_constructor_args['html_id'] .= '-' . $answer->ID(); |
|
504 | - $input_constructor_args['html_label_id'] .= '-' . $answer->ID(); |
|
499 | + if ($answer instanceof EE_Answer) { |
|
500 | + if ($answer->ID()) { |
|
501 | + $input_constructor_args['html_name'] .= '['.$answer->ID().']'; |
|
502 | + $input_constructor_args['html_id'] .= '-'.$answer->ID(); |
|
503 | + $input_constructor_args['html_label_id'] .= '-'.$answer->ID(); |
|
505 | 504 | } |
506 | 505 | $input_constructor_args['default'] = $answer->value(); |
507 | 506 | } |
508 | 507 | //add "-lbl" to the end of the label id |
509 | - $input_constructor_args['html_label_id'] .= '-lbl'; |
|
510 | - $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
511 | - if( EEM_Question::instance()->question_type_is_in_category( $question->type(), 'text' ) ) { |
|
512 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( |
|
508 | + $input_constructor_args['html_label_id'] .= '-lbl'; |
|
509 | + $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
510 | + if (EEM_Question::instance()->question_type_is_in_category($question->type(), 'text')) { |
|
511 | + $input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( |
|
513 | 512 | null, |
514 | 513 | min( |
515 | 514 | $max_max_for_question, |
@@ -517,83 +516,83 @@ discard block |
||
517 | 516 | ) |
518 | 517 | ); |
519 | 518 | } |
520 | - $input_constructor_args = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
519 | + $input_constructor_args = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__input_constructor_args', |
|
521 | 520 | $input_constructor_args, |
522 | 521 | $registration, |
523 | 522 | $question, |
524 | 523 | $answer |
525 | 524 | ); |
526 | 525 | |
527 | - $this->_required_questions[ $identifier ] = $question->required() ? true : false; |
|
526 | + $this->_required_questions[$identifier] = $question->required() ? true : false; |
|
528 | 527 | |
529 | - switch ( $question->type() ) { |
|
528 | + switch ($question->type()) { |
|
530 | 529 | // Text |
531 | 530 | case EEM_Question::QST_type_text : |
532 | - if( $identifier == 'email' ){ |
|
533 | - return new EE_Email_Input( $input_constructor_args ); |
|
534 | - }else{ |
|
535 | - return new EE_Text_Input( $input_constructor_args ); |
|
531 | + if ($identifier == 'email') { |
|
532 | + return new EE_Email_Input($input_constructor_args); |
|
533 | + } else { |
|
534 | + return new EE_Text_Input($input_constructor_args); |
|
536 | 535 | } |
537 | 536 | break; |
538 | 537 | // Textarea |
539 | 538 | case EEM_Question::QST_type_textarea : |
540 | - return new EE_Text_Area_Input( $input_constructor_args ); |
|
539 | + return new EE_Text_Area_Input($input_constructor_args); |
|
541 | 540 | break; |
542 | 541 | // Radio Buttons |
543 | 542 | case EEM_Question::QST_type_radio : |
544 | - return new EE_Radio_Button_Input( $question->options(), $input_constructor_args ); |
|
543 | + return new EE_Radio_Button_Input($question->options(), $input_constructor_args); |
|
545 | 544 | break; |
546 | 545 | // Dropdown |
547 | 546 | case EEM_Question::QST_type_dropdown : |
548 | - return new EE_Select_Input( $question->options(), $input_constructor_args ); |
|
547 | + return new EE_Select_Input($question->options(), $input_constructor_args); |
|
549 | 548 | break; |
550 | 549 | // State Dropdown |
551 | 550 | case EEM_Question::QST_type_state : |
552 | - $state_options = array( '' => array( '' => '')); |
|
551 | + $state_options = array('' => array('' => '')); |
|
553 | 552 | $states = $this->checkout->action == 'process_reg_step' ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_active_states(); |
554 | - if ( ! empty( $states )) { |
|
555 | - foreach( $states as $state ){ |
|
556 | - if ( $state instanceof EE_State ) { |
|
557 | - $state_options[ $state->country()->name() ][ $state->ID() ] = $state->name(); |
|
553 | + if ( ! empty($states)) { |
|
554 | + foreach ($states as $state) { |
|
555 | + if ($state instanceof EE_State) { |
|
556 | + $state_options[$state->country()->name()][$state->ID()] = $state->name(); |
|
558 | 557 | } |
559 | 558 | } |
560 | 559 | } |
561 | - $state_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer ); |
|
562 | - return new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
560 | + $state_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', $state_options, $this, $registration, $question, $answer); |
|
561 | + return new EE_State_Select_Input($state_options, $input_constructor_args); |
|
563 | 562 | break; |
564 | 563 | // Country Dropdown |
565 | 564 | case EEM_Question::QST_type_country : |
566 | - $country_options = array( '' => '' ); |
|
565 | + $country_options = array('' => ''); |
|
567 | 566 | // get possibly cached list of countries |
568 | 567 | $countries = $this->checkout->action == 'process_reg_step' ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
569 | - if ( ! empty( $countries )) { |
|
570 | - foreach( $countries as $country ){ |
|
571 | - if ( $country instanceof EE_Country ) { |
|
572 | - $country_options[ $country->ID() ] = $country->name(); |
|
568 | + if ( ! empty($countries)) { |
|
569 | + foreach ($countries as $country) { |
|
570 | + if ($country instanceof EE_Country) { |
|
571 | + $country_options[$country->ID()] = $country->name(); |
|
573 | 572 | } |
574 | 573 | } |
575 | 574 | } |
576 | - $country_options = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer ); |
|
577 | - return new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
575 | + $country_options = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', $country_options, $this, $registration, $question, $answer); |
|
576 | + return new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
578 | 577 | break; |
579 | 578 | // Checkboxes |
580 | 579 | case EEM_Question::QST_type_checkbox : |
581 | - return new EE_Checkbox_Multi_Input( $question->options(), $input_constructor_args ); |
|
580 | + return new EE_Checkbox_Multi_Input($question->options(), $input_constructor_args); |
|
582 | 581 | break; |
583 | 582 | // Date |
584 | 583 | case EEM_Question::QST_type_date : |
585 | - return new EE_Datepicker_Input( $input_constructor_args ); |
|
584 | + return new EE_Datepicker_Input($input_constructor_args); |
|
586 | 585 | break; |
587 | 586 | case EEM_Question::QST_type_html_textarea : |
588 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
589 | - $input = new EE_Text_Area_Input( $input_constructor_args ); |
|
590 | - $input->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
587 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
588 | + $input = new EE_Text_Area_Input($input_constructor_args); |
|
589 | + $input->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
591 | 590 | return $input; |
592 | 591 | // fallback |
593 | 592 | default : |
594 | - $default_input = apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args ); |
|
595 | - if( ! $default_input ){ |
|
596 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
593 | + $default_input = apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__default', null, $question->type(), $question, $input_constructor_args); |
|
594 | + if ( ! $default_input) { |
|
595 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
597 | 596 | } |
598 | 597 | return $default_input; |
599 | 598 | } |
@@ -618,65 +617,65 @@ discard block |
||
618 | 617 | */ |
619 | 618 | public function process_reg_step() { |
620 | 619 | |
621 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
620 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
622 | 621 | // grab validated data from form |
623 | 622 | $valid_data = $this->checkout->current_step->valid_data(); |
624 | 623 | //EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
625 | 624 | //EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ ); |
626 | 625 | // if we don't have any $valid_data then something went TERRIBLY WRONG !!! |
627 | - if ( empty( $valid_data )) { |
|
628 | - EE_Error::add_error( __('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
626 | + if (empty($valid_data)) { |
|
627 | + EE_Error::add_error(__('No valid question responses were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
629 | 628 | return FALSE; |
630 | 629 | } |
631 | 630 | //EEH_Debug_Tools::printr( $this->checkout->transaction, '$this->checkout->transaction', __FILE__, __LINE__ ); |
632 | - if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) { |
|
633 | - EE_Error::add_error( __( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
631 | + if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) { |
|
632 | + EE_Error::add_error(__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
634 | 633 | return FALSE; |
635 | 634 | } |
636 | 635 | // get cached registrations |
637 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
636 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
638 | 637 | // verify we got the goods |
639 | - if ( empty( $registrations )) { |
|
640 | - EE_Error::add_error( __( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
638 | + if (empty($registrations)) { |
|
639 | + EE_Error::add_error(__('Your form data could not be applied to any valid registrations.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
641 | 640 | return FALSE; |
642 | 641 | } |
643 | 642 | // extract attendee info from form data and save to model objects |
644 | - $registrations_processed = $this->_process_registrations( $registrations, $valid_data ); |
|
643 | + $registrations_processed = $this->_process_registrations($registrations, $valid_data); |
|
645 | 644 | // if first pass thru SPCO, then let's check processed registrations against the total number of tickets in the cart |
646 | - if ( $registrations_processed === FALSE ) { |
|
645 | + if ($registrations_processed === FALSE) { |
|
647 | 646 | // but return immediately if the previous step exited early due to errors |
648 | 647 | return FALSE; |
649 | - } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) { |
|
648 | + } else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) { |
|
650 | 649 | // generate a correctly translated string for all possible singular/plural combinations |
651 | - if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) { |
|
650 | + if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) { |
|
652 | 651 | $error_msg = sprintf( |
653 | - __( 'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
652 | + __('There was %1$d ticket in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
654 | 653 | $this->checkout->total_ticket_count, |
655 | 654 | $registrations_processed |
656 | 655 | ); |
657 | - } else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) { |
|
656 | + } else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) { |
|
658 | 657 | $error_msg = sprintf( |
659 | - __( 'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso' ), |
|
658 | + __('There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed', 'event_espresso'), |
|
660 | 659 | $this->checkout->total_ticket_count, |
661 | 660 | $registrations_processed |
662 | 661 | ); |
663 | 662 | } else { |
664 | 663 | $error_msg = sprintf( |
665 | - __( 'There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso' ), |
|
664 | + __('There was a total of %1$d tickets in the Event Queue, but %2$ds registrations were processed', 'event_espresso'), |
|
666 | 665 | $this->checkout->total_ticket_count, |
667 | 666 | $registrations_processed |
668 | 667 | ); |
669 | 668 | |
670 | 669 | } |
671 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
670 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
672 | 671 | return FALSE; |
673 | 672 | } |
674 | 673 | // mark this reg step as completed |
675 | 674 | $this->set_completed(); |
676 | - $this->_set_success_message( __('The Attendee Information Step has been successfully completed.', 'event_espresso' )); |
|
675 | + $this->_set_success_message(__('The Attendee Information Step has been successfully completed.', 'event_espresso')); |
|
677 | 676 | //do action in case a plugin wants to do something with the data submitted in step 1. |
678 | 677 | //passes EE_Single_Page_Checkout, and it's posted data |
679 | - do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data ); |
|
678 | + do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data); |
|
680 | 679 | return TRUE; |
681 | 680 | |
682 | 681 | } |
@@ -690,9 +689,9 @@ discard block |
||
690 | 689 | * @param array $valid_data |
691 | 690 | * @return boolean | int |
692 | 691 | */ |
693 | - private function _process_registrations( $registrations = array(), $valid_data = array() ) { |
|
692 | + private function _process_registrations($registrations = array(), $valid_data = array()) { |
|
694 | 693 | // load resources and set some defaults |
695 | - EE_Registry::instance()->load_model( 'Attendee' ); |
|
694 | + EE_Registry::instance()->load_model('Attendee'); |
|
696 | 695 | // holder for primary registrant attendee object |
697 | 696 | $this->checkout->primary_attendee_obj = NULL; |
698 | 697 | // array for tracking reg form data for the primary registrant |
@@ -709,19 +708,19 @@ discard block |
||
709 | 708 | // attendee counter |
710 | 709 | $att_nmbr = 0; |
711 | 710 | // grab the saved registrations from the transaction |
712 | - foreach ( $registrations as $registration ) { |
|
711 | + foreach ($registrations as $registration) { |
|
713 | 712 | // verify EE_Registration object |
714 | - if ( ! $registration instanceof EE_Registration ) { |
|
715 | - EE_Error::add_error( __( 'An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
713 | + if ( ! $registration instanceof EE_Registration) { |
|
714 | + EE_Error::add_error(__('An invalid Registration object was discovered when attempting to process your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
716 | 715 | return FALSE; |
717 | 716 | } |
718 | 717 | $reg_url_link = $registration->reg_url_link(); |
719 | 718 | // reg_url_link exists ? |
720 | - if ( $reg_url_link ) { |
|
719 | + if ($reg_url_link) { |
|
721 | 720 | // should this registration be processed during this visit ? |
722 | - if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) { |
|
721 | + if ($this->checkout->visit_allows_processing_of_this_registration($registration)) { |
|
723 | 722 | // if NOT revisiting, then let's save the registration now, so that we have a REG_ID to use when generating other objects |
724 | - if ( ! $this->checkout->revisit ) { |
|
723 | + if ( ! $this->checkout->revisit) { |
|
725 | 724 | $registration->save(); |
726 | 725 | } |
727 | 726 | |
@@ -732,41 +731,41 @@ discard block |
||
732 | 731 | * @var bool if TRUE is returned by the plugin then the |
733 | 732 | * registration processing is halted. |
734 | 733 | */ |
735 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this ) ) { |
|
734 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process', FALSE, $att_nmbr, $registration, $registrations, $valid_data, $this)) { |
|
736 | 735 | return FALSE; |
737 | 736 | } |
738 | 737 | |
739 | 738 | // Houston, we have a registration! |
740 | 739 | $att_nmbr++; |
741 | - $this->_attendee_data[ $reg_url_link ] = array(); |
|
740 | + $this->_attendee_data[$reg_url_link] = array(); |
|
742 | 741 | // unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ); |
743 | - if ( isset( $valid_data[ $reg_url_link ] )) { |
|
742 | + if (isset($valid_data[$reg_url_link])) { |
|
744 | 743 | // do we need to copy basic info from primary attendee ? |
745 | - $copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0 ? TRUE : FALSE; |
|
744 | + $copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info']) && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0 ? TRUE : FALSE; |
|
746 | 745 | // filter form input data for this registration |
747 | - $valid_data[ $reg_url_link ] = apply_filters( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[ $reg_url_link ] ); |
|
746 | + $valid_data[$reg_url_link] = apply_filters('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', $valid_data[$reg_url_link]); |
|
748 | 747 | //EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ ); |
749 | - if ( isset( $valid_data['primary_attendee'] )) { |
|
750 | - $primary_registrant['line_item_id'] = ! empty( $valid_data['primary_attendee'] ) ? $valid_data['primary_attendee'] : FALSE; |
|
751 | - unset( $valid_data['primary_attendee'] ); |
|
748 | + if (isset($valid_data['primary_attendee'])) { |
|
749 | + $primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee']) ? $valid_data['primary_attendee'] : FALSE; |
|
750 | + unset($valid_data['primary_attendee']); |
|
752 | 751 | } |
753 | 752 | // now loop through our array of valid post data && process attendee reg forms |
754 | - foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) { |
|
755 | - if ( ! in_array( $form_section, $non_input_form_sections )) { |
|
756 | - foreach ( $form_inputs as $form_input => $input_value ) { |
|
753 | + foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) { |
|
754 | + if ( ! in_array($form_section, $non_input_form_sections)) { |
|
755 | + foreach ($form_inputs as $form_input => $input_value) { |
|
757 | 756 | // check for critical inputs |
758 | - if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email( $form_input, $input_value )) { |
|
757 | + if ( ! $this->_verify_critical_attendee_details_are_set_and_validate_email($form_input, $input_value)) { |
|
759 | 758 | return FALSE; |
760 | 759 | } |
761 | 760 | // store a bit of data about the primary attendee |
762 | - if ( $att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty( $input_value )) { |
|
763 | - $primary_registrant[ $form_input ] = $input_value; |
|
764 | - } else if ( $copy_primary && isset( $primary_registrant[ $form_input ] ) && $input_value == NULL ) { |
|
765 | - $input_value = $primary_registrant[ $form_input ]; |
|
761 | + if ($att_nmbr == 1 && $reg_url_link == $primary_registrant['line_item_id'] && ! empty($input_value)) { |
|
762 | + $primary_registrant[$form_input] = $input_value; |
|
763 | + } else if ($copy_primary && isset($primary_registrant[$form_input]) && $input_value == NULL) { |
|
764 | + $input_value = $primary_registrant[$form_input]; |
|
766 | 765 | } |
767 | 766 | // now attempt to save the input data |
768 | - if ( ! $this->_save_registration_form_input( $registration, $form_input, $input_value )) { |
|
769 | - EE_Error::add_error( sprintf( __( 'Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso' ), $form_input, $input_value ), __FILE__, __FUNCTION__, __LINE__ ); |
|
767 | + if ( ! $this->_save_registration_form_input($registration, $form_input, $input_value)) { |
|
768 | + EE_Error::add_error(sprintf(__('Unable to save registration form data for the form input: "%1$s" with the submitted value: "%2$s"', 'event_espresso'), $form_input, $input_value), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 769 | return FALSE; |
771 | 770 | } |
772 | 771 | } |
@@ -775,51 +774,51 @@ discard block |
||
775 | 774 | } |
776 | 775 | //EEH_Debug_Tools::printr( $this->_attendee_data, '$this->_attendee_data', __FILE__, __LINE__ ); |
777 | 776 | // this registration does not require additional attendee information ? |
778 | - if ( $copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
777 | + if ($copy_primary && $att_nmbr > 1 && $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
779 | 778 | // just copy the primary registrant |
780 | 779 | $attendee = $this->checkout->primary_attendee_obj; |
781 | 780 | } else { |
782 | 781 | // have we met before? |
783 | - $attendee = $this->_find_existing_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
782 | + $attendee = $this->_find_existing_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
784 | 783 | // did we find an already existing record for this attendee ? |
785 | - if ( $attendee instanceof EE_Attendee ) { |
|
786 | - $attendee = $this->_update_existing_attendee_data( $attendee, $this->_attendee_data[ $reg_url_link ] ); |
|
784 | + if ($attendee instanceof EE_Attendee) { |
|
785 | + $attendee = $this->_update_existing_attendee_data($attendee, $this->_attendee_data[$reg_url_link]); |
|
787 | 786 | } else { |
788 | 787 | // ensure critical details are set for additional attendees |
789 | - $this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant( $this->_attendee_data[ $reg_url_link ] ) : $this->_attendee_data[ $reg_url_link ]; |
|
790 | - $attendee = $this->_create_new_attendee( $registration, $this->_attendee_data[ $reg_url_link ] ); |
|
788 | + $this->_attendee_data[$reg_url_link] = $att_nmbr > 1 ? $this->_copy_critical_attendee_details_from_primary_registrant($this->_attendee_data[$reg_url_link]) : $this->_attendee_data[$reg_url_link]; |
|
789 | + $attendee = $this->_create_new_attendee($registration, $this->_attendee_data[$reg_url_link]); |
|
791 | 790 | } |
792 | 791 | // who's #1 ? |
793 | - if ( $att_nmbr == 1 ) { |
|
792 | + if ($att_nmbr == 1) { |
|
794 | 793 | $this->checkout->primary_attendee_obj = $attendee; |
795 | 794 | } |
796 | 795 | } |
797 | 796 | //EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ ); |
798 | 797 | // add relation to registration, set attendee ID, and cache attendee |
799 | - $this->_associate_attendee_with_registration( $registration, $attendee ); |
|
800 | - if ( ! $registration->attendee() instanceof EE_Attendee ) { |
|
801 | - EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ ); |
|
798 | + $this->_associate_attendee_with_registration($registration, $attendee); |
|
799 | + if ( ! $registration->attendee() instanceof EE_Attendee) { |
|
800 | + EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__); |
|
802 | 801 | return FALSE; |
803 | 802 | } |
804 | 803 | /** @type EE_Registration_Processor $registration_processor */ |
805 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
804 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
806 | 805 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
807 | - $registration_processor->toggle_incomplete_registration_status_to_default( $registration, FALSE ); |
|
806 | + $registration_processor->toggle_incomplete_registration_status_to_default($registration, FALSE); |
|
808 | 807 | /** @type EE_Transaction_Processor $transaction_processor */ |
809 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
808 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
810 | 809 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
811 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
810 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
812 | 811 | // if we've gotten this far, then let's save what we have |
813 | 812 | $registration->save(); |
814 | 813 | // add relation between TXN and registration |
815 | - $this->_associate_registration_with_transaction( $registration ); |
|
814 | + $this->_associate_registration_with_transaction($registration); |
|
816 | 815 | |
817 | 816 | } // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) { |
818 | 817 | |
819 | - } else { |
|
820 | - 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__ ); |
|
818 | + } else { |
|
819 | + 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__); |
|
821 | 820 | // remove malformed data |
822 | - unset( $valid_data[ $reg_url_link ] ); |
|
821 | + unset($valid_data[$reg_url_link]); |
|
823 | 822 | return FALSE; |
824 | 823 | } |
825 | 824 | |
@@ -837,22 +836,22 @@ discard block |
||
837 | 836 | * @param string $input_value |
838 | 837 | * @return boolean |
839 | 838 | */ |
840 | - private function _save_registration_form_input( EE_Registration $registration, $form_input = '', $input_value = '' ) { |
|
839 | + private function _save_registration_form_input(EE_Registration $registration, $form_input = '', $input_value = '') { |
|
841 | 840 | //echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '()</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span> <b style="font-size:10px;"> ' . __LINE__ . ' </b></h3>'; |
842 | 841 | //EEH_Debug_Tools::printr( $form_input, '$form_input', __FILE__, __LINE__ ); |
843 | 842 | // allow for plugins to hook in and do their own processing of the form input. |
844 | 843 | // For plugins to bypass normal processing here, they just need to return a boolean value. |
845 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this ) ) { |
|
844 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input', FALSE, $registration, $form_input, $input_value, $this)) { |
|
846 | 845 | return TRUE; |
847 | 846 | } |
848 | 847 | |
849 | 848 | // grab related answer objects |
850 | 849 | $answers = $registration->answers(); |
851 | 850 | // $answer_cache_id is the key used to find the EE_Answer we want |
852 | - $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input . '-' . $registration->reg_url_link(); |
|
853 | - $answer_is_obj = isset( $answers[ $answer_cache_id ] ) && $answers[ $answer_cache_id ] instanceof EE_Answer ? TRUE : FALSE; |
|
851 | + $answer_cache_id = $this->checkout->reg_url_link ? $form_input : $form_input.'-'.$registration->reg_url_link(); |
|
852 | + $answer_is_obj = isset($answers[$answer_cache_id]) && $answers[$answer_cache_id] instanceof EE_Answer ? TRUE : FALSE; |
|
854 | 853 | //rename form_inputs if they are EE_Attendee properties |
855 | - switch( (string)$form_input ) { |
|
854 | + switch ((string) $form_input) { |
|
856 | 855 | |
857 | 856 | case 'state' : |
858 | 857 | case 'STA_ID' : |
@@ -867,33 +866,33 @@ discard block |
||
867 | 866 | break; |
868 | 867 | |
869 | 868 | default : |
870 | - $ATT_input = 'ATT_' . $form_input; |
|
869 | + $ATT_input = 'ATT_'.$form_input; |
|
871 | 870 | //EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ ); |
872 | - $attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? TRUE : FALSE; |
|
873 | - $form_input = $attendee_property ? 'ATT_' . $form_input : $form_input; |
|
871 | + $attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? TRUE : FALSE; |
|
872 | + $form_input = $attendee_property ? 'ATT_'.$form_input : $form_input; |
|
874 | 873 | } |
875 | 874 | //EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ ); |
876 | 875 | //EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ ); |
877 | 876 | //EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ ); |
878 | 877 | //EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ ); |
879 | 878 | // if this form input has a corresponding attendee property |
880 | - if ( $attendee_property ) { |
|
881 | - $this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value; |
|
882 | - if ( $answer_is_obj ) { |
|
879 | + if ($attendee_property) { |
|
880 | + $this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value; |
|
881 | + if ($answer_is_obj) { |
|
883 | 882 | // and delete the corresponding answer since we won't be storing this data in that object |
884 | - $registration->_remove_relation_to( $answers[ $answer_cache_id ], 'Answer' ); |
|
885 | - $answers[ $answer_cache_id ]->delete_permanently(); |
|
883 | + $registration->_remove_relation_to($answers[$answer_cache_id], 'Answer'); |
|
884 | + $answers[$answer_cache_id]->delete_permanently(); |
|
886 | 885 | } |
887 | 886 | return TRUE; |
888 | - } elseif ( $answer_is_obj ) { |
|
887 | + } elseif ($answer_is_obj) { |
|
889 | 888 | // save this data to the answer object |
890 | - $answers[ $answer_cache_id ]->set_value( $input_value ); |
|
891 | - $result = $answers[ $answer_cache_id ]->save(); |
|
889 | + $answers[$answer_cache_id]->set_value($input_value); |
|
890 | + $result = $answers[$answer_cache_id]->save(); |
|
892 | 891 | return $result !== false ? true : false; |
893 | 892 | } else { |
894 | - foreach ( $answers as $answer ) { |
|
895 | - if ( $answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id ) { |
|
896 | - $answer->set_value( $input_value ); |
|
893 | + foreach ($answers as $answer) { |
|
894 | + if ($answer instanceof EE_Answer && $answer->question_ID() == $answer_cache_id) { |
|
895 | + $answer->set_value($input_value); |
|
897 | 896 | $result = $answer->save(); |
898 | 897 | return $result !== false ? true : false; |
899 | 898 | } |
@@ -911,33 +910,33 @@ discard block |
||
911 | 910 | * @param string $input_value |
912 | 911 | * @return boolean |
913 | 912 | */ |
914 | - private function _verify_critical_attendee_details_are_set_and_validate_email( $form_input = '', $input_value = '' ) { |
|
915 | - if ( empty( $input_value )) { |
|
913 | + private function _verify_critical_attendee_details_are_set_and_validate_email($form_input = '', $input_value = '') { |
|
914 | + if (empty($input_value)) { |
|
916 | 915 | // if the form input isn't marked as being required, then just return |
917 | - if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) { |
|
916 | + if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) { |
|
918 | 917 | return true; |
919 | 918 | } |
920 | - switch( $form_input ) { |
|
919 | + switch ($form_input) { |
|
921 | 920 | case 'fname' : |
922 | - EE_Error::add_error( __( 'First Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
921 | + EE_Error::add_error(__('First Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
923 | 922 | return FALSE; |
924 | 923 | break; |
925 | 924 | case 'lname' : |
926 | - EE_Error::add_error( __( 'Last Name is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
925 | + EE_Error::add_error(__('Last Name is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
927 | 926 | return FALSE; |
928 | 927 | break; |
929 | 928 | case 'email' : |
930 | - EE_Error::add_error( __( 'Email Address is a required value.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
929 | + EE_Error::add_error(__('Email Address is a required value.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
931 | 930 | return FALSE; |
932 | 931 | break; |
933 | 932 | } |
934 | - } else if ( $form_input === 'email' ) { |
|
933 | + } else if ($form_input === 'email') { |
|
935 | 934 | // clean the email address |
936 | - $valid_email = sanitize_email( $input_value ); |
|
935 | + $valid_email = sanitize_email($input_value); |
|
937 | 936 | // check if it matches |
938 | - if ( $input_value != $valid_email ) { |
|
937 | + if ($input_value != $valid_email) { |
|
939 | 938 | // whoops!!! |
940 | - EE_Error::add_error( __( 'Please enter a valid email address.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
939 | + EE_Error::add_error(__('Please enter a valid email address.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
941 | 940 | return FALSE; |
942 | 941 | } |
943 | 942 | } |
@@ -965,14 +964,14 @@ discard block |
||
965 | 964 | * @param array $attendee_data |
966 | 965 | * @return boolean |
967 | 966 | */ |
968 | - private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
967 | + private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
969 | 968 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
970 | - $ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : ''; |
|
971 | - $ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : ''; |
|
972 | - $ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] ) ? $attendee_data['ATT_email'] : ''; |
|
969 | + $ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : ''; |
|
970 | + $ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : ''; |
|
971 | + $ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email']) ? $attendee_data['ATT_email'] : ''; |
|
973 | 972 | // but only if those have values |
974 | - if ( $ATT_fname && $ATT_lname && $ATT_email ) { |
|
975 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
973 | + if ($ATT_fname && $ATT_lname && $ATT_email) { |
|
974 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
976 | 975 | 'ATT_fname' => $ATT_fname, |
977 | 976 | 'ATT_lname' => $ATT_lname, |
978 | 977 | 'ATT_email' => $ATT_email |
@@ -980,7 +979,7 @@ discard block |
||
980 | 979 | } else { |
981 | 980 | $existing_attendee = NULL; |
982 | 981 | } |
983 | - return apply_filters( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data ); |
|
982 | + return apply_filters('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', $existing_attendee, $registration, $attendee_data); |
|
984 | 983 | } |
985 | 984 | |
986 | 985 | |
@@ -992,13 +991,13 @@ discard block |
||
992 | 991 | * @param array $attendee_data |
993 | 992 | * @return \EE_Attendee |
994 | 993 | */ |
995 | - private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) { |
|
994 | + private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { |
|
996 | 995 | // first remove fname, lname, and email from attendee data |
997 | - $dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
996 | + $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
998 | 997 | // now loop thru what's left and add to attendee CPT |
999 | - foreach ( $attendee_data as $property_name => $property_value ) { |
|
1000 | - if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) { |
|
1001 | - $existing_attendee->set( $property_name, $property_value ); |
|
998 | + foreach ($attendee_data as $property_name => $property_value) { |
|
999 | + if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { |
|
1000 | + $existing_attendee->set($property_name, $property_value); |
|
1002 | 1001 | } |
1003 | 1002 | } |
1004 | 1003 | // better save that now |
@@ -1015,11 +1014,11 @@ discard block |
||
1015 | 1014 | * @param EE_Attendee $attendee |
1016 | 1015 | * @return void |
1017 | 1016 | */ |
1018 | - private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) { |
|
1017 | + private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { |
|
1019 | 1018 | // add relation to attendee |
1020 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1021 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1022 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1019 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1020 | + $registration->set_attendee_id($attendee->ID()); |
|
1021 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1023 | 1022 | } |
1024 | 1023 | |
1025 | 1024 | |
@@ -1030,10 +1029,10 @@ discard block |
||
1030 | 1029 | * @param EE_Registration $registration |
1031 | 1030 | * @return void |
1032 | 1031 | */ |
1033 | - private function _associate_registration_with_transaction( EE_Registration $registration ) { |
|
1032 | + private function _associate_registration_with_transaction(EE_Registration $registration) { |
|
1034 | 1033 | // add relation to attendee |
1035 | - $this->checkout->transaction->_add_relation_to( $registration, 'Registration' ); |
|
1036 | - $this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration ); |
|
1034 | + $this->checkout->transaction->_add_relation_to($registration, 'Registration'); |
|
1035 | + $this->checkout->transaction->update_cache_after_object_save('Registration', $registration); |
|
1037 | 1036 | } |
1038 | 1037 | |
1039 | 1038 | |
@@ -1045,17 +1044,17 @@ discard block |
||
1045 | 1044 | * @param array $attendee_data |
1046 | 1045 | * @return array |
1047 | 1046 | */ |
1048 | - private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) { |
|
1047 | + private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) { |
|
1049 | 1048 | // bare minimum critical details include first name, last name, email address |
1050 | - $critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' ); |
|
1049 | + $critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email'); |
|
1051 | 1050 | // add address info to critical details? |
1052 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE )) { |
|
1053 | - $address_details = array( 'ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone' ); |
|
1054 | - $critical_attendee_details = array_merge( $critical_attendee_details, $address_details ); |
|
1051 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details', FALSE)) { |
|
1052 | + $address_details = array('ATT_address', 'ATT_address2', 'ATT_city', 'STA_ID', 'CNT_ISO', 'ATT_zip', 'ATT_phone'); |
|
1053 | + $critical_attendee_details = array_merge($critical_attendee_details, $address_details); |
|
1055 | 1054 | } |
1056 | - foreach ( $critical_attendee_details as $critical_attendee_detail ) { |
|
1057 | - if ( ! isset( $attendee_data[ $critical_attendee_detail ] ) || empty( $attendee_data[ $critical_attendee_detail ] )) { |
|
1058 | - $attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get( $critical_attendee_detail ); |
|
1055 | + foreach ($critical_attendee_details as $critical_attendee_detail) { |
|
1056 | + if ( ! isset($attendee_data[$critical_attendee_detail]) || empty($attendee_data[$critical_attendee_detail])) { |
|
1057 | + $attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get($critical_attendee_detail); |
|
1059 | 1058 | } |
1060 | 1059 | } |
1061 | 1060 | return $attendee_data; |
@@ -1070,11 +1069,11 @@ discard block |
||
1070 | 1069 | * @param array $attendee_data |
1071 | 1070 | * @return \EE_Attendee |
1072 | 1071 | */ |
1073 | - private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) { |
|
1072 | + private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) { |
|
1074 | 1073 | // create new attendee object |
1075 | - $new_attendee = EE_Attendee::new_instance( $attendee_data ); |
|
1074 | + $new_attendee = EE_Attendee::new_instance($attendee_data); |
|
1076 | 1075 | // set author to event creator |
1077 | - $new_attendee->set( 'ATT_author', $registration->event()->wp_user() ); |
|
1076 | + $new_attendee->set('ATT_author', $registration->event()->wp_user()); |
|
1078 | 1077 | $new_attendee->save(); |
1079 | 1078 | return $new_attendee; |
1080 | 1079 | } |
@@ -1090,7 +1089,7 @@ discard block |
||
1090 | 1089 | */ |
1091 | 1090 | public function update_reg_step() { |
1092 | 1091 | // save everything |
1093 | - if ( $this->process_reg_step() ) { |
|
1092 | + if ($this->process_reg_step()) { |
|
1094 | 1093 | $this->checkout->redirect = TRUE; |
1095 | 1094 | $this->checkout->redirect_url = add_query_arg( |
1096 | 1095 | array( |
@@ -1099,7 +1098,7 @@ discard block |
||
1099 | 1098 | ), |
1100 | 1099 | $this->checkout->thank_you_page_url |
1101 | 1100 | ); |
1102 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1101 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1103 | 1102 | return TRUE; |
1104 | 1103 | } |
1105 | 1104 | return FALSE; |
@@ -1,37 +1,37 @@ |
||
1 | 1 | <div id="admin-side-mbox-billing-info-dv" class="admin-side-mbox-dv"> |
2 | -<?php if ( empty($billing_form) ) : ?> |
|
2 | +<?php if (empty($billing_form)) : ?> |
|
3 | 3 | <div class="clearfix"> |
4 | - <?php _e( 'There is no billing info for this transaction.', 'event_espresso' );?><br/> |
|
4 | + <?php _e('There is no billing info for this transaction.', 'event_espresso'); ?><br/> |
|
5 | 5 | </div> |
6 | 6 | <?php else : |
7 | - function ee_show_billing_info_cleaned( EE_Form_Section_Proper $form_section, $found_cc_data = false ) { |
|
8 | - foreach( $form_section->subsections() as $subsection ) { |
|
9 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
10 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal || |
|
11 | - $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal ){ |
|
7 | + function ee_show_billing_info_cleaned(EE_Form_Section_Proper $form_section, $found_cc_data = false) { |
|
8 | + foreach ($form_section->subsections() as $subsection) { |
|
9 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
10 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_All_Sensitive_Data_Removal || |
|
11 | + $subsection->get_sensitive_data_removal_strategy() instanceof EE_CCV_Sensitive_Data_Removal) { |
|
12 | 12 | continue; |
13 | 13 | } |
14 | - if( $subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal ) { |
|
14 | + if ($subsection->get_sensitive_data_removal_strategy() instanceof EE_Credit_Card_Sensitive_Data_Removal) { |
|
15 | 15 | $found_cc_data = true; |
16 | 16 | } |
17 | 17 | ?> |
18 | 18 | <div class="clearfix"> |
19 | - <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label();?></span><?php echo $subsection->pretty_value();?> |
|
19 | + <span class="admin-side-mbox-label-spn lt-grey-txt float-left"><?php echo $subsection->get_html_for_label(); ?></span><?php echo $subsection->pretty_value(); ?> |
|
20 | 20 | </div><?php |
21 | - } elseif( $subsection instanceof EE_Form_Section_Proper ) { |
|
22 | - $found_cc_data = ee_show_billing_info_cleaned( $subsection, $found_cc_data); |
|
21 | + } elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
22 | + $found_cc_data = ee_show_billing_info_cleaned($subsection, $found_cc_data); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | return $found_cc_data; |
26 | 26 | } |
27 | - $found_cc_data = ee_show_billing_info_cleaned( $billing_form ); |
|
28 | - if( apply_filters( |
|
27 | + $found_cc_data = ee_show_billing_info_cleaned($billing_form); |
|
28 | + if (apply_filters( |
|
29 | 29 | 'FHEE__txn_admin_details_side_meta_box_billing_info__show_default_note', |
30 | 30 | $found_cc_data, |
31 | - $billing_form ) ) {?> |
|
32 | - <p class="help"><?php _e( 'Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso' );?></p> |
|
31 | + $billing_form )) {?> |
|
32 | + <p class="help"><?php _e('Note: Card expiry dates and CCV are not stored. Only the last 4 digits of card numbers are stored.', 'event_espresso'); ?></p> |
|
33 | 33 | <?php } |
34 | - do_action( 'AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form ); |
|
34 | + do_action('AHEE__txn_admin_details_side_meta_box_billing_info__billing_form_footer', $billing_form); |
|
35 | 35 | endif; ?> |
36 | 36 | |
37 | 37 | </div> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _init_page_props() { |
65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
68 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
68 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
70 | 70 | $this->_cpt_model_names = array( |
71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => __('Update Venue', 'event_espresso'), |
109 | 109 | 'add_category' => __('Save New Category', 'event_espresso'), |
110 | 110 | 'edit_category' => __('Update Category', 'event_espresso'), |
111 | - 'google_map_settings' => __( 'Update Settings', 'event_espresso' ) |
|
111 | + 'google_map_settings' => __('Update Settings', 'event_espresso') |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | protected function _set_page_routes() { |
121 | 121 | |
122 | 122 | //load formatter helper |
123 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
123 | + EE_Registry::instance()->load_helper('Formatter'); |
|
124 | 124 | //load field generator helper |
125 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
125 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
126 | 126 | |
127 | 127 | //is there a vnu_id in the request? |
128 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
129 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
128 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
129 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
130 | 130 | |
131 | 131 | $this->_page_routes = array( |
132 | 132 | 'default' => array( |
@@ -144,27 +144,27 @@ discard block |
||
144 | 144 | ), |
145 | 145 | 'trash_venue' => array( |
146 | 146 | 'func' => '_trash_or_restore_venue', |
147 | - 'args' => array( 'venue_status' => 'trash' ), |
|
147 | + 'args' => array('venue_status' => 'trash'), |
|
148 | 148 | 'noheader' => TRUE, |
149 | 149 | 'capability' => 'ee_delete_venue', |
150 | 150 | 'obj_id' => $vnu_id |
151 | 151 | ), |
152 | 152 | 'trash_venues' => array( |
153 | 153 | 'func' => '_trash_or_restore_venues', |
154 | - 'args' => array( 'venue_status' => 'trash' ), |
|
154 | + 'args' => array('venue_status' => 'trash'), |
|
155 | 155 | 'noheader' => TRUE, |
156 | 156 | 'capability' => 'ee_delete_venues' |
157 | 157 | ), |
158 | 158 | 'restore_venue' => array( |
159 | 159 | 'func' => '_trash_or_restore_venue', |
160 | - 'args' => array( 'venue_status' => 'draft' ), |
|
160 | + 'args' => array('venue_status' => 'draft'), |
|
161 | 161 | 'noheader' => TRUE, |
162 | 162 | 'capability' => 'ee_delete_venue', |
163 | 163 | 'obj_id' => $vnu_id |
164 | 164 | ), |
165 | 165 | 'restore_venues' => array( |
166 | 166 | 'func' => '_trash_or_restore_venues', |
167 | - 'args' => array( 'venue_status' => 'draft' ), |
|
167 | + 'args' => array('venue_status' => 'draft'), |
|
168 | 168 | 'noheader' => TRUE, |
169 | 169 | 'capability' => 'ee_delete_venues' |
170 | 170 | ), |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'filename' => 'venues_overview_views_bulk_actions_search' |
267 | 267 | ) |
268 | 268 | ), |
269 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
269 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
270 | 270 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
271 | 271 | 'require_nonce' => FALSE |
272 | 272 | ), |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | 'filename' => 'venues_editor_other' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
305 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
306 | 306 | 'metaboxes' => array('_venue_editor_metaboxes'), |
307 | 307 | 'require_nonce' => FALSE |
308 | 308 | ), |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | 'label' => __('Edit Venue', 'event_espresso'), |
312 | 312 | 'order' => 5, |
313 | 313 | 'persistent' => FALSE, |
314 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
314 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
315 | 315 | ), |
316 | 316 | 'help_tabs' => array( |
317 | 317 | 'venues_editor_help_tab' => array( |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | 'filename' => 'venues_editor_other' |
340 | 340 | ) |
341 | 341 | ), |
342 | - 'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ), |
|
342 | + 'help_tour' => array('Venues_Edit_Venue_Help_Tour'), |
|
343 | 343 | 'metaboxes' => array('_venue_editor_metaboxes'), |
344 | 344 | 'require_nonce' => FALSE |
345 | 345 | ), |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | 'label' => __('Google Maps'), |
349 | 349 | 'order' => 40 |
350 | 350 | ), |
351 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
351 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
352 | 352 | 'help_tabs' => array( |
353 | 353 | 'general_settings_google_maps_help_tab' => array( |
354 | 354 | 'title' => __('Google Maps', 'event_espresso'), |
355 | 355 | 'filename' => 'general_settings_google_maps' |
356 | 356 | ) |
357 | 357 | ), |
358 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
358 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
359 | 359 | 'require_nonce' => FALSE |
360 | 360 | ), |
361 | 361 | //venue category stuff |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | 'filename' => 'venues_add_category' |
372 | 372 | ) |
373 | 373 | ), |
374 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
374 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
375 | 375 | 'require_nonce' => FALSE |
376 | 376 | ), |
377 | 377 | 'edit_category' => array( |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | 'label' => __('Edit Category', 'event_espresso'), |
380 | 380 | 'order' => 15, |
381 | 381 | 'persistent' => FALSE, |
382 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
382 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
383 | 383 | ), |
384 | 384 | 'metaboxes' => array('_publish_post_box'), |
385 | 385 | 'help_tabs' => array( |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'filename' => 'venues_edit_category' |
389 | 389 | ) |
390 | 390 | ), |
391 | - 'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ), |
|
391 | + 'help_tour' => array('Venues_Edit_Category_Help_Tour'), |
|
392 | 392 | 'require_nonce' => FALSE |
393 | 393 | ), |
394 | 394 | 'category_list' => array( |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | 'filename' => 'venues_categories_other' |
416 | 416 | ) |
417 | 417 | ), |
418 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
418 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
419 | 419 | 'metaboxes' => $this->_default_espresso_metaboxes, |
420 | 420 | 'require_nonce' => FALSE |
421 | 421 | ) |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | |
473 | 473 | |
474 | 474 | public function load_scripts_styles() { |
475 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
475 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
476 | 476 | wp_enqueue_style('ee-cat-admin'); |
477 | 477 | } |
478 | 478 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | public function load_scripts_styles_edit() { |
496 | 496 | //styles |
497 | 497 | wp_enqueue_style('espresso-ui-theme'); |
498 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
498 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
499 | 499 | wp_enqueue_style('espresso_venues'); |
500 | 500 | } |
501 | 501 | |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | ) |
515 | 515 | ); |
516 | 516 | |
517 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
517 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
518 | 518 | $this->_views['all']['bulk_action'] = array( |
519 | 519 | 'trash_venues' => __('Move to Trash', 'event_espresso') |
520 | 520 | ); |
521 | 521 | $this->_views['trash'] = array( |
522 | 522 | 'slug' => 'trash', |
523 | - 'label' => __( 'Trash', 'event_espresso' ), |
|
523 | + 'label' => __('Trash', 'event_espresso'), |
|
524 | 524 | 'count' => 0, |
525 | 525 | 'bulk_action' => array( |
526 | 526 | 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
@@ -553,8 +553,8 @@ discard block |
||
553 | 553 | |
554 | 554 | |
555 | 555 | protected function _overview_list_table() { |
556 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
557 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' ); |
|
556 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
557 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button'); |
|
558 | 558 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
559 | 559 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
560 | 560 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
569 | 569 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
570 | 570 | ); |
571 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
572 | - EEH_Template::display_template( $template, $extra_rows ); |
|
571 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
572 | + EEH_Template::display_template($template, $extra_rows); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -584,115 +584,115 @@ discard block |
||
584 | 584 | $default_map_settings = new stdClass(); |
585 | 585 | $default_map_settings->use_google_maps = TRUE; |
586 | 586 | // for event details pages (reg page) |
587 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
588 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
589 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
590 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
591 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
592 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
593 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
587 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
588 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
589 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
590 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
591 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
592 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
593 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
594 | 594 | // for event list pages |
595 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
596 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
597 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
598 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
599 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
600 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
601 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
595 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
596 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
597 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
598 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
599 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
600 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
601 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
602 | 602 | |
603 | 603 | $this->_template_args['map_settings'] = |
604 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
605 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
604 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
605 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
606 | 606 | : $default_map_settings; |
607 | 607 | |
608 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
609 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
610 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE ); |
|
608 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
609 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
610 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE); |
|
611 | 611 | $this->display_admin_page_with_sidebar(); |
612 | 612 | } |
613 | 613 | |
614 | 614 | protected function _update_google_map_settings() { |
615 | 615 | |
616 | 616 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
617 | - isset( $this->_req_data['use_google_maps'] ) |
|
618 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
617 | + isset($this->_req_data['use_google_maps']) |
|
618 | + ? absint($this->_req_data['use_google_maps']) |
|
619 | 619 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
620 | 620 | |
621 | 621 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
622 | - isset( $this->_req_data['event_details_map_width'] ) |
|
623 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
622 | + isset($this->_req_data['event_details_map_width']) |
|
623 | + ? absint($this->_req_data['event_details_map_width']) |
|
624 | 624 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
625 | 625 | |
626 | 626 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
627 | - isset( $this->_req_data['event_details_map_height'] ) |
|
628 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
627 | + isset($this->_req_data['event_details_map_height']) |
|
628 | + ? absint($this->_req_data['event_details_map_height']) |
|
629 | 629 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
630 | 630 | |
631 | 631 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
632 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
633 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
632 | + isset($this->_req_data['event_details_map_zoom']) |
|
633 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
634 | 634 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
635 | 635 | |
636 | 636 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
637 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
638 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
637 | + isset($this->_req_data['event_details_display_nav']) |
|
638 | + ? absint($this->_req_data['event_details_display_nav']) |
|
639 | 639 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
640 | 640 | |
641 | 641 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
642 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
643 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
642 | + isset($this->_req_data['event_details_nav_size']) |
|
643 | + ? absint($this->_req_data['event_details_nav_size']) |
|
644 | 644 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
645 | 645 | |
646 | 646 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
647 | - isset( $this->_req_data['event_details_control_type'] ) |
|
648 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
647 | + isset($this->_req_data['event_details_control_type']) |
|
648 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
649 | 649 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
650 | 650 | |
651 | 651 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
652 | - isset( $this->_req_data['event_details_map_align'] ) |
|
653 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
652 | + isset($this->_req_data['event_details_map_align']) |
|
653 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
654 | 654 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
655 | 655 | |
656 | 656 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
657 | - isset( $this->_req_data['event_list_map_width'] ) |
|
658 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
657 | + isset($this->_req_data['event_list_map_width']) |
|
658 | + ? absint($this->_req_data['event_list_map_width']) |
|
659 | 659 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
660 | 660 | |
661 | 661 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
662 | - isset( $this->_req_data['event_list_map_height'] ) |
|
663 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
662 | + isset($this->_req_data['event_list_map_height']) |
|
663 | + ? absint($this->_req_data['event_list_map_height']) |
|
664 | 664 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
665 | 665 | |
666 | 666 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
667 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
668 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
667 | + isset($this->_req_data['event_list_map_zoom']) |
|
668 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
669 | 669 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
670 | 670 | |
671 | 671 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
672 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
673 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
672 | + isset($this->_req_data['event_list_display_nav']) |
|
673 | + ? absint($this->_req_data['event_list_display_nav']) |
|
674 | 674 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
675 | 675 | |
676 | 676 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
677 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
678 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
677 | + isset($this->_req_data['event_list_nav_size']) |
|
678 | + ? absint($this->_req_data['event_list_nav_size']) |
|
679 | 679 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
680 | 680 | |
681 | 681 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
682 | - isset( $this->_req_data['event_list_control_type'] ) |
|
683 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
682 | + isset($this->_req_data['event_list_control_type']) |
|
683 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
684 | 684 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
685 | 685 | |
686 | 686 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
687 | - isset( $this->_req_data['event_list_map_align'] ) |
|
688 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
687 | + isset($this->_req_data['event_list_map_align']) |
|
688 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
689 | 689 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
690 | 690 | |
691 | - EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings ); |
|
691 | + EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings); |
|
692 | 692 | |
693 | 693 | $what = 'Google Map Settings'; |
694 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
695 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
694 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__); |
|
695 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
696 | 696 | |
697 | 697 | } |
698 | 698 | |
@@ -701,9 +701,9 @@ discard block |
||
701 | 701 | protected function _venue_editor_metaboxes() { |
702 | 702 | $this->verify_cpt_object(); |
703 | 703 | |
704 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
705 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
706 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
704 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
705 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
706 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
707 | 707 | |
708 | 708 | } |
709 | 709 | |
@@ -711,23 +711,23 @@ discard block |
||
711 | 711 | |
712 | 712 | public function venue_gmap_metabox() { |
713 | 713 | $template_args = array( |
714 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
714 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
715 | 715 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
716 | 716 | ); |
717 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
718 | - EEH_Template::display_template( $template, $template_args ); |
|
717 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
718 | + EEH_Template::display_template($template, $template_args); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
722 | 722 | |
723 | 723 | public function venue_address_metabox() { |
724 | 724 | |
725 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
725 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
726 | 726 | |
727 | 727 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
728 | 728 | $QFI = new EE_Question_Form_Input( |
729 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
730 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
729 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
730 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
731 | 731 | array( |
732 | 732 | 'input_name' => 'sta_id', |
733 | 733 | 'input_id' => 'sta_id', |
@@ -739,8 +739,8 @@ discard block |
||
739 | 739 | ); |
740 | 740 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
741 | 741 | $QFI = new EE_Question_Form_Input( |
742 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
743 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
742 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
743 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
744 | 744 | array( |
745 | 745 | 'input_name' => 'cnt_iso', |
746 | 746 | 'input_id' => 'cnt_iso', |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | ) |
752 | 752 | ); |
753 | 753 | |
754 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
755 | - EEH_Template::display_template( $template, $template_args ); |
|
754 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
755 | + EEH_Template::display_template($template, $template_args); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | |
@@ -764,8 +764,8 @@ discard block |
||
764 | 764 | $template_args = array( |
765 | 765 | '_venue' => $this->_cpt_model_obj |
766 | 766 | ); |
767 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
768 | - EEH_Template::display_template( $template, $template_args ); |
|
767 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
768 | + EEH_Template::display_template($template, $template_args); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -788,52 +788,52 @@ discard block |
||
788 | 788 | * @param object $post Post object (with "blessed" WP properties) |
789 | 789 | * @return void |
790 | 790 | */ |
791 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
791 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
792 | 792 | |
793 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) { |
|
794 | - return;// get out we're not processing the saving of venues. |
|
793 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
794 | + return; // get out we're not processing the saving of venues. |
|
795 | 795 | } |
796 | 796 | |
797 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
797 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
798 | 798 | |
799 | 799 | $venue_values = array( |
800 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
801 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
802 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
803 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
804 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
805 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
806 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
807 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF, |
|
808 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
809 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
810 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
811 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
812 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
800 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
801 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
802 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
803 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
804 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
805 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
806 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
807 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF, |
|
808 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
809 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
810 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
811 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
812 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
813 | 813 | ); |
814 | 814 | |
815 | 815 | //update venue |
816 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
816 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
817 | 817 | |
818 | 818 | //get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
819 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
820 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
819 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
820 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
821 | 821 | |
822 | 822 | //notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
823 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
823 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
824 | 824 | |
825 | 825 | $att_success = TRUE; |
826 | 826 | |
827 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
828 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
829 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
827 | + foreach ($venue_update_callbacks as $v_callback) { |
|
828 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
829 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | //any errors? |
833 | - if ( $success && !$att_success ) { |
|
834 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
835 | - } else if ( $success === FALSE ) { |
|
836 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
833 | + if ($success && ! $att_success) { |
|
834 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
835 | + } else if ($success === FALSE) { |
|
836 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
837 | 837 | } |
838 | 838 | } |
839 | 839 | |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | |
842 | 842 | |
843 | 843 | |
844 | - public function trash_cpt_item( $post_id ) { |
|
844 | + public function trash_cpt_item($post_id) { |
|
845 | 845 | $this->_req_data['VNU_ID'] = $post_id; |
846 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
846 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | |
@@ -851,18 +851,18 @@ discard block |
||
851 | 851 | |
852 | 852 | |
853 | 853 | |
854 | - public function restore_cpt_item( $post_id ) { |
|
854 | + public function restore_cpt_item($post_id) { |
|
855 | 855 | $this->_req_data['VNU_ID'] = $post_id; |
856 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
856 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
857 | 857 | } |
858 | 858 | |
859 | 859 | |
860 | 860 | |
861 | 861 | |
862 | 862 | |
863 | - public function delete_cpt_item( $post_id ) { |
|
863 | + public function delete_cpt_item($post_id) { |
|
864 | 864 | $this->_req_data['VNU_ID'] = $post_id; |
865 | - $this->_delete_venue( FALSE ); |
|
865 | + $this->_delete_venue(FALSE); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -877,15 +877,15 @@ discard block |
||
877 | 877 | |
878 | 878 | |
879 | 879 | |
880 | - protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
881 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
880 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) { |
|
881 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
882 | 882 | |
883 | 883 | //loop thru venues |
884 | - if ( $VNU_ID ) { |
|
884 | + if ($VNU_ID) { |
|
885 | 885 | //clean status |
886 | - $venue_status = sanitize_key( $venue_status ); |
|
886 | + $venue_status = sanitize_key($venue_status); |
|
887 | 887 | // grab status |
888 | - if (!empty($venue_status)) { |
|
888 | + if ( ! empty($venue_status)) { |
|
889 | 889 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
890 | 890 | } else { |
891 | 891 | $success = FALSE; |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | } |
900 | 900 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
901 | 901 | |
902 | - if ( $redirect_after ) |
|
902 | + if ($redirect_after) |
|
903 | 903 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
904 | 904 | |
905 | 905 | } |
@@ -908,11 +908,11 @@ discard block |
||
908 | 908 | |
909 | 909 | |
910 | 910 | |
911 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
911 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
912 | 912 | // clean status |
913 | 913 | $venue_status = sanitize_key($venue_status); |
914 | 914 | // grab status |
915 | - if (!empty($venue_status)) { |
|
915 | + if ( ! empty($venue_status)) { |
|
916 | 916 | $success = TRUE; |
917 | 917 | //determine the event id and set to array. |
918 | 918 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -952,20 +952,20 @@ discard block |
||
952 | 952 | * @param string $venue_status |
953 | 953 | * @return void |
954 | 954 | */ |
955 | - private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
|
955 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') { |
|
956 | 956 | // grab venue id |
957 | - if (! $VNU_ID) { |
|
957 | + if ( ! $VNU_ID) { |
|
958 | 958 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
959 | 959 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
960 | 960 | return FALSE; |
961 | 961 | } |
962 | 962 | |
963 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
963 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
964 | 964 | |
965 | 965 | // clean status |
966 | 966 | $venue_status = sanitize_key($venue_status); |
967 | 967 | // grab status |
968 | - if ( ! $venue_status ) { |
|
968 | + if ( ! $venue_status) { |
|
969 | 969 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
970 | 970 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
971 | 971 | return FALSE; |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $hook = FALSE; |
987 | 987 | } |
988 | 988 | //use class to change status |
989 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
989 | + $this->_cpt_model_obj->set_status($venue_status); |
|
990 | 990 | $success = $this->_cpt_model_obj->save(); |
991 | 991 | |
992 | 992 | if ($success === FALSE) { |
@@ -1005,21 +1005,21 @@ discard block |
||
1005 | 1005 | * @param bool $redirect_after |
1006 | 1006 | * @return void |
1007 | 1007 | */ |
1008 | - protected function _delete_venue( $redirect_after = true ) { |
|
1008 | + protected function _delete_venue($redirect_after = true) { |
|
1009 | 1009 | //determine the venue id and set to array. |
1010 | 1010 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
1011 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID; |
|
1011 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1012 | 1012 | |
1013 | 1013 | |
1014 | 1014 | // loop thru venues |
1015 | 1015 | if ($VNU_ID) { |
1016 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
1016 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1017 | 1017 | } else { |
1018 | 1018 | $success = FALSE; |
1019 | 1019 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1020 | 1020 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1021 | 1021 | } |
1022 | - if ( $redirect_after ) |
|
1022 | + if ($redirect_after) |
|
1023 | 1023 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | //todo: put in parent |
1052 | 1052 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
1053 | 1053 | // grab event id |
1054 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
1054 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1055 | 1055 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1056 | 1056 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1057 | 1057 | return FALSE; |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1072 | 1072 | return FALSE; |
1073 | 1073 | } |
1074 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
1074 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1075 | 1075 | return TRUE; |
1076 | 1076 | } |
1077 | 1077 | |
@@ -1082,11 +1082,11 @@ discard block |
||
1082 | 1082 | /* QUERIES */ |
1083 | 1083 | |
1084 | 1084 | |
1085 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
1085 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
1086 | 1086 | |
1087 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
1087 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1088 | 1088 | |
1089 | - switch ( $_orderby ) { |
|
1089 | + switch ($_orderby) { |
|
1090 | 1090 | case 'id': |
1091 | 1091 | $orderby = 'VNU_ID'; |
1092 | 1092 | break; |
@@ -1104,43 +1104,43 @@ discard block |
||
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
1107 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1108 | 1108 | |
1109 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1110 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
1111 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1109 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1110 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1111 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1112 | 1112 | |
1113 | 1113 | |
1114 | - $offset = ($current_page-1)*$per_page; |
|
1114 | + $offset = ($current_page - 1) * $per_page; |
|
1115 | 1115 | $limit = array($offset, $per_page); |
1116 | 1116 | |
1117 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1117 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1118 | 1118 | $where = array(); |
1119 | 1119 | |
1120 | 1120 | //only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
1121 | - if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) { |
|
1121 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1122 | 1122 | $where['status'] = $this->_req_data['status']; |
1123 | 1123 | } |
1124 | 1124 | |
1125 | - if ( isset( $this->_req_data['venue_status'] ) ) { |
|
1125 | + if (isset($this->_req_data['venue_status'])) { |
|
1126 | 1126 | $where['status'] = $this->_req_data['venue_status']; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | |
1130 | - if ( $category ) { |
|
1130 | + if ($category) { |
|
1131 | 1131 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
1132 | 1132 | $where['Term_Taxonomy.term_id'] = $category; |
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
1136 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
1137 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1136 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1137 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1138 | 1138 | } else { |
1139 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
1139 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1140 | 1140 | $where['OR'] = array( |
1141 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1141 | + 'status*restrict_private' => array('!=', 'private'), |
|
1142 | 1142 | 'AND' => array( |
1143 | - 'status*inclusive' => array( '=', 'private' ), |
|
1143 | + 'status*inclusive' => array('=', 'private'), |
|
1144 | 1144 | 'VNU_wp_user' => get_current_user_id() |
1145 | 1145 | ) |
1146 | 1146 | ); |
@@ -1150,30 +1150,30 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | |
1152 | 1152 | |
1153 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1154 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1153 | + if (isset($this->_req_data['s'])) { |
|
1154 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1155 | 1155 | $where['OR'] = array( |
1156 | - 'VNU_name' => array('LIKE',$sstr ), |
|
1157 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
1158 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
1159 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
1160 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
1161 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
1162 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
1163 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
1164 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
1165 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
1166 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
1167 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
1168 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
1169 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
1170 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
1171 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
1156 | + 'VNU_name' => array('LIKE', $sstr), |
|
1157 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1158 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1159 | + 'VNU_address' => array('LIKE', $sstr), |
|
1160 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1161 | + 'VNU_city' => array('LIKE', $sstr), |
|
1162 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1163 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1164 | + 'VNU_url' => array('LIKE', $sstr), |
|
1165 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1166 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1167 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1168 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1169 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1170 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1171 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1172 | 1172 | ); |
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
1176 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
1177 | 1177 | |
1178 | 1178 | return $venues; |
1179 | 1179 | |
@@ -1191,22 +1191,22 @@ discard block |
||
1191 | 1191 | * @return void |
1192 | 1192 | */ |
1193 | 1193 | private function _set_category_object() { |
1194 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1194 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
1195 | 1195 | return; //already have the category object so get out. |
1196 | 1196 | |
1197 | 1197 | //set default category object |
1198 | 1198 | $this->_set_empty_category_object(); |
1199 | 1199 | |
1200 | 1200 | //only set if we've got an id |
1201 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
1201 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1202 | 1202 | return; |
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
1206 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
1206 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1207 | 1207 | |
1208 | 1208 | |
1209 | - if ( !empty( $term ) ) { |
|
1209 | + if ( ! empty($term)) { |
|
1210 | 1210 | $this->_category->category_name = $term->name; |
1211 | 1211 | $this->_category->category_identifier = $term->slug; |
1212 | 1212 | $this->_category->category_desc = $term->description; |
@@ -1220,14 +1220,14 @@ discard block |
||
1220 | 1220 | |
1221 | 1221 | private function _set_empty_category_object() { |
1222 | 1222 | $this->_category = new stdClass(); |
1223 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1223 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1224 | 1224 | $this->_category->id = $this->_category->parent = 0; |
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | |
1228 | 1228 | |
1229 | 1229 | protected function _category_list_table() { |
1230 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1230 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1231 | 1231 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
1232 | 1232 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
1233 | 1233 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -1237,21 +1237,21 @@ discard block |
||
1237 | 1237 | protected function _category_details($view) { |
1238 | 1238 | |
1239 | 1239 | //load formatter helper |
1240 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1240 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1241 | 1241 | //load field generator helper |
1242 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1242 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1243 | 1243 | |
1244 | 1244 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
1245 | 1245 | $this->_set_add_edit_form_tags($route); |
1246 | 1246 | |
1247 | 1247 | $this->_set_category_object(); |
1248 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
1248 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1249 | 1249 | |
1250 | 1250 | $delete_action = 'delete_category'; |
1251 | 1251 | |
1252 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
1252 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1253 | 1253 | |
1254 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
1254 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1255 | 1255 | |
1256 | 1256 | //take care of contents |
1257 | 1257 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1265,25 +1265,25 @@ discard block |
||
1265 | 1265 | 'type' => 'wp_editor', |
1266 | 1266 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
1267 | 1267 | 'class' => 'my_editor_custom', |
1268 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
1268 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
1269 | 1269 | ); |
1270 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
1270 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1271 | 1271 | |
1272 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
1272 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
1273 | 1273 | |
1274 | 1274 | //setup category select for term parents. |
1275 | 1275 | $category_select_values[] = array( |
1276 | 1276 | 'text' => __('No Parent', 'event_espresso'), |
1277 | 1277 | 'id' => 0 |
1278 | 1278 | ); |
1279 | - foreach ( $all_terms as $term ) { |
|
1279 | + foreach ($all_terms as $term) { |
|
1280 | 1280 | $category_select_values[] = array( |
1281 | 1281 | 'text' => $term->name, |
1282 | 1282 | 'id' => $term->term_id |
1283 | 1283 | ); |
1284 | 1284 | } |
1285 | 1285 | |
1286 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
1286 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
1287 | 1287 | $template_args = array( |
1288 | 1288 | 'category' => $this->_category, |
1289 | 1289 | 'category_select' => $category_select, |
@@ -1292,15 +1292,15 @@ discard block |
||
1292 | 1292 | 'disable' => '', |
1293 | 1293 | 'disabled_message' =>FALSE |
1294 | 1294 | ); |
1295 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1296 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
1295 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1296 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | |
1300 | 1300 | protected function _delete_categories() { |
1301 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1301 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1302 | 1302 | |
1303 | - foreach ( $cat_ids as $cat_id ) { |
|
1303 | + foreach ($cat_ids as $cat_id) { |
|
1304 | 1304 | $this->_delete_category($cat_id); |
1305 | 1305 | } |
1306 | 1306 | |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | $query_args = array( |
1309 | 1309 | 'action' => 'category_list' |
1310 | 1310 | ); |
1311 | - $this->_redirect_after_action(0,'','',$query_args); |
|
1311 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1312 | 1312 | |
1313 | 1313 | } |
1314 | 1314 | |
@@ -1317,58 +1317,58 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | |
1319 | 1319 | protected function _delete_category($cat_id) { |
1320 | - $cat_id = absint( $cat_id ); |
|
1321 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
1320 | + $cat_id = absint($cat_id); |
|
1321 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | |
1325 | 1325 | |
1326 | 1326 | protected function _insert_or_update_category($new_category) { |
1327 | 1327 | |
1328 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
1328 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
1329 | 1329 | $success = 0; //we already have a success message so lets not send another. |
1330 | - if ( $cat_id ) { |
|
1330 | + if ($cat_id) { |
|
1331 | 1331 | $query_args = array( |
1332 | 1332 | 'action' => 'edit_category', |
1333 | 1333 | 'VEN_CAT_ID' => $cat_id |
1334 | 1334 | ); |
1335 | 1335 | } else { |
1336 | - $query_args = array( 'action' => 'add_category' ); |
|
1336 | + $query_args = array('action' => 'add_category'); |
|
1337 | 1337 | } |
1338 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
1338 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
1339 | 1339 | |
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | |
1343 | 1343 | |
1344 | - private function _insert_category( $update = FALSE ) { |
|
1344 | + private function _insert_category($update = FALSE) { |
|
1345 | 1345 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
1346 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
1347 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
1348 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
1346 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1347 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1348 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1349 | 1349 | |
1350 | - if ( empty( $category_name ) ) { |
|
1351 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
1352 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1350 | + if (empty($category_name)) { |
|
1351 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1352 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1353 | 1353 | return false; |
1354 | 1354 | } |
1355 | 1355 | |
1356 | 1356 | |
1357 | - $term_args=array( |
|
1357 | + $term_args = array( |
|
1358 | 1358 | 'name'=>$category_name, |
1359 | 1359 | 'description'=>$category_desc, |
1360 | 1360 | 'parent'=>$category_parent |
1361 | 1361 | ); |
1362 | 1362 | |
1363 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1363 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
1364 | 1364 | |
1365 | - if ( !is_array( $insert_ids ) ) { |
|
1366 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1367 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1365 | + if ( ! is_array($insert_ids)) { |
|
1366 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1367 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1368 | 1368 | } else { |
1369 | 1369 | $cat_id = $insert_ids['term_id']; |
1370 | - $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
1371 | - EE_Error::add_success( $msg ); |
|
1370 | + $msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name); |
|
1371 | + EE_Error::add_success($msg); |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | return $cat_id; |
@@ -1388,12 +1388,12 @@ discard block |
||
1388 | 1388 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
1389 | 1389 | ); |
1390 | 1390 | |
1391 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
1391 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1392 | 1392 | |
1393 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1394 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
1395 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
1396 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
1393 | + EE_Registry::instance()->load_helper('File'); |
|
1394 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1395 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1396 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1397 | 1397 | $EE_Export->export(); |
1398 | 1398 | } |
1399 | 1399 | |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | |
1406 | 1406 | protected function _import_categories() { |
1407 | 1407 | |
1408 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1408 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1409 | 1409 | EE_Import::instance()->import(); |
1410 | 1410 | |
1411 | 1411 | } |
@@ -1413,29 +1413,29 @@ discard block |
||
1413 | 1413 | |
1414 | 1414 | |
1415 | 1415 | |
1416 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1416 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
1417 | 1417 | |
1418 | 1418 | //testing term stuff |
1419 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1420 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1421 | - $limit = ($current_page-1)*$per_page; |
|
1422 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1423 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1424 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1419 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1420 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1421 | + $limit = ($current_page - 1) * $per_page; |
|
1422 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1423 | + if (isset($this->_req_data['s'])) { |
|
1424 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1425 | 1425 | $where['OR'] = array( |
1426 | - 'Term.name' => array( 'LIKE', $sstr), |
|
1427 | - 'description' => array( 'LIKE', $sstr ) |
|
1426 | + 'Term.name' => array('LIKE', $sstr), |
|
1427 | + 'description' => array('LIKE', $sstr) |
|
1428 | 1428 | ); |
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | $query_params = array( |
1432 | 1432 | $where, |
1433 | - 'order_by' => array( $orderby => $order ), |
|
1434 | - 'limit' => $limit . ',' . $per_page, |
|
1433 | + 'order_by' => array($orderby => $order), |
|
1434 | + 'limit' => $limit.','.$per_page, |
|
1435 | 1435 | 'force_join' => array('Term') |
1436 | 1436 | ); |
1437 | 1437 | |
1438 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1438 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1439 | 1439 | |
1440 | 1440 | return $categories; |
1441 | 1441 | } |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
3 | -EE_Registry::instance()->load_helper( 'Event_View' ); |
|
4 | -EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | +EE_Registry::instance()->load_helper('Event_View'); |
|
4 | +EE_Registry::instance()->load_helper('Form_Fields'); |
|
5 | 5 | $values = EEH_Form_Fields::prep_answer_options( |
6 | 6 | array( |
7 | - array( 'id' => 1, 'text' => __( 'Yes', 'event_espresso' ) ), |
|
8 | - array( 'id' => 0, 'text' => __( 'No', 'event_espresso' ) ) |
|
7 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
8 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
9 | 9 | ) |
10 | 10 | ); |
11 | 11 | ?> |
@@ -24,27 +24,27 @@ discard block |
||
24 | 24 | </label> |
25 | 25 | </th> |
26 | 26 | <td> |
27 | - <?php echo EEH_Form_Fields::select( 'display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single' ); ?> |
|
28 | - <p class="description"><?php _e( 'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso' ); ?></p> |
|
27 | + <?php echo EEH_Form_Fields::select('display_status_banner_single', $display_status_banner_single, $values, 'display_status_banner_single', 'display_status_banner_single'); ?> |
|
28 | + <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the single event page.', 'event_espresso'); ?></p> |
|
29 | 29 | </td> |
30 | 30 | </tr> |
31 | 31 | |
32 | 32 | <tr> |
33 | 33 | <th> |
34 | 34 | <label for="display_venue"> |
35 | - <?php _e( 'Display Venue Details', 'event_espresso' ); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
35 | + <?php _e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
36 | 36 | </label> |
37 | 37 | </th> |
38 | 38 | <td> |
39 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'display_venue', 'display_venue' ); ?> |
|
40 | - <p class="description"><?php _e( 'Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso' ); ?></p> |
|
39 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'display_venue', 'display_venue'); ?> |
|
40 | + <p class="description"><?php _e('Do not use this if you are using the venue shortcodes in your event description.', 'event_espresso'); ?></p> |
|
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | |
44 | 44 | <tr> |
45 | 45 | <th> |
46 | 46 | <label for="EED_Events_Single_use_sortable_display_order"> |
47 | - <?php _e( 'Use Custom Display Order?', 'event_espresso' ); ?> |
|
47 | + <?php _e('Use Custom Display Order?', 'event_espresso'); ?> |
|
48 | 48 | </label> |
49 | 49 | </th> |
50 | 50 | <td> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <p class="description "> |
61 | 61 | <?php |
62 | 62 | echo sprintf( |
63 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
63 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Single page display, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
64 | 64 | '<span class="important-notice">', |
65 | 65 | '</span>', |
66 | 66 | '<br />' |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | <tr> |
74 | 74 | <th> |
75 | - <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info');?> |
|
75 | + <?php _e('Display Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link('display_addresses_in_reg_form_info'); ?> |
|
76 | 76 | </th> |
77 | 77 | <td> |
78 | 78 | |
79 | - <?php wp_nonce_field( 'espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false ); ?> |
|
79 | + <?php wp_nonce_field('espresso_update_event_single_order', 'espresso_update_event_single_order_nonce', false); ?> |
|
80 | 80 | <?php echo $event_single_display_order; ?> |
81 | 81 | |
82 | 82 | <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the single event page.', 'event_espresso'); ?></p> |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | -add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' ); |
|
3 | -EE_Registry::instance()->load_helper( 'Event_View' ); |
|
4 | -EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2 | +add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
3 | +EE_Registry::instance()->load_helper('Event_View'); |
|
4 | +EE_Registry::instance()->load_helper('Form_Fields'); |
|
5 | 5 | |
6 | -$values = EEH_Form_Fields::prep_answer_options( array( |
|
7 | - array( 'id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
8 | - array( 'id' => 0, 'text' => __('No', 'event_espresso')) |
|
6 | +$values = EEH_Form_Fields::prep_answer_options(array( |
|
7 | + array('id' => 1, 'text' => __('Yes', 'event_espresso')), |
|
8 | + array('id' => 0, 'text' => __('No', 'event_espresso')) |
|
9 | 9 | )); |
10 | 10 | |
11 | -$description = EEH_Form_Fields::prep_answer_options( array( |
|
12 | - array( 'id' => 0, 'text' => __('none', 'event_espresso')), |
|
13 | - array( 'id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
14 | - array( 'id' => 2, 'text' => __('full description', 'event_espresso')) |
|
11 | +$description = EEH_Form_Fields::prep_answer_options(array( |
|
12 | + array('id' => 0, 'text' => __('none', 'event_espresso')), |
|
13 | + array('id' => 1, 'text' => __('excerpt (short desc)', 'event_espresso')), |
|
14 | + array('id' => 2, 'text' => __('full description', 'event_espresso')) |
|
15 | 15 | )); |
16 | 16 | |
17 | 17 | ?> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | <tr> |
30 | 30 | <th> |
31 | 31 | <label for="event_listings_url"> |
32 | - <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info');?> |
|
32 | + <?php _e('Event Listings URL', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('event_listings_url_info'); ?> |
|
33 | 33 | </label> |
34 | 34 | </th> |
35 | 35 | <td> |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | </label> |
45 | 45 | </th> |
46 | 46 | <td> |
47 | - <p><?php echo site_url() . '/ ' . EEH_Form_Fields::text( 'not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular' ); ?></p> |
|
47 | + <p><?php echo site_url().'/ '.EEH_Form_Fields::text('not_used', EE_Registry::instance()->CFG->core->event_cpt_slug, 'event_cpt_slug', 'event_cpt_slug', 'regular'); ?></p> |
|
48 | 48 | <p class="description"><?php _e('This allows you to configure what slug is used for the url of all event pages.', 'event_espresso'); ?></p> |
49 | - <?php if ( has_filter( 'FHEE__EE_Register_CPTs__register_CPT__rewrite' ) ) : ?> |
|
49 | + <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?> |
|
50 | 50 | <p class="important-notice"> |
51 | 51 | <?php |
52 | 52 | sprintf( |
53 | - __( 'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso' ), |
|
53 | + __('Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected. Please be aware that while this filter is being used, this setting has no affect.', 'event_espresso'), |
|
54 | 54 | '<code>', |
55 | 55 | '</code>' |
56 | 56 | ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </label> |
68 | 68 | </th> |
69 | 69 | <td> |
70 | - <?php echo EEH_Form_Fields::select( 'display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner' );?> |
|
70 | + <?php echo EEH_Form_Fields::select('display_status_banner', $display_status_banner, $values, 'EED_Events_Archive_display_status_banner', 'EED_Events_Archive_display_status_banner'); ?> |
|
71 | 71 | <p class="description"><?php _e('Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.', 'event_espresso'); ?></p> |
72 | 72 | </td> |
73 | 73 | </tr> |
@@ -75,55 +75,55 @@ discard block |
||
75 | 75 | <tr> |
76 | 76 | <th> |
77 | 77 | <label for="EED_Events_Archive_display_description"> |
78 | - <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info');?> |
|
78 | + <?php _e('Display Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_description_info'); ?> |
|
79 | 79 | </label> |
80 | 80 | </th> |
81 | 81 | <td> |
82 | - <?php echo EEH_Form_Fields::select( 'description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description' );?> |
|
82 | + <?php echo EEH_Form_Fields::select('description', $display_description, $description, 'EED_Events_Archive_display_description', 'EED_Events_Archive_display_description'); ?> |
|
83 | 83 | </td> |
84 | 84 | </tr> |
85 | 85 | |
86 | 86 | <tr> |
87 | 87 | <th> |
88 | 88 | <label for="EED_Events_Archive_display_ticket_selector"> |
89 | - <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info');?> |
|
89 | + <?php _e('Display Ticket Selector', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_ticket_selector_info'); ?> |
|
90 | 90 | </label> |
91 | 91 | </th> |
92 | 92 | <td> |
93 | - <?php echo EEH_Form_Fields::select( 'ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector' );?> |
|
93 | + <?php echo EEH_Form_Fields::select('ticket_selector', $display_ticket_selector, $values, 'EED_Events_Archive_display_ticket_selector', 'EED_Events_Archive_display_ticket_selector'); ?> |
|
94 | 94 | </td> |
95 | 95 | </tr> |
96 | 96 | |
97 | 97 | <tr> |
98 | 98 | <th> |
99 | 99 | <label for="EED_Events_Archive_display_datetimes"> |
100 | - <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info');?> |
|
100 | + <?php _e('Display Datetimes', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_datetimes_info'); ?> |
|
101 | 101 | </label> |
102 | 102 | </th> |
103 | 103 | <td> |
104 | - <?php echo EEH_Form_Fields::select( 'venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes' );?> |
|
104 | + <?php echo EEH_Form_Fields::select('venue_details', $display_datetimes, $values, 'EED_Events_Archive_display_datetimes', 'EED_Events_Archive_display_datetimes'); ?> |
|
105 | 105 | </td> |
106 | 106 | </tr> |
107 | 107 | |
108 | 108 | <tr> |
109 | 109 | <th> |
110 | 110 | <label for="EED_Events_Archive_display_venue"> |
111 | - <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info');?> |
|
111 | + <?php _e('Display Venue Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_venue_details_info'); ?> |
|
112 | 112 | </label> |
113 | 113 | </th> |
114 | 114 | <td> |
115 | - <?php echo EEH_Form_Fields::select( 'display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue' );?> |
|
115 | + <?php echo EEH_Form_Fields::select('display_venue', $display_venue, $values, 'EED_Events_Archive_display_venue', 'EED_Events_Archive_display_venue'); ?> |
|
116 | 116 | </td> |
117 | 117 | </tr> |
118 | 118 | |
119 | 119 | <tr> |
120 | 120 | <th> |
121 | 121 | <label for="EED_Events_Archive_display_expired_events"> |
122 | - <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info');?> |
|
122 | + <?php _e('Display Expired Events', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('display_expired_events_info'); ?> |
|
123 | 123 | </label> |
124 | 124 | </th> |
125 | 125 | <td> |
126 | - <?php echo EEH_Form_Fields::select( 'expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events' );?> |
|
126 | + <?php echo EEH_Form_Fields::select('expired_events', $display_expired_events, $values, 'EED_Events_Archive_display_expired_events', 'EED_Events_Archive_display_expired_events'); ?> |
|
127 | 127 | </td> |
128 | 128 | </tr> |
129 | 129 | |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | </label> |
135 | 135 | </th> |
136 | 136 | <td> |
137 | - <?php echo EEH_Form_Fields::select( 'use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order' );?> |
|
137 | + <?php echo EEH_Form_Fields::select('use_sortable_display_order', $use_sortable_display_order, $values, 'EED_Events_Archive_use_sortable_display_order', 'EED_Events_Archive_use_sortable_display_order'); ?> |
|
138 | 138 | <p class="description "> |
139 | 139 | <?php |
140 | 140 | echo sprintf( |
141 | - __( '%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso' ), |
|
141 | + __('%1$sPlease Note:%2$s%3$sIf you are currently using filters to customize the display order for elements within the Event Archive listings, then you do NOT activate this feature until those filters have been removed or disabled. If this feature is activated while still using such filters, duplicate event content such as the ticket selector, datetimes, or venue information could be displayed on the frontend of the site. Please verify that this is not the case after activating this feature.', 'event_espresso'), |
|
142 | 142 | '<span class="important-notice">', |
143 | 143 | '</span>', |
144 | 144 | '<br />' |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | |
151 | 151 | <tr> |
152 | 152 | <th> |
153 | - <?php _e( 'Display Order', 'event_espresso' ); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
153 | + <?php _e('Display Order', 'event_espresso'); ?><?php //echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?> |
|
154 | 154 | </th> |
155 | 155 | <td> |
156 | 156 | |
157 | - <?php wp_nonce_field( 'espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false ); ?> |
|
157 | + <?php wp_nonce_field('espresso_update_event_archive_order', 'espresso_update_event_archive_order_nonce', false); ?> |
|
158 | 158 | <?php echo $event_archive_display_order; ?> |
159 | 159 | |
160 | - <p class="description"><?php _e( 'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso' ); ?></p> |
|
160 | + <p class="description"><?php _e('Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.', 'event_espresso'); ?></p> |
|
161 | 161 | |
162 | 162 | </td> |
163 | 163 | </tr> |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | <tr> |
166 | 166 | <th> |
167 | 167 | <label for="EED_Events_Archive_reset_event_list_settings"> |
168 | - <?php _e( 'Reset Event List Settings', 'event_espresso' ); ?> |
|
168 | + <?php _e('Reset Event List Settings', 'event_espresso'); ?> |
|
169 | 169 | </label> |
170 | 170 | </th> |
171 | 171 | <td> |
172 | - <?php echo EEH_Form_Fields::select( 'reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings' ); ?> |
|
172 | + <?php echo EEH_Form_Fields::select('reset_event_list_settings', 0, $values, 'EED_Events_Archive_reset_event_list_settings', 'EED_Events_Archive_reset_event_list_settings'); ?> |
|
173 | 173 | </td> |
174 | 174 | </tr> |
175 | 175 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Ticket_Selector_Caff |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | * @return void |
38 | 38 | */ |
39 | 39 | public static function set_hooks_admin() { |
40 | - define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
41 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 ); |
|
42 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 ); |
|
40 | + define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
41 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10); |
|
42 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
46 | 46 | //just required because of abstract declaration |
47 | - public function run( $WP ) { |
|
47 | + public function run($WP) { |
|
48 | 48 | $this->set_config(); |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function set_config(){ |
|
55 | - $this->set_config_section( 'template_settings' ); |
|
56 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
57 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
54 | + protected function set_config() { |
|
55 | + $this->set_config_section('template_settings'); |
|
56 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
57 | + $this->set_config_name('EED_Ticket_Selector'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections', |
90 | 90 | array( |
91 | 91 | 'appearance_settings_hdr' => new EE_Form_Section_HTML( |
92 | - EEH_HTML::br(2) . |
|
93 | - EEH_HTML::h2( __( 'Ticket Selector Template Settings', 'event_espresso' )) |
|
92 | + EEH_HTML::br(2). |
|
93 | + EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso')) |
|
94 | 94 | ), |
95 | 95 | 'appearance_settings' => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings() |
96 | 96 | ) |
@@ -114,25 +114,25 @@ discard block |
||
114 | 114 | 'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections', array( |
115 | 115 | 'show_ticket_details' => new EE_Yes_No_Input( |
116 | 116 | array( |
117 | - 'html_label_text' => __('Show Ticket Details?', 'event_espresso' ), |
|
118 | - 'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
117 | + 'html_label_text' => __('Show Ticket Details?', 'event_espresso'), |
|
118 | + 'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'), |
|
119 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details : true, |
|
120 | 120 | 'display_html_label_text' => false |
121 | 121 | ) |
122 | 122 | ), |
123 | 123 | 'show_ticket_sale_columns' => new EE_Yes_No_Input( |
124 | 124 | array( |
125 | - 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ), |
|
126 | - 'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
125 | + 'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'), |
|
126 | + 'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'), |
|
127 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns : true, |
|
128 | 128 | 'display_html_label_text' => false |
129 | 129 | ) |
130 | 130 | ), |
131 | 131 | 'show_expired_tickets' => new EE_Yes_No_Input( |
132 | 132 | array( |
133 | - 'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ), |
|
134 | - 'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ), |
|
135 | - 'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
133 | + 'html_label_text' => __('Show Expired Tickets?', 'event_espresso'), |
|
134 | + 'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'), |
|
135 | + 'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets : true, |
|
136 | 136 | 'display_html_label_text' => false |
137 | 137 | ) |
138 | 138 | ) |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return void |
157 | 157 | */ |
158 | - public static function update_template_settings( EE_Template_Config $CFG, $REQ ) { |
|
159 | - if ( ! isset( $CFG->EED_Ticket_Selector ) ) { |
|
158 | + public static function update_template_settings(EE_Template_Config $CFG, $REQ) { |
|
159 | + if ( ! isset($CFG->EED_Ticket_Selector)) { |
|
160 | 160 | $CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
161 | 161 | } |
162 | 162 | try { |
163 | 163 | $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form(); |
164 | 164 | |
165 | 165 | //check for form submission |
166 | - if ( $ticket_selector_form->was_submitted() ) { |
|
166 | + if ($ticket_selector_form->was_submitted()) { |
|
167 | 167 | |
168 | 168 | //capture form data |
169 | 169 | $ticket_selector_form->receive_form_submission(); |
170 | 170 | |
171 | 171 | //validate form data |
172 | - if ( $ticket_selector_form->is_valid() ) { |
|
172 | + if ($ticket_selector_form->is_valid()) { |
|
173 | 173 | |
174 | 174 | //grab validated data from form |
175 | 175 | $valid_data = $ticket_selector_form->valid_data(); |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details']; |
180 | 180 | $CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets']; |
181 | 181 | } else { |
182 | - if ( $ticket_selector_form->submission_error_message() != '' ) { |
|
183 | - EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
182 | + if ($ticket_selector_form->submission_error_message() != '') { |
|
183 | + EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | 187 | } |
188 | - } catch( EE_Error $e ) { |
|
188 | + } catch (EE_Error $e) { |
|
189 | 189 | $e->get_error(); |
190 | 190 | } |
191 | 191 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <h3><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></h3> |
9 | 9 | <ul> |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?> |
29 | 29 | <br> |
30 | 30 | <?php printf( |
31 | - __( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
31 | + __('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'), |
|
32 | 32 | '<a href="http://authorize.net" target="_blank">', |
33 | 33 | '</a>', |
34 | 34 | '<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">', |
35 | 35 | '<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">', |
36 | - '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?> |
|
36 | + '<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?> |
|
37 | 37 | </li> |
38 | 38 | <li> |
39 | 39 | <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br /> |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param array $arguments |
40 | 40 | * @return \EE_CPT_Event_Strategy |
41 | 41 | */ |
42 | - public function __construct( $arguments = array() ) { |
|
43 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
44 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
42 | + public function __construct($arguments = array()) { |
|
43 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
44 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
45 | 45 | |
46 | 46 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
47 | 47 | // here's the list of available filters in the WP_Query object |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | // 'posts_fields' |
56 | 56 | // 'posts_join' |
57 | 57 | $this->_add_filters(); |
58 | - if ( $WP_Query instanceof WP_Query ) { |
|
59 | - $WP_Query->is_espresso_event_single = is_singular() && isset( $WP_Query->query->post_type ) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
58 | + if ($WP_Query instanceof WP_Query) { |
|
59 | + $WP_Query->is_espresso_event_single = is_singular() && isset($WP_Query->query->post_type) && $WP_Query->query->post_type == 'espresso_events' ? TRUE : FALSE; |
|
60 | 60 | $WP_Query->is_espresso_event_archive = is_post_type_archive('espresso_events') ? TRUE : FALSE; |
61 | - $WP_Query->is_espresso_event_taxonomy = is_tax( 'espresso_event_categories' ) ? TRUE : FALSE; |
|
61 | + $WP_Query->is_espresso_event_taxonomy = is_tax('espresso_event_categories') ? TRUE : FALSE; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * (which will get removed in case the next call to get_posts ISN'T |
71 | 71 | * for event CPTs) |
72 | 72 | */ |
73 | - protected function _add_filters(){ |
|
74 | - add_filter( 'posts_fields', array( $this, 'posts_fields' ), 1, 2 ); |
|
75 | - add_filter( 'posts_join', array( $this, 'posts_join' ), 1, 2 ); |
|
76 | - add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 ); |
|
77 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
|
78 | - add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1, 2 ); |
|
79 | - add_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1, 2 ); |
|
73 | + protected function _add_filters() { |
|
74 | + add_filter('posts_fields', array($this, 'posts_fields'), 1, 2); |
|
75 | + add_filter('posts_join', array($this, 'posts_join'), 1, 2); |
|
76 | + add_filter('posts_where', array($this, 'posts_where'), 10, 2); |
|
77 | + add_filter('the_posts', array($this, 'the_posts'), 1, 2); |
|
78 | + add_filter('posts_orderby', array($this, 'posts_orderby'), 1, 2); |
|
79 | + add_filter('posts_groupby', array($this, 'posts_groupby'), 1, 2); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * This is to avoid applying this CPT strategy for other posts or CPTs (eg, |
87 | 87 | * we don't want to join to the datetime table when querying for venues, do we!?) |
88 | 88 | */ |
89 | - protected function _remove_filters(){ |
|
90 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' ), 1 ); |
|
91 | - remove_filter( 'posts_join', array( $this, 'posts_join' ), 1 ); |
|
92 | - remove_filter( 'posts_where', array( $this, 'posts_where' ), 10 ); |
|
93 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1 ); |
|
94 | - remove_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 1 ); |
|
95 | - remove_filter( 'posts_groupby', array( $this, 'posts_groupby' ), 1 ); |
|
89 | + protected function _remove_filters() { |
|
90 | + remove_filter('posts_fields', array($this, 'posts_fields'), 1); |
|
91 | + remove_filter('posts_join', array($this, 'posts_join'), 1); |
|
92 | + remove_filter('posts_where', array($this, 'posts_where'), 10); |
|
93 | + remove_filter('the_posts', array($this, 'the_posts'), 1); |
|
94 | + remove_filter('posts_orderby', array($this, 'posts_orderby'), 1); |
|
95 | + remove_filter('posts_groupby', array($this, 'posts_groupby'), 1); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param WP_Query $wp_query |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function posts_fields( $SQL, WP_Query $wp_query ) { |
|
108 | + public function posts_fields($SQL, WP_Query $wp_query) { |
|
109 | 109 | if ( |
110 | 110 | $wp_query instanceof WP_Query |
111 | 111 | && |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | ) |
117 | 117 | ) { |
118 | 118 | // adds something like ", wp_esp_datetime.* " to WP Query SELECT statement |
119 | - $SQL .= ', ' . EEM_Datetime::instance()->table() . '.* ' ; |
|
120 | - if ( $wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy ) { |
|
119 | + $SQL .= ', '.EEM_Datetime::instance()->table().'.* '; |
|
120 | + if ($wp_query->is_espresso_event_archive || $wp_query->is_espresso_event_taxonomy) { |
|
121 | 121 | // because we only want to retrieve the next upcoming datetime for each event: |
122 | 122 | // add something like ", MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date " to WP Query SELECT statement |
123 | - $SQL .= ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ; |
|
123 | + $SQL .= ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date '; |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | return $SQL; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @internal param \WP_Query $WP_Query |
138 | 138 | * @return string |
139 | 139 | */ |
140 | - public function posts_join( $SQL, WP_Query $wp_query ) { |
|
140 | + public function posts_join($SQL, WP_Query $wp_query) { |
|
141 | 141 | if ( |
142 | 142 | $wp_query instanceof WP_Query |
143 | 143 | && |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ) |
149 | 149 | ) { |
150 | 150 | // adds something like " LEFT JOIN wp_esp_datetime ON ( wp_esp_datetime.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
151 | - $SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) '; |
|
151 | + $SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name().' ) '; |
|
152 | 152 | } |
153 | 153 | return $SQL; |
154 | 154 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param WP_Query $wp_query |
164 | 164 | * @return string |
165 | 165 | */ |
166 | - public function posts_where( $SQL, WP_Query $wp_query ) { |
|
166 | + public function posts_where($SQL, WP_Query $wp_query) { |
|
167 | 167 | // global $wpdb; |
168 | 168 | if ( |
169 | 169 | $wp_query instanceof WP_Query |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | || $wp_query->is_espresso_event_taxonomy |
174 | 174 | ) |
175 | 175 | ) { |
176 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive ) || ! isset( EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events ) { |
|
177 | - $SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', true ) . '" '; |
|
176 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive) || ! isset(EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) || ! EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->display_expired_events) { |
|
177 | + $SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', true).'" '; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | return $SQL; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @param WP_Query $wp_query |
191 | 191 | * @return string |
192 | 192 | */ |
193 | - public function posts_orderby( $SQL, WP_Query $wp_query ) { |
|
193 | + public function posts_orderby($SQL, WP_Query $wp_query) { |
|
194 | 194 | if ( |
195 | 195 | $wp_query instanceof WP_Query |
196 | 196 | && |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param WP_Query $wp_query |
215 | 215 | * @return string |
216 | 216 | */ |
217 | - public function posts_groupby( $SQL, WP_Query $wp_query ) { |
|
217 | + public function posts_groupby($SQL, WP_Query $wp_query) { |
|
218 | 218 | if ( |
219 | 219 | $wp_query instanceof WP_Query |
220 | 220 | && |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // we're joining to the datetimes table, where there can be MANY datetimes for a single event, but we want to only show each event only once |
228 | 228 | // (whereas if we didn't group them by the post's ID, then we would end up with many repeats) |
229 | 229 | global $wpdb; |
230 | - $SQL = $wpdb->posts . '.ID '; |
|
230 | + $SQL = $wpdb->posts.'.ID '; |
|
231 | 231 | } |
232 | 232 | return $SQL; |
233 | 233 | } |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | * @param WP_Query $wp_query |
243 | 243 | * @return array |
244 | 244 | */ |
245 | - public function the_posts( $posts, WP_Query $wp_query ) { |
|
246 | - if ( $wp_query instanceof WP_Query && isset( $wp_query->query_vars['post_type'] ) && $wp_query->query_vars['post_type'] == 'espresso_events' ) { |
|
245 | + public function the_posts($posts, WP_Query $wp_query) { |
|
246 | + if ($wp_query instanceof WP_Query && isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] == 'espresso_events') { |
|
247 | 247 | // automagically load the EEH_Event_View helper so that it's functions are available |
248 | 248 | EE_Registry::instance()->load_helper('Event_View'); |
249 | 249 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param $single |
263 | 263 | * @return string |
264 | 264 | */ |
265 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
265 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
266 | 266 | return $meta_value; |
267 | 267 | } |
268 | 268 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function instance() { |
80 | 80 | // check if class object is instantiated |
81 | - if ( ! self::$_instance instanceof EE_CPT_Strategy ) { |
|
81 | + if ( ! self::$_instance instanceof EE_CPT_Strategy) { |
|
82 | 82 | self::$_instance = new self(); |
83 | 83 | } |
84 | 84 | return self::$_instance; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // d( $this->_CPT_endpoints ); |
102 | 102 | // d( $this->_CPT_taxonomies ); |
103 | 103 | |
104 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 ); |
|
104 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 5); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _set_CPT_endpoints() { |
116 | 116 | $_CPT_endpoints = array(); |
117 | - if ( is_array( $this->_CPTs )) { |
|
118 | - foreach ( $this->_CPTs as $CPT_type => $CPT ) { |
|
119 | - $_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type; |
|
117 | + if (is_array($this->_CPTs)) { |
|
118 | + foreach ($this->_CPTs as $CPT_type => $CPT) { |
|
119 | + $_CPT_endpoints [$CPT['plural_slug']] = $CPT_type; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | return $_CPT_endpoints; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param WP_Query $WP_Query |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) { |
|
134 | + private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) { |
|
135 | 135 | $WP_Query->is_espresso_event_single = FALSE; |
136 | 136 | $WP_Query->is_espresso_event_archive = FALSE; |
137 | 137 | $WP_Query->is_espresso_event_taxonomy = FALSE; |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | */ |
159 | 159 | private function _set_CPT_taxonomies() { |
160 | 160 | // check if taxonomies have already been set |
161 | - if ( empty( $this->_CPT_taxonomies )) { |
|
161 | + if (empty($this->_CPT_taxonomies)) { |
|
162 | 162 | // and that this CPT has taxonomies registered for it |
163 | - if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) { |
|
163 | + if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) { |
|
164 | 164 | // if so then grab them, but we want the taxonomy name as the key |
165 | - $taxonomies = array_flip( $this->CPT['args']['taxonomies'] ); |
|
165 | + $taxonomies = array_flip($this->CPT['args']['taxonomies']); |
|
166 | 166 | // then grab the list of ALL taxonomies |
167 | 167 | $all_taxonomies = EE_Register_CPTs::get_taxonomies(); |
168 | - foreach ( $taxonomies as $taxonomy => $details ) { |
|
168 | + foreach ($taxonomies as $taxonomy => $details) { |
|
169 | 169 | // add details to our taxonomies if they exist |
170 | - $taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL; |
|
170 | + $taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL; |
|
171 | 171 | } |
172 | 172 | $this->_CPT_taxonomies = $taxonomies; |
173 | 173 | } |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | * @return void |
193 | 193 | */ |
194 | 194 | private function _set_CPT_terms() { |
195 | - if ( empty( $this->_CPT_terms )) { |
|
195 | + if (empty($this->_CPT_terms)) { |
|
196 | 196 | $terms = EEM_Term::instance()->get_all_CPT_post_tags(); |
197 | - foreach ( $terms as $term ) { |
|
198 | - $this->_CPT_terms[ $term->slug() ] = $term; |
|
197 | + foreach ($terms as $term) { |
|
198 | + $this->_CPT_terms[$term->slug()] = $term; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
@@ -209,24 +209,24 @@ discard block |
||
209 | 209 | * @param $WP_Query |
210 | 210 | * @return void |
211 | 211 | */ |
212 | - private function _set_post_type_for_terms( WP_Query $WP_Query ) { |
|
212 | + private function _set_post_type_for_terms(WP_Query $WP_Query) { |
|
213 | 213 | // is a tag set ? |
214 | - if ( isset( $WP_Query->query['tag'] )) { |
|
214 | + if (isset($WP_Query->query['tag'])) { |
|
215 | 215 | // set post_tags |
216 | 216 | $this->_set_CPT_terms(); |
217 | 217 | // is this tag archive term in the list of terms used by our CPTs ? |
218 | - $term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL; |
|
218 | + $term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL; |
|
219 | 219 | // verify the term |
220 | - if ( $term instanceof EE_Term ) { |
|
221 | - $term->post_type = array_merge( array( 'post', 'page' ), (array)$term->post_type ); |
|
222 | - $term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term ); |
|
220 | + if ($term instanceof EE_Term) { |
|
221 | + $term->post_type = array_merge(array('post', 'page'), (array) $term->post_type); |
|
222 | + $term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term); |
|
223 | 223 | // if a post type is already set |
224 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
224 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
225 | 225 | // add to existing array |
226 | - $term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type ); |
|
226 | + $term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type); |
|
227 | 227 | } |
228 | 228 | // just set post_type to our CPT |
229 | - $WP_Query->set( 'post_type', $term->post_type ); |
|
229 | + $WP_Query->set('post_type', $term->post_type); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * in order for is_archive() and is_single() methods to work properly. |
242 | 242 | * @return void |
243 | 243 | */ |
244 | - public function _possibly_set_ee_request_var(){ |
|
244 | + public function _possibly_set_ee_request_var() { |
|
245 | 245 | // check if ee action var has been set |
246 | - if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) { |
|
246 | + if ( ! EE_Registry::instance()->REQ->is_set('ee')) { |
|
247 | 247 | // check that route exists for CPT archive slug |
248 | - if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) { |
|
248 | + if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) { |
|
249 | 249 | // ie: set "ee" to "events" |
250 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] ); |
|
250 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']); |
|
251 | 251 | // or does it match a single page CPT like /event/ |
252 | - } else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) { |
|
252 | + } else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) { |
|
253 | 253 | // ie: set "ee" to "event" |
254 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
254 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | } |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | * @param WP_Query $WP_Query |
266 | 266 | * @return void |
267 | 267 | */ |
268 | - public function _set_paging( $WP_Query ) { |
|
269 | - if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) { |
|
270 | - $page = ( get_query_var('page') ) ? get_query_var('page') : NULL; |
|
271 | - $paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page; |
|
272 | - $WP_Query->set( 'paged', $paged ); |
|
268 | + public function _set_paging($WP_Query) { |
|
269 | + if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) { |
|
270 | + $page = (get_query_var('page')) ? get_query_var('page') : NULL; |
|
271 | + $paged = (get_query_var('paged')) ? get_query_var('paged') : $page; |
|
272 | + $WP_Query->set('paged', $paged); |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | |
@@ -286,35 +286,35 @@ discard block |
||
286 | 286 | * @param WP_Query $WP_Query |
287 | 287 | * @return void |
288 | 288 | */ |
289 | - public function pre_get_posts( $WP_Query ) { |
|
289 | + public function pre_get_posts($WP_Query) { |
|
290 | 290 | // check that post-type is set |
291 | - if ( ! $WP_Query instanceof WP_Query ) { |
|
291 | + if ( ! $WP_Query instanceof WP_Query) { |
|
292 | 292 | return; |
293 | 293 | } |
294 | 294 | |
295 | 295 | // add our conditionals |
296 | - $this->_set_EE_tags_on_WP_Query( $WP_Query ); |
|
296 | + $this->_set_EE_tags_on_WP_Query($WP_Query); |
|
297 | 297 | // check for terms |
298 | - $this->_set_post_type_for_terms( $WP_Query ); |
|
298 | + $this->_set_post_type_for_terms($WP_Query); |
|
299 | 299 | // make sure paging is always set |
300 | - $this->_set_paging( $WP_Query ); |
|
300 | + $this->_set_paging($WP_Query); |
|
301 | 301 | |
302 | 302 | // is a taxonomy set ? |
303 | - if ( $WP_Query->is_tax ) { |
|
303 | + if ($WP_Query->is_tax) { |
|
304 | 304 | // loop thru our taxonomies |
305 | - foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) { |
|
305 | + foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) { |
|
306 | 306 | // check if one of our taxonomies is set as a query var |
307 | - if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) { |
|
307 | + if (isset($WP_Query->query[$CPT_taxonomy])) { |
|
308 | 308 | // but which CPT does that correspond to??? hmmm... guess we gotta go looping |
309 | - foreach ( $this->_CPTs as $post_type => $CPT ) { |
|
309 | + foreach ($this->_CPTs as $post_type => $CPT) { |
|
310 | 310 | // verify our CPT has args, is public and has taxonomies set |
311 | - if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) { |
|
311 | + if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) { |
|
312 | 312 | // does the captured taxonomy belong to this CPT ? |
313 | - if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) { |
|
313 | + if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) { |
|
314 | 314 | // if so, then add this CPT post_type to the current query's array of post_types' |
315 | - $WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array(); |
|
315 | + $WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array(); |
|
316 | 316 | $WP_Query->query_vars['post_type'][] = $post_type; |
317 | - switch( $post_type ) { |
|
317 | + switch ($post_type) { |
|
318 | 318 | case 'espresso_events' : |
319 | 319 | $WP_Query->is_espresso_event_taxonomy = TRUE; |
320 | 320 | break; |
@@ -335,24 +335,24 @@ discard block |
||
335 | 335 | // d( $CPT_taxonomy ); |
336 | 336 | // d( $WP_Query ); |
337 | 337 | |
338 | - if ( isset( $WP_Query->query_vars['post_type'] )) { |
|
338 | + if (isset($WP_Query->query_vars['post_type'])) { |
|
339 | 339 | // loop thru post_types as array |
340 | - foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) { |
|
340 | + foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) { |
|
341 | 341 | |
342 | 342 | // is current query for an EE CPT ? |
343 | - if ( isset( $this->_CPTs[ $post_type ] )) { |
|
343 | + if (isset($this->_CPTs[$post_type])) { |
|
344 | 344 | // is EE on or off ? |
345 | - if ( EE_Maintenance_Mode::instance()->level() ) { |
|
345 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
346 | 346 | // reroute CPT template view to maintenance_mode.template.php |
347 | - if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){ |
|
348 | - add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 ); |
|
347 | + if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) { |
|
348 | + add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999); |
|
349 | 349 | } |
350 | 350 | return; |
351 | 351 | } |
352 | 352 | // load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037 |
353 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
353 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
354 | 354 | // grab details for the CPT the current query is for |
355 | - $this->CPT = $this->_CPTs[ $post_type ]; |
|
355 | + $this->CPT = $this->_CPTs[$post_type]; |
|
356 | 356 | // set post type |
357 | 357 | $this->CPT['post_type'] = $post_type; |
358 | 358 | // set taxonomies |
@@ -360,27 +360,27 @@ discard block |
||
360 | 360 | // the post or category or term that is triggering EE |
361 | 361 | $this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page(); |
362 | 362 | // requested post name |
363 | - $this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' ); |
|
363 | + $this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name'); |
|
364 | 364 | //d( $this->CPT ); |
365 | 365 | // add support for viewing 'private', 'draft', or 'pending' posts |
366 | - if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) { |
|
366 | + if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) { |
|
367 | 367 | // we can just inject directly into the WP_Query object |
368 | - $WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' ); |
|
368 | + $WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending'); |
|
369 | 369 | // now set the main 'ee' request var so that the appropriate module can load the appropriate template(s) |
370 | - EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] ); |
|
370 | + EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']); |
|
371 | 371 | } |
372 | - $this->_possibly_set_ee_request_var( $post_type ); |
|
372 | + $this->_possibly_set_ee_request_var($post_type); |
|
373 | 373 | // convert post_type to model name |
374 | - $model_name = str_replace( 'EE_', '', $this->CPT['class_name'] ); |
|
374 | + $model_name = str_replace('EE_', '', $this->CPT['class_name']); |
|
375 | 375 | // get CPT table data via CPT Model |
376 | - $this->CPT_model = EE_Registry::instance()->load_model( $model_name ); |
|
376 | + $this->CPT_model = EE_Registry::instance()->load_model($model_name); |
|
377 | 377 | $this->CPT['tables'] = $this->CPT_model->get_tables(); |
378 | 378 | // is there a Meta Table for this CPT? |
379 | - $this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE; |
|
379 | + $this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE; |
|
380 | 380 | // creates classname like: CPT_Event_Strategy |
381 | - $CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy'; |
|
381 | + $CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy'; |
|
382 | 382 | // load and instantiate |
383 | - $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT )); |
|
383 | + $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT)); |
|
384 | 384 | |
385 | 385 | // !!!!!!!!!! IMPORTANT !!!!!!!!!!!! |
386 | 386 | // here's the list of available filters in the WP_Query object |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | // 'post_limits' |
393 | 393 | // 'posts_fields' |
394 | 394 | // 'posts_join' |
395 | - add_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
396 | - add_filter( 'posts_join', array( $this, 'posts_join' )); |
|
397 | - add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 ); |
|
398 | - add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
399 | - add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 ); |
|
395 | + add_filter('posts_fields', array($this, 'posts_fields')); |
|
396 | + add_filter('posts_join', array($this, 'posts_join')); |
|
397 | + add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4); |
|
398 | + add_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
399 | + add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2); |
|
400 | 400 | |
401 | - $this->_do_template_filters( $WP_Query ); |
|
401 | + $this->_do_template_filters($WP_Query); |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | } |
@@ -413,13 +413,13 @@ discard block |
||
413 | 413 | * @param $SQL |
414 | 414 | * @return string |
415 | 415 | */ |
416 | - public function posts_fields( $SQL ) { |
|
416 | + public function posts_fields($SQL) { |
|
417 | 417 | // does this CPT have a meta table ? |
418 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
418 | + if ( ! empty($this->CPT['meta_table'])) { |
|
419 | 419 | // adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement |
420 | - $SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ; |
|
420 | + $SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* '; |
|
421 | 421 | } |
422 | - remove_filter( 'posts_fields', array( $this, 'posts_fields' )); |
|
422 | + remove_filter('posts_fields', array($this, 'posts_fields')); |
|
423 | 423 | return $SQL; |
424 | 424 | } |
425 | 425 | |
@@ -432,14 +432,14 @@ discard block |
||
432 | 432 | * @param $SQL |
433 | 433 | * @return string |
434 | 434 | */ |
435 | - public function posts_join( $SQL ) { |
|
435 | + public function posts_join($SQL) { |
|
436 | 436 | // does this CPT have a meta table ? |
437 | - if ( ! empty( $this->CPT['meta_table'] )) { |
|
437 | + if ( ! empty($this->CPT['meta_table'])) { |
|
438 | 438 | global $wpdb; |
439 | 439 | // adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement |
440 | - $SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) '; |
|
440 | + $SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) '; |
|
441 | 441 | } |
442 | - remove_filter( 'posts_join', array( $this, 'posts_join' )); |
|
442 | + remove_filter('posts_join', array($this, 'posts_join')); |
|
443 | 443 | return $SQL; |
444 | 444 | } |
445 | 445 | |
@@ -452,18 +452,18 @@ discard block |
||
452 | 452 | * @param \WP_Post[] $posts |
453 | 453 | * @return \WP_Post[] |
454 | 454 | */ |
455 | - public function the_posts( $posts ) { |
|
455 | + public function the_posts($posts) { |
|
456 | 456 | // d( $posts ); |
457 | 457 | $CPT_class = $this->CPT['class_name']; |
458 | 458 | // loop thru posts |
459 | - if ( is_array( $posts )) { |
|
460 | - foreach( $posts as $key => $post ) { |
|
461 | - if ( isset( $this->_CPTs[ $post->post_type ] )) { |
|
462 | - $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object( $post ); |
|
459 | + if (is_array($posts)) { |
|
460 | + foreach ($posts as $key => $post) { |
|
461 | + if (isset($this->_CPTs[$post->post_type])) { |
|
462 | + $post->$CPT_class = $this->CPT_model->instantiate_class_from_post_object($post); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | - remove_filter( 'the_posts', array( $this, 'the_posts' ), 1, 1 ); |
|
466 | + remove_filter('the_posts', array($this, 'the_posts'), 1, 1); |
|
467 | 467 | return $posts; |
468 | 468 | } |
469 | 469 | |
@@ -474,17 +474,17 @@ discard block |
||
474 | 474 | * @param $ID |
475 | 475 | * @return string |
476 | 476 | */ |
477 | - function get_edit_post_link( $url, $ID ) { |
|
477 | + function get_edit_post_link($url, $ID) { |
|
478 | 478 | //need to make sure we only edit links if our cpt |
479 | 479 | global $post; |
480 | - if ( ! isset( $this->_CPTs[ $post->post_type ] )) { |
|
480 | + if ( ! isset($this->_CPTs[$post->post_type])) { |
|
481 | 481 | return $url; |
482 | 482 | } |
483 | 483 | //k made it here so all is good. |
484 | 484 | $scheme = is_ssl() ? 'https' : 'http'; |
485 | - $url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme ); |
|
485 | + $url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme); |
|
486 | 486 | // http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6 |
487 | - return wp_nonce_url( add_query_arg( array( 'page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' ); |
|
487 | + return wp_nonce_url(add_query_arg(array('page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce'); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | * @param WP_Query $WP_Query |
499 | 499 | * @return void |
500 | 500 | */ |
501 | - protected function _do_template_filters( WP_Query $WP_Query ) { |
|
501 | + protected function _do_template_filters(WP_Query $WP_Query) { |
|
502 | 502 | // if it's the main query and requested cpt supports page_templates, |
503 | - if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) { |
|
503 | + if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) { |
|
504 | 504 | // then let's hook into the appropriate query_template hook |
505 | - add_filter( 'single_template', array( $this, 'single_cpt_template' ) ); |
|
505 | + add_filter('single_template', array($this, 'single_cpt_template')); |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @param string $current_template Existing default template path derived for this page call. |
517 | 517 | * @return string the path to the full template file. |
518 | 518 | */ |
519 | - public function single_cpt_template( $current_template ) { |
|
519 | + public function single_cpt_template($current_template) { |
|
520 | 520 | $object = get_queried_object(); |
521 | 521 | //does this called object HAVE a page template set that is something other than the default. |
522 | - $template = get_post_meta( $object->ID, '_wp_page_template', true ); |
|
522 | + $template = get_post_meta($object->ID, '_wp_page_template', true); |
|
523 | 523 | |
524 | 524 | //exit early if default or not set or invalid path (accounts for theme changes) |
525 | - if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) { |
|
525 | + if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) { |
|
526 | 526 | return $current_template; |
527 | 527 | } |
528 | 528 | //made it here so we SHOULD be able to just locate the template and then return it. |
529 | - $template = locate_template( array($template) ); |
|
529 | + $template = locate_template(array($template)); |
|
530 | 530 | |
531 | 531 | return $template; |
532 | 532 | } |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | * @param array $arguments |
575 | 575 | * @return \EE_CPT_Default_Strategy |
576 | 576 | */ |
577 | - public function __construct( $arguments = array() ) { |
|
578 | - $this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL; |
|
579 | - $WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL; |
|
577 | + public function __construct($arguments = array()) { |
|
578 | + $this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL; |
|
579 | + $WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL; |
|
580 | 580 | //EEH_Debug_Tools::printr( $this->CPT, '$this->CPT <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
581 | 581 | // add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 ); |
582 | 582 | // add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 ); |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | * @param \WP_Query $WP_Query |
592 | 592 | * @return \WP_Query |
593 | 593 | */ |
594 | - public function pre_get_posts( WP_Query $WP_Query ) { |
|
594 | + public function pre_get_posts(WP_Query $WP_Query) { |
|
595 | 595 | //EEH_Debug_Tools::printr( $WP_Query, '$WP_Query <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
596 | - if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) { |
|
596 | + if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) { |
|
597 | 597 | return $WP_Query; |
598 | 598 | } |
599 | 599 | // $WP_Query->set( 'post_type', array( $this->CPT['post_type'] )); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @param \WP_Query $WP_Query |
612 | 612 | * @return \WP_Post[] |
613 | 613 | */ |
614 | - public function the_posts( $posts, WP_Query $WP_Query ) { |
|
614 | + public function the_posts($posts, WP_Query $WP_Query) { |
|
615 | 615 | return $posts; |
616 | 616 | } |
617 | 617 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * @param string $single |
628 | 628 | * @return mixed |
629 | 629 | */ |
630 | - public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) { |
|
630 | + public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) { |
|
631 | 631 | return $meta_value; |
632 | 632 | } |
633 | 633 |