@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | * This just returns whatever is set as the _event object property |
1292 | 1292 | * |
1293 | 1293 | * //todo this will become obsolete once the models are in place |
1294 | - * @return object |
|
1294 | + * @return EE_CPT_Base |
|
1295 | 1295 | */ |
1296 | 1296 | public function get_event_object() { |
1297 | 1297 | return $this->_cpt_model_obj; |
@@ -1761,9 +1761,8 @@ discard block |
||
1761 | 1761 | * _trash_or_restore_events |
1762 | 1762 | * |
1763 | 1763 | * @access private |
1764 | - * @param int $event_id |
|
1765 | 1764 | * @param string $event_status |
1766 | - * @return void |
|
1765 | + * @return boolean |
|
1767 | 1766 | */ |
1768 | 1767 | private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) { |
1769 | 1768 | // grab event id |
@@ -1883,7 +1882,7 @@ discard block |
||
1883 | 1882 | * |
1884 | 1883 | * @access private |
1885 | 1884 | * @param int $EVT_ID |
1886 | - * @return void |
|
1885 | + * @return boolean |
|
1887 | 1886 | */ |
1888 | 1887 | private function _permanently_delete_event($EVT_ID = FALSE) { |
1889 | 1888 | // grab event id |
@@ -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 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'espresso_events' => 'edit' |
68 | 68 | ); |
69 | 69 | |
70 | - add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) ); |
|
70 | + add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function _ajax_hooks() { |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | 'edit' => __('Update Event', 'event_espresso'), |
94 | 94 | 'add_category' => __('Save New Category', 'event_espresso'), |
95 | 95 | 'edit_category' => __('Update Category', 'event_espresso'), |
96 | - 'template_settings' => __( 'Update Settings', 'event_espresso' ) |
|
96 | + 'template_settings' => __('Update Settings', 'event_espresso') |
|
97 | 97 | ) |
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
101 | 101 | protected function _set_page_routes() { |
102 | 102 | //load formatter helper |
103 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
103 | + EE_Registry::instance()->load_helper('Formatter'); |
|
104 | 104 | //load field generator helper |
105 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
105 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
106 | 106 | |
107 | 107 | //is there a evt_id in the request? |
108 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
108 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
109 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
110 | 110 | |
111 | 111 | |
112 | 112 | $this->_page_routes = array( |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'help_tour' => array( |
321 | 321 | 'Event_Editor_Help_Tour' |
322 | 322 | ), |
323 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
323 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
324 | 324 | 'require_nonce' => FALSE |
325 | 325 | ), |
326 | 326 | 'edit' => array( |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | 'help_tour' => array( |
377 | 377 | 'Event_Edit_Help_Tour' |
378 | 378 | ), |
379 | - 'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ), |
|
379 | + 'qtips' => array('EE_Event_Editor_Decaf_Tips'), |
|
380 | 380 | 'require_nonce' => FALSE |
381 | 381 | ), |
382 | 382 | 'default_event_settings' => array( |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'filename' => 'events_default_settings_status' |
399 | 399 | ) |
400 | 400 | ), |
401 | - 'help_tour' => array( 'Event_Default_Settings_Help_Tour'), |
|
401 | + 'help_tour' => array('Event_Default_Settings_Help_Tour'), |
|
402 | 402 | 'require_nonce' => FALSE |
403 | 403 | ), |
404 | 404 | //template settings |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'filename' => 'general_settings_templates' |
415 | 415 | ) |
416 | 416 | ), |
417 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
417 | + 'help_tour' => array('Templates_Help_Tour'), |
|
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ), |
420 | 420 | //event category stuff |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | 'label' => __('Edit Category', 'event_espresso'), |
439 | 439 | 'order' => 15, |
440 | 440 | 'persistent' => FALSE, |
441 | - '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 |
|
441 | + '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 |
|
442 | 442 | ), |
443 | 443 | 'help_tabs' => array( |
444 | 444 | 'edit_category_help_tab' => array( |
@@ -508,14 +508,14 @@ discard block |
||
508 | 508 | |
509 | 509 | public function load_scripts_styles() { |
510 | 510 | |
511 | - wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
511 | + wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
512 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
513 | 513 | wp_enqueue_style('events-admin-css'); |
514 | 514 | wp_enqueue_style('ee-cat-admin'); |
515 | 515 | //todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details |
516 | 516 | //registers for all views |
517 | 517 | //scripts |
518 | - wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
518 | + wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | public function load_scripts_styles_edit() { |
534 | 534 | //styles |
535 | 535 | wp_enqueue_style('espresso-ui-theme'); |
536 | - wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
536 | + wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
537 | 537 | wp_enqueue_style('event-editor-css'); |
538 | 538 | |
539 | 539 | //scripts |
540 | - wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION ); |
|
540 | + wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION); |
|
541 | 541 | wp_enqueue_script('event-datetime-metabox'); |
542 | 542 | |
543 | 543 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | |
573 | 573 | |
574 | 574 | public function admin_init() { |
575 | - EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ); |
|
575 | + EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | |
@@ -593,35 +593,35 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function verify_event_edit($event = NULL) { |
595 | 595 | // no event? |
596 | - if ( empty( $event )) { |
|
596 | + if (empty($event)) { |
|
597 | 597 | // set event |
598 | 598 | $event = $this->_cpt_model_obj; |
599 | 599 | } |
600 | 600 | // STILL no event? |
601 | - if ( empty ( $event )) { |
|
601 | + if (empty ($event)) { |
|
602 | 602 | return; |
603 | 603 | } |
604 | 604 | // first check if event is active. |
605 | - if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) { |
|
605 | + if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) { |
|
606 | 606 | return; |
607 | 607 | } |
608 | 608 | $orig_status = $event->status(); |
609 | 609 | //made it here so it IS active... next check that any of the tickets are sold. |
610 | - if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) { |
|
611 | - if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out ) { |
|
612 | - EE_Error::add_attention( sprintf( |
|
613 | - __( 'Please note that the Event Status has automaticallly been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso' ), |
|
614 | - EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' ) |
|
610 | + if ($event->is_sold_out() || $event->is_sold_out(TRUE)) { |
|
611 | + if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) { |
|
612 | + EE_Error::add_attention(sprintf( |
|
613 | + __('Please note that the Event Status has automaticallly been changed to %s because there are no more spaces available for this event. However, this change is not permanent until you update the event. You <em>can</em> change the status back to something else before updating if you wish.', 'event_espresso'), |
|
614 | + EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence') |
|
615 | 615 | )); |
616 | 616 | } |
617 | 617 | return; |
618 | 618 | } |
619 | 619 | //now we need to determine if the event has any tickets on sale. If not then we dont' show the error |
620 | - if ( ! $event->tickets_on_sale() ) { |
|
620 | + if ( ! $event->tickets_on_sale()) { |
|
621 | 621 | return; |
622 | 622 | } |
623 | 623 | //made it here so show warning |
624 | - EE_Error::add_attention( $this->_edit_event_warning() ); |
|
624 | + EE_Error::add_attention($this->_edit_event_warning()); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | ), |
662 | 662 | ); |
663 | 663 | |
664 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
664 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
665 | 665 | $this->_views['trash'] = array( |
666 | 666 | 'slug' => 'trash', |
667 | 667 | 'label' => __('Trash', 'event_espresso'), |
@@ -691,39 +691,39 @@ discard block |
||
691 | 691 | 'desc' => __('View Registrations for Event', 'event_espresso') |
692 | 692 | ) |
693 | 693 | ); |
694 | - $items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items ); |
|
694 | + $items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items); |
|
695 | 695 | $statuses = array( |
696 | 696 | 'sold_out_status' => array( |
697 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out, |
|
698 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' ) |
|
697 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out, |
|
698 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence') |
|
699 | 699 | ), |
700 | 700 | 'active_status' => array( |
701 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active, |
|
702 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' ) |
|
701 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active, |
|
702 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence') |
|
703 | 703 | ), |
704 | 704 | 'upcoming_status' => array( |
705 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming, |
|
706 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' ) |
|
705 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming, |
|
706 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence') |
|
707 | 707 | ), |
708 | 708 | 'postponed_status' => array( |
709 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed, |
|
710 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' ) |
|
709 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed, |
|
710 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence') |
|
711 | 711 | ), |
712 | 712 | 'cancelled_status' => array( |
713 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled, |
|
714 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' ) |
|
713 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled, |
|
714 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence') |
|
715 | 715 | ), |
716 | 716 | 'expired_status' => array( |
717 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired, |
|
718 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' ) |
|
717 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired, |
|
718 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence') |
|
719 | 719 | ), |
720 | 720 | 'inactive_status' => array( |
721 | - 'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive, |
|
722 | - 'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' ) |
|
721 | + 'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive, |
|
722 | + 'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence') |
|
723 | 723 | ) |
724 | 724 | ); |
725 | - $statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses ); |
|
726 | - return array_merge( $items, $statuses ); |
|
725 | + $statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses); |
|
726 | + return array_merge($items, $statuses); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | * @return EEM_Event |
736 | 736 | */ |
737 | 737 | private function _event_model() { |
738 | - if ( ! $this->_event_model instanceof EEM_Event ) { |
|
739 | - $this->_event_model = EE_Registry::instance()->load_model( 'Event' ); |
|
738 | + if ( ! $this->_event_model instanceof EEM_Event) { |
|
739 | + $this->_event_model = EE_Registry::instance()->load_model('Event'); |
|
740 | 740 | } |
741 | 741 | return $this->_event_model; |
742 | 742 | } |
@@ -755,12 +755,12 @@ discard block |
||
755 | 755 | * @param string $new_slug what the slug is |
756 | 756 | * @return string The new html string for the permalink area |
757 | 757 | */ |
758 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
758 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
759 | 759 | //make sure this is only when editing |
760 | - if ( !empty( $id ) ) { |
|
761 | - $post = get_post( $id ); |
|
762 | - $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> '; |
|
763 | - $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\'' . $post->ID . '\']"">'; |
|
760 | + if ( ! empty($id)) { |
|
761 | + $post = get_post($id); |
|
762 | + $return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#" tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> '; |
|
763 | + $return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=\''.$post->ID.'\']"">'; |
|
764 | 764 | } |
765 | 765 | return $return; |
766 | 766 | } |
@@ -776,8 +776,8 @@ discard block |
||
776 | 776 | * @return string html for generated table |
777 | 777 | */ |
778 | 778 | protected function _events_overview_list_table() { |
779 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
780 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) . |
|
779 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
780 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button'). |
|
781 | 781 | $this->_display_legend($this->_event_legend_items()); |
782 | 782 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
783 | 783 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -795,46 +795,46 @@ discard block |
||
795 | 795 | |
796 | 796 | |
797 | 797 | |
798 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
798 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
799 | 799 | |
800 | 800 | $event_values = array( |
801 | - 'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0, |
|
802 | - 'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0, |
|
801 | + 'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0, |
|
802 | + 'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0, |
|
803 | 803 | 'EVT_additional_limit' => min( |
804 | - apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ), |
|
805 | - !empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ), |
|
806 | - 'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
807 | - 'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0, |
|
808 | - 'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0, |
|
809 | - 'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL, |
|
810 | - 'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL, |
|
811 | - 'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL |
|
804 | + apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255), |
|
805 | + ! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ), |
|
806 | + 'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID, |
|
807 | + 'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0, |
|
808 | + 'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0, |
|
809 | + 'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL, |
|
810 | + 'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL, |
|
811 | + 'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL |
|
812 | 812 | ); |
813 | 813 | |
814 | 814 | //update event |
815 | - $success = $this->_event_model()->update_by_ID( $event_values, $post_id ); |
|
815 | + $success = $this->_event_model()->update_by_ID($event_values, $post_id); |
|
816 | 816 | |
817 | 817 | |
818 | 818 | //get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_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->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
820 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
819 | + $get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
820 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
821 | 821 | |
822 | 822 | |
823 | 823 | //the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons. |
824 | - $event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) ); |
|
824 | + $event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))); |
|
825 | 825 | |
826 | 826 | $att_success = TRUE; |
827 | 827 | |
828 | - foreach ( $event_update_callbacks as $e_callback ) { |
|
829 | - $_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) ); |
|
830 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
828 | + foreach ($event_update_callbacks as $e_callback) { |
|
829 | + $_succ = call_user_func_array($e_callback, array($event, $this->_req_data)); |
|
830 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | //any errors? |
834 | - if ( $success && FALSE === $att_success ) { |
|
835 | - EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
836 | - } else if ( $success === FALSE ) { |
|
837 | - EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
834 | + if ($success && FALSE === $att_success) { |
|
835 | + EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
836 | + } else if ($success === FALSE) { |
|
837 | + EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
838 | 838 | } |
839 | 839 | } |
840 | 840 | |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | /** |
845 | 845 | * @see parent::restore_item() |
846 | 846 | */ |
847 | - protected function _restore_cpt_item( $post_id, $revision_id ) { |
|
847 | + protected function _restore_cpt_item($post_id, $revision_id) { |
|
848 | 848 | //copy existing event meta to new post |
849 | 849 | $post_evt = $this->_event_model()->get_one_by_ID($post_id); |
850 | 850 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | $post_evt->restore_revision($revision_id); |
853 | 853 | |
854 | 854 | //related objs restore |
855 | - $post_evt->restore_revision($revision_id, array( 'Venue', 'Datetime', 'Price' ) ); |
|
855 | + $post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price')); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | |
@@ -864,50 +864,50 @@ discard block |
||
864 | 864 | * @param array $data The request data from the form |
865 | 865 | * @return bool Success or fail. |
866 | 866 | */ |
867 | - protected function _default_venue_update( $evtobj, $data ) { |
|
868 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
867 | + protected function _default_venue_update($evtobj, $data) { |
|
868 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
869 | 869 | $venue_model = EE_Registry::instance()->load_model('Venue'); |
870 | 870 | $rows_affected = NULL; |
871 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
871 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
872 | 872 | |
873 | 873 | //very important. If we don't have a venue name then we'll get out because not necessary to create empty venue |
874 | - if ( empty( $data['venue_title'] ) ) |
|
874 | + if (empty($data['venue_title'])) |
|
875 | 875 | return; |
876 | 876 | |
877 | 877 | $venue_array = array( |
878 | 878 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
879 | - 'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL, |
|
880 | - 'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL, |
|
881 | - 'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL, |
|
882 | - 'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL, |
|
883 | - 'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL, |
|
884 | - 'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL, |
|
885 | - 'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL, |
|
886 | - 'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL, |
|
887 | - 'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL, |
|
888 | - 'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL, |
|
889 | - 'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL, |
|
890 | - 'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL, |
|
891 | - 'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL, |
|
892 | - 'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
893 | - 'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL, |
|
894 | - 'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0, |
|
879 | + 'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL, |
|
880 | + 'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL, |
|
881 | + 'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL, |
|
882 | + 'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL, |
|
883 | + 'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL, |
|
884 | + 'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL, |
|
885 | + 'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL, |
|
886 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL, |
|
887 | + 'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL, |
|
888 | + 'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL, |
|
889 | + 'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL, |
|
890 | + 'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL, |
|
891 | + 'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL, |
|
892 | + 'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL, |
|
893 | + 'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL, |
|
894 | + 'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0, |
|
895 | 895 | 'status' => 'publish' |
896 | 896 | ); |
897 | 897 | |
898 | 898 | |
899 | 899 | //if we've got the venue_id then we're just updating the existing venue so let's do that and then get out. |
900 | - if ( !empty( $venue_id ) ) { |
|
901 | - $update_where = array( $venue_model->primary_key_name() => $venue_id ); |
|
902 | - $rows_affected = $venue_model->update( $venue_array, array( $update_where ) ); |
|
900 | + if ( ! empty($venue_id)) { |
|
901 | + $update_where = array($venue_model->primary_key_name() => $venue_id); |
|
902 | + $rows_affected = $venue_model->update($venue_array, array($update_where)); |
|
903 | 903 | //we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present. |
904 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
904 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
905 | 905 | return $rows_affected > 0 ? TRUE : FALSE; |
906 | 906 | } else { |
907 | 907 | //we insert the venue |
908 | - $venue_id = $venue_model->insert( $venue_array ); |
|
909 | - $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
910 | - return !empty( $venue_id ) ? TRUE : FALSE; |
|
908 | + $venue_id = $venue_model->insert($venue_array); |
|
909 | + $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
910 | + return ! empty($venue_id) ? TRUE : FALSE; |
|
911 | 911 | } |
912 | 912 | return TRUE; //when we have the ancestor come in it's already been handled by the revision save. |
913 | 913 | } |
@@ -921,50 +921,50 @@ discard block |
||
921 | 921 | * @param array $data The request data from the form |
922 | 922 | * @return bool success or fail |
923 | 923 | */ |
924 | - protected function _default_tickets_update( $evtobj, $data ) { |
|
924 | + protected function _default_tickets_update($evtobj, $data) { |
|
925 | 925 | $success = TRUE; |
926 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
927 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
928 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
926 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
927 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
928 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
929 | 929 | $datetime_values = array( |
930 | - 'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
930 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
931 | 931 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
932 | 932 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
933 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'], |
|
933 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'], |
|
934 | 934 | 'DTT_order' => $row, |
935 | 935 | ); |
936 | 936 | |
937 | 937 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
938 | 938 | |
939 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
940 | - $DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
941 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
942 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
943 | - foreach ( $datetime_values as $field => $value ) { |
|
944 | - $DTM->set( $field, $value ); |
|
939 | + if ( ! empty($dtt['DTT_ID'])) { |
|
940 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']); |
|
941 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
942 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
943 | + foreach ($datetime_values as $field => $value) { |
|
944 | + $DTM->set($field, $value); |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
948 | 948 | $saved_dtts[$DTM->ID()] = $DTM; |
949 | 949 | } else { |
950 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE ); |
|
951 | - $DTM->set_date_format( $incoming_date_formats[0] ); |
|
952 | - $DTM->set_time_format( $incoming_date_formats[1] ); |
|
953 | - $DTM->set_timezone( $evtobj->get_timezone() ); |
|
954 | - foreach ( $datetime_values as $field => $value ) { |
|
955 | - $DTM->set( $field, $value ); |
|
950 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE); |
|
951 | + $DTM->set_date_format($incoming_date_formats[0]); |
|
952 | + $DTM->set_time_format($incoming_date_formats[1]); |
|
953 | + $DTM->set_timezone($evtobj->get_timezone()); |
|
954 | + foreach ($datetime_values as $field => $value) { |
|
955 | + $DTM->set($field, $value); |
|
956 | 956 | } |
957 | 957 | } |
958 | 958 | $DTM->save(); |
959 | 959 | |
960 | - $DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' ); |
|
960 | + $DTT = $evtobj->_add_relation_to($DTM, 'Datetime'); |
|
961 | 961 | |
962 | 962 | //load DTT helper |
963 | 963 | EE_Registry::instance()->load_helper('DTT_Helper'); |
964 | 964 | |
965 | 965 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
966 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
967 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
966 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
967 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
968 | 968 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
969 | 969 | $DTT->save(); |
970 | 970 | } |
@@ -972,42 +972,42 @@ discard block |
||
972 | 972 | //now we got to make sure we add the new DTT_ID to the $saved_dtts array because it is possible there was a new one created for the autosave. |
973 | 973 | $saved_dtt = $DTT; |
974 | 974 | |
975 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
975 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
976 | 976 | } |
977 | 977 | |
978 | 978 | //no dtts get deleted so we don't do any of that logic here. |
979 | 979 | //update tickets next |
980 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
981 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
982 | - $incoming_date_formats = array( 'Y-m-d', 'h:i a' ); |
|
980 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
981 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
982 | + $incoming_date_formats = array('Y-m-d', 'h:i a'); |
|
983 | 983 | $update_prices = false; |
984 | - $ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
984 | + $ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0; |
|
985 | 985 | |
986 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
986 | + if (empty($tkt['TKT_start_date'])) { |
|
987 | 987 | //let's use now in the set timezone. |
988 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
989 | - $tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] ); |
|
988 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
989 | + $tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]); |
|
990 | 990 | } |
991 | 991 | |
992 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
992 | + if (empty($tkt['TKT_end_date'])) { |
|
993 | 993 | //use the start date of the first datetime |
994 | - $dtt = $evtobj->get_first_related( 'Datetime' ); |
|
995 | - $tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] ); |
|
994 | + $dtt = $evtobj->get_first_related('Datetime'); |
|
995 | + $tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]); |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | $TKT_values = array( |
999 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
1000 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
1001 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
1002 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '', |
|
999 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
1000 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
1001 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
1002 | + 'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '', |
|
1003 | 1003 | 'TKT_start_date' => $tkt['TKT_start_date'], |
1004 | 1004 | 'TKT_end_date' => $tkt['TKT_end_date'], |
1005 | - 'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'], |
|
1006 | - 'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'], |
|
1007 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
1008 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'], |
|
1005 | + 'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'], |
|
1006 | + 'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'], |
|
1007 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
1008 | + 'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'], |
|
1009 | 1009 | 'TKT_row' => $row, |
1010 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row, |
|
1010 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row, |
|
1011 | 1011 | 'TKT_price' => $ticket_price |
1012 | 1012 | ); |
1013 | 1013 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | |
1016 | 1016 | |
1017 | 1017 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
1018 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
1018 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
1019 | 1019 | $TKT_values['TKT_ID'] = 0; |
1020 | 1020 | $TKT_values['TKT_is_default'] = 0; |
1021 | 1021 | $TKT_values['TKT_price'] = $ticket_price; |
@@ -1026,25 +1026,25 @@ discard block |
||
1026 | 1026 | //we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
1027 | 1027 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
1028 | 1028 | |
1029 | - if ( !empty( $tkt['TKT_ID'] ) ) { |
|
1030 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
1029 | + if ( ! empty($tkt['TKT_ID'])) { |
|
1030 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']); |
|
1031 | 1031 | |
1032 | 1032 | |
1033 | - $ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
1033 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
1034 | 1034 | |
1035 | 1035 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
1036 | - $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && !$TKT->get('TKT_deleted') ? TRUE : FALSE; |
|
1036 | + $create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? TRUE : FALSE; |
|
1037 | 1037 | |
1038 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1039 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1038 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1039 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1040 | 1040 | |
1041 | 1041 | //set new values |
1042 | - foreach ( $TKT_values as $field => $value ) { |
|
1043 | - $TKT->set( $field, $value ); |
|
1042 | + foreach ($TKT_values as $field => $value) { |
|
1043 | + $TKT->set($field, $value); |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
1047 | - if ( $create_new_TKT ) { |
|
1047 | + if ($create_new_TKT) { |
|
1048 | 1048 | //archive the old ticket first |
1049 | 1049 | $TKT->set('TKT_deleted', 1); |
1050 | 1050 | $TKT->save(); |
@@ -1055,31 +1055,31 @@ discard block |
||
1055 | 1055 | |
1056 | 1056 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
1057 | 1057 | $TKT = clone $TKT; |
1058 | - $TKT->set( 'TKT_ID', 0 ); |
|
1059 | - $TKT->set( 'TKT_deleted', 0 ); |
|
1060 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1061 | - $TKT->set( 'TKT_sold', 0 ); |
|
1058 | + $TKT->set('TKT_ID', 0); |
|
1059 | + $TKT->set('TKT_deleted', 0); |
|
1060 | + $TKT->set('TKT_price', $ticket_price); |
|
1061 | + $TKT->set('TKT_sold', 0); |
|
1062 | 1062 | |
1063 | 1063 | //now we need to make sure that $new prices are created as well and attached to new ticket. |
1064 | 1064 | $update_prices = TRUE; |
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | //make sure price is set if it hasn't been already |
1068 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
1068 | + $TKT->set('TKT_price', $ticket_price); |
|
1069 | 1069 | |
1070 | 1070 | } else { |
1071 | 1071 | //no TKT_id so a new TKT |
1072 | 1072 | $TKT_values['TKT_price'] = $ticket_price; |
1073 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE ); |
|
1073 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE); |
|
1074 | 1074 | |
1075 | 1075 | //need to reset values to properly account for the date formats |
1076 | - $TKT->set_date_format( $incoming_date_formats[0] ); |
|
1077 | - $TKT->set_time_format( $incoming_date_formats[1] ); |
|
1078 | - $TKT->set_timezone( $evtobj->get_timezone() ); |
|
1076 | + $TKT->set_date_format($incoming_date_formats[0]); |
|
1077 | + $TKT->set_time_format($incoming_date_formats[1]); |
|
1078 | + $TKT->set_timezone($evtobj->get_timezone()); |
|
1079 | 1079 | |
1080 | 1080 | //set new values |
1081 | - foreach ( $TKT_values as $field => $value ) { |
|
1082 | - $TKT->set( $field, $value ); |
|
1081 | + foreach ($TKT_values as $field => $value) { |
|
1082 | + $TKT->set($field, $value); |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | $update_prices = TRUE; |
@@ -1089,27 +1089,27 @@ discard block |
||
1089 | 1089 | $TKT->save(); |
1090 | 1090 | |
1091 | 1091 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
1092 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
1093 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
1092 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
1093 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
1094 | 1094 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1095 | 1095 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
1096 | 1096 | $TKT->save(); |
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | //initially let's add the ticket to the dtt |
1100 | - $saved_dtt->_add_relation_to( $TKT, 'Ticket' ); |
|
1100 | + $saved_dtt->_add_relation_to($TKT, 'Ticket'); |
|
1101 | 1101 | |
1102 | 1102 | $saved_tickets[$TKT->ID()] = $TKT; |
1103 | 1103 | |
1104 | 1104 | //add prices to ticket |
1105 | - $this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices ); |
|
1105 | + $this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices); |
|
1106 | 1106 | } |
1107 | 1107 | //however now we need to handle permanantly deleting tickets via the ui. Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold. However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanantely because there is no need to save in db. |
1108 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1109 | - $tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) ); |
|
1108 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
1109 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
1110 | 1110 | |
1111 | - foreach ( $tickets_removed as $id ) { |
|
1112 | - $id = absint( $id ); |
|
1111 | + foreach ($tickets_removed as $id) { |
|
1112 | + $id = absint($id); |
|
1113 | 1113 | |
1114 | 1114 | //get the ticket for this id |
1115 | 1115 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
1118 | 1118 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
1119 | 1119 | |
1120 | - foreach( $dtts as $dtt ) { |
|
1120 | + foreach ($dtts as $dtt) { |
|
1121 | 1121 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
1122 | 1122 | } |
1123 | 1123 | |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
1129 | 1129 | $tkt_to_remove->delete_permanently(); |
1130 | 1130 | }/**/ |
1131 | - return array( $saved_dtt, $saved_tickets ); |
|
1131 | + return array($saved_dtt, $saved_tickets); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
@@ -1143,31 +1143,31 @@ discard block |
||
1143 | 1143 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
1144 | 1144 | * @return void |
1145 | 1145 | */ |
1146 | - private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) { |
|
1147 | - foreach ( $prices as $row => $prc ) { |
|
1146 | + private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) { |
|
1147 | + foreach ($prices as $row => $prc) { |
|
1148 | 1148 | $PRC_values = array( |
1149 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
1150 | - 'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL, |
|
1151 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
1152 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
1153 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
1149 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
1150 | + 'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL, |
|
1151 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
1152 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
1153 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
1154 | 1154 | 'PRC_is_default' => 0, //make sure prices are NOT set as default from this context |
1155 | 1155 | 'PRC_order' => $row |
1156 | 1156 | ); |
1157 | 1157 | |
1158 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
1158 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
1159 | 1159 | $PRC_values['PRC_ID'] = 0; |
1160 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
1160 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
1161 | 1161 | } else { |
1162 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
1162 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
1163 | 1163 | //update this price with new values |
1164 | - foreach ( $PRC_values as $field => $newprc ) { |
|
1165 | - $PRC->set( $field, $newprc ); |
|
1164 | + foreach ($PRC_values as $field => $newprc) { |
|
1165 | + $PRC->set($field, $newprc); |
|
1166 | 1166 | } |
1167 | 1167 | $PRC->save(); |
1168 | 1168 | } |
1169 | 1169 | |
1170 | - $PRC = $ticket->_add_relation_to( $PRC, 'Price' ); |
|
1170 | + $PRC = $ticket->_add_relation_to($PRC, 'Price'); |
|
1171 | 1171 | } |
1172 | 1172 | } |
1173 | 1173 | |
@@ -1190,33 +1190,33 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | return; //TEMPORARILY EXITING CAUSE THIS IS A TODO |
1192 | 1192 | |
1193 | - $postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL; |
|
1193 | + $postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL; |
|
1194 | 1194 | |
1195 | 1195 | |
1196 | 1196 | //if no postid then get out cause we need it for stuff in here |
1197 | - if ( empty( $postid ) ) return; |
|
1197 | + if (empty($postid)) return; |
|
1198 | 1198 | |
1199 | 1199 | |
1200 | 1200 | //handle datetime saves |
1201 | 1201 | $items = array(); |
1202 | 1202 | |
1203 | - $get_one_where = array( $this->_event_model()->primary_key_name() => $postid ); |
|
1204 | - $event = $this->_event_model()->get_one( array($get_one_where) ); |
|
1203 | + $get_one_where = array($this->_event_model()->primary_key_name() => $postid); |
|
1204 | + $event = $this->_event_model()->get_one(array($get_one_where)); |
|
1205 | 1205 | |
1206 | 1206 | //now let's get the attached datetimes from the most recent autosave |
1207 | 1207 | $dtts = $event->get_many_related('Datetime'); |
1208 | 1208 | |
1209 | 1209 | $dtt_ids = array(); |
1210 | - foreach( $dtts as $dtt ) { |
|
1210 | + foreach ($dtts as $dtt) { |
|
1211 | 1211 | $dtt_ids[] = $dtt->ID(); |
1212 | 1212 | $order = $dtt->order(); |
1213 | 1213 | $this->_template_args['data']['items']['ID-'.$order] = $dtt->ID(); |
1214 | 1214 | } |
1215 | - $this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids ); |
|
1215 | + $this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids); |
|
1216 | 1216 | |
1217 | 1217 | //handle DECAF venues |
1218 | 1218 | //we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event. |
1219 | - if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) { |
|
1219 | + if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) { |
|
1220 | 1220 | $venue = $event->get_first_related('Venue'); |
1221 | 1221 | $this->_template_args['data']['items']['venue-id'] = $venue->ID(); |
1222 | 1222 | } |
@@ -1227,23 +1227,23 @@ discard block |
||
1227 | 1227 | |
1228 | 1228 | $ticket_ids = array(); |
1229 | 1229 | $price_ids = array(); |
1230 | - foreach ( $tickets as $ticket ) { |
|
1230 | + foreach ($tickets as $ticket) { |
|
1231 | 1231 | $ticket_ids[] = $price->ID(); |
1232 | 1232 | $ticket_order = $price->get('TKT_order'); |
1233 | - $this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID(); |
|
1234 | - $this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID(); |
|
1233 | + $this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID(); |
|
1234 | + $this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID(); |
|
1235 | 1235 | |
1236 | 1236 | //now we have to make sure the prices are updated appropriately |
1237 | 1237 | $prices = $ticket->get_many_related('Prices'); |
1238 | 1238 | |
1239 | - foreach ( $prices as $price ) { |
|
1239 | + foreach ($prices as $price) { |
|
1240 | 1240 | $price_ids[] = $price->ID(); |
1241 | 1241 | $price_order = $price->get('PRC_order'); |
1242 | - $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID(); |
|
1243 | - $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID(); |
|
1244 | - $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default'); |
|
1242 | + $this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID(); |
|
1243 | + $this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID(); |
|
1244 | + $this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default'); |
|
1245 | 1245 | } |
1246 | - $this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids); |
|
1246 | + $this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids); |
|
1247 | 1247 | } |
1248 | 1248 | $this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids); |
1249 | 1249 | } |
@@ -1261,26 +1261,26 @@ discard block |
||
1261 | 1261 | private function _generate_publish_box_extra_content() { |
1262 | 1262 | |
1263 | 1263 | //load formatter helper |
1264 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1264 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1265 | 1265 | |
1266 | 1266 | //args for getting related registrations |
1267 | - $approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) ); |
|
1268 | - $not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) ); |
|
1269 | - $pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) ); |
|
1267 | + $approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved)); |
|
1268 | + $not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved)); |
|
1269 | + $pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment)); |
|
1270 | 1270 | |
1271 | 1271 | |
1272 | 1272 | // publish box |
1273 | - $publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved ), REG_ADMIN_URL); |
|
1274 | - $publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved ), REG_ADMIN_URL); |
|
1275 | - $publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment ), REG_ADMIN_URL); |
|
1273 | + $publish_box_extra_args['view_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_approved), REG_ADMIN_URL); |
|
1274 | + $publish_box_extra_args['view_not_approved_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_not_approved), REG_ADMIN_URL); |
|
1275 | + $publish_box_extra_args['view_pending_payment_reg_url'] = add_query_arg(array('action' => 'default', 'event_id' => $this->_cpt_model_obj->ID(), '_reg_status' => EEM_Registration::status_id_pending_payment), REG_ADMIN_URL); |
|
1276 | 1276 | $publish_box_extra_args['approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $approved_query_args); |
1277 | 1277 | $publish_box_extra_args['not_approved_regs'] = $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args); |
1278 | 1278 | $publish_box_extra_args['pending_payment_regs'] = $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args); |
1279 | - $publish_box_extra_args['misc_pub_section_class'] = apply_filters( 'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section'); |
|
1279 | + $publish_box_extra_args['misc_pub_section_class'] = apply_filters('FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class', 'misc-pub-section'); |
|
1280 | 1280 | //$publish_box_extra_args['email_attendees_url'] = add_query_arg(array('event_admin_reports' => 'event_newsletter', 'event_id' => $this->_cpt_model_obj->id), 'admin.php?page=espresso_registrations'); |
1281 | - $publish_box_extra_args['event_editor_overview_add'] = do_action( 'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj ); |
|
1281 | + $publish_box_extra_args['event_editor_overview_add'] = do_action('AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add', $this->_cpt_model_obj); |
|
1282 | 1282 | // load template |
1283 | - EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args ); |
|
1283 | + EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args); |
|
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | $this->verify_cpt_object(); |
1313 | 1313 | add_meta_box('espresso_event_editor_tickets', __('Event Datetime & Ticket', 'event_espresso'), array($this, 'ticket_metabox'), $this->page_slug, 'normal', 'high'); |
1314 | 1314 | add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'default'); |
1315 | - add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array( $this, 'venue_metabox' ), $this->page_slug, 'normal', 'core'); |
|
1315 | + add_meta_box('espresso_event_editor_venue', __('Venue Details', 'event_espresso'), array($this, 'venue_metabox'), $this->page_slug, 'normal', 'core'); |
|
1316 | 1316 | //note if you're looking for other metaboxes in here, where a metabox has a related management page in the admin you will find it setup in the related management page's "_Hooks" file. i.e. messages metabox is found in "espresso_events_Messages_Hooks.class.php". |
1317 | 1317 | } |
1318 | 1318 | |
@@ -1337,53 +1337,53 @@ discard block |
||
1337 | 1337 | 'disabled' => '' |
1338 | 1338 | ); |
1339 | 1339 | |
1340 | - $event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL; |
|
1340 | + $event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL; |
|
1341 | 1341 | |
1342 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1342 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1343 | 1343 | |
1344 | 1344 | /** |
1345 | 1345 | * 1. Start with retrieving Datetimes |
1346 | 1346 | * 2. Fore each datetime get related tickets |
1347 | 1347 | * 3. For each ticket get related prices |
1348 | 1348 | */ |
1349 | - $times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id ); |
|
1350 | - EE_Registry::instance()->load_helper('DTT_Helper' ); |
|
1349 | + $times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id); |
|
1350 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
1351 | 1351 | |
1352 | 1352 | $firstdtt = array_slice($times, 0, 1); |
1353 | 1353 | //do we get related tickets? |
1354 | - if ( $firstdtt[0]->get('DTT_ID') !== 0 ) { |
|
1355 | - foreach ( $times as $time ) { |
|
1354 | + if ($firstdtt[0]->get('DTT_ID') !== 0) { |
|
1355 | + foreach ($times as $time) { |
|
1356 | 1356 | $existing_datetime_ids[] = $time->get('DTT_ID'); |
1357 | 1357 | $template_args['time'] = $time; |
1358 | - $related_tickets = $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none' ) ); |
|
1358 | + $related_tickets = $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none')); |
|
1359 | 1359 | |
1360 | - if ( !empty($related_tickets) ) { |
|
1360 | + if ( ! empty($related_tickets)) { |
|
1361 | 1361 | $template_args['total_ticket_rows'] = count($related_tickets); |
1362 | 1362 | $row = 0; |
1363 | - foreach ( $related_tickets as $ticket ) { |
|
1363 | + foreach ($related_tickets as $ticket) { |
|
1364 | 1364 | $existing_ticket_ids[] = $ticket->get('TKT_ID'); |
1365 | - $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row ); |
|
1365 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row); |
|
1366 | 1366 | |
1367 | 1367 | $row++; |
1368 | 1368 | } |
1369 | 1369 | } else { |
1370 | 1370 | $template_args['total_ticket_rows'] = 1; |
1371 | 1371 | $ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object(); |
1372 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket ); |
|
1372 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket); |
|
1373 | 1373 | } |
1374 | 1374 | } |
1375 | 1375 | } else { |
1376 | 1376 | $template_args['time'] = $times[0]; |
1377 | 1377 | $ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
1378 | - $template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] ); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent); |
|
1378 | + $template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]); //note we're just sending the first default row (decaf can't manage default tickets so this should be sufficent); |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | $template_args['event_datetime_help_link'] = $this->_get_help_tab_link('event_editor_event_datetimes_help_tab'); |
1382 | 1382 | $template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info'); |
1383 | 1383 | $template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
1384 | 1384 | $template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
1385 | - $template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE ); |
|
1386 | - $template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' ); |
|
1385 | + $template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE); |
|
1386 | + $template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'); |
|
1387 | 1387 | EEH_Template::display_template($template, $template_args); |
1388 | 1388 | } |
1389 | 1389 | |
@@ -1397,21 +1397,21 @@ discard block |
||
1397 | 1397 | * @param boolean $skeleton whether we're generating a skeleton for js manipulation |
1398 | 1398 | * @return string generated html for the ticket row. |
1399 | 1399 | */ |
1400 | - private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) { |
|
1400 | + private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) { |
|
1401 | 1401 | $template_args = array( |
1402 | - 'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(), |
|
1403 | - 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '', |
|
1402 | + 'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(), |
|
1403 | + 'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '', |
|
1404 | 1404 | 'ticketrow' => $skeleton ? 'TICKETNUM' : $row, |
1405 | 1405 | 'TKT_ID' => $ticket->get('TKT_ID'), |
1406 | 1406 | 'TKT_name' => $ticket->get('TKT_name'), |
1407 | 1407 | 'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'), |
1408 | 1408 | 'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'), |
1409 | 1409 | 'TKT_is_default' => $ticket->get('TKT_is_default'), |
1410 | - 'TKT_qty' => $ticket->get_pretty('TKT_qty','input'), |
|
1410 | + 'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'), |
|
1411 | 1411 | 'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets', |
1412 | 1412 | 'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'), |
1413 | - 'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1414 | - 'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled' |
|
1413 | + 'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon', |
|
1414 | + 'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled' |
|
1415 | 1415 | ); |
1416 | 1416 | |
1417 | 1417 | $price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object(); |
@@ -1427,23 +1427,23 @@ discard block |
||
1427 | 1427 | |
1428 | 1428 | //make sure we have default start and end dates if skeleton |
1429 | 1429 | //handle rows that should NOT be empty |
1430 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1430 | + if (empty($template_args['TKT_start_date'])) { |
|
1431 | 1431 | //if empty then the start date will be now. |
1432 | 1432 | $template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp')); |
1433 | 1433 | } |
1434 | 1434 | |
1435 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1435 | + if (empty($template_args['TKT_end_date'])) { |
|
1436 | 1436 | //get the earliest datetime (if present); |
1437 | - $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1437 | + $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1438 | 1438 | |
1439 | - if ( !empty( $earliest_dtt ) ) |
|
1439 | + if ( ! empty($earliest_dtt)) |
|
1440 | 1440 | $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
1441 | 1441 | else |
1442 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1442 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))); |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | - $template_args = array_merge( $template_args, $price_args ); |
|
1446 | - $template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1445 | + $template_args = array_merge($template_args, $price_args); |
|
1446 | + $template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket); |
|
1447 | 1447 | return EEH_Template::display_template($template, $template_args, TRUE); |
1448 | 1448 | } |
1449 | 1449 | |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | array('id' => false, 'text' => __('No', 'event_espresso')) |
1457 | 1457 | ); |
1458 | 1458 | |
1459 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
1459 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
1460 | 1460 | |
1461 | 1461 | //$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active()); |
1462 | 1462 | $template_args['_event'] = $this->_cpt_model_obj; |
@@ -1465,8 +1465,8 @@ discard block |
||
1465 | 1465 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
1466 | 1466 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
1467 | 1467 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
1468 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
1469 | - $templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
1468 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
1469 | + $templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
1470 | 1470 | EEH_Template::display_template($templatepath, $template_args); |
1471 | 1471 | } |
1472 | 1472 | |
@@ -1480,14 +1480,14 @@ discard block |
||
1480 | 1480 | |
1481 | 1481 | //first let's see if we have a venue already |
1482 | 1482 | $event_id = $this->_cpt_model_obj->ID(); |
1483 | - $venue = !empty( $event_id ) ? $this->_cpt_model_obj->venues() : NULL; |
|
1484 | - $venue = empty( $venue ) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift( $venue ); |
|
1483 | + $venue = ! empty($event_id) ? $this->_cpt_model_obj->venues() : NULL; |
|
1484 | + $venue = empty($venue) ? EE_Registry::instance()->load_model('Venue')->create_default_object() : array_shift($venue); |
|
1485 | 1485 | $template_args['_venue'] = $venue; |
1486 | 1486 | |
1487 | 1487 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
1488 | 1488 | $QFI = new EE_Question_Form_Input( |
1489 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
1490 | - EE_Answer::new_instance( array( 'ANS_value'=> $venue->state_ID() )), |
|
1489 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
1490 | + EE_Answer::new_instance(array('ANS_value'=> $venue->state_ID())), |
|
1491 | 1491 | array( |
1492 | 1492 | 'input_name' => 'state', |
1493 | 1493 | 'input_id' => 'phys-state', |
@@ -1499,8 +1499,8 @@ discard block |
||
1499 | 1499 | ); |
1500 | 1500 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
1501 | 1501 | $QFI = new EE_Question_Form_Input( |
1502 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
1503 | - EE_Answer::new_instance( array( 'ANS_value'=> $venue->country_ID() )), |
|
1502 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
1503 | + EE_Answer::new_instance(array('ANS_value'=> $venue->country_ID())), |
|
1504 | 1504 | array( |
1505 | 1505 | 'input_name' => 'countries', |
1506 | 1506 | 'input_id' => 'phys-country', |
@@ -1511,8 +1511,8 @@ discard block |
||
1511 | 1511 | ) |
1512 | 1512 | ); |
1513 | 1513 | |
1514 | - $template_path = EVENTS_TEMPLATE_PATH . 'event_venues_metabox_content.template.php'; |
|
1515 | - EEH_Template::display_template( $template_path, $template_args ); |
|
1514 | + $template_path = EVENTS_TEMPLATE_PATH.'event_venues_metabox_content.template.php'; |
|
1515 | + EEH_Template::display_template($template_path, $template_args); |
|
1516 | 1516 | } |
1517 | 1517 | |
1518 | 1518 | |
@@ -1539,21 +1539,21 @@ discard block |
||
1539 | 1539 | $EEME = $this->_event_model(); |
1540 | 1540 | |
1541 | 1541 | $offset = ($current_page - 1) * $per_page; |
1542 | - $limit = $count ? NULL : $offset . ',' . $per_page; |
|
1542 | + $limit = $count ? NULL : $offset.','.$per_page; |
|
1543 | 1543 | $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID'; |
1544 | 1544 | $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC"; |
1545 | 1545 | |
1546 | 1546 | if (isset($this->_req_data['month_range'])) { |
1547 | 1547 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
1548 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1549 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
1548 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
1549 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
1550 | 1550 | } |
1551 | 1551 | |
1552 | 1552 | $where = array(); |
1553 | 1553 | |
1554 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
1554 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
1555 | 1555 | //determine what post_status our condition will have for the query. |
1556 | - switch ( $status ) { |
|
1556 | + switch ($status) { |
|
1557 | 1557 | case 'month' : |
1558 | 1558 | case 'today' : |
1559 | 1559 | case NULL : |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | break; |
1562 | 1562 | |
1563 | 1563 | case 'draft' : |
1564 | - $where['status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1564 | + $where['status'] = array('IN', array('draft', 'auto-draft')); |
|
1565 | 1565 | break; |
1566 | 1566 | |
1567 | 1567 | default : |
@@ -1569,43 +1569,43 @@ discard block |
||
1569 | 1569 | } |
1570 | 1570 | |
1571 | 1571 | //categories? |
1572 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1572 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
1573 | 1573 | |
1574 | - if ( !empty ( $category ) ) { |
|
1574 | + if ( ! empty ($category)) { |
|
1575 | 1575 | $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1576 | 1576 | $where['Term_Taxonomy.term_id'] = $category; |
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | //date where conditions |
1580 | - $start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' ); |
|
1580 | + $start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start'); |
|
1581 | 1581 | if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') { |
1582 | - $DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) ); |
|
1583 | - $start = $DateTime->format( implode( ' ', $start_formats ) ); |
|
1584 | - $end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) ); |
|
1585 | - $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) ); |
|
1582 | + $DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone())); |
|
1583 | + $start = $DateTime->format(implode(' ', $start_formats)); |
|
1584 | + $end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1585 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1586 | 1586 | } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') { |
1587 | - $DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1588 | - $start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) ); |
|
1589 | - $end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1590 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1591 | - } else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) { |
|
1592 | - $now = date( 'Y-m-01' ); |
|
1593 | - $DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) ); |
|
1594 | - $start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) ); |
|
1595 | - $end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) ); |
|
1596 | - $where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) ); |
|
1587 | + $DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1588 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1589 | + $end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1590 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1591 | + } else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') { |
|
1592 | + $now = date('Y-m-01'); |
|
1593 | + $DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone())); |
|
1594 | + $start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats)); |
|
1595 | + $end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats)); |
|
1596 | + $where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end)); |
|
1597 | 1597 | } |
1598 | 1598 | |
1599 | 1599 | |
1600 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1601 | - $where['EVT_wp_user'] = get_current_user_id(); |
|
1600 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1601 | + $where['EVT_wp_user'] = get_current_user_id(); |
|
1602 | 1602 | } else { |
1603 | - if ( ! isset( $where['status'] ) ) { |
|
1604 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) { |
|
1603 | + if ( ! isset($where['status'])) { |
|
1604 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) { |
|
1605 | 1605 | $where['OR'] = array( |
1606 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1606 | + 'status*restrict_private' => array('!=', 'private'), |
|
1607 | 1607 | 'AND' => array( |
1608 | - 'status*inclusive' => array( '=', 'private' ), |
|
1608 | + 'status*inclusive' => array('=', 'private'), |
|
1609 | 1609 | 'EVT_wp_user' => get_current_user_id() |
1610 | 1610 | ) |
1611 | 1611 | ); |
@@ -1613,16 +1613,16 @@ discard block |
||
1613 | 1613 | } |
1614 | 1614 | } |
1615 | 1615 | |
1616 | - if ( isset( $this->_req_data['EVT_wp_user'] ) ) { |
|
1617 | - if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) { |
|
1616 | + if (isset($this->_req_data['EVT_wp_user'])) { |
|
1617 | + if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) { |
|
1618 | 1618 | $where['EVT_wp_user'] = $this->_req_data['EVT_wp_user']; |
1619 | 1619 | } |
1620 | 1620 | } |
1621 | 1621 | |
1622 | 1622 | |
1623 | 1623 | //search query handling |
1624 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1625 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1624 | + if (isset($this->_req_data['s'])) { |
|
1625 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1626 | 1626 | $where['OR'] = array( |
1627 | 1627 | 'EVT_name' => array('LIKE', $search_string), |
1628 | 1628 | 'EVT_desc' => array('LIKE', $search_string), |
@@ -1631,32 +1631,32 @@ discard block |
||
1631 | 1631 | } |
1632 | 1632 | |
1633 | 1633 | |
1634 | - $where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data ); |
|
1635 | - $query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data ); |
|
1634 | + $where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data); |
|
1635 | + $query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data); |
|
1636 | 1636 | |
1637 | 1637 | |
1638 | 1638 | //let's first check if we have special requests coming in. |
1639 | - if ( isset( $this->_req_data['active_status'] ) ) { |
|
1640 | - switch ( $this->_req_data['active_status'] ) { |
|
1639 | + if (isset($this->_req_data['active_status'])) { |
|
1640 | + switch ($this->_req_data['active_status']) { |
|
1641 | 1641 | case 'upcoming' : |
1642 | - return $EEME->get_upcoming_events( $query_params, $count ); |
|
1642 | + return $EEME->get_upcoming_events($query_params, $count); |
|
1643 | 1643 | break; |
1644 | 1644 | |
1645 | 1645 | case 'expired' : |
1646 | - return $EEME->get_expired_events( $query_params, $count ); |
|
1646 | + return $EEME->get_expired_events($query_params, $count); |
|
1647 | 1647 | break; |
1648 | 1648 | |
1649 | 1649 | case 'active' : |
1650 | - return $EEME->get_active_events( $query_params, $count ); |
|
1650 | + return $EEME->get_active_events($query_params, $count); |
|
1651 | 1651 | break; |
1652 | 1652 | |
1653 | 1653 | case 'inactive' : |
1654 | - return $EEME->get_inactive_events( $query_params, $count ); |
|
1654 | + return $EEME->get_inactive_events($query_params, $count); |
|
1655 | 1655 | break; |
1656 | 1656 | } |
1657 | 1657 | } |
1658 | 1658 | |
1659 | - $events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params ); |
|
1659 | + $events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params); |
|
1660 | 1660 | |
1661 | 1661 | return $events; |
1662 | 1662 | } |
@@ -1665,23 +1665,23 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | |
1667 | 1667 | //handling for WordPress CPT actions (trash, restore, delete) |
1668 | - public function trash_cpt_item( $post_id ) { |
|
1668 | + public function trash_cpt_item($post_id) { |
|
1669 | 1669 | $this->_req_data['EVT_ID'] = $post_id; |
1670 | - $this->_trash_or_restore_event( 'trash', FALSE ); |
|
1670 | + $this->_trash_or_restore_event('trash', FALSE); |
|
1671 | 1671 | } |
1672 | 1672 | |
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | |
1676 | - public function restore_cpt_item( $post_id ) { |
|
1676 | + public function restore_cpt_item($post_id) { |
|
1677 | 1677 | $this->_req_data['EVT_ID'] = $post_id; |
1678 | - $this->_trash_or_restore_event( 'draft', FALSE ); |
|
1678 | + $this->_trash_or_restore_event('draft', FALSE); |
|
1679 | 1679 | } |
1680 | 1680 | |
1681 | 1681 | |
1682 | - public function delete_cpt_item( $post_id ) { |
|
1682 | + public function delete_cpt_item($post_id) { |
|
1683 | 1683 | $this->_req_data['EVT_ID'] = $post_id; |
1684 | - $this->_delete_event( FALSE ); |
|
1684 | + $this->_delete_event(FALSE); |
|
1685 | 1685 | } |
1686 | 1686 | |
1687 | 1687 | |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | * @param string $event_status |
1694 | 1694 | * @return void |
1695 | 1695 | */ |
1696 | - protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) { |
|
1696 | + protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) { |
|
1697 | 1697 | //determine the event id and set to array. |
1698 | 1698 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE; |
1699 | 1699 | // loop thru events |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | // clean status |
1702 | 1702 | $event_status = sanitize_key($event_status); |
1703 | 1703 | // grab status |
1704 | - if (!empty($event_status)) { |
|
1704 | + if ( ! empty($event_status)) { |
|
1705 | 1705 | $success = $this->_change_event_status($EVT_ID, $event_status); |
1706 | 1706 | } else { |
1707 | 1707 | $success = FALSE; |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | } |
1716 | 1716 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1717 | 1717 | |
1718 | - if ( $redirect_after ) |
|
1718 | + if ($redirect_after) |
|
1719 | 1719 | $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
1720 | 1720 | } |
1721 | 1721 | |
@@ -1730,7 +1730,7 @@ discard block |
||
1730 | 1730 | // clean status |
1731 | 1731 | $event_status = sanitize_key($event_status); |
1732 | 1732 | // grab status |
1733 | - if (!empty($event_status)) { |
|
1733 | + if ( ! empty($event_status)) { |
|
1734 | 1734 | $success = TRUE; |
1735 | 1735 | //determine the event id and set to array. |
1736 | 1736 | $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array(); |
@@ -1767,13 +1767,13 @@ discard block |
||
1767 | 1767 | */ |
1768 | 1768 | private function _change_event_status($EVT_ID = FALSE, $event_status = FALSE) { |
1769 | 1769 | // grab event id |
1770 | - if (!$EVT_ID) { |
|
1770 | + if ( ! $EVT_ID) { |
|
1771 | 1771 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1772 | 1772 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1773 | 1773 | return FALSE; |
1774 | 1774 | } |
1775 | 1775 | |
1776 | - $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
1776 | + $this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
1777 | 1777 | |
1778 | 1778 | // clean status |
1779 | 1779 | $event_status = sanitize_key($event_status); |
@@ -1799,7 +1799,7 @@ discard block |
||
1799 | 1799 | $hook = FALSE; |
1800 | 1800 | } |
1801 | 1801 | //use class to change status |
1802 | - $this->_cpt_model_obj->set_status( $event_status ); |
|
1802 | + $this->_cpt_model_obj->set_status($event_status); |
|
1803 | 1803 | $success = $this->_cpt_model_obj->save(); |
1804 | 1804 | |
1805 | 1805 | if ($success === FALSE) { |
@@ -1819,15 +1819,15 @@ discard block |
||
1819 | 1819 | * @access protected |
1820 | 1820 | * @return void |
1821 | 1821 | */ |
1822 | - protected function _delete_event( $redirect_after = TRUE ) { |
|
1822 | + protected function _delete_event($redirect_after = TRUE) { |
|
1823 | 1823 | //determine the event id and set to array. |
1824 | 1824 | $EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL; |
1825 | - $EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID; |
|
1825 | + $EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID; |
|
1826 | 1826 | |
1827 | 1827 | |
1828 | 1828 | // loop thru events |
1829 | 1829 | if ($EVT_ID) { |
1830 | - $success = $this->_permanently_delete_event( $EVT_ID ); |
|
1830 | + $success = $this->_permanently_delete_event($EVT_ID); |
|
1831 | 1831 | // get list of events with no prices |
1832 | 1832 | $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array()); |
1833 | 1833 | // remove this event from the list of events with no prices |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1842 | 1842 | } |
1843 | 1843 | |
1844 | - if ( $redirect_after ) |
|
1844 | + if ($redirect_after) |
|
1845 | 1845 | $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
1846 | 1846 | } |
1847 | 1847 | |
@@ -1887,7 +1887,7 @@ discard block |
||
1887 | 1887 | */ |
1888 | 1888 | private function _permanently_delete_event($EVT_ID = FALSE) { |
1889 | 1889 | // grab event id |
1890 | - if (!$EVT_ID = absint($EVT_ID)) { |
|
1890 | + if ( ! $EVT_ID = absint($EVT_ID)) { |
|
1891 | 1891 | $msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso'); |
1892 | 1892 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1893 | 1893 | return FALSE; |
@@ -1898,10 +1898,10 @@ discard block |
||
1898 | 1898 | |
1899 | 1899 | //need to delete related tickets and prices first. |
1900 | 1900 | $datetimes = $this->_cpt_model_obj->get_many_related('Datetime'); |
1901 | - foreach ( $datetimes as $datetime ) { |
|
1901 | + foreach ($datetimes as $datetime) { |
|
1902 | 1902 | $this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime'); |
1903 | 1903 | $tickets = $datetime->get_many_related('Ticket'); |
1904 | - foreach ( $tickets as $ticket ) { |
|
1904 | + foreach ($tickets as $ticket) { |
|
1905 | 1905 | $ticket->_remove_relation_to($datetime, 'Datetime'); |
1906 | 1906 | $ticket->delete_related_permanently('Price'); |
1907 | 1907 | $ticket->delete_permanently(); |
@@ -1911,14 +1911,14 @@ discard block |
||
1911 | 1911 | |
1912 | 1912 | //what about related venues or terms? |
1913 | 1913 | $venues = $this->_cpt_model_obj->get_many_related('Venue'); |
1914 | - foreach ( $venues as $venue ) { |
|
1914 | + foreach ($venues as $venue) { |
|
1915 | 1915 | $this->_cpt_model_obj->_remove_relation_to($venue, 'Venue'); |
1916 | 1916 | } |
1917 | 1917 | |
1918 | 1918 | //any attached question groups? |
1919 | 1919 | $question_groups = $this->_cpt_model_obj->get_many_related('Question_Group'); |
1920 | - if ( !empty( $question_groups ) ) { |
|
1921 | - foreach ( $question_groups as $question_group ) { |
|
1920 | + if ( ! empty($question_groups)) { |
|
1921 | + foreach ($question_groups as $question_group) { |
|
1922 | 1922 | $this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group'); |
1923 | 1923 | } |
1924 | 1924 | } |
@@ -1927,13 +1927,13 @@ discard block |
||
1927 | 1927 | |
1928 | 1928 | |
1929 | 1929 | //Message Template Groups |
1930 | - $this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' ); |
|
1930 | + $this->_cpt_model_obj->_remove_relations('Message_Template_Group'); |
|
1931 | 1931 | |
1932 | 1932 | |
1933 | 1933 | //term taxonomies |
1934 | 1934 | $term_taxonomies = $this->_cpt_model_obj->term_taxonomies(); |
1935 | 1935 | |
1936 | - foreach ( $term_taxonomies as $term_taxonomy ) { |
|
1936 | + foreach ($term_taxonomies as $term_taxonomy) { |
|
1937 | 1937 | $this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy); |
1938 | 1938 | } |
1939 | 1939 | |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1948 | 1948 | return FALSE; |
1949 | 1949 | } |
1950 | - do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted' ); |
|
1950 | + do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted'); |
|
1951 | 1951 | return TRUE; |
1952 | 1952 | } |
1953 | 1953 | |
@@ -1964,7 +1964,7 @@ discard block |
||
1964 | 1964 | */ |
1965 | 1965 | public function total_events() { |
1966 | 1966 | |
1967 | - $count = EEM_Event::instance()->count( array(), 'EVT_ID', true ); |
|
1967 | + $count = EEM_Event::instance()->count(array(), 'EVT_ID', true); |
|
1968 | 1968 | return $count; |
1969 | 1969 | } |
1970 | 1970 | |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | */ |
1980 | 1980 | public function total_events_draft() { |
1981 | 1981 | $where = array( |
1982 | - 'status' => array( 'IN', array('draft', 'auto-draft' ) ) |
|
1982 | + 'status' => array('IN', array('draft', 'auto-draft')) |
|
1983 | 1983 | ); |
1984 | 1984 | |
1985 | - $count = EEM_Event::instance()->count( array( $where ), 'EVT_ID', true ); |
|
1985 | + $count = EEM_Event::instance()->count(array($where), 'EVT_ID', true); |
|
1986 | 1986 | return $count; |
1987 | 1987 | } |
1988 | 1988 | |
@@ -2001,7 +2001,7 @@ discard block |
||
2001 | 2001 | 'status' => 'trash' |
2002 | 2002 | ); |
2003 | 2003 | |
2004 | - $count = EEM_Event::instance()->count( array( $where ), 'EVT_ID', true ); |
|
2004 | + $count = EEM_Event::instance()->count(array($where), 'EVT_ID', true); |
|
2005 | 2005 | return $count; |
2006 | 2006 | } |
2007 | 2007 | |
@@ -2029,11 +2029,11 @@ discard block |
||
2029 | 2029 | // translated |
2030 | 2030 | TRUE |
2031 | 2031 | ); |
2032 | - $this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment; |
|
2032 | + $this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment; |
|
2033 | 2033 | |
2034 | 2034 | $this->_set_add_edit_form_tags('update_default_event_settings'); |
2035 | 2035 | $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
2036 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE); |
|
2036 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE); |
|
2037 | 2037 | $this->display_admin_page_with_sidebar(); |
2038 | 2038 | } |
2039 | 2039 | |
@@ -2059,9 +2059,9 @@ discard block |
||
2059 | 2059 | |
2060 | 2060 | protected function _template_settings() { |
2061 | 2061 | $this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso'); |
2062 | - $this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />'; |
|
2063 | - $this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>'; |
|
2064 | - $this->display_admin_caf_preview_page( 'template_settings_tab' ); |
|
2062 | + $this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />'; |
|
2063 | + $this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>'; |
|
2064 | + $this->display_admin_caf_preview_page('template_settings_tab'); |
|
2065 | 2065 | } |
2066 | 2066 | |
2067 | 2067 | |
@@ -2074,22 +2074,22 @@ discard block |
||
2074 | 2074 | * @return void |
2075 | 2075 | */ |
2076 | 2076 | private function _set_category_object() { |
2077 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2077 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
2078 | 2078 | return; //already have the category object so get out. |
2079 | 2079 | |
2080 | 2080 | //set default category object |
2081 | 2081 | $this->_set_empty_category_object(); |
2082 | 2082 | |
2083 | 2083 | //only set if we've got an id |
2084 | - if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) { |
|
2084 | + if ( ! isset($this->_req_data['EVT_CAT_ID'])) { |
|
2085 | 2085 | return; |
2086 | 2086 | } |
2087 | 2087 | |
2088 | 2088 | $category_id = absint($this->_req_data['EVT_CAT_ID']); |
2089 | 2089 | |
2090 | - $term = get_term( $category_id, 'espresso_event_categories' ); |
|
2090 | + $term = get_term($category_id, 'espresso_event_categories'); |
|
2091 | 2091 | |
2092 | - if ( !empty( $term ) ) { |
|
2092 | + if ( ! empty($term)) { |
|
2093 | 2093 | $this->_category->category_name = $term->name; |
2094 | 2094 | $this->_category->category_identifier = $term->slug; |
2095 | 2095 | $this->_category->category_desc = $term->description; |
@@ -2103,13 +2103,13 @@ discard block |
||
2103 | 2103 | |
2104 | 2104 | private function _set_empty_category_object() { |
2105 | 2105 | $this->_category = new stdClass(); |
2106 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2106 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
2107 | 2107 | $this->_category->id = $this->_category->parent = 0; |
2108 | 2108 | } |
2109 | 2109 | |
2110 | 2110 | |
2111 | 2111 | protected function _category_list_table() { |
2112 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2112 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2113 | 2113 | $this->_search_btn_label = __('Categories', 'event_espresso'); |
2114 | 2114 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
2115 | 2115 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -2119,22 +2119,22 @@ discard block |
||
2119 | 2119 | protected function _category_details($view) { |
2120 | 2120 | |
2121 | 2121 | //load formatter helper |
2122 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
2122 | + EE_Registry::instance()->load_helper('Formatter'); |
|
2123 | 2123 | //load field generator helper |
2124 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2124 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
2125 | 2125 | |
2126 | 2126 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
2127 | 2127 | $this->_set_add_edit_form_tags($route); |
2128 | 2128 | |
2129 | 2129 | $this->_set_category_object(); |
2130 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
2130 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
2131 | 2131 | |
2132 | 2132 | $delete_action = 'delete_category'; |
2133 | 2133 | |
2134 | 2134 | //custom redirect |
2135 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url ); |
|
2135 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
2136 | 2136 | |
2137 | - $this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect ); |
|
2137 | + $this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect); |
|
2138 | 2138 | |
2139 | 2139 | //take care of contents |
2140 | 2140 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -2148,25 +2148,25 @@ discard block |
||
2148 | 2148 | 'type' => 'wp_editor', |
2149 | 2149 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
2150 | 2150 | 'class' => 'my_editor_custom', |
2151 | - 'wpeditor_args' => array('media_buttons' => FALSE ) |
|
2151 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
2152 | 2152 | ); |
2153 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
2153 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
2154 | 2154 | |
2155 | - $all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
2155 | + $all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
2156 | 2156 | |
2157 | 2157 | //setup category select for term parents. |
2158 | 2158 | $category_select_values[] = array( |
2159 | 2159 | 'text' => __('No Parent', 'event_espresso'), |
2160 | 2160 | 'id' => 0 |
2161 | 2161 | ); |
2162 | - foreach ( $all_terms as $term ) { |
|
2162 | + foreach ($all_terms as $term) { |
|
2163 | 2163 | $category_select_values[] = array( |
2164 | 2164 | 'text' => $term->name, |
2165 | 2165 | 'id' => $term->term_id |
2166 | 2166 | ); |
2167 | 2167 | } |
2168 | 2168 | |
2169 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
2169 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
2170 | 2170 | |
2171 | 2171 | $template_args = array( |
2172 | 2172 | 'category' => $this->_category, |
@@ -2176,15 +2176,15 @@ discard block |
||
2176 | 2176 | 'disable' => '', |
2177 | 2177 | 'disabled_message' => FALSE |
2178 | 2178 | ); |
2179 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
2180 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
2179 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
2180 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
2181 | 2181 | } |
2182 | 2182 | |
2183 | 2183 | |
2184 | 2184 | protected function _delete_categories() { |
2185 | - $cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2185 | + $cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
2186 | 2186 | |
2187 | - foreach ( $cat_ids as $cat_id ) { |
|
2187 | + foreach ($cat_ids as $cat_id) { |
|
2188 | 2188 | $this->_delete_category($cat_id); |
2189 | 2189 | } |
2190 | 2190 | |
@@ -2192,7 +2192,7 @@ discard block |
||
2192 | 2192 | $query_args = array( |
2193 | 2193 | 'action' => 'category_list' |
2194 | 2194 | ); |
2195 | - $this->_redirect_after_action(0,'','',$query_args); |
|
2195 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
2196 | 2196 | |
2197 | 2197 | } |
2198 | 2198 | |
@@ -2202,61 +2202,61 @@ discard block |
||
2202 | 2202 | |
2203 | 2203 | protected function _delete_category($cat_id) { |
2204 | 2204 | global $wpdb; |
2205 | - $cat_id = absint( $cat_id ); |
|
2206 | - wp_delete_term( $cat_id, 'espresso_event_categories' ); |
|
2205 | + $cat_id = absint($cat_id); |
|
2206 | + wp_delete_term($cat_id, 'espresso_event_categories'); |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | 2209 | |
2210 | 2210 | |
2211 | 2211 | protected function _insert_or_update_category($new_category) { |
2212 | 2212 | |
2213 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
2213 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
2214 | 2214 | $success = 0; //we already have a success message so lets not send another. |
2215 | 2215 | |
2216 | - if ( $cat_id ) { |
|
2216 | + if ($cat_id) { |
|
2217 | 2217 | $query_args = array( |
2218 | 2218 | 'action' => 'edit_category', |
2219 | 2219 | 'EVT_CAT_ID' => $cat_id |
2220 | 2220 | ); |
2221 | 2221 | } else { |
2222 | - $query_args = array( 'action' => 'add_category' ); |
|
2222 | + $query_args = array('action' => 'add_category'); |
|
2223 | 2223 | } |
2224 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
2224 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
2225 | 2225 | |
2226 | 2226 | } |
2227 | 2227 | |
2228 | 2228 | |
2229 | 2229 | |
2230 | - private function _insert_category( $update = FALSE ) { |
|
2230 | + private function _insert_category($update = FALSE) { |
|
2231 | 2231 | $cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : ''; |
2232 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
2233 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
2234 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
2232 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
2233 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
2234 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
2235 | 2235 | |
2236 | - if ( empty( $category_name ) ) { |
|
2237 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
2238 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2236 | + if (empty($category_name)) { |
|
2237 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
2238 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2239 | 2239 | return false; |
2240 | 2240 | } |
2241 | 2241 | |
2242 | - $term_args=array( |
|
2242 | + $term_args = array( |
|
2243 | 2243 | 'name'=>$category_name, |
2244 | 2244 | 'description'=>$category_desc, |
2245 | 2245 | 'parent'=>$category_parent |
2246 | 2246 | ); |
2247 | 2247 | //was the category_identifier input disabled? |
2248 | - if(isset($this->_req_data['category_identifier'])){ |
|
2248 | + if (isset($this->_req_data['category_identifier'])) { |
|
2249 | 2249 | $term_args['slug'] = $this->_req_data['category_identifier']; |
2250 | 2250 | } |
2251 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args ); |
|
2251 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args); |
|
2252 | 2252 | |
2253 | - if ( !is_array( $insert_ids ) ) { |
|
2254 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
2255 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2253 | + if ( ! is_array($insert_ids)) { |
|
2254 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
2255 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2256 | 2256 | } else { |
2257 | 2257 | $cat_id = $insert_ids['term_id']; |
2258 | - $msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name ); |
|
2259 | - EE_Error::add_success( $msg ); |
|
2258 | + $msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name); |
|
2259 | + EE_Error::add_success($msg); |
|
2260 | 2260 | } |
2261 | 2261 | |
2262 | 2262 | return $cat_id; |
@@ -2265,32 +2265,32 @@ discard block |
||
2265 | 2265 | |
2266 | 2266 | |
2267 | 2267 | |
2268 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
2268 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
2269 | 2269 | global $wpdb; |
2270 | 2270 | |
2271 | 2271 | //testing term stuff |
2272 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2273 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
2274 | - $limit = ($current_page-1)*$per_page; |
|
2272 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
2273 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
2274 | + $limit = ($current_page - 1) * $per_page; |
|
2275 | 2275 | |
2276 | - $where = array( 'taxonomy' => 'espresso_event_categories' ); |
|
2276 | + $where = array('taxonomy' => 'espresso_event_categories'); |
|
2277 | 2277 | |
2278 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2279 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2278 | + if (isset($this->_req_data['s'])) { |
|
2279 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2280 | 2280 | $where['OR'] = array( |
2281 | - 'Term.name' => array( 'LIKE', $sstr), |
|
2282 | - 'description' => array( 'LIKE', $sstr ) |
|
2281 | + 'Term.name' => array('LIKE', $sstr), |
|
2282 | + 'description' => array('LIKE', $sstr) |
|
2283 | 2283 | ); |
2284 | 2284 | } |
2285 | 2285 | |
2286 | 2286 | $query_params = array( |
2287 | - $where , |
|
2288 | - 'order_by' => array( $orderby => $order ), |
|
2289 | - 'limit' => $limit . ',' . $per_page, |
|
2287 | + $where, |
|
2288 | + 'order_by' => array($orderby => $order), |
|
2289 | + 'limit' => $limit.','.$per_page, |
|
2290 | 2290 | 'force_join' => array('Term') |
2291 | 2291 | ); |
2292 | 2292 | |
2293 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
2293 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
2294 | 2294 | |
2295 | 2295 | return $categories; |
2296 | 2296 | } |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -871,8 +872,9 @@ discard block |
||
871 | 872 | $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
872 | 873 | |
873 | 874 | //very important. If we don't have a venue name then we'll get out because not necessary to create empty venue |
874 | - if ( empty( $data['venue_title'] ) ) |
|
875 | - return; |
|
875 | + if ( empty( $data['venue_title'] ) ) { |
|
876 | + return; |
|
877 | + } |
|
876 | 878 | |
877 | 879 | $venue_array = array( |
878 | 880 | 'VNU_wp_user' => $evtobj->get('EVT_wp_user'), |
@@ -1194,7 +1196,9 @@ discard block |
||
1194 | 1196 | |
1195 | 1197 | |
1196 | 1198 | //if no postid then get out cause we need it for stuff in here |
1197 | - if ( empty( $postid ) ) return; |
|
1199 | + if ( empty( $postid ) ) { |
|
1200 | + return; |
|
1201 | + } |
|
1198 | 1202 | |
1199 | 1203 | |
1200 | 1204 | //handle datetime saves |
@@ -1436,10 +1440,11 @@ discard block |
||
1436 | 1440 | //get the earliest datetime (if present); |
1437 | 1441 | $earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
1438 | 1442 | |
1439 | - if ( !empty( $earliest_dtt ) ) |
|
1440 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1441 | - else |
|
1442 | - $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1443 | + if ( !empty( $earliest_dtt ) ) { |
|
1444 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a'); |
|
1445 | + } else { |
|
1446 | + $template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) ); |
|
1447 | + } |
|
1443 | 1448 | } |
1444 | 1449 | |
1445 | 1450 | $template_args = array_merge( $template_args, $price_args ); |
@@ -1715,8 +1720,9 @@ discard block |
||
1715 | 1720 | } |
1716 | 1721 | $action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
1717 | 1722 | |
1718 | - if ( $redirect_after ) |
|
1719 | - $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1723 | + if ( $redirect_after ) { |
|
1724 | + $this->_redirect_after_action($success, 'Event', $action, array('action' => 'default')); |
|
1725 | + } |
|
1720 | 1726 | } |
1721 | 1727 | |
1722 | 1728 | /** |
@@ -1841,8 +1847,9 @@ discard block |
||
1841 | 1847 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1842 | 1848 | } |
1843 | 1849 | |
1844 | - if ( $redirect_after ) |
|
1845 | - $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1850 | + if ( $redirect_after ) { |
|
1851 | + $this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash')); |
|
1852 | + } |
|
1846 | 1853 | } |
1847 | 1854 | |
1848 | 1855 | /** |
@@ -2074,8 +2081,10 @@ discard block |
||
2074 | 2081 | * @return void |
2075 | 2082 | */ |
2076 | 2083 | private function _set_category_object() { |
2077 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
2078 | - return; //already have the category object so get out. |
|
2084 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
2085 | + return; |
|
2086 | + } |
|
2087 | + //already have the category object so get out. |
|
2079 | 2088 | |
2080 | 2089 | //set default category object |
2081 | 2090 | $this->_set_empty_category_object(); |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @access public |
547 | 547 | * @param string $CNT_ISO |
548 | - * @return mixed string | array |
|
548 | + * @return string|null string | array |
|
549 | 549 | */ |
550 | 550 | public function display_country_settings( $CNT_ISO = '' ) { |
551 | 551 | |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | * delete_state |
709 | 709 | * |
710 | 710 | * @access public |
711 | - * @return boolean | void |
|
711 | + * @return false|null | void |
|
712 | 712 | */ |
713 | 713 | public function delete_state() { |
714 | 714 | $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
@@ -938,10 +938,10 @@ discard block |
||
938 | 938 | /** |
939 | 939 | * generates a dropdown of all parent pages - copied from WP core |
940 | 940 | * |
941 | - * @param unknown_type $default |
|
942 | - * @param unknown_type $parent |
|
943 | - * @param unknown_type $level |
|
944 | - * @return unknown |
|
941 | + * @param integer $default |
|
942 | + * @param integer $parent |
|
943 | + * @param integer $level |
|
944 | + * @return null|false |
|
945 | 945 | */ |
946 | 946 | public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
947 | 947 | global $wpdb; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'order' => 50 |
155 | 155 | ), |
156 | 156 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
157 | - 'help_tabs' => array( |
|
157 | + 'help_tabs' => array( |
|
158 | 158 | 'general_settings_critical_pages_help_tab' => array( |
159 | 159 | 'title' => __('Critical Pages', 'event_espresso'), |
160 | 160 | 'filename' => 'general_settings_critical_pages' |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | 'label' => __('Your Organization', 'event_espresso'), |
169 | 169 | 'order' => 20 |
170 | 170 | ), |
171 | - 'help_tabs' => array( |
|
171 | + 'help_tabs' => array( |
|
172 | 172 | 'general_settings_your_organization_help_tab' => array( |
173 | 173 | 'title' => __('Your Organization', 'event_espresso'), |
174 | 174 | 'filename' => 'general_settings_your_organization' |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'order' => 60 |
185 | 185 | ), |
186 | 186 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
187 | - 'help_tabs' => array( |
|
187 | + 'help_tabs' => array( |
|
188 | 188 | 'general_settings_admin_options_help_tab' => array( |
189 | 189 | 'title' => __('Admin Options', 'event_espresso'), |
190 | 190 | 'filename' => 'general_settings_admin_options' |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'label' => __('Countries', 'event_espresso'), |
199 | 199 | 'order' => 70 |
200 | 200 | ), |
201 | - 'help_tabs' => array( |
|
201 | + 'help_tabs' => array( |
|
202 | 202 | 'general_settings_countries_help_tab' => array( |
203 | 203 | 'title' => __('Countries', 'event_espresso'), |
204 | 204 | 'filename' => 'general_settings_countries' |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -419,8 +420,9 @@ discard block |
||
419 | 420 | } |
420 | 421 | |
421 | 422 | protected function _update_your_organization_settings() { |
422 | - if ( is_main_site() ) |
|
423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
423 | + if ( is_main_site() ) { |
|
424 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
425 | + } |
|
424 | 426 | EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
425 | 427 | EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
426 | 428 | EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
@@ -950,10 +952,11 @@ discard block |
||
950 | 952 | if ( $items ) { |
951 | 953 | foreach ( $items as $item ) { |
952 | 954 | $pad = str_repeat( ' ', $level * 3 ); |
953 | - if ( $item->ID == $default) |
|
954 | - $current = ' selected="selected"'; |
|
955 | - else |
|
956 | - $current = ''; |
|
955 | + if ( $item->ID == $default) { |
|
956 | + $current = ' selected="selected"'; |
|
957 | + } else { |
|
958 | + $current = ''; |
|
959 | + } |
|
957 | 960 | |
958 | 961 | echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
959 | 962 | parent_dropdown( $default, $item->ID, $level +1 ); |
@@ -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 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - public function __construct( $routing = TRUE ) { |
|
44 | - parent::__construct( $routing ); |
|
43 | + public function __construct($routing = TRUE) { |
|
44 | + parent::__construct($routing); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | protected function _ajax_hooks() { |
60 | - add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings')); |
|
61 | - add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states')); |
|
62 | - add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 ); |
|
63 | - add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state')); |
|
60 | + add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings')); |
|
61 | + add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states')); |
|
62 | + add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3); |
|
63 | + add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | 'label' => __('Critical Pages', 'event_espresso'), |
154 | 154 | 'order' => 50 |
155 | 155 | ), |
156 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
156 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
157 | 157 | 'help_tabs' => array( |
158 | 158 | 'general_settings_critical_pages_help_tab' => array( |
159 | 159 | 'title' => __('Critical Pages', 'event_espresso'), |
160 | 160 | 'filename' => 'general_settings_critical_pages' |
161 | 161 | ) |
162 | 162 | ), |
163 | - 'help_tour' => array( 'Critical_Pages_Help_Tour' ), |
|
163 | + 'help_tour' => array('Critical_Pages_Help_Tour'), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'default' => array( |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | 'filename' => 'general_settings_your_organization' |
175 | 175 | ) |
176 | 176 | ), |
177 | - 'help_tour' => array( 'Your_Organization_Help_Tour' ), |
|
178 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
177 | + 'help_tour' => array('Your_Organization_Help_Tour'), |
|
178 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
179 | 179 | 'require_nonce' => FALSE |
180 | 180 | ), |
181 | 181 | 'admin_option_settings' => array( |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | 'label' => __('Admin Options', 'event_espresso'), |
184 | 184 | 'order' => 60 |
185 | 185 | ), |
186 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
186 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
187 | 187 | 'help_tabs' => array( |
188 | 188 | 'general_settings_admin_options_help_tab' => array( |
189 | 189 | 'title' => __('Admin Options', 'event_espresso'), |
190 | 190 | 'filename' => 'general_settings_admin_options' |
191 | 191 | ) |
192 | 192 | ), |
193 | - 'help_tour' => array( 'Admin_Options_Help_Tour' ), |
|
193 | + 'help_tour' => array('Admin_Options_Help_Tour'), |
|
194 | 194 | 'require_nonce' => FALSE |
195 | 195 | ), |
196 | 196 | 'country_settings' => array( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | 'filename' => 'general_settings_countries' |
205 | 205 | ) |
206 | 206 | ), |
207 | - 'help_tour' => array( 'Countries_Help_Tour' ), |
|
207 | + 'help_tour' => array('Countries_Help_Tour'), |
|
208 | 208 | 'require_nonce' => FALSE |
209 | 209 | ) |
210 | 210 | ); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | public function admin_init() { |
225 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
226 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
227 | - EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' ); |
|
228 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
229 | - EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol ); |
|
225 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
226 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
227 | + EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso'); |
|
228 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
229 | + EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | public function admin_notices() {} |
@@ -239,21 +239,21 @@ discard block |
||
239 | 239 | //scripts |
240 | 240 | wp_enqueue_script('media-upload'); |
241 | 241 | wp_enqueue_script('thickbox'); |
242 | - wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
243 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
244 | - wp_enqueue_script( 'organization_settings' ); |
|
245 | - wp_enqueue_style( 'organization-css' ); |
|
246 | - $confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | - wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete ); |
|
242 | + wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE); |
|
243 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
244 | + wp_enqueue_script('organization_settings'); |
|
245 | + wp_enqueue_style('organization-css'); |
|
246 | + $confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso')); |
|
247 | + wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete); |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | 251 | public function load_scripts_styles_country_settings() { |
252 | 252 | //scripts |
253 | - wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
254 | - wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION ); |
|
255 | - wp_enqueue_script( 'gen_settings_countries' ); |
|
256 | - wp_enqueue_style( 'organization-css' ); |
|
253 | + wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
254 | + wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION); |
|
255 | + wp_enqueue_script('gen_settings_countries'); |
|
256 | + wp_enqueue_style('organization-css'); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
@@ -265,37 +265,37 @@ discard block |
||
265 | 265 | |
266 | 266 | // Check to make sure all of the main pages are setup properly, |
267 | 267 | // if not create the default pages and display an admin notice |
268 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
268 | + EE_Registry::instance()->load_helper('Activation'); |
|
269 | 269 | EEH_Activation::verify_default_pages_exist(); |
270 | 270 | |
271 | 271 | $this->_transient_garbage_collection(); |
272 | 272 | $this->_template_args['values'] = $this->_yes_no_values; |
273 | 273 | |
274 | - $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
275 | - $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE; |
|
274 | + $this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL; |
|
275 | + $this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE; |
|
276 | 276 | |
277 | - $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
278 | - $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE; |
|
277 | + $this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL; |
|
278 | + $this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE; |
|
279 | 279 | |
280 | - $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
281 | - $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE; |
|
280 | + $this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL; |
|
281 | + $this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE; |
|
282 | 282 | |
283 | - $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
284 | - $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE; |
|
283 | + $this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL; |
|
284 | + $this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE; |
|
285 | 285 | |
286 | - $this->_set_add_edit_form_tags( 'update_espresso_page_settings' ); |
|
287 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
288 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE ); |
|
286 | + $this->_set_add_edit_form_tags('update_espresso_page_settings'); |
|
287 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
288 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE); |
|
289 | 289 | $this->display_admin_page_with_sidebar(); |
290 | 290 | |
291 | 291 | } |
292 | 292 | |
293 | 293 | protected function _update_espresso_page_settings() { |
294 | 294 | // capture incoming request data |
295 | - $reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
296 | - $txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
297 | - $thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
298 | - $cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
295 | + $reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id; |
|
296 | + $txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id; |
|
297 | + $thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id; |
|
298 | + $cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id; |
|
299 | 299 | // pack critical_pages into an array |
300 | 300 | $critical_pages = array( |
301 | 301 | 'reg_page_id' => $reg_page_id, |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | 'thank_you_page_id' => $thank_you_page_id, |
304 | 304 | 'cancel_page_id' => $cancel_page_id |
305 | 305 | ); |
306 | - foreach ( $critical_pages as $critical_page_name => $critical_page_id ) { |
|
306 | + foreach ($critical_pages as $critical_page_name => $critical_page_id) { |
|
307 | 307 | // has the page changed ? |
308 | - if ( EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id ) { |
|
308 | + if (EE_Registry::instance()->CFG->core->$critical_page_name != $critical_page_id) { |
|
309 | 309 | // grab post object for old page |
310 | - $post = get_post( EE_Registry::instance()->CFG->core->$critical_page_name ); |
|
310 | + $post = get_post(EE_Registry::instance()->CFG->core->$critical_page_name); |
|
311 | 311 | // update post shortcodes for old page |
312 | - EE_Admin::parse_post_content_on_save( $critical_page_id, $post ); |
|
312 | + EE_Admin::parse_post_content_on_save($critical_page_id, $post); |
|
313 | 313 | // grab post object for new page |
314 | - $post = get_post( $critical_page_id ); |
|
314 | + $post = get_post($critical_page_id); |
|
315 | 315 | // update post shortcodes for new page |
316 | - EE_Admin::parse_post_content_on_save( $critical_page_id, $post ); |
|
316 | + EE_Admin::parse_post_content_on_save($critical_page_id, $post); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | // set page IDs |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id; |
323 | 323 | EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id; |
324 | 324 | |
325 | - EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data ); |
|
325 | + EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data); |
|
326 | 326 | |
327 | 327 | $what = __('Critical Pages & Shortcodes', 'event_espresso'); |
328 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ ); |
|
328 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__); |
|
329 | 329 | $query_args = array( |
330 | 330 | 'action' => 'critical_pages' |
331 | 331 | ); |
332 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
332 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
333 | 333 | |
334 | 334 | } |
335 | 335 | |
@@ -344,35 +344,35 @@ discard block |
||
344 | 344 | |
345 | 345 | protected function _your_organization_settings() { |
346 | 346 | |
347 | - $this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : ''; |
|
348 | - $this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : ''; |
|
349 | - $this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : ''; |
|
350 | - $this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : ''; |
|
351 | - $this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : ''; |
|
352 | - $this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : ''; |
|
353 | - $this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : ''; |
|
354 | - $this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : ''; |
|
355 | - $this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : ''; |
|
356 | - $this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$'; |
|
357 | - $this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE; |
|
358 | - $this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : ''; |
|
359 | - $this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : ''; |
|
360 | - $this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : ''; |
|
361 | - $this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : ''; |
|
362 | - $this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : ''; |
|
363 | - $this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : ''; |
|
347 | + $this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : ''; |
|
348 | + $this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : ''; |
|
349 | + $this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : ''; |
|
350 | + $this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : ''; |
|
351 | + $this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : ''; |
|
352 | + $this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : ''; |
|
353 | + $this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : ''; |
|
354 | + $this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : ''; |
|
355 | + $this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : ''; |
|
356 | + $this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$'; |
|
357 | + $this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE; |
|
358 | + $this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : ''; |
|
359 | + $this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : ''; |
|
360 | + $this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : ''; |
|
361 | + $this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : ''; |
|
362 | + $this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : ''; |
|
363 | + $this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : ''; |
|
364 | 364 | //UXIP settings |
365 | - $this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE; |
|
365 | + $this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE; |
|
366 | 366 | |
367 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
368 | - $STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
367 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
368 | + $STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4; |
|
369 | 369 | $this->_template_args['states'] = new EE_Question_Form_Input( |
370 | - EE_Question::new_instance ( array( |
|
370 | + EE_Question::new_instance(array( |
|
371 | 371 | 'QST_ID'=> 0, |
372 | 372 | 'QST_display_text'=> __('State/Province', 'event_espresso'), |
373 | 373 | 'QST_system'=>'admin-state' |
374 | 374 | )), |
375 | - EE_Answer::new_instance ( array( |
|
375 | + EE_Answer::new_instance(array( |
|
376 | 376 | 'ANS_ID' => 0, |
377 | 377 | 'ANS_value' => $STA_ID |
378 | 378 | )), |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | ) |
385 | 385 | ); |
386 | 386 | |
387 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
387 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
388 | 388 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
389 | - EE_Question::new_instance ( array( |
|
389 | + EE_Question::new_instance(array( |
|
390 | 390 | 'QST_ID'=> 0, |
391 | 391 | 'QST_display_text'=> __('Country', 'event_espresso'), |
392 | 392 | 'QST_system'=>'admin-country' |
393 | 393 | )), |
394 | - EE_Answer::new_instance ( array( |
|
394 | + EE_Answer::new_instance(array( |
|
395 | 395 | 'ANS_ID' => 0, |
396 | 396 | 'ANS_value' => $CNT_ISO |
397 | 397 | )), |
@@ -403,51 +403,51 @@ discard block |
||
403 | 403 | ) |
404 | 404 | ); |
405 | 405 | |
406 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
407 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
406 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
407 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
408 | 408 | |
409 | 409 | //PUE verification stuff |
410 | - $ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME ); |
|
411 | - $verify_fail = get_option( $ver_option_key ); |
|
412 | - $this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
410 | + $ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME); |
|
411 | + $verify_fail = get_option($ver_option_key); |
|
412 | + $this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>'; |
|
413 | 413 | |
414 | - $this->_set_add_edit_form_tags( 'update_your_organization_settings' ); |
|
415 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
416 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE ); |
|
414 | + $this->_set_add_edit_form_tags('update_your_organization_settings'); |
|
415 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
416 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE); |
|
417 | 417 | |
418 | 418 | $this->display_admin_page_with_sidebar(); |
419 | 419 | } |
420 | 420 | |
421 | 421 | protected function _update_your_organization_settings() { |
422 | - if ( is_main_site() ) |
|
423 | - EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | - EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name; |
|
425 | - EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | - EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | - EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city; |
|
428 | - EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | - EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | - EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | - EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email; |
|
432 | - EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | - EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | - EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | - EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | - EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | - EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | - EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | - EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google; |
|
440 | - EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | - EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | - |
|
443 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO ); |
|
444 | - |
|
445 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG ); |
|
422 | + if (is_main_site()) |
|
423 | + EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key; |
|
424 | + EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name; |
|
425 | + EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1; |
|
426 | + EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2; |
|
427 | + EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city; |
|
428 | + EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID; |
|
429 | + EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO; |
|
430 | + EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip; |
|
431 | + EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email; |
|
432 | + EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat; |
|
433 | + EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone; |
|
434 | + EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url; |
|
435 | + EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook; |
|
436 | + EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter; |
|
437 | + EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin; |
|
438 | + EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest; |
|
439 | + EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google; |
|
440 | + EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram; |
|
441 | + EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin; |
|
442 | + |
|
443 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO); |
|
444 | + |
|
445 | + EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG); |
|
446 | 446 | |
447 | 447 | $what = 'Your Organization Settings'; |
448 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
448 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
449 | 449 | |
450 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) ); |
|
450 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'default')); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
@@ -458,36 +458,36 @@ discard block |
||
458 | 458 | protected function _admin_option_settings() { |
459 | 459 | |
460 | 460 | $this->_template_args['values'] = $this->_yes_no_values; |
461 | - $this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE; |
|
462 | - $this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE; |
|
463 | - $this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30; |
|
464 | - $this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE; |
|
465 | - $this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE; |
|
466 | - $this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
467 | - $this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1; |
|
468 | - |
|
469 | - $this->_set_add_edit_form_tags( 'update_admin_option_settings' ); |
|
470 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
461 | + $this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE; |
|
462 | + $this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE; |
|
463 | + $this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30; |
|
464 | + $this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE; |
|
465 | + $this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE; |
|
466 | + $this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : ''; |
|
467 | + $this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1; |
|
468 | + |
|
469 | + $this->_set_add_edit_form_tags('update_admin_option_settings'); |
|
470 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
471 | 471 | $this->_template_args['template_args'] = $this->_template_args; |
472 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE ); |
|
472 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE); |
|
473 | 473 | $this->display_admin_page_with_sidebar(); |
474 | 474 | } |
475 | 475 | |
476 | 476 | protected function _update_admin_option_settings() { |
477 | - EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
478 | - EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
479 | - EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
480 | - EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
481 | - EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
482 | - EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
483 | - EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
477 | + EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager; |
|
478 | + EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget; |
|
479 | + EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard; |
|
480 | + EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones; |
|
481 | + EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer; |
|
482 | + EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id; |
|
483 | + EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation; |
|
484 | 484 | |
485 | - EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin ); |
|
485 | + EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin); |
|
486 | 486 | |
487 | 487 | $what = 'Admin Options'; |
488 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ ); |
|
489 | - $success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success ); |
|
490 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) ); |
|
488 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__); |
|
489 | + $success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success); |
|
490 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings')); |
|
491 | 491 | |
492 | 492 | } |
493 | 493 | |
@@ -500,21 +500,21 @@ discard block |
||
500 | 500 | |
501 | 501 | protected function _country_settings() { |
502 | 502 | |
503 | - $CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
504 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
503 | + $CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US'; |
|
504 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
505 | 505 | |
506 | 506 | //load field generator helper |
507 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
507 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
508 | 508 | |
509 | 509 | $this->_template_args['values'] = $this->_yes_no_values; |
510 | 510 | |
511 | 511 | $this->_template_args['countries'] = new EE_Question_Form_Input( |
512 | - EE_Question::new_instance ( array( |
|
512 | + EE_Question::new_instance(array( |
|
513 | 513 | 'QST_ID'=> 0, |
514 | 514 | 'QST_display_text'=> __('Select Country', 'event_espresso'), |
515 | 515 | 'QST_system'=>'admin-country' |
516 | 516 | )), |
517 | - EE_Answer::new_instance ( array( |
|
517 | + EE_Answer::new_instance(array( |
|
518 | 518 | 'ANS_ID' => 0, |
519 | 519 | 'ANS_value' => $CNT_ISO |
520 | 520 | )), |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | ); |
528 | 528 | // EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
529 | 529 | |
530 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
531 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
530 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
531 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
532 | 532 | $this->_template_args['country_details_settings'] = $this->display_country_settings(); |
533 | 533 | $this->_template_args['country_states_settings'] = $this->display_country_states(); |
534 | 534 | |
535 | - $this->_set_add_edit_form_tags( 'update_country_settings' ); |
|
536 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
537 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE ); |
|
535 | + $this->_set_add_edit_form_tags('update_country_settings'); |
|
536 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
537 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE); |
|
538 | 538 | $this->display_admin_page_with_no_sidebar(); |
539 | 539 | } |
540 | 540 | |
@@ -547,44 +547,44 @@ discard block |
||
547 | 547 | * @param string $CNT_ISO |
548 | 548 | * @return mixed string | array |
549 | 549 | */ |
550 | - public function display_country_settings( $CNT_ISO = '' ) { |
|
550 | + public function display_country_settings($CNT_ISO = '') { |
|
551 | 551 | |
552 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO; |
|
553 | - if ( ! $CNT_ISO ) { |
|
552 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO; |
|
553 | + if ( ! $CNT_ISO) { |
|
554 | 554 | return ''; |
555 | 555 | } |
556 | 556 | |
557 | 557 | // for ajax |
558 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
559 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
560 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
561 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 ); |
|
562 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 ); |
|
563 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
558 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
559 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
560 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
561 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2); |
|
562 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2); |
|
563 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
564 | 564 | //EEH_Debug_Tools::printr( $country, '$country <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
565 | 565 | $country_input_types = array( |
566 | - 'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
567 | - 'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
568 | - 'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
569 | - 'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
570 | - 'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ), |
|
571 | - 'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
572 | - 'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
573 | - 'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ), |
|
574 | - 'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ), |
|
575 | - 'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ), |
|
576 | - 'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))), |
|
577 | - 'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
578 | - 'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ), |
|
579 | - 'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ), |
|
580 | - 'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ) |
|
566 | + 'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
567 | + 'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
568 | + 'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
569 | + 'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
570 | + 'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'), |
|
571 | + 'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
572 | + 'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
573 | + 'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'), |
|
574 | + 'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE), |
|
575 | + 'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE), |
|
576 | + 'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))), |
|
577 | + 'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
578 | + 'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE), |
|
579 | + 'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'), |
|
580 | + 'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE) |
|
581 | 581 | ); |
582 | - $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types ); |
|
583 | - $country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE ); |
|
582 | + $this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types); |
|
583 | + $country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE); |
|
584 | 584 | |
585 | - if ( defined( 'DOING_AJAX' )) { |
|
586 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
587 | - echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
585 | + if (defined('DOING_AJAX')) { |
|
586 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
587 | + echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
588 | 588 | die(); |
589 | 589 | } else { |
590 | 590 | return $country_details_settings; |
@@ -602,50 +602,50 @@ discard block |
||
602 | 602 | * @param string $CNT_ISO |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - public function display_country_states( $CNT_ISO = '' ) { |
|
605 | + public function display_country_states($CNT_ISO = '') { |
|
606 | 606 | |
607 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO; |
|
607 | + $CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO; |
|
608 | 608 | |
609 | - if ( ! $CNT_ISO ) { |
|
609 | + if ( ! $CNT_ISO) { |
|
610 | 610 | return ''; |
611 | 611 | } |
612 | 612 | // for ajax |
613 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
614 | - remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' ); |
|
615 | - remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' ); |
|
616 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 ); |
|
617 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 ); |
|
618 | - $states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO )); |
|
613 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
614 | + remove_all_filters('FHEE__EEH_Form_Fields__label_html'); |
|
615 | + remove_all_filters('FHEE__EEH_Form_Fields__input_html'); |
|
616 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2); |
|
617 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2); |
|
618 | + $states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO)); |
|
619 | 619 | |
620 | 620 | // echo '<h4>$CNT_ISO : ' . $CNT_ISO . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
621 | 621 | // global $wpdb; |
622 | 622 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
623 | 623 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
624 | - if ( $states ) { |
|
625 | - foreach ( $states as $STA_ID => $state ) { |
|
626 | - if ( $state instanceof EE_State ) { |
|
624 | + if ($states) { |
|
625 | + foreach ($states as $STA_ID => $state) { |
|
626 | + if ($state instanceof EE_State) { |
|
627 | 627 | //STA_abbrev STA_name STA_active |
628 | 628 | $state_input_types = array( |
629 | - 'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ), |
|
630 | - 'STA_name' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ), |
|
631 | - 'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true ) |
|
629 | + 'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'), |
|
630 | + 'STA_name' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'), |
|
631 | + 'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true) |
|
632 | 632 | ); |
633 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types ); |
|
634 | - $query_args = array( 'action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() ); |
|
635 | - $this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL ); |
|
633 | + $this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types); |
|
634 | + $query_args = array('action' => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev()); |
|
635 | + $this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | } else { |
639 | 639 | $this->_template_args['states'] = FALSE; |
640 | 640 | } |
641 | 641 | // EEH_Debug_Tools::printr( $this->_template_args['states'], 'states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
642 | - $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ), GEN_SET_ADMIN_URL ); |
|
642 | + $this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL); |
|
643 | 643 | |
644 | - $state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE ); |
|
644 | + $state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE); |
|
645 | 645 | |
646 | - if ( defined( 'DOING_AJAX' )) { |
|
647 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
648 | - echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] )); |
|
646 | + if (defined('DOING_AJAX')) { |
|
647 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
648 | + echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'])); |
|
649 | 649 | die(); |
650 | 650 | } else { |
651 | 651 | return $state_details_settings; |
@@ -666,40 +666,39 @@ discard block |
||
666 | 666 | |
667 | 667 | $success = TRUE; |
668 | 668 | |
669 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
670 | - if ( ! $CNT_ISO ) { |
|
671 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
669 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
670 | + if ( ! $CNT_ISO) { |
|
671 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
672 | 672 | $success = FALSE; |
673 | 673 | } |
674 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
675 | - if ( ! $STA_abbrev ) { |
|
676 | - EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
674 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
675 | + if ( ! $STA_abbrev) { |
|
676 | + EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
677 | 677 | $success = FALSE; |
678 | 678 | } |
679 | - $STA_name = isset( $this->_req_data['STA_name'] ) ? sanitize_text_field( $this->_req_data['STA_name'] ) : |
|
680 | - FALSE; |
|
681 | - if ( ! $STA_name ) { |
|
682 | - EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
679 | + $STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE; |
|
680 | + if ( ! $STA_name) { |
|
681 | + EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
683 | 682 | $success = FALSE; |
684 | 683 | } |
685 | 684 | |
686 | - if ( $success ) { |
|
685 | + if ($success) { |
|
687 | 686 | $cols_n_values = array( |
688 | 687 | 'CNT_ISO' => $CNT_ISO, |
689 | 688 | 'STA_abbrev' => $STA_abbrev, |
690 | 689 | 'STA_name' => $STA_name, |
691 | 690 | 'STA_active' => TRUE |
692 | 691 | ); |
693 | - $success = EEM_State::instance()->insert ( $cols_n_values ); |
|
694 | - EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) ); |
|
692 | + $success = EEM_State::instance()->insert($cols_n_values); |
|
693 | + EE_Error::add_success(__('The State was added successfully.', 'event_espresso')); |
|
695 | 694 | } |
696 | 695 | |
697 | - if ( defined( 'DOING_AJAX' )) { |
|
698 | - $notices = EE_Error::get_notices( FALSE, FALSE, FALSE ); |
|
699 | - echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) ); |
|
696 | + if (defined('DOING_AJAX')) { |
|
697 | + $notices = EE_Error::get_notices(FALSE, FALSE, FALSE); |
|
698 | + echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO))); |
|
700 | 699 | die(); |
701 | 700 | } else { |
702 | - $this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) ); |
|
701 | + $this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings')); |
|
703 | 702 | } |
704 | 703 | } |
705 | 704 | |
@@ -712,25 +711,25 @@ discard block |
||
712 | 711 | * @return boolean | void |
713 | 712 | */ |
714 | 713 | public function delete_state() { |
715 | - $CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE; |
|
716 | - $STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE; |
|
717 | - $STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE; |
|
718 | - if ( ! $STA_ID ) { |
|
719 | - EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
714 | + $CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE; |
|
715 | + $STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE; |
|
716 | + $STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE; |
|
717 | + if ( ! $STA_ID) { |
|
718 | + EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
720 | 719 | return FALSE; |
721 | 720 | } |
722 | - $success = EEM_State::instance()->delete_by_ID( $STA_ID ); |
|
723 | - if ( $success !== FALSE ) { |
|
724 | - do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev )); |
|
725 | - EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' )); |
|
721 | + $success = EEM_State::instance()->delete_by_ID($STA_ID); |
|
722 | + if ($success !== FALSE) { |
|
723 | + do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev)); |
|
724 | + EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso')); |
|
726 | 725 | } |
727 | - if ( defined( 'DOING_AJAX' )) { |
|
728 | - $notices = EE_Error::get_notices( FALSE, FALSE ); |
|
726 | + if (defined('DOING_AJAX')) { |
|
727 | + $notices = EE_Error::get_notices(FALSE, FALSE); |
|
729 | 728 | $notices['return_data'] = TRUE; |
730 | - echo json_encode( $notices ); |
|
729 | + echo json_encode($notices); |
|
731 | 730 | die(); |
732 | 731 | } else { |
733 | - $this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) ); |
|
732 | + $this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings')); |
|
734 | 733 | } |
735 | 734 | } |
736 | 735 | |
@@ -746,63 +745,63 @@ discard block |
||
746 | 745 | protected function _update_country_settings() { |
747 | 746 | // EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
748 | 747 | // grab the country ISO code |
749 | - $CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE; |
|
750 | - if ( ! $CNT_ISO ) { |
|
751 | - EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
748 | + $CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE; |
|
749 | + if ( ! $CNT_ISO) { |
|
750 | + EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
752 | 751 | return; |
753 | 752 | } |
754 | 753 | $cols_n_values = array(); |
755 | - $cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE; |
|
756 | - $cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL; |
|
757 | - $cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL; |
|
758 | - $cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD'; |
|
759 | - $cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar'; |
|
760 | - $cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars'; |
|
761 | - $cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$'; |
|
762 | - $cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE; |
|
763 | - $cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2; |
|
764 | - $cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.'; |
|
765 | - $cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ','; |
|
766 | - $cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL; |
|
767 | - $cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE; |
|
768 | - $cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE; |
|
754 | + $cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE; |
|
755 | + $cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL; |
|
756 | + $cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL; |
|
757 | + $cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD'; |
|
758 | + $cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar'; |
|
759 | + $cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars'; |
|
760 | + $cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$'; |
|
761 | + $cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE; |
|
762 | + $cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2; |
|
763 | + $cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.'; |
|
764 | + $cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ','; |
|
765 | + $cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL; |
|
766 | + $cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE; |
|
767 | + $cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE; |
|
769 | 768 | // allow filtering of country data |
770 | - $cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values ); |
|
769 | + $cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values); |
|
771 | 770 | //EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
772 | 771 | // where values |
773 | - $where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO )); |
|
772 | + $where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO)); |
|
774 | 773 | // run the update |
775 | - $success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
774 | + $success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values); |
|
776 | 775 | // global $wpdb; |
777 | 776 | // echo '<h4>' . $wpdb->last_query . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
778 | 777 | // echo '<h4>$success : ' . $success . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
779 | - if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) { |
|
778 | + if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) { |
|
780 | 779 | // allow filtering of states data |
781 | - $states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] ); |
|
780 | + $states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']); |
|
782 | 781 | // EEH_Debug_Tools::printr( $states, '$states <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
783 | 782 | // loop thru state data ( looks like : states[75][STA_name] ) |
784 | - foreach( $states as $STA_ID => $state ) { |
|
783 | + foreach ($states as $STA_ID => $state) { |
|
785 | 784 | $cols_n_values = array( |
786 | 785 | 'CNT_ISO' => $CNT_ISO, |
787 | - 'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ), |
|
788 | - 'STA_name' => sanitize_text_field( $state['STA_name'] ), |
|
789 | - 'STA_active' => (bool)absint( $state['STA_active'] ) |
|
786 | + 'STA_abbrev' => sanitize_text_field($state['STA_abbrev']), |
|
787 | + 'STA_name' => sanitize_text_field($state['STA_name']), |
|
788 | + 'STA_active' => (bool) absint($state['STA_active']) |
|
790 | 789 | ); |
791 | 790 | // where values |
792 | - $where_cols_n_values = array( array( 'STA_ID' => $STA_ID )); |
|
791 | + $where_cols_n_values = array(array('STA_ID' => $STA_ID)); |
|
793 | 792 | // run the update |
794 | - $success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values ); |
|
795 | - if ( $success !== FALSE ) { |
|
796 | - do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values ); |
|
793 | + $success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values); |
|
794 | + if ($success !== FALSE) { |
|
795 | + do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values); |
|
797 | 796 | } |
798 | 797 | } |
799 | 798 | } |
800 | 799 | // check if country being edited matches org option country, and if so, then update EE_Config with new settings |
801 | - if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) { |
|
802 | - EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO ); |
|
800 | + if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) { |
|
801 | + EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO); |
|
803 | 802 | EE_Registry::instance()->CFG->update_espresso_config(); |
804 | 803 | } |
805 | - $this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO )); |
|
804 | + $this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO)); |
|
806 | 805 | } |
807 | 806 | |
808 | 807 | |
@@ -816,11 +815,11 @@ discard block |
||
816 | 815 | * @param string $label |
817 | 816 | * @return string |
818 | 817 | */ |
819 | - public function country_form_field_label_wrap( $label, $required_text ) { |
|
818 | + public function country_form_field_label_wrap($label, $required_text) { |
|
820 | 819 | return ' |
821 | 820 | <tr> |
822 | 821 | <th> |
823 | - ' . $label . ' |
|
822 | + ' . $label.' |
|
824 | 823 | </th>'; |
825 | 824 | } |
826 | 825 | |
@@ -834,10 +833,10 @@ discard block |
||
834 | 833 | * @param string $label |
835 | 834 | * @return string |
836 | 835 | */ |
837 | - public function country_form_field_input__wrap( $input, $label ) { |
|
836 | + public function country_form_field_input__wrap($input, $label) { |
|
838 | 837 | return ' |
839 | 838 | <td class="general-settings-country-input-td"> |
840 | - ' . $input . ' |
|
839 | + ' . $input.' |
|
841 | 840 | </td> |
842 | 841 | </tr>'; |
843 | 842 | } |
@@ -853,7 +852,7 @@ discard block |
||
853 | 852 | * @param string $required_text |
854 | 853 | * @return string |
855 | 854 | */ |
856 | - public function state_form_field_label_wrap( $label, $required_text ) { |
|
855 | + public function state_form_field_label_wrap($label, $required_text) { |
|
857 | 856 | return $required_text; |
858 | 857 | } |
859 | 858 | |
@@ -867,10 +866,10 @@ discard block |
||
867 | 866 | * @param string $label |
868 | 867 | * @return string |
869 | 868 | */ |
870 | - public function state_form_field_input__wrap( $input, $label ) { |
|
869 | + public function state_form_field_input__wrap($input, $label) { |
|
871 | 870 | return ' |
872 | 871 | <td class="general-settings-country-state-input-td"> |
873 | - ' . $input . ' |
|
872 | + ' . $input.' |
|
874 | 873 | </td>'; |
875 | 874 | |
876 | 875 | } |
@@ -893,10 +892,10 @@ discard block |
||
893 | 892 | * @param int $ee_page_id |
894 | 893 | * @return string |
895 | 894 | */ |
896 | - public static function edit_view_links( $ee_page_id ) { |
|
897 | - $links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ), admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>'; |
|
895 | + public static function edit_view_links($ee_page_id) { |
|
896 | + $links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>'; |
|
898 | 897 | $links .= ' | '; |
899 | - $links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>'; |
|
898 | + $links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>'; |
|
900 | 899 | return $links; |
901 | 900 | } |
902 | 901 | |
@@ -909,27 +908,27 @@ discard block |
||
909 | 908 | * @param WP page object $ee_page |
910 | 909 | * @return string |
911 | 910 | */ |
912 | - public static function page_and_shortcode_status( $ee_page, $shortcode ) { |
|
911 | + public static function page_and_shortcode_status($ee_page, $shortcode) { |
|
913 | 912 | |
914 | 913 | // page status |
915 | - if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') { |
|
914 | + if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') { |
|
916 | 915 | $pg_colour = 'green'; |
917 | - $pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), ' ' , ' ' ); |
|
916 | + $pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), ' ', ' '); |
|
918 | 917 | } else { |
919 | 918 | $pg_colour = 'red'; |
920 | - $pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' ' ); |
|
919 | + $pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), ' ', ' '); |
|
921 | 920 | } |
922 | 921 | |
923 | 922 | // shortcode status |
924 | - if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) { |
|
923 | + if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) { |
|
925 | 924 | $sc_colour = 'green'; |
926 | - $sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), ' ' ); |
|
925 | + $sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), ' '); |
|
927 | 926 | } else { |
928 | 927 | $sc_colour = 'red'; |
929 | - $sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), ' ' ); |
|
928 | + $sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), ' '); |
|
930 | 929 | } |
931 | 930 | |
932 | - return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>'; |
|
931 | + return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>'; |
|
933 | 932 | |
934 | 933 | } |
935 | 934 | |
@@ -944,20 +943,20 @@ discard block |
||
944 | 943 | * @param unknown_type $level |
945 | 944 | * @return unknown |
946 | 945 | */ |
947 | - public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) { |
|
946 | + public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) { |
|
948 | 947 | global $wpdb; |
949 | - $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) ); |
|
948 | + $items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent)); |
|
950 | 949 | |
951 | - if ( $items ) { |
|
952 | - foreach ( $items as $item ) { |
|
953 | - $pad = str_repeat( ' ', $level * 3 ); |
|
954 | - if ( $item->ID == $default) |
|
950 | + if ($items) { |
|
951 | + foreach ($items as $item) { |
|
952 | + $pad = str_repeat(' ', $level * 3); |
|
953 | + if ($item->ID == $default) |
|
955 | 954 | $current = ' selected="selected"'; |
956 | 955 | else |
957 | 956 | $current = ''; |
958 | 957 | |
959 | - echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>"; |
|
960 | - parent_dropdown( $default, $item->ID, $level +1 ); |
|
958 | + echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>"; |
|
959 | + parent_dropdown($default, $item->ID, $level + 1); |
|
961 | 960 | } |
962 | 961 | } else { |
963 | 962 | return false; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @access protected |
423 | 423 | * @param \EE_Payment_Method $payment_method |
424 | - * @return \EE_Form_Section_Proper |
|
424 | + * @return EE_Form_Section_HTML |
|
425 | 425 | */ |
426 | 426 | protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
427 | 427 | if ( $payment_method->type_obj()->requires_https() ) { |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | * |
452 | 452 | * @access protected |
453 | 453 | * @param \EE_Payment_Method $payment_method |
454 | - * @return \EE_Form_Section_Proper |
|
454 | + * @return EE_Form_Section_HTML |
|
455 | 455 | */ |
456 | 456 | protected function _currency_support( EE_Payment_Method $payment_method ) { |
457 | 457 | if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @access protected |
485 | 485 | * @param \EE_Payment_Method $payment_method |
486 | - * @return \EE_Form_Section_HTML |
|
486 | + * @return EE_Payment_Method_Form |
|
487 | 487 | */ |
488 | 488 | protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
489 | 489 | //modify the form so we only have/show fields that will be implemented for this version |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | * |
552 | 552 | * @access protected |
553 | 553 | * @param \EE_Payment_Method $payment_method |
554 | - * @return \EE_Form_Section_Proper |
|
554 | + * @return EE_Form_Section_HTML |
|
555 | 555 | */ |
556 | 556 | protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
557 | 557 | $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * When cap mapping is implemented, some routes will need to use the singular form of |
85 | 85 | * capability method and also include the $id of the payment method for the route. |
86 | - **/ |
|
86 | + **/ |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func'=>'_payment_methods_list', |
@@ -747,9 +747,9 @@ discard block |
||
747 | 747 | |
748 | 748 | /** |
749 | 749 | * _update_payment_settings |
750 | - * @access protected |
|
751 | - * @return array |
|
752 | - */ |
|
750 | + * @access protected |
|
751 | + * @return array |
|
752 | + */ |
|
753 | 753 | protected function _update_payment_settings() { |
754 | 754 | EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
755 | 755 | EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -655,7 +656,7 @@ discard block |
||
655 | 656 | $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
656 | 657 | |
657 | 658 | $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
658 | - }else{ |
|
659 | + } else{ |
|
659 | 660 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
660 | 661 | } |
661 | 662 | } |
@@ -670,7 +671,7 @@ discard block |
||
670 | 671 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
671 | 672 | $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
672 | 673 | $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
673 | - }else{ |
|
674 | + } else{ |
|
674 | 675 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
675 | 676 | } |
676 | 677 | } |
@@ -712,7 +713,7 @@ discard block |
||
712 | 713 | $pm = $correct_pmt_form_to_use->get_model_object(); |
713 | 714 | /** @var $pm EE_Payment_Method */ |
714 | 715 | $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
715 | - }else{ |
|
716 | + } else{ |
|
716 | 717 | EE_Error::add_error( |
717 | 718 | sprintf( |
718 | 719 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
@@ -838,7 +839,7 @@ discard block |
||
838 | 839 | if(isset($this->_req_data['order'])){ |
839 | 840 | $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
840 | 841 | $query_params['order_by'] = array('LOG_time' => $sort); |
841 | - }else{ |
|
842 | + } else{ |
|
842 | 843 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
843 | 844 | } |
844 | 845 | $offset = ($current_page-1)*$per_page; |
@@ -881,7 +882,7 @@ discard block |
||
881 | 882 | $comparison = $timeA < $timeB ? -1 : 1; |
882 | 883 | if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
883 | 884 | return $comparison * -1; |
884 | - }else{ |
|
885 | + } else{ |
|
885 | 886 | return $comparison; |
886 | 887 | } |
887 | 888 | } |
@@ -896,7 +897,7 @@ discard block |
||
896 | 897 | if( $payment_log->object() instanceof EE_Payment ){ |
897 | 898 | $payment_method = $payment_log->object()->payment_method(); |
898 | 899 | $transaction = $payment_log->object()->transaction(); |
899 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
900 | + } elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
900 | 901 | $payment_method = $payment_log->object(); |
901 | 902 | } |
902 | 903 | } |
@@ -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 | /** |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
45 | 45 | * @return \Payments_Admin_Page |
46 | 46 | */ |
47 | - public function __construct( $routing = TRUE ) { |
|
48 | - parent::__construct( $routing ); |
|
47 | + public function __construct($routing = TRUE) { |
|
48 | + parent::__construct($routing); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | protected function _set_page_config() { |
131 | 131 | $payment_method_list_config = array( |
132 | 132 | 'nav' => array( |
133 | - 'label' => __( 'Payment Methods', 'event_espresso' ), |
|
133 | + 'label' => __('Payment Methods', 'event_espresso'), |
|
134 | 134 | 'order' => 10 |
135 | 135 | ), |
136 | 136 | 'metaboxes' => $this->_default_espresso_metaboxes, |
137 | 137 | 'help_tabs' => array_merge( |
138 | 138 | array( |
139 | 139 | 'payment_methods_overview_help_tab' => array( |
140 | - 'title' => __( 'Payment Methods Overview', 'event_espresso' ), |
|
140 | + 'title' => __('Payment Methods Overview', 'event_espresso'), |
|
141 | 141 | 'filename' => 'payment_methods_overview' |
142 | 142 | ) |
143 | 143 | ), |
144 | 144 | $this->_add_payment_method_help_tabs() ), |
145 | - 'help_tour' => array( 'Payment_Methods_Selection_Help_Tour' ), |
|
145 | + 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
146 | 146 | 'require_nonce' => false |
147 | 147 | ); |
148 | 148 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | ) |
161 | 161 | ), |
162 | 162 | //'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
163 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
163 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
164 | 164 | 'require_nonce' => FALSE |
165 | 165 | ), |
166 | 166 | 'payment_log'=>array( |
@@ -179,18 +179,18 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * @return array |
181 | 181 | */ |
182 | - protected function _add_payment_method_help_tabs(){ |
|
182 | + protected function _add_payment_method_help_tabs() { |
|
183 | 183 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
184 | 184 | $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
185 | 185 | $all_pmt_help_tabs_config = array(); |
186 | - foreach( $payment_method_types as $payment_method_type ){ |
|
187 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
186 | + foreach ($payment_method_types as $payment_method_type) { |
|
187 | + if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) { |
|
188 | 188 | continue; |
189 | 189 | } |
190 | - foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){ |
|
190 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
191 | 191 | $all_pmt_help_tabs_config[$help_tab_name] = array( |
192 | 192 | 'title'=>$config['title'], |
193 | - 'content'=>EEH_Template::display_template( $payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true) |
|
193 | + 'content'=>EEH_Template::display_template($payment_method_type->file_folder().'help_tabs'.DS.$config['filename'].'.help_tab.php', array('admin_page_obj'=>$this), true) |
|
194 | 194 | ); |
195 | 195 | } |
196 | 196 | } |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | |
212 | 212 | |
213 | 213 | public function load_scripts_styles() { |
214 | - wp_enqueue_script( 'ee_admin_js' ); |
|
215 | - wp_enqueue_script( 'ee-text-links' ); |
|
216 | - wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
214 | + wp_enqueue_script('ee_admin_js'); |
|
215 | + wp_enqueue_script('ee-text-links'); |
|
216 | + wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | |
223 | 223 | public function load_scripts_styles_default() { |
224 | 224 | //styles |
225 | - wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION ); |
|
226 | - wp_enqueue_style( 'espresso_payments' ); |
|
227 | - wp_enqueue_style( 'ee-text-links' ); |
|
225 | + wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION); |
|
226 | + wp_enqueue_style('espresso_payments'); |
|
227 | + wp_enqueue_style('ee-text-links'); |
|
228 | 228 | //scripts |
229 | 229 | } |
230 | 230 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | * to the loading process. However, people MUST setup the details for the payment method so its safe to do a |
239 | 239 | * recheck here. |
240 | 240 | */ |
241 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
241 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
242 | 242 | EEM_Payment_Method::instance()->verify_button_urls(); |
243 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
244 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
243 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
244 | + EE_Registry::instance()->load_helper('HTML'); |
|
245 | 245 | //setup tabs, one for each payment method type |
246 | 246 | $tabs = array(); |
247 | - foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) { |
|
247 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
248 | 248 | // we don't want to show admin-only PMTs for now |
249 | - if ( $pmt_obj instanceof EE_PMT_Admin_Only ) { |
|
249 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
250 | 250 | continue; |
251 | 251 | } |
252 | 252 | //check access |
253 | - if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) { |
|
253 | + if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 | //check for any active pms of that type |
257 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() ); |
|
258 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
257 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
258 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
259 | 259 | $payment_method = EE_Payment_Method::new_instance( |
260 | 260 | array( |
261 | - 'PMD_slug' =>sanitize_key( $pmt_obj->system_name() ), |
|
261 | + 'PMD_slug' =>sanitize_key($pmt_obj->system_name()), |
|
262 | 262 | 'PMD_type' =>$pmt_obj->system_name(), |
263 | 263 | 'PMD_name' =>$pmt_obj->pretty_name(), |
264 | 264 | 'PMD_admin_name' =>$pmt_obj->pretty_name() |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | |
269 | 269 | add_meta_box( |
270 | 270 | //html id |
271 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
271 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
272 | 272 | //title |
273 | - sprintf( __('%s Settings', 'event_espresso'), $payment_method->admin_name() ), |
|
273 | + sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
274 | 274 | //callback |
275 | - array( $this, 'payment_method_settings_meta_box' ), |
|
275 | + array($this, 'payment_method_settings_meta_box'), |
|
276 | 276 | //post type |
277 | 277 | NULL, |
278 | 278 | //context |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | //priority |
281 | 281 | 'default', |
282 | 282 | //callback args |
283 | - array( 'payment_method' => $payment_method ) |
|
283 | + array('payment_method' => $payment_method) |
|
284 | 284 | ); |
285 | 285 | |
286 | 286 | //setup for tabbed content |
287 | 287 | $tabs[$payment_method->slug()] = array( |
288 | 288 | 'label' => $payment_method->admin_name(), |
289 | 289 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
290 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
290 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
291 | 291 | 'title' => __('Modify this Payment Method', 'event_espresso'), |
292 | 292 | 'slug' => $payment_method->slug() |
293 | 293 | ); |
294 | 294 | } |
295 | 295 | |
296 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() ); |
|
296 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug()); |
|
297 | 297 | $this->display_admin_page_with_sidebar(); |
298 | 298 | |
299 | 299 | } |
@@ -304,20 +304,20 @@ discard block |
||
304 | 304 | * _get_active_payment_method_slug |
305 | 305 | * @return string |
306 | 306 | */ |
307 | - protected function _get_active_payment_method_slug(){ |
|
307 | + protected function _get_active_payment_method_slug() { |
|
308 | 308 | $payment_method_slug = FALSE; |
309 | 309 | //decide which payment method tab to open first, as dictated by the request's 'payment_method' |
310 | - if ( isset( $this->_req_data['payment_method'] )) { |
|
310 | + if (isset($this->_req_data['payment_method'])) { |
|
311 | 311 | // if they provided the current payment method, use it |
312 | - $payment_method_slug = sanitize_key( $this->_req_data['payment_method'] ); |
|
312 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
313 | 313 | } |
314 | - $payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug ))); |
|
314 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
315 | 315 | // if that didn't work or wasn't provided, find another way to select the current pm |
316 | - if ( ! $this->_verify_payment_method( $payment_method )) { |
|
316 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
317 | 317 | // like, looking for an active one |
318 | - $payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' ); |
|
318 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
319 | 319 | // test that one as well |
320 | - if ( $this->_verify_payment_method( $payment_method )) { |
|
320 | + if ($this->_verify_payment_method($payment_method)) { |
|
321 | 321 | $payment_method_slug = $payment_method->slug(); |
322 | 322 | } else { |
323 | 323 | $payment_method_slug = 'paypal_standard'; |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | * @param \EE_Payment_Method $payment_method |
336 | 336 | * @return boolean |
337 | 337 | */ |
338 | - protected function _verify_payment_method( $payment_method ){ |
|
338 | + protected function _verify_payment_method($payment_method) { |
|
339 | 339 | if ( |
340 | 340 | $payment_method instanceof EE_Payment_Method && |
341 | 341 | $payment_method->type_obj() instanceof EE_PMT_Base && |
342 | - EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' ) |
|
342 | + EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access') |
|
343 | 343 | ) { |
344 | 344 | return TRUE; |
345 | 345 | } |
@@ -356,21 +356,21 @@ discard block |
||
356 | 356 | * @return string |
357 | 357 | * @throws EE_Error |
358 | 358 | */ |
359 | - public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){ |
|
360 | - $payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL; |
|
361 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
362 | - throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' ))); |
|
359 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) { |
|
360 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL; |
|
361 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
362 | + throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso'))); |
|
363 | 363 | } |
364 | 364 | $payment_method_scopes = $payment_method->active(); |
365 | 365 | // if the payment method really exists show its form, otherwise the activation template |
366 | - if ( $payment_method->ID() && ! empty( $payment_method_scopes )) { |
|
367 | - $form = $this->_generate_payment_method_settings_form( $payment_method ); |
|
368 | - if ( $form->form_data_present_in( $this->_req_data )) { |
|
369 | - $form->receive_form_submission( $this->_req_data ); |
|
366 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
367 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
368 | + if ($form->form_data_present_in($this->_req_data)) { |
|
369 | + $form->receive_form_submission($this->_req_data); |
|
370 | 370 | } |
371 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); |
|
371 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); |
|
372 | 372 | } else { |
373 | - echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js(); |
|
373 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | * @param \EE_Payment_Method $payment_method |
384 | 384 | * @return \EE_Form_Section_Proper |
385 | 385 | */ |
386 | - protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) { |
|
387 | - if ( ! $payment_method instanceof EE_Payment_Method ){ |
|
386 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) { |
|
387 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
388 | 388 | return new EE_Form_Section_Proper(); |
389 | 389 | } |
390 | 390 | return new EE_Form_Section_Proper( |
391 | 391 | array( |
392 | - 'name' => $payment_method->slug() . '_settings_form', |
|
393 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
392 | + 'name' => $payment_method->slug().'_settings_form', |
|
393 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
394 | 394 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
395 | 395 | array( |
396 | 396 | 'action' => 'update_payment_method', |
@@ -402,12 +402,12 @@ discard block |
||
402 | 402 | 'subsections' => apply_filters( |
403 | 403 | 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
404 | 404 | array( |
405 | - 'pci_dss_compliance_' . $payment_method->slug() => $this->_pci_dss_compliance( $payment_method ), |
|
406 | - 'currency_support_' . $payment_method->slug() => $this->_currency_support( $payment_method ), |
|
407 | - 'payment_method_settings_' . $payment_method->slug() => $this->_payment_method_settings( $payment_method ), |
|
408 | - 'update_' . $payment_method->slug() => $this->_update_payment_method_button( $payment_method ), |
|
409 | - 'deactivate_' . $payment_method->slug() => $this->_deactivate_payment_method_button( $payment_method ), |
|
410 | - 'fine_print_' . $payment_method->slug() => $this->_fine_print() |
|
405 | + 'pci_dss_compliance_'.$payment_method->slug() => $this->_pci_dss_compliance($payment_method), |
|
406 | + 'currency_support_'.$payment_method->slug() => $this->_currency_support($payment_method), |
|
407 | + 'payment_method_settings_'.$payment_method->slug() => $this->_payment_method_settings($payment_method), |
|
408 | + 'update_'.$payment_method->slug() => $this->_update_payment_method_button($payment_method), |
|
409 | + 'deactivate_'.$payment_method->slug() => $this->_deactivate_payment_method_button($payment_method), |
|
410 | + 'fine_print_'.$payment_method->slug() => $this->_fine_print() |
|
411 | 411 | ) |
412 | 412 | ) |
413 | 413 | ) |
@@ -423,19 +423,19 @@ discard block |
||
423 | 423 | * @param \EE_Payment_Method $payment_method |
424 | 424 | * @return \EE_Form_Section_Proper |
425 | 425 | */ |
426 | - protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) { |
|
427 | - if ( $payment_method->type_obj()->requires_https() ) { |
|
426 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) { |
|
427 | + if ($payment_method->type_obj()->requires_https()) { |
|
428 | 428 | return new EE_Form_Section_HTML( |
429 | 429 | EEH_HTML::tr( |
430 | 430 | EEH_HTML::th( |
431 | 431 | EEH_HTML::label( |
432 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
432 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
433 | 433 | ) |
434 | - ) . |
|
434 | + ). |
|
435 | 435 | EEH_HTML::td( |
436 | - EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) . |
|
437 | - EEH_HTML::br() . |
|
438 | - __( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' )) |
|
436 | + EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')). |
|
437 | + EEH_HTML::br(). |
|
438 | + __('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso')) |
|
439 | 439 | ) |
440 | 440 | ) |
441 | 441 | ); |
@@ -453,19 +453,19 @@ discard block |
||
453 | 453 | * @param \EE_Payment_Method $payment_method |
454 | 454 | * @return \EE_Form_Section_Proper |
455 | 455 | */ |
456 | - protected function _currency_support( EE_Payment_Method $payment_method ) { |
|
457 | - if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) { |
|
456 | + protected function _currency_support(EE_Payment_Method $payment_method) { |
|
457 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
458 | 458 | return new EE_Form_Section_HTML( |
459 | 459 | EEH_HTML::tr( |
460 | 460 | EEH_HTML::th( |
461 | 461 | EEH_HTML::label( |
462 | - EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' ) |
|
462 | + EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice') |
|
463 | 463 | ) |
464 | - ) . |
|
464 | + ). |
|
465 | 465 | EEH_HTML::td( |
466 | 466 | EEH_HTML::strong( |
467 | 467 | sprintf( |
468 | - __( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
468 | + __('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'), |
|
469 | 469 | EE_Config::instance()->currency->code |
470 | 470 | ) |
471 | 471 | ) |
@@ -485,9 +485,9 @@ discard block |
||
485 | 485 | * @param \EE_Payment_Method $payment_method |
486 | 486 | * @return \EE_Form_Section_HTML |
487 | 487 | */ |
488 | - protected function _payment_method_settings( EE_Payment_Method $payment_method ) { |
|
488 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) { |
|
489 | 489 | //modify the form so we only have/show fields that will be implemented for this version |
490 | - return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() ); |
|
490 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | * @return \EE_Payment_Method_Form |
501 | 501 | * @throws \EE_Error |
502 | 502 | */ |
503 | - protected function _simplify_form( $form_section, $payment_method_name = '' ){ |
|
504 | - if ( $form_section instanceof EE_Payment_Method_Form ) { |
|
503 | + protected function _simplify_form($form_section, $payment_method_name = '') { |
|
504 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
505 | 505 | $form_section->exclude( |
506 | 506 | array( |
507 | 507 | 'PMD_type', //dont want them changing the type |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | ); |
513 | 513 | return $form_section; |
514 | 514 | } else { |
515 | - throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name )); |
|
515 | + throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name)); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | |
@@ -525,18 +525,18 @@ discard block |
||
525 | 525 | * @param \EE_Payment_Method $payment_method |
526 | 526 | * @return \EE_Form_Section_HTML |
527 | 527 | */ |
528 | - protected function _update_payment_method_button( EE_Payment_Method $payment_method ) { |
|
528 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) { |
|
529 | 529 | $update_button = new EE_Submit_Input( |
530 | 530 | array( |
531 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
532 | - 'default' => sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ), |
|
531 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
532 | + 'default' => sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()), |
|
533 | 533 | 'html_label' => EEH_HTML::nbsp() |
534 | 534 | ) |
535 | 535 | ); |
536 | 536 | return new EE_Form_Section_HTML( |
537 | - EEH_HTML::no_row( EEH_HTML::br(2) ) . |
|
537 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
538 | 538 | EEH_HTML::tr( |
539 | - EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) . |
|
539 | + EEH_HTML::th(__('Update Settings', 'event_espresso')). |
|
540 | 540 | EEH_HTML::td( |
541 | 541 | $update_button->get_html_for_input() |
542 | 542 | ) |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | * @param \EE_Payment_Method $payment_method |
554 | 554 | * @return \EE_Form_Section_Proper |
555 | 555 | */ |
556 | - protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
557 | - $link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() ); |
|
556 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) { |
|
557 | + $link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name()); |
|
558 | 558 | return new EE_Form_Section_HTML( |
559 | 559 | EEH_HTML::tr( |
560 | - EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) . |
|
560 | + EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')). |
|
561 | 561 | EEH_HTML::td( |
562 | 562 | EEH_HTML::link( |
563 | 563 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | ), |
570 | 570 | $link_text_and_title, |
571 | 571 | $link_text_and_title, |
572 | - 'deactivate_' . $payment_method->slug(), |
|
572 | + 'deactivate_'.$payment_method->slug(), |
|
573 | 573 | 'espresso-button button-secondary' |
574 | 574 | ) |
575 | 575 | ) |
@@ -585,12 +585,12 @@ discard block |
||
585 | 585 | * @param \EE_Payment_Method $payment_method |
586 | 586 | * @return \EE_Form_Section_Proper |
587 | 587 | */ |
588 | - protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) { |
|
589 | - $link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() ); |
|
588 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) { |
|
589 | + $link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name()); |
|
590 | 590 | return new EE_Form_Section_Proper( |
591 | 591 | array( |
592 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
593 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
592 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
593 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
594 | 594 | 'action' => '#', |
595 | 595 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
596 | 596 | 'subsections' => apply_filters( |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | new EE_Form_Section_HTML( |
600 | 600 | EEH_HTML::tr( |
601 | 601 | EEH_HTML::th( |
602 | - EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' )) |
|
603 | - ) . |
|
602 | + EEH_HTML::label(__('Click to Activate ', 'event_espresso')) |
|
603 | + ). |
|
604 | 604 | EEH_HTML::td( |
605 | 605 | EEH_HTML::link( |
606 | 606 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | ), |
613 | 613 | $link_text_and_title, |
614 | 614 | $link_text_and_title, |
615 | - 'activate_' . $payment_method->slug(), |
|
615 | + 'activate_'.$payment_method->slug(), |
|
616 | 616 | 'espresso-button-green button-primary' |
617 | 617 | ) |
618 | 618 | ) |
@@ -633,9 +633,9 @@ discard block |
||
633 | 633 | protected function _fine_print() { |
634 | 634 | return new EE_Form_Section_HTML( |
635 | 635 | EEH_HTML::tr( |
636 | - EEH_HTML::th() . |
|
636 | + EEH_HTML::th(). |
|
637 | 637 | EEH_HTML::td( |
638 | - EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' ) |
|
638 | + EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
639 | 639 | ) |
640 | 640 | ) |
641 | 641 | ); |
@@ -647,15 +647,15 @@ discard block |
||
647 | 647 | * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
648 | 648 | * @global WP_User $current_user |
649 | 649 | */ |
650 | - protected function _activate_payment_method(){ |
|
651 | - if(isset($this->_req_data['payment_method_type'])){ |
|
650 | + protected function _activate_payment_method() { |
|
651 | + if (isset($this->_req_data['payment_method_type'])) { |
|
652 | 652 | $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
653 | 653 | //see if one exists |
654 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
655 | - $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type ); |
|
654 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
655 | + $payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type); |
|
656 | 656 | |
657 | - $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug())); |
|
658 | - }else{ |
|
657 | + $this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug())); |
|
658 | + } else { |
|
659 | 659 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
660 | 660 | } |
661 | 661 | } |
@@ -663,14 +663,14 @@ discard block |
||
663 | 663 | /** |
664 | 664 | * Deactivates the payment method with the specified slug, and redirects. |
665 | 665 | */ |
666 | - protected function _deactivate_payment_method(){ |
|
667 | - if(isset($this->_req_data['payment_method'])){ |
|
666 | + protected function _deactivate_payment_method() { |
|
667 | + if (isset($this->_req_data['payment_method'])) { |
|
668 | 668 | $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
669 | 669 | //deactivate it |
670 | 670 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
671 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug ); |
|
672 | - $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug)); |
|
673 | - }else{ |
|
671 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
672 | + $this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug)); |
|
673 | + } else { |
|
674 | 674 | $this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default')); |
675 | 675 | } |
676 | 676 | } |
@@ -684,39 +684,39 @@ discard block |
||
684 | 684 | * subsequently called 'headers_sent_func' which is _payment_methods_list) |
685 | 685 | * @return void |
686 | 686 | */ |
687 | - protected function _update_payment_method(){ |
|
688 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
687 | + protected function _update_payment_method() { |
|
688 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
689 | 689 | //ok let's find which gateway form to use based on the form input |
690 | 690 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
691 | 691 | /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
692 | 692 | $correct_pmt_form_to_use = NULL; |
693 | 693 | $pmt_obj = NULL; |
694 | - foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){ |
|
694 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
695 | 695 | /** @var $pmt_obj EE_PMT_Base */ |
696 | 696 | //get the form and simplify it, like what we do when we display it |
697 | 697 | $pmt_form = $pmt_obj->settings_form(); |
698 | 698 | $this->_simplify_form($pmt_form); |
699 | - if($pmt_form->form_data_present_in($this->_req_data)){ |
|
699 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
700 | 700 | $correct_pmt_form_to_use = $pmt_form; |
701 | 701 | break; |
702 | 702 | } |
703 | 703 | } |
704 | 704 | //if we couldn't find the correct payment method type... |
705 | - if( ! $correct_pmt_form_to_use ){ |
|
705 | + if ( ! $correct_pmt_form_to_use) { |
|
706 | 706 | EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
707 | 707 | $this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default')); |
708 | 708 | } |
709 | 709 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
710 | - if($correct_pmt_form_to_use->is_valid()){ |
|
710 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
711 | 711 | $correct_pmt_form_to_use->save(); |
712 | 712 | $pm = $correct_pmt_form_to_use->get_model_object(); |
713 | 713 | /** @var $pm EE_Payment_Method */ |
714 | - $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug())); |
|
715 | - }else{ |
|
714 | + $this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug())); |
|
715 | + } else { |
|
716 | 716 | EE_Error::add_error( |
717 | 717 | sprintf( |
718 | 718 | __('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'), |
719 | - $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' ) |
|
719 | + $pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso') |
|
720 | 720 | ), |
721 | 721 | __FILE__, |
722 | 722 | __FUNCTION__, |
@@ -733,11 +733,11 @@ discard block |
||
733 | 733 | protected function _payment_settings() { |
734 | 734 | |
735 | 735 | $this->_template_args['values'] = $this->_yes_no_values; |
736 | - $this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE; |
|
736 | + $this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE; |
|
737 | 737 | |
738 | - $this->_set_add_edit_form_tags( 'update_payment_settings' ); |
|
739 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
740 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE ); |
|
738 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
739 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
740 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE); |
|
741 | 741 | $this->display_admin_page_with_sidebar(); |
742 | 742 | |
743 | 743 | } |
@@ -751,13 +751,13 @@ discard block |
||
751 | 751 | * @return array |
752 | 752 | */ |
753 | 753 | protected function _update_payment_settings() { |
754 | - EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
755 | - EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG ); |
|
754 | + EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE; |
|
755 | + EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG); |
|
756 | 756 | |
757 | 757 | |
758 | - $what = __('Payment Settings','event_espresso'); |
|
759 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ ); |
|
760 | - $this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) ); |
|
758 | + $what = __('Payment Settings', 'event_espresso'); |
|
759 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__); |
|
760 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings')); |
|
761 | 761 | |
762 | 762 | } |
763 | 763 | protected function _payment_log_overview_list_table() { |
@@ -783,18 +783,18 @@ discard block |
||
783 | 783 | * @param bool $count |
784 | 784 | * @return array |
785 | 785 | */ |
786 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){ |
|
787 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
786 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) { |
|
787 | + EE_Registry::instance()->load_model('Change_Log'); |
|
788 | 788 | //we may need to do multiple queries (joining differently), so we actually wan tan array of query params |
789 | - $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
789 | + $query_params = array(array('LOG_type'=> EEM_Change_Log::type_gateway)); |
|
790 | 790 | //check if they've selected a specific payment method |
791 | - if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){ |
|
791 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
792 | 792 | $query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'], |
793 | 793 | 'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']); |
794 | 794 | } |
795 | 795 | //take into account search |
796 | - if(isset($this->_req_data['s']) && $this->_req_data['s']){ |
|
797 | - $similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%'); |
|
796 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
797 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
798 | 798 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
799 | 799 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
800 | 800 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -809,48 +809,48 @@ discard block |
||
809 | 809 | $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
810 | 810 | |
811 | 811 | } |
812 | - if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){ |
|
812 | + if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) { |
|
813 | 813 | //add date |
814 | - $start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ); |
|
815 | - $end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ); |
|
814 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
815 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
816 | 816 | //make sure our timestamps start and end right at the boundaries for each day |
817 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
818 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
817 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
818 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
819 | 819 | |
820 | 820 | //convert to timestamps |
821 | - $start_date = strtotime( $start_date ); |
|
822 | - $end_date = strtotime( $end_date ); |
|
821 | + $start_date = strtotime($start_date); |
|
822 | + $end_date = strtotime($end_date); |
|
823 | 823 | |
824 | 824 | //makes sure start date is the lowest value and vice versa |
825 | - $start_date = min( $start_date, $end_date ); |
|
826 | - $end_date = max( $start_date, $end_date ); |
|
825 | + $start_date = min($start_date, $end_date); |
|
826 | + $end_date = max($start_date, $end_date); |
|
827 | 827 | |
828 | 828 | //convert for query |
829 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
830 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
829 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
830 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
831 | 831 | |
832 | - $query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date)); |
|
832 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
833 | 833 | |
834 | 834 | } |
835 | - if($count){ |
|
835 | + if ($count) { |
|
836 | 836 | return EEM_Change_Log::instance()->count($query_params); |
837 | 837 | } |
838 | - if(isset($this->_req_data['order'])){ |
|
839 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
838 | + if (isset($this->_req_data['order'])) { |
|
839 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
840 | 840 | $query_params['order_by'] = array('LOG_time' => $sort); |
841 | - }else{ |
|
841 | + } else { |
|
842 | 842 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
843 | 843 | } |
844 | - $offset = ($current_page-1)*$per_page; |
|
844 | + $offset = ($current_page - 1) * $per_page; |
|
845 | 845 | |
846 | - if( ! isset($this->_req_data['download_results'])){ |
|
847 | - $query_params['limit'] = array( $offset, $per_page ); |
|
846 | + if ( ! isset($this->_req_data['download_results'])) { |
|
847 | + $query_params['limit'] = array($offset, $per_page); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
851 | 851 | |
852 | 852 | //now they've requested to instead just download the file instead of viewing it. |
853 | - if(isset($this->_req_data['download_results'])){ |
|
853 | + if (isset($this->_req_data['download_results'])) { |
|
854 | 854 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
855 | 855 | header('Content-Disposition: attachment'); |
856 | 856 | header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
@@ -872,36 +872,36 @@ discard block |
||
872 | 872 | * @param EE_Change_Log $logB |
873 | 873 | * @return int |
874 | 874 | */ |
875 | - protected function _sort_logs_again($logA,$logB){ |
|
875 | + protected function _sort_logs_again($logA, $logB) { |
|
876 | 876 | $timeA = $logA->get_raw('LOG_time'); |
877 | 877 | $timeB = $logB->get_raw('LOG_time'); |
878 | - if($timeA == $timeB){ |
|
878 | + if ($timeA == $timeB) { |
|
879 | 879 | return 0; |
880 | 880 | } |
881 | 881 | $comparison = $timeA < $timeB ? -1 : 1; |
882 | - if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){ |
|
882 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
883 | 883 | return $comparison * -1; |
884 | - }else{ |
|
884 | + } else { |
|
885 | 885 | return $comparison; |
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
889 | 889 | protected function _payment_log_details() { |
890 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
890 | + EE_Registry::instance()->load_model('Change_Log'); |
|
891 | 891 | /** @var $payment_log EE_Change_Log */ |
892 | 892 | $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
893 | 893 | $payment_method = NULL; |
894 | 894 | $transaction = NULL; |
895 | - if( $payment_log instanceof EE_Change_Log ){ |
|
896 | - if( $payment_log->object() instanceof EE_Payment ){ |
|
895 | + if ($payment_log instanceof EE_Change_Log) { |
|
896 | + if ($payment_log->object() instanceof EE_Payment) { |
|
897 | 897 | $payment_method = $payment_log->object()->payment_method(); |
898 | 898 | $transaction = $payment_log->object()->transaction(); |
899 | - }elseif($payment_log->object() instanceof EE_Payment_Method){ |
|
899 | + }elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
900 | 900 | $payment_method = $payment_log->object(); |
901 | 901 | } |
902 | 902 | } |
903 | 903 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
904 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
904 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
905 | 905 | array( |
906 | 906 | 'payment_log'=>$payment_log, |
907 | 907 | 'payment_method'=>$payment_method, |
@@ -1565,8 +1565,6 @@ discard block |
||
1565 | 1565 | * form_form_field_input__wrap |
1566 | 1566 | * |
1567 | 1567 | * @access public |
1568 | - * @param string $label |
|
1569 | - * @return string |
|
1570 | 1568 | */ |
1571 | 1569 | public function form_form_field_input__wrap( $input ) { |
1572 | 1570 | return ' |
@@ -1649,6 +1647,10 @@ discard block |
||
1649 | 1647 | |
1650 | 1648 | |
1651 | 1649 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1650 | + |
|
1651 | + /** |
|
1652 | + * @param boolean $REG_ID |
|
1653 | + */ |
|
1652 | 1654 | private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
1653 | 1655 | $set_values = array( |
1654 | 1656 | 'QST_ID' => $QST_ID, |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | |
125 | 125 | /** |
126 | 126 | * grab url requests and route them |
127 | - * @access private |
|
128 | - * @return void |
|
129 | - */ |
|
127 | + * @access private |
|
128 | + * @return void |
|
129 | + */ |
|
130 | 130 | public function _set_page_routes() { |
131 | 131 | |
132 | 132 | $this->_get_registration_status_array(); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | 'title' => __('Registrations Other', 'event_espresso'), |
399 | 399 | 'filename' => 'registrations_overview_other' |
400 | 400 | ) |
401 | - ), |
|
401 | + ), |
|
402 | 402 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
403 | 403 | 'qtips' => array('Registration_List_Table_Tips'), |
404 | 404 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
413 | 413 | 'persistent' => FALSE |
414 | 414 | ), |
415 | - 'help_tabs' => array( |
|
415 | + 'help_tabs' => array( |
|
416 | 416 | 'registrations_details_help_tab' => array( |
417 | 417 | 'title' => __('Registration Details', 'event_espresso'), |
418 | 418 | 'filename' => 'registrations_details' |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | 'order' => 20 |
477 | 477 | ), |
478 | 478 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
479 | - 'help_tabs' => array( |
|
479 | + 'help_tabs' => array( |
|
480 | 480 | 'registrations_contact_list_help_tab' => array( |
481 | 481 | 'title' => __('Registrations Contact List', 'event_espresso'), |
482 | 482 | 'filename' => 'registrations_contact_list' |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | 'title' => __('Contact List Other', 'event_espresso'), |
494 | 494 | 'filename' => 'registrations_contact_list_other' |
495 | 495 | ) |
496 | - ), |
|
496 | + ), |
|
497 | 497 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
498 | 498 | 'metaboxes' => array(), |
499 | 499 | 'require_nonce' => FALSE |
@@ -527,9 +527,9 @@ discard block |
||
527 | 527 | |
528 | 528 | /** |
529 | 529 | * get list of registration statuses |
530 | - * @access private |
|
531 | - * @return void |
|
532 | - */ |
|
530 | + * @access private |
|
531 | + * @return void |
|
532 | + */ |
|
533 | 533 | private function _get_registration_status_array() { |
534 | 534 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
535 | 535 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | return TRUE; |
831 | 831 | } |
832 | 832 | |
833 | - $REG = EEM_Registration::instance(); |
|
833 | + $REG = EEM_Registration::instance(); |
|
834 | 834 | |
835 | 835 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
836 | 836 | |
@@ -1051,9 +1051,9 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | /** |
1053 | 1053 | * generates HTML for the View Registration Details Admin page |
1054 | - * @access protected |
|
1055 | - * @return void |
|
1056 | - */ |
|
1054 | + * @access protected |
|
1055 | + * @return void |
|
1056 | + */ |
|
1057 | 1057 | protected function _registration_details() { |
1058 | 1058 | |
1059 | 1059 | $this->_template_args = array(); |
@@ -1130,9 +1130,9 @@ discard block |
||
1130 | 1130 | |
1131 | 1131 | /** |
1132 | 1132 | * _set_approve_or_decline_reg_status_buttons |
1133 | - * @access protected |
|
1134 | - * @return string |
|
1135 | - */ |
|
1133 | + * @access protected |
|
1134 | + * @return string |
|
1135 | + */ |
|
1136 | 1136 | public function set_reg_status_buttons_metabox() { |
1137 | 1137 | |
1138 | 1138 | //is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown. |
@@ -1321,10 +1321,10 @@ discard block |
||
1321 | 1321 | |
1322 | 1322 | /** |
1323 | 1323 | * approve_registration |
1324 | - * @access protected |
|
1325 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1326 | - * @return void |
|
1327 | - */ |
|
1324 | + * @access protected |
|
1325 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1326 | + * @return void |
|
1327 | + */ |
|
1328 | 1328 | protected function approve_registration( $notify = false ) { |
1329 | 1329 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
1330 | 1330 | } |
@@ -1334,10 +1334,10 @@ discard block |
||
1334 | 1334 | |
1335 | 1335 | /** |
1336 | 1336 | * decline_registration |
1337 | - * @access protected |
|
1338 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1339 | - * @return void |
|
1340 | - */ |
|
1337 | + * @access protected |
|
1338 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1339 | + * @return void |
|
1340 | + */ |
|
1341 | 1341 | protected function decline_registration( $notify = false ) { |
1342 | 1342 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
1343 | 1343 | } |
@@ -1347,10 +1347,10 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | /** |
1349 | 1349 | * cancel_registration |
1350 | - * @access protected |
|
1351 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1352 | - * @return void |
|
1353 | - */ |
|
1350 | + * @access protected |
|
1351 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1352 | + * @return void |
|
1353 | + */ |
|
1354 | 1354 | protected function cancel_registration( $notify = false ) { |
1355 | 1355 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
1356 | 1356 | } |
@@ -1361,10 +1361,10 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | /** |
1363 | 1363 | * not_approve_registration |
1364 | - * @access protected |
|
1365 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1366 | - * @return void |
|
1367 | - */ |
|
1364 | + * @access protected |
|
1365 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1366 | + * @return void |
|
1367 | + */ |
|
1368 | 1368 | protected function not_approve_registration( $notify = false ) { |
1369 | 1369 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
1370 | 1370 | } |
@@ -1373,10 +1373,10 @@ discard block |
||
1373 | 1373 | |
1374 | 1374 | /** |
1375 | 1375 | * decline_registration |
1376 | - * @access protected |
|
1377 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1378 | - * @return void |
|
1379 | - */ |
|
1376 | + * @access protected |
|
1377 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1378 | + * @return void |
|
1379 | + */ |
|
1380 | 1380 | protected function pending_registration( $notify = false ) { |
1381 | 1381 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
1382 | 1382 | } |
@@ -1386,9 +1386,9 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | /** |
1388 | 1388 | * generates HTML for the Registration main meta box |
1389 | - * @access public |
|
1390 | - * @return void |
|
1391 | - */ |
|
1389 | + * @access public |
|
1390 | + * @return void |
|
1391 | + */ |
|
1392 | 1392 | public function _reg_details_meta_box() { |
1393 | 1393 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1394 | 1394 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1471,9 +1471,9 @@ discard block |
||
1471 | 1471 | |
1472 | 1472 | /** |
1473 | 1473 | * generates HTML for the Registration Questions meta box |
1474 | - * @access public |
|
1475 | - * @return void |
|
1476 | - */ |
|
1474 | + * @access public |
|
1475 | + * @return void |
|
1476 | + */ |
|
1477 | 1477 | public function _reg_questions_meta_box() { |
1478 | 1478 | |
1479 | 1479 | add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
@@ -1581,9 +1581,9 @@ discard block |
||
1581 | 1581 | |
1582 | 1582 | /** |
1583 | 1583 | * generates HTML for the Registration main meta box |
1584 | - * @access protected |
|
1585 | - * @return void |
|
1586 | - */ |
|
1584 | + * @access protected |
|
1585 | + * @return void |
|
1586 | + */ |
|
1587 | 1587 | protected function _update_attendee_registration_form() { |
1588 | 1588 | $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
1589 | 1589 | $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
@@ -1665,12 +1665,12 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | /** |
1667 | 1667 | * generates HTML for the Registration main meta box |
1668 | - * @access public |
|
1669 | - * @return void |
|
1670 | - */ |
|
1668 | + * @access public |
|
1669 | + * @return void |
|
1670 | + */ |
|
1671 | 1671 | public function _reg_attendees_meta_box() { |
1672 | 1672 | |
1673 | - $REG = EEM_Registration::instance(); |
|
1673 | + $REG = EEM_Registration::instance(); |
|
1674 | 1674 | //get all other registrations on this transaction, and cache |
1675 | 1675 | //the attendees for them so we don't have to run another query using force_join |
1676 | 1676 | $registrations = $REG->get_all(array( |
@@ -1723,9 +1723,9 @@ discard block |
||
1723 | 1723 | |
1724 | 1724 | /** |
1725 | 1725 | * generates HTML for the Edit Registration side meta box |
1726 | - * @access public |
|
1727 | - * @return void |
|
1728 | - */ |
|
1726 | + * @access public |
|
1727 | + * @return void |
|
1728 | + */ |
|
1729 | 1729 | public function _reg_registrant_side_meta_box() { |
1730 | 1730 | |
1731 | 1731 | /*@var $attendee EE_Attendee */ |
@@ -2071,9 +2071,9 @@ discard block |
||
2071 | 2071 | |
2072 | 2072 | /** |
2073 | 2073 | * set_reg_event |
2074 | - * @access private |
|
2075 | - * @return boolean |
|
2076 | - */ |
|
2074 | + * @access private |
|
2075 | + * @return boolean |
|
2076 | + */ |
|
2077 | 2077 | private function _set_reg_event() { |
2078 | 2078 | if ( is_object( $this->_reg_event )) { |
2079 | 2079 | return TRUE; |
@@ -2177,9 +2177,9 @@ discard block |
||
2177 | 2177 | |
2178 | 2178 | /** |
2179 | 2179 | * generates HTML for the Attendee Contact List |
2180 | - * @access protected |
|
2181 | - * @return void |
|
2182 | - */ |
|
2180 | + * @access protected |
|
2181 | + * @return void |
|
2182 | + */ |
|
2183 | 2183 | protected function _attendee_contact_list_table() { |
2184 | 2184 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2185 | 2185 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2193,9 +2193,9 @@ discard block |
||
2193 | 2193 | /** |
2194 | 2194 | * get_attendees |
2195 | 2195 | * @param bool $count whether to return count or data. |
2196 | - * @access public |
|
2197 | - * @return array |
|
2198 | - */ |
|
2196 | + * @access public |
|
2197 | + * @return array |
|
2198 | + */ |
|
2199 | 2199 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2200 | 2200 | |
2201 | 2201 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2513,9 +2513,9 @@ discard block |
||
2513 | 2513 | |
2514 | 2514 | /** |
2515 | 2515 | * _attendee_details |
2516 | - * @access protected |
|
2517 | - * @return void |
|
2518 | - */ |
|
2516 | + * @access protected |
|
2517 | + * @return void |
|
2518 | + */ |
|
2519 | 2519 | public function attendee_registrations_meta_box( $post ) { |
2520 | 2520 | |
2521 | 2521 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2548,10 +2548,10 @@ discard block |
||
2548 | 2548 | |
2549 | 2549 | /** |
2550 | 2550 | * _trash_or_restore_attendee |
2551 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2552 | - * @access protected |
|
2553 | - * @return void |
|
2554 | - */ |
|
2551 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2552 | + * @access protected |
|
2553 | + * @return void |
|
2554 | + */ |
|
2555 | 2555 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2556 | 2556 | |
2557 | 2557 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param bool $routing |
43 | 43 | * @return Registrations_Admin_Page |
44 | 44 | */ |
45 | - public function __construct( $routing = TRUE ) { |
|
46 | - parent::__construct( $routing ); |
|
45 | + public function __construct($routing = TRUE) { |
|
46 | + parent::__construct($routing); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | 'espresso_attendees' => 'edit_attendee' |
71 | 71 | ); |
72 | 72 | |
73 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
73 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
74 | 74 | //add filters so that the comment urls don't take users to a confusing 404 page |
75 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
75 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | - public function clear_comment_link( $link, $comment, $args ) { |
|
79 | + public function clear_comment_link($link, $comment, $args) { |
|
80 | 80 | //gotta make sure this only happens on this route |
81 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
82 | - if ( $post_type == 'espresso_attendees' ) |
|
81 | + $post_type = get_post_type($comment->comment_post_ID); |
|
82 | + if ($post_type == 'espresso_attendees') |
|
83 | 83 | return '#commentsdiv'; |
84 | 84 | return $link; |
85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | protected function _ajax_hooks() { |
89 | 89 | //todo: all hooks for registrations ajax goes in here |
90 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
90 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
103 | 103 | 'edit' => __('Edit Contact', 'event_espresso'), |
104 | 104 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
105 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
106 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
105 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
106 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
107 | 107 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
108 | 108 | ), |
109 | 109 | 'publishbox' => array( |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | |
132 | 132 | $this->_get_registration_status_array(); |
133 | 133 | |
134 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
135 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
136 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
134 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
135 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
136 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
137 | 137 | |
138 | 138 | $this->_page_routes = array( |
139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | 'edit_registration' => array( |
152 | 152 | 'func' => '_registration_details', |
153 | - 'args' => array( 'edit' ), |
|
153 | + 'args' => array('edit'), |
|
154 | 154 | 'noheader' => TRUE, |
155 | 155 | 'capability' => 'ee_edit_registration', |
156 | 156 | 'obj_id' => $reg_id |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | 'restore_registrations' => array( |
167 | 167 | 'func' => '_trash_or_restore_registrations', |
168 | - 'args' => array( 'trash' => FALSE ), |
|
168 | + 'args' => array('trash' => FALSE), |
|
169 | 169 | 'noheader' => TRUE, |
170 | 170 | 'capability' => 'ee_delete_registrations' |
171 | 171 | ), |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | 'filename' => 'registrations_overview_other' |
400 | 400 | ) |
401 | 401 | ), |
402 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
402 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
403 | 403 | 'qtips' => array('Registration_List_Table_Tips'), |
404 | 404 | 'list_table' => 'EE_Registrations_List_Table', |
405 | 405 | 'require_nonce' => FALSE |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | 'nav' => array( |
410 | 410 | 'label' => __('REG Details', 'event_espresso'), |
411 | 411 | 'order' => 15, |
412 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
412 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
413 | 413 | 'persistent' => FALSE |
414 | 414 | ), |
415 | 415 | 'help_tabs' => array( |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | 'filename' => 'registrations_details_registrant_details' |
431 | 431 | ) |
432 | 432 | ), |
433 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
434 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
433 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
434 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
435 | 435 | 'require_nonce' => FALSE |
436 | 436 | ), |
437 | 437 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | 'order' => 15, |
456 | 456 | 'persistent' => FALSE |
457 | 457 | ), |
458 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
458 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
459 | 459 | 'require_nonce' => FALSE |
460 | 460 | ), |
461 | 461 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | 'label' => __('Edit Contact', 'event_espresso'), |
465 | 465 | 'order' => 15, |
466 | 466 | 'persistent' => FALSE, |
467 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
467 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
468 | 468 | ), |
469 | 469 | 'metaboxes' => array('attendee_editor_metaboxes'), |
470 | 470 | 'require_nonce' => FALSE |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | 'filename' => 'registrations_contact_list_other' |
495 | 495 | ) |
496 | 496 | ), |
497 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
497 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
498 | 498 | 'metaboxes' => array(), |
499 | 499 | 'require_nonce' => FALSE |
500 | 500 | ), |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | protected function _add_screen_options() {} |
514 | 514 | protected function _add_feature_pointers() {} |
515 | 515 | public function admin_init() { |
516 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
516 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
517 | 517 | } |
518 | 518 | public function admin_notices() {} |
519 | 519 | public function admin_footer_scripts() {} |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | * @return void |
532 | 532 | */ |
533 | 533 | private function _get_registration_status_array() { |
534 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
534 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | |
@@ -554,11 +554,11 @@ discard block |
||
554 | 554 | public function load_scripts_styles() { |
555 | 555 | //style |
556 | 556 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
557 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
557 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
558 | 558 | wp_enqueue_style('espresso_reg'); |
559 | 559 | |
560 | 560 | //script |
561 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
561 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
562 | 562 | wp_enqueue_script('espresso_reg'); |
563 | 563 | } |
564 | 564 | |
@@ -567,9 +567,9 @@ discard block |
||
567 | 567 | public function load_scripts_styles_edit_attendee() { |
568 | 568 | //stuff to only show up on our attendee edit details page. |
569 | 569 | $attendee_details_translations = array( |
570 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
570 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
571 | 571 | ); |
572 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
572 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
573 | 573 | wp_enqueue_script('jquery-validate'); |
574 | 574 | } |
575 | 575 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | |
588 | 588 | public function load_scripts_styles_contact_list() { |
589 | 589 | wp_deregister_style('espresso_reg'); |
590 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
590 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
591 | 591 | wp_enqueue_style('espresso_att'); |
592 | 592 | } |
593 | 593 | |
@@ -596,9 +596,9 @@ discard block |
||
596 | 596 | |
597 | 597 | |
598 | 598 | public function load_scripts_styles_new_registration() { |
599 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
599 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | 600 | wp_enqueue_script('ee-spco-for-admin'); |
601 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
601 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
602 | 602 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
603 | 603 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
604 | 604 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -637,23 +637,23 @@ discard block |
||
637 | 637 | |
638 | 638 | /** setup reg status bulk actions **/ |
639 | 639 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
640 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
640 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
641 | 641 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
642 | 642 | } |
643 | 643 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
644 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
644 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
645 | 645 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
646 | 646 | } |
647 | 647 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
648 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
648 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
649 | 649 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
650 | 650 | } |
651 | 651 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
652 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
652 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
653 | 653 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
654 | 654 | } |
655 | 655 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
656 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
656 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
657 | 657 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
658 | 658 | } |
659 | 659 | |
@@ -662,29 +662,29 @@ discard block |
||
662 | 662 | 'slug' => 'all', |
663 | 663 | 'label' => __('View All Registrations', 'event_espresso'), |
664 | 664 | 'count' => 0, |
665 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
665 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
666 | 666 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
667 | - ) ) |
|
667 | + )) |
|
668 | 668 | ), |
669 | 669 | 'month' => array( |
670 | 670 | 'slug' => 'month', |
671 | 671 | 'label' => __('This Month', 'event_espresso'), |
672 | 672 | 'count' => 0, |
673 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
673 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
674 | 674 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
675 | 675 | )) |
676 | 676 | ), |
677 | 677 | 'today' => array( |
678 | 678 | 'slug' => 'today', |
679 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
679 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
680 | 680 | 'count' => 0, |
681 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
681 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
682 | 682 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
683 | 683 | )) |
684 | 684 | ) |
685 | 685 | ); |
686 | 686 | |
687 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
687 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
688 | 688 | $this->_views['incomplete'] = array( |
689 | 689 | 'slug' => 'incomplete', |
690 | 690 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | ) |
721 | 721 | ); |
722 | 722 | |
723 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
723 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
724 | 724 | $this->_views['trash'] = array( |
725 | 725 | 'slug' => 'trash', |
726 | 726 | 'label' => __('Trash', 'event_espresso'), |
@@ -755,42 +755,42 @@ discard block |
||
755 | 755 | 'desc' => __('View Transaction Details', 'event_espresso') |
756 | 756 | ) |
757 | 757 | ); |
758 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
758 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
759 | 759 | $fc_items['resend_registration'] = array( |
760 | 760 | 'class' => 'dashicons dashicons-email-alt', |
761 | 761 | 'desc' => __('Resend Registration Details', 'event_espresso') |
762 | 762 | ); |
763 | 763 | } else { |
764 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
764 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | $sc_items = array( |
768 | 768 | 'approved_status' => array( |
769 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
770 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
769 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
770 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
771 | 771 | ), |
772 | 772 | 'pending_status' => array( |
773 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
774 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
773 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
774 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
775 | 775 | ), |
776 | 776 | 'incomplete_status' => array( |
777 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
778 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
777 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
778 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
779 | 779 | ), |
780 | 780 | 'not_approved' => array( |
781 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
782 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
781 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
782 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
783 | 783 | ), |
784 | 784 | 'declined_status' => array( |
785 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
786 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
785 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
786 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
787 | 787 | ), |
788 | 788 | 'cancelled_status' => array( |
789 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
790 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
789 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
790 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
791 | 791 | ) |
792 | 792 | ); |
793 | - return array_merge( $fc_items, $sc_items ); |
|
793 | + return array_merge($fc_items, $sc_items); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | |
@@ -803,15 +803,15 @@ discard block |
||
803 | 803 | |
804 | 804 | |
805 | 805 | protected function _registrations_overview_list_table() { |
806 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
807 | - if ( $EVT_ID ) { |
|
808 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
809 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
806 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
807 | + if ($EVT_ID) { |
|
808 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
809 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
810 | 810 | } |
811 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
812 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
811 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
812 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
813 | 813 | } |
814 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
814 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
815 | 815 | $this->display_admin_list_table_page_with_no_sidebar(); |
816 | 816 | } |
817 | 817 | |
@@ -826,19 +826,19 @@ discard block |
||
826 | 826 | */ |
827 | 827 | private function _set_registration_object() { |
828 | 828 | //get out if we've already set the object |
829 | - if ( is_object( $this->_registration )) { |
|
829 | + if (is_object($this->_registration)) { |
|
830 | 830 | return TRUE; |
831 | 831 | } |
832 | 832 | |
833 | 833 | $REG = EEM_Registration::instance(); |
834 | 834 | |
835 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
835 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
836 | 836 | |
837 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
837 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
838 | 838 | return TRUE; |
839 | 839 | else { |
840 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
841 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
840 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
841 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
842 | 842 | $this->_registration = NULL; |
843 | 843 | return FALSE; |
844 | 844 | } |
@@ -857,25 +857,25 @@ discard block |
||
857 | 857 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
858 | 858 | * @return mixed (int|array) int = count || array of registration objects |
859 | 859 | */ |
860 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
861 | - |
|
862 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
863 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
864 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
865 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
866 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
867 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
860 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
861 | + |
|
862 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
863 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
864 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
865 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
866 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
867 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
868 | 868 | $start_date = FALSE; |
869 | 869 | $end_date = FALSE; |
870 | 870 | $_where = array(); |
871 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
872 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
871 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
872 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
873 | 873 | |
874 | 874 | //set orderby |
875 | 875 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
876 | 876 | |
877 | 877 | |
878 | - switch ( $this->_req_data['orderby'] ) { |
|
878 | + switch ($this->_req_data['orderby']) { |
|
879 | 879 | case '_REG_ID': |
880 | 880 | $orderby = 'REG_ID'; |
881 | 881 | break; |
@@ -895,26 +895,26 @@ discard block |
||
895 | 895 | $orderby = 'REG_date'; |
896 | 896 | } |
897 | 897 | |
898 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
899 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
900 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
898 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
899 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
900 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
901 | 901 | |
902 | 902 | |
903 | - $offset = ($current_page-1)*$per_page; |
|
904 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
903 | + $offset = ($current_page - 1) * $per_page; |
|
904 | + $limit = $count ? NULL : array($offset, $per_page); |
|
905 | 905 | |
906 | - if($EVT_ID){ |
|
907 | - $_where['EVT_ID']=$EVT_ID; |
|
906 | + if ($EVT_ID) { |
|
907 | + $_where['EVT_ID'] = $EVT_ID; |
|
908 | 908 | } |
909 | - if($CAT_ID){ |
|
909 | + if ($CAT_ID) { |
|
910 | 910 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
911 | 911 | } |
912 | - if ( $incomplete ) { |
|
912 | + if ($incomplete) { |
|
913 | 913 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
914 | 914 | } else if ( ! $trash) { |
915 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
915 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
916 | 916 | } |
917 | - if($reg_status){ |
|
917 | + if ($reg_status) { |
|
918 | 918 | $_where['STS_ID'] = $reg_status; |
919 | 919 | } |
920 | 920 | |
@@ -926,103 +926,103 @@ discard block |
||
926 | 926 | $time_start = ' 00:00:00'; |
927 | 927 | $time_end = ' 23:59:59'; |
928 | 928 | |
929 | - if($today_a || $today ){ |
|
929 | + if ($today_a || $today) { |
|
930 | 930 | $curdate = date('Y-m-d', current_time('timestamp')); |
931 | - $_where['REG_date']= array('BETWEEN', |
|
931 | + $_where['REG_date'] = array('BETWEEN', |
|
932 | 932 | array( |
933 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
934 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
933 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
934 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
935 | 935 | )); |
936 | - }elseif($this_month_a || $this_month){ |
|
936 | + }elseif ($this_month_a || $this_month) { |
|
937 | 937 | $this_month_r = date('m', current_time('timestamp')); |
938 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
939 | - $_where['REG_date']= array('BETWEEN', |
|
938 | + $days_this_month = date('t', current_time('timestamp')); |
|
939 | + $_where['REG_date'] = array('BETWEEN', |
|
940 | 940 | array( |
941 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
942 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
941 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
942 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
943 | 943 | )); |
944 | - }elseif($month_range){ |
|
944 | + }elseif ($month_range) { |
|
945 | 945 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
946 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
947 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
948 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
949 | - $_where['REG_date']= array('BETWEEN', |
|
950 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
951 | - }elseif($start_date && $end_date){ |
|
946 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
947 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
948 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
949 | + $_where['REG_date'] = array('BETWEEN', |
|
950 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
951 | + }elseif ($start_date && $end_date) { |
|
952 | 952 | throw new EE_Error("not yet supported"); |
953 | - }elseif($start_date){ |
|
953 | + }elseif ($start_date) { |
|
954 | 954 | throw new EE_Error("not yet supported"); |
955 | - }elseif($end_date){ |
|
955 | + }elseif ($end_date) { |
|
956 | 956 | throw new EE_Error("not yet supported"); |
957 | 957 | } |
958 | 958 | |
959 | - if ( isset( $this->_req_data['s'] ) ) { |
|
960 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
959 | + if (isset($this->_req_data['s'])) { |
|
960 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
961 | 961 | $_where['OR'] = array( |
962 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
963 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
964 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
965 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
966 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
967 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
968 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
969 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
970 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
971 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
972 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
973 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
974 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
975 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
976 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
977 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ) |
|
962 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
963 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
964 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
965 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
966 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
967 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
968 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
969 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
970 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
971 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
972 | + 'REG_final_price' => array('LIKE', $sstr), |
|
973 | + 'REG_code' => array('LIKE', $sstr), |
|
974 | + 'REG_count' => array('LIKE', $sstr), |
|
975 | + 'REG_group_size' => array('LIKE', $sstr), |
|
976 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
977 | + 'Ticket.TKT_description' => array('LIKE', $sstr) |
|
978 | 978 | ); |
979 | 979 | } |
980 | 980 | |
981 | 981 | //capability checks |
982 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
982 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
983 | 983 | $_where['AND'] = array( |
984 | 984 | 'Event.EVT_wp_user' => get_current_user_id() |
985 | 985 | ); |
986 | 986 | } |
987 | 987 | |
988 | 988 | |
989 | - if( $count ){ |
|
990 | - if ( $trash ) { |
|
991 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
992 | - } else if ( $incomplete ) { |
|
993 | - return EEM_Registration::instance()->count( array( $_where )); |
|
989 | + if ($count) { |
|
990 | + if ($trash) { |
|
991 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
992 | + } else if ($incomplete) { |
|
993 | + return EEM_Registration::instance()->count(array($_where)); |
|
994 | 994 | } else { |
995 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
995 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
996 | 996 | } |
997 | 997 | } else { |
998 | 998 | //make sure we remove default where conditions cause all registrations matching query are returned |
999 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1000 | - if ( $per_page !== -1 ) { |
|
999 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1000 | + if ($per_page !== -1) { |
|
1001 | 1001 | $query_params['limit'] = $limit; |
1002 | 1002 | } |
1003 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1003 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1004 | 1004 | |
1005 | 1005 | |
1006 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1006 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1007 | 1007 | $first_registration = $registrations[0]; |
1008 | 1008 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1009 | 1009 | $event_name = $first_registration->event_obj()->name(); |
1010 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1010 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1011 | 1011 | // edit event link |
1012 | - if ( $event_name != '' ) { |
|
1013 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1014 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1015 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1012 | + if ($event_name != '') { |
|
1013 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1014 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1015 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1019 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1018 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1019 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1020 | 1020 | |
1021 | 1021 | $this->_template_args['before_admin_page_content'] = ' |
1022 | 1022 | <div id="admin-page-header"> |
1023 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1024 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1025 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1023 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1024 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1025 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1026 | 1026 | </div> |
1027 | 1027 | '; |
1028 | 1028 | |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | |
1061 | 1061 | $this->_set_registration_object(); |
1062 | 1062 | |
1063 | - if ( is_object( $this->_registration )) { |
|
1063 | + if (is_object($this->_registration)) { |
|
1064 | 1064 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1065 | 1065 | $this->_session = $transaction->session_data(); |
1066 | 1066 | |
@@ -1068,10 +1068,10 @@ discard block |
||
1068 | 1068 | |
1069 | 1069 | |
1070 | 1070 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1071 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1071 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1072 | 1072 | |
1073 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1074 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1073 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1074 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1075 | 1075 | |
1076 | 1076 | $this->_template_args['grand_total'] = $transaction->total(); |
1077 | 1077 | |
@@ -1079,19 +1079,19 @@ discard block |
||
1079 | 1079 | // link back to overview |
1080 | 1080 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1081 | 1081 | $this->_template_args['registration'] = $this->_registration; |
1082 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1083 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1084 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1082 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1083 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1084 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1085 | 1085 | |
1086 | 1086 | //next and previous links |
1087 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1088 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1089 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1090 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1087 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1088 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1089 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1090 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1091 | 1091 | |
1092 | 1092 | // grab header |
1093 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1094 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1093 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1094 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1095 | 1095 | |
1096 | 1096 | } else { |
1097 | 1097 | |
@@ -1112,14 +1112,14 @@ discard block |
||
1112 | 1112 | protected function _registration_details_metaboxes() { |
1113 | 1113 | $this->_set_registration_object(); |
1114 | 1114 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1115 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1116 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1117 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1118 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1115 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1116 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1117 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1118 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1119 | 1119 | } |
1120 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1121 | - if ( $this->_registration->group_size() > 1 ) { |
|
1122 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1120 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1121 | + if ($this->_registration->group_size() > 1) { |
|
1122 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1123 | 1123 | } |
1124 | 1124 | } |
1125 | 1125 | |
@@ -1140,23 +1140,23 @@ discard block |
||
1140 | 1140 | |
1141 | 1141 | //let's get an array of all possible buttons that we can just reference |
1142 | 1142 | $status_buttons = $this->_get_reg_status_buttons(); |
1143 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1144 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1143 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1144 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1145 | 1145 | $template_args['attendee'] = $this->_registration->attendee(); |
1146 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1147 | - if ( $this->_set_registration_object() ) { |
|
1146 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1147 | + if ($this->_set_registration_object()) { |
|
1148 | 1148 | $current_status = $this->_registration->status_ID(); |
1149 | - unset( $status_buttons[$current_status] ); |
|
1150 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1151 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1149 | + unset($status_buttons[$current_status]); |
|
1150 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1151 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1152 | 1152 | } |
1153 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1153 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1154 | 1154 | } |
1155 | 1155 | $template_args['form_url'] = REG_ADMIN_URL; |
1156 | 1156 | $template_args['REG_ID'] = $this->_registration->ID(); |
1157 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1157 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1158 | 1158 | |
1159 | - EEH_Template::display_template( $template, $template_args ); |
|
1159 | + EEH_Template::display_template($template, $template_args); |
|
1160 | 1160 | |
1161 | 1161 | } |
1162 | 1162 | |
@@ -1170,11 +1170,11 @@ discard block |
||
1170 | 1170 | private function _get_reg_status_buttons() { |
1171 | 1171 | |
1172 | 1172 | $buttons = array( |
1173 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1174 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1175 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1176 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1177 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1173 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1174 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1175 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1176 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1177 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1178 | 1178 | ); |
1179 | 1179 | return $buttons; |
1180 | 1180 | } |
@@ -1188,13 +1188,13 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return array (array with reg_id(s) updated and whether update was successful. |
1190 | 1190 | */ |
1191 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1192 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1191 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1192 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1193 | 1193 | |
1194 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1194 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1195 | 1195 | |
1196 | 1196 | //notify? |
1197 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1197 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1198 | 1198 | $this->_process_resend_registration(); |
1199 | 1199 | } |
1200 | 1200 | |
@@ -1212,19 +1212,19 @@ discard block |
||
1212 | 1212 | * @param bool $status |
1213 | 1213 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1214 | 1214 | */ |
1215 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1215 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1216 | 1216 | $success = true; |
1217 | 1217 | // set default status if none is passed |
1218 | 1218 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1219 | 1219 | |
1220 | 1220 | //typecast and sanitize reg_id |
1221 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1221 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1222 | 1222 | |
1223 | 1223 | //loop through REG_ID's and change status |
1224 | - foreach ( $reg_ids as $r_id ) { |
|
1225 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1226 | - if ( $registration instanceof EE_Registration ) { |
|
1227 | - $registration->set_status( $status ); |
|
1224 | + foreach ($reg_ids as $r_id) { |
|
1225 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1226 | + if ($registration instanceof EE_Registration) { |
|
1227 | + $registration->set_status($status); |
|
1228 | 1228 | $result = $registration->save(); |
1229 | 1229 | |
1230 | 1230 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | $this->_req_data['_REG_ID'] = $reg_ids; |
1237 | 1237 | |
1238 | 1238 | //return $success and processed registrations |
1239 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1239 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | |
@@ -1248,37 +1248,37 @@ discard block |
||
1248 | 1248 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1249 | 1249 | * @return void |
1250 | 1250 | */ |
1251 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1251 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1252 | 1252 | |
1253 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1253 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1254 | 1254 | |
1255 | 1255 | |
1256 | - $success = isset( $result['success'] ) && $result['success']; |
|
1256 | + $success = isset($result['success']) && $result['success']; |
|
1257 | 1257 | |
1258 | 1258 | //setup success message |
1259 | - if ( $success ) { |
|
1260 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1261 | - EE_Error::add_success( $msg ); |
|
1259 | + if ($success) { |
|
1260 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1261 | + EE_Error::add_success($msg); |
|
1262 | 1262 | } else { |
1263 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1263 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1266 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1267 | 1267 | //unset nonces |
1268 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1269 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1270 | - unset( $this->_req_data[$ref] ); |
|
1268 | + foreach ($this->_req_data as $ref => $value) { |
|
1269 | + if (strpos($ref, 'nonce') !== false) { |
|
1270 | + unset($this->_req_data[$ref]); |
|
1271 | 1271 | continue; |
1272 | 1272 | } |
1273 | 1273 | |
1274 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1274 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1275 | 1275 | $this->_req_data[$ref] = $value; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | 1278 | //merge request vars so that the reloaded list table contains any existing filter query params |
1279 | - $route = array_merge( $this->_req_data, $route ); |
|
1279 | + $route = array_merge($this->_req_data, $route); |
|
1280 | 1280 | |
1281 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1281 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1282 | 1282 | } |
1283 | 1283 | |
1284 | 1284 | |
@@ -1291,28 +1291,28 @@ discard block |
||
1291 | 1291 | $this->_req_data['return'] = 'view_registration'; |
1292 | 1292 | |
1293 | 1293 | //set notify based on whether the send notifications toggle is set or not |
1294 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1294 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1295 | 1295 | |
1296 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1297 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1298 | - $this->approve_registration( $notify ); |
|
1296 | + switch ($this->_req_data['_reg_status_id']) { |
|
1297 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1298 | + $this->approve_registration($notify); |
|
1299 | 1299 | break; |
1300 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1301 | - $this->pending_registration( $notify ); |
|
1300 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1301 | + $this->pending_registration($notify); |
|
1302 | 1302 | break; |
1303 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1304 | - $this->not_approve_registration( $notify ); |
|
1303 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1304 | + $this->not_approve_registration($notify); |
|
1305 | 1305 | break; |
1306 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1307 | - $this->decline_registration( $notify ); |
|
1306 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1307 | + $this->decline_registration($notify); |
|
1308 | 1308 | break; |
1309 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1310 | - $this->cancel_registration( $notify ); |
|
1309 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1310 | + $this->cancel_registration($notify); |
|
1311 | 1311 | break; |
1312 | 1312 | default : |
1313 | 1313 | $result['success'] = false; |
1314 | - unset( $this->_req_data['return'] ); |
|
1315 | - $this->_reg_status_change_return( '', false ); |
|
1314 | + unset($this->_req_data['return']); |
|
1315 | + $this->_reg_status_change_return('', false); |
|
1316 | 1316 | break; |
1317 | 1317 | } |
1318 | 1318 | } |
@@ -1325,8 +1325,8 @@ discard block |
||
1325 | 1325 | * @param bool $notify whether or not to notify the registrant about their approval. |
1326 | 1326 | * @return void |
1327 | 1327 | */ |
1328 | - protected function approve_registration( $notify = false ) { |
|
1329 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1328 | + protected function approve_registration($notify = false) { |
|
1329 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1330 | 1330 | } |
1331 | 1331 | |
1332 | 1332 | |
@@ -1338,8 +1338,8 @@ discard block |
||
1338 | 1338 | * @param bool $notify whether or not to notify the registrant about their approval. |
1339 | 1339 | * @return void |
1340 | 1340 | */ |
1341 | - protected function decline_registration( $notify = false ) { |
|
1342 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1341 | + protected function decline_registration($notify = false) { |
|
1342 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | |
@@ -1351,8 +1351,8 @@ discard block |
||
1351 | 1351 | * @param bool $notify whether or not to notify the registrant about their approval. |
1352 | 1352 | * @return void |
1353 | 1353 | */ |
1354 | - protected function cancel_registration( $notify = false ) { |
|
1355 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1354 | + protected function cancel_registration($notify = false) { |
|
1355 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | |
@@ -1365,8 +1365,8 @@ discard block |
||
1365 | 1365 | * @param bool $notify whether or not to notify the registrant about their approval. |
1366 | 1366 | * @return void |
1367 | 1367 | */ |
1368 | - protected function not_approve_registration( $notify = false ) { |
|
1369 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1368 | + protected function not_approve_registration($notify = false) { |
|
1369 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1370 | 1370 | } |
1371 | 1371 | |
1372 | 1372 | |
@@ -1377,8 +1377,8 @@ discard block |
||
1377 | 1377 | * @param bool $notify whether or not to notify the registrant about their approval. |
1378 | 1378 | * @return void |
1379 | 1379 | */ |
1380 | - protected function pending_registration( $notify = false ) { |
|
1381 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1380 | + protected function pending_registration($notify = false) { |
|
1381 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | |
@@ -1392,75 +1392,75 @@ discard block |
||
1392 | 1392 | public function _reg_details_meta_box() { |
1393 | 1393 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1394 | 1394 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1395 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1395 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1396 | 1396 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1397 | 1397 | $this->_session = $transaction->session_data(); |
1398 | 1398 | |
1399 | 1399 | $filters = new EE_Line_Item_Filter_Collection(); |
1400 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1401 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1402 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1400 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1401 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1402 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1403 | 1403 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1404 | 1404 | |
1405 | 1405 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1406 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1407 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1406 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1407 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1408 | 1408 | |
1409 | 1409 | |
1410 | 1410 | $attendee = $this->_registration->attendee(); |
1411 | 1411 | |
1412 | 1412 | |
1413 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1414 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1413 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1414 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1415 | 1415 | |
1416 | 1416 | |
1417 | 1417 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1418 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1418 | + $payment = $transaction->get_first_related('Payment'); |
|
1419 | 1419 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1420 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1420 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1421 | 1421 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1422 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1422 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1423 | 1423 | $reg_details = array( |
1424 | 1424 | 'payment_method' => $payment_method->name(), |
1425 | 1425 | 'response_msg' => $payment->gateway_response(), |
1426 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1426 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1427 | 1427 | 'registration_session' => $this->_registration->session_ID(), |
1428 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1429 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1428 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1429 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1430 | 1430 | ); |
1431 | 1431 | |
1432 | 1432 | |
1433 | - if ( isset( $reg_details['registration_id'] )) { |
|
1433 | + if (isset($reg_details['registration_id'])) { |
|
1434 | 1434 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1435 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1435 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1436 | 1436 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1437 | 1437 | } |
1438 | 1438 | |
1439 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1439 | + if (isset($reg_details['payment_method'])) { |
|
1440 | 1440 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1441 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1441 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1442 | 1442 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1443 | 1443 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1444 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1444 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1445 | 1445 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1446 | 1446 | } |
1447 | 1447 | |
1448 | 1448 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1449 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1449 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1450 | 1450 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1451 | 1451 | |
1452 | 1452 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1453 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1453 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1454 | 1454 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1455 | 1455 | |
1456 | 1456 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1457 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1457 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1458 | 1458 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1459 | 1459 | |
1460 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1460 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1461 | 1461 | |
1462 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1463 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1462 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1463 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1464 | 1464 | |
1465 | 1465 | } |
1466 | 1466 | |
@@ -1476,23 +1476,23 @@ discard block |
||
1476 | 1476 | */ |
1477 | 1477 | public function _reg_questions_meta_box() { |
1478 | 1478 | |
1479 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $this, 'form_before_question_group' ), 10, 1 ); |
|
1480 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $this, 'form_after_question_group' ), 10, 1 ); |
|
1481 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'form_form_field_label_wrap' ), 10, 1 ); |
|
1482 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'form_form_field_input__wrap' ), 10, 1 ); |
|
1479 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($this, 'form_before_question_group'), 10, 1); |
|
1480 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($this, 'form_after_question_group'), 10, 1); |
|
1481 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'form_form_field_label_wrap'), 10, 1); |
|
1482 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'form_form_field_input__wrap'), 10, 1); |
|
1483 | 1483 | |
1484 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $this->_registration, $this->_registration->get('EVT_ID') ); |
|
1484 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($this->_registration, $this->_registration->get('EVT_ID')); |
|
1485 | 1485 | |
1486 | 1486 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1487 | 1487 | |
1488 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
1489 | - $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html( $question_groups ); |
|
1488 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
1489 | + $this->_template_args['att_questions'] = EEH_Form_Fields::generate_question_groups_html($question_groups); |
|
1490 | 1490 | |
1491 | 1491 | $this->_template_args['reg_questions_form_action'] = 'update_attendee_registration_form'; |
1492 | 1492 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1493 | 1493 | |
1494 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1495 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1494 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1495 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1496 | 1496 | |
1497 | 1497 | } |
1498 | 1498 | |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | * @param string $output |
1508 | 1508 | * @return string |
1509 | 1509 | */ |
1510 | - public function form_before_question_group( $output ) { |
|
1510 | + public function form_before_question_group($output) { |
|
1511 | 1511 | return ' |
1512 | 1512 | <table class="form-table ee-width-100"> |
1513 | 1513 | <tbody> |
@@ -1524,13 +1524,13 @@ discard block |
||
1524 | 1524 | * @param string $output |
1525 | 1525 | * @return string |
1526 | 1526 | */ |
1527 | - public function form_after_question_group( $output ) { |
|
1527 | + public function form_after_question_group($output) { |
|
1528 | 1528 | return ' |
1529 | 1529 | <tr class="hide-if-no-js"> |
1530 | 1530 | <th> </th> |
1531 | 1531 | <td class="reg-admin-edit-attendee-question-td"> |
1532 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1533 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1532 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1533 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1534 | 1534 | <div class="dashicons dashicons-edit"></div> |
1535 | 1535 | </a> |
1536 | 1536 | </td> |
@@ -1550,11 +1550,11 @@ discard block |
||
1550 | 1550 | * @param string $label |
1551 | 1551 | * @return string |
1552 | 1552 | */ |
1553 | - public function form_form_field_label_wrap( $label ) { |
|
1553 | + public function form_form_field_label_wrap($label) { |
|
1554 | 1554 | return ' |
1555 | 1555 | <tr> |
1556 | 1556 | <th> |
1557 | - ' . $label . ' |
|
1557 | + ' . $label.' |
|
1558 | 1558 | </th>'; |
1559 | 1559 | } |
1560 | 1560 | |
@@ -1568,10 +1568,10 @@ discard block |
||
1568 | 1568 | * @param string $label |
1569 | 1569 | * @return string |
1570 | 1570 | */ |
1571 | - public function form_form_field_input__wrap( $input ) { |
|
1571 | + public function form_form_field_input__wrap($input) { |
|
1572 | 1572 | return ' |
1573 | 1573 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1574 | - ' . $input . ' |
|
1574 | + ' . $input.' |
|
1575 | 1575 | </td> |
1576 | 1576 | </tr>'; |
1577 | 1577 | } |
@@ -1585,13 +1585,13 @@ discard block |
||
1585 | 1585 | * @return void |
1586 | 1586 | */ |
1587 | 1587 | protected function _update_attendee_registration_form() { |
1588 | - $qstns = isset( $this->_req_data['qstn'] ) ? $this->_req_data['qstn'] : FALSE; |
|
1589 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1590 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
1591 | - $success = $this->_save_attendee_registration_form( $REG_ID, $qstns ); |
|
1588 | + $qstns = isset($this->_req_data['qstn']) ? $this->_req_data['qstn'] : FALSE; |
|
1589 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1590 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
1591 | + $success = $this->_save_attendee_registration_form($REG_ID, $qstns); |
|
1592 | 1592 | $what = __('Registration Form', 'event_espresso'); |
1593 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1594 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1593 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1594 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1595 | 1595 | |
1596 | 1596 | } |
1597 | 1597 | |
@@ -1604,26 +1604,26 @@ discard block |
||
1604 | 1604 | * @param bool $qstns |
1605 | 1605 | * @return bool |
1606 | 1606 | */ |
1607 | - private function _save_attendee_registration_form( $REG_ID = FALSE, $qstns = FALSE ) { |
|
1607 | + private function _save_attendee_registration_form($REG_ID = FALSE, $qstns = FALSE) { |
|
1608 | 1608 | |
1609 | - if ( ! $REG_ID || ! $qstns ) { |
|
1610 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1609 | + if ( ! $REG_ID || ! $qstns) { |
|
1610 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1611 | 1611 | } |
1612 | 1612 | $success = TRUE; |
1613 | 1613 | |
1614 | 1614 | // allow others to get in on this awesome fun :D |
1615 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
1615 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
1616 | 1616 | // loop thru questions... FINALLY!!! |
1617 | 1617 | |
1618 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
1618 | + foreach ($qstns as $QST_ID => $qstn) { |
|
1619 | 1619 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
1620 | - if ( !is_array($qstn) ) { |
|
1621 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1620 | + if ( ! is_array($qstn)) { |
|
1621 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1622 | 1622 | continue; |
1623 | 1623 | } |
1624 | 1624 | |
1625 | 1625 | |
1626 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
1626 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
1627 | 1627 | //get answer |
1628 | 1628 | $query_params = array( |
1629 | 1629 | 0 => array( |
@@ -1634,8 +1634,8 @@ discard block |
||
1634 | 1634 | ); |
1635 | 1635 | $answer = EEM_Answer::instance()->get_one($query_params); |
1636 | 1636 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
1637 | - if ( ! $answer instanceof EE_Answer ) { |
|
1638 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
1637 | + if ( ! $answer instanceof EE_Answer) { |
|
1638 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
1639 | 1639 | continue 2; |
1640 | 1640 | } |
1641 | 1641 | |
@@ -1649,7 +1649,7 @@ discard block |
||
1649 | 1649 | |
1650 | 1650 | |
1651 | 1651 | //TODO: try changing this to use the model directly... not indirectly through creating a default object... |
1652 | - private function _save_new_answer( $REG_ID, $QST_ID, $ans ) { |
|
1652 | + private function _save_new_answer($REG_ID, $QST_ID, $ans) { |
|
1653 | 1653 | $set_values = array( |
1654 | 1654 | 'QST_ID' => $QST_ID, |
1655 | 1655 | 'REG_ID' => $REG_ID, |
@@ -1676,30 +1676,30 @@ discard block |
||
1676 | 1676 | $registrations = $REG->get_all(array( |
1677 | 1677 | array( |
1678 | 1678 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1679 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1679 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1680 | 1680 | ), |
1681 | 1681 | 'force_join'=>array('Attendee'))); |
1682 | 1682 | |
1683 | 1683 | $this->_template_args['attendees'] = array(); |
1684 | 1684 | $this->_template_args['attendee_notice'] = ''; |
1685 | 1685 | EE_Registry::instance()->load_helper('Array'); |
1686 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1687 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1686 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1687 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1688 | 1688 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1689 | 1689 | } else { |
1690 | 1690 | |
1691 | 1691 | $att_nmbr = 1; |
1692 | - foreach ( $registrations as $registration ) { |
|
1692 | + foreach ($registrations as $registration) { |
|
1693 | 1693 | /* @var $registration EE_Registration */ |
1694 | 1694 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1695 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1696 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1697 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1698 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1695 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1696 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1697 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1698 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1699 | 1699 | |
1700 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1700 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1701 | 1701 | |
1702 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1702 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1703 | 1703 | |
1704 | 1704 | $att_nmbr++; |
1705 | 1705 | } |
@@ -1711,8 +1711,8 @@ discard block |
||
1711 | 1711 | |
1712 | 1712 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1713 | 1713 | } |
1714 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1715 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1714 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1715 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1716 | 1716 | |
1717 | 1717 | } |
1718 | 1718 | |
@@ -1733,11 +1733,11 @@ discard block |
||
1733 | 1733 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1734 | 1734 | |
1735 | 1735 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1736 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1736 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1737 | 1737 | $primary_registration = $this->_registration->get_primary_registration(); |
1738 | 1738 | $primary_attendee = $primary_registration->attendee(); |
1739 | 1739 | |
1740 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1740 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1741 | 1741 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1742 | 1742 | $primary_registration = NULL; |
1743 | 1743 | } |
@@ -1746,28 +1746,28 @@ discard block |
||
1746 | 1746 | } |
1747 | 1747 | |
1748 | 1748 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1749 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1750 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1751 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1749 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1750 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1751 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1752 | 1752 | $this->_template_args['phone'] = $attendee->phone(); |
1753 | 1753 | |
1754 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1755 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1754 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1755 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1756 | 1756 | |
1757 | 1757 | |
1758 | 1758 | //edit link |
1759 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1760 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1759 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1760 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1761 | 1761 | |
1762 | 1762 | //create link |
1763 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1763 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1764 | 1764 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1765 | 1765 | |
1766 | 1766 | $this->_template_args['att_check'] = $att_check; |
1767 | 1767 | |
1768 | 1768 | |
1769 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1770 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1769 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1770 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1771 | 1771 | } |
1772 | 1772 | |
1773 | 1773 | |
@@ -1780,7 +1780,7 @@ discard block |
||
1780 | 1780 | * @access protected |
1781 | 1781 | * @return void |
1782 | 1782 | */ |
1783 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1783 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1784 | 1784 | $REGM = EEM_Registration::instance(); |
1785 | 1785 | |
1786 | 1786 | $success = 1; |
@@ -1790,26 +1790,26 @@ discard block |
||
1790 | 1790 | $dtts = array(); |
1791 | 1791 | |
1792 | 1792 | //if empty _REG_ID then get out because there's nothing to do |
1793 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1793 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1794 | 1794 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1795 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1796 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1795 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1796 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1797 | 1797 | } |
1798 | 1798 | |
1799 | 1799 | //Checkboxes |
1800 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1800 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1801 | 1801 | // if array has more than one element than success message should be plural |
1802 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1802 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1803 | 1803 | // cycle thru checkboxes |
1804 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1804 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1805 | 1805 | |
1806 | 1806 | $REG = $REGM->get_one_by_ID($REG_ID); |
1807 | 1807 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1808 | - if ( $payment_count > 0 ) { |
|
1808 | + if ($payment_count > 0) { |
|
1809 | 1809 | $name = $REG->attendee()->full_name(); |
1810 | 1810 | $error = 1; |
1811 | 1811 | $success = 0; |
1812 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1812 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1813 | 1813 | continue; //can't trash this registration because it has payments. |
1814 | 1814 | } |
1815 | 1815 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1818,7 +1818,7 @@ discard block |
||
1818 | 1818 | $dtts = array_merge($dtts, $dtt); |
1819 | 1819 | |
1820 | 1820 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1821 | - if ( !$updated ) { |
|
1821 | + if ( ! $updated) { |
|
1822 | 1822 | $success = 0; |
1823 | 1823 | } else { |
1824 | 1824 | $success = 2; |
@@ -1833,7 +1833,7 @@ discard block |
||
1833 | 1833 | $tickets[$ticket->ID()] = $ticket; |
1834 | 1834 | $dtts = $ticket->get_many_related('Datetime'); |
1835 | 1835 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1836 | - if ( ! $updated ) { |
|
1836 | + if ( ! $updated) { |
|
1837 | 1837 | $success = 0; |
1838 | 1838 | } |
1839 | 1839 | |
@@ -1843,10 +1843,10 @@ discard block |
||
1843 | 1843 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1844 | 1844 | EEM_Datetime::instance()->update_sold($dtts); |
1845 | 1845 | |
1846 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1847 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1846 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1847 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1848 | 1848 | $overwrite_msgs = $error ? TRUE : FALSE; |
1849 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1849 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1850 | 1850 | } |
1851 | 1851 | |
1852 | 1852 | |
@@ -1870,16 +1870,16 @@ discard block |
||
1870 | 1870 | $success = 1; |
1871 | 1871 | |
1872 | 1872 | //Checkboxes |
1873 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1873 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1874 | 1874 | // if array has more than one element than success message should be plural |
1875 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1875 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1876 | 1876 | // cycle thru checkboxes |
1877 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1877 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1878 | 1878 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1879 | - if ( ! $REG instanceof EE_Registration ) |
|
1879 | + if ( ! $REG instanceof EE_Registration) |
|
1880 | 1880 | continue; |
1881 | 1881 | $deleted = $this->_delete_registration($REG); |
1882 | - if ( !$deleted ) { |
|
1882 | + if ( ! $deleted) { |
|
1883 | 1883 | $success = 0; |
1884 | 1884 | } |
1885 | 1885 | } |
@@ -1889,15 +1889,15 @@ discard block |
||
1889 | 1889 | $REG_ID = $this->_req_data['_REG_ID']; |
1890 | 1890 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1891 | 1891 | $deleted = $this->_delete_registration($REG); |
1892 | - if ( ! $deleted ) { |
|
1892 | + if ( ! $deleted) { |
|
1893 | 1893 | $success = 0; |
1894 | 1894 | } |
1895 | 1895 | |
1896 | 1896 | } |
1897 | 1897 | |
1898 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1899 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1900 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1898 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1899 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1900 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1901 | 1901 | } |
1902 | 1902 | |
1903 | 1903 | |
@@ -1909,31 +1909,31 @@ discard block |
||
1909 | 1909 | * @param EE_Registration $REG registration to be deleted permenantly |
1910 | 1910 | * @return boolean true = successful deletion, false = fail. |
1911 | 1911 | */ |
1912 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1912 | + protected function _delete_registration(EE_Registration $REG) { |
|
1913 | 1913 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1914 | 1914 | $TXN = $REG->get_first_related('Transaction'); |
1915 | 1915 | $REGS = $TXN->get_many_related('Registration'); |
1916 | 1916 | |
1917 | 1917 | $all_trashed = TRUE; |
1918 | - foreach ( $REGS as $registration ) { |
|
1919 | - if ( ! $registration->get('REG_deleted') ) |
|
1918 | + foreach ($REGS as $registration) { |
|
1919 | + if ( ! $registration->get('REG_deleted')) |
|
1920 | 1920 | $all_trashed = FALSE; |
1921 | 1921 | } |
1922 | 1922 | |
1923 | - if ( ! $all_trashed ) { |
|
1924 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1923 | + if ( ! $all_trashed) { |
|
1924 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1925 | 1925 | return false; |
1926 | 1926 | } |
1927 | 1927 | |
1928 | 1928 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1929 | - foreach ( $REGS as $registration ) { |
|
1929 | + foreach ($REGS as $registration) { |
|
1930 | 1930 | |
1931 | 1931 | //delete related answers |
1932 | 1932 | $registration->delete_related_permanently('Answer'); |
1933 | 1933 | |
1934 | 1934 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1935 | 1935 | $attendee = $registration->get_first_related('Attendee'); |
1936 | - if ( $attendee instanceof EE_Attendee ) { |
|
1936 | + if ($attendee instanceof EE_Attendee) { |
|
1937 | 1937 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1938 | 1938 | } |
1939 | 1939 | |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | //now delete permanently the checkins related to this registration. |
1944 | 1944 | $registration->delete_related_permanently('Checkin'); |
1945 | 1945 | |
1946 | - if ( $registration->ID() === $REG->ID() ) |
|
1946 | + if ($registration->ID() === $REG->ID()) |
|
1947 | 1947 | continue; //we don't want to delete permanently the existing registration just yet. |
1948 | 1948 | |
1949 | 1949 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -1976,34 +1976,34 @@ discard block |
||
1976 | 1976 | * @return void |
1977 | 1977 | */ |
1978 | 1978 | public function new_registration() { |
1979 | - if ( ! $this->_set_reg_event() ) { |
|
1980 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
1979 | + if ( ! $this->_set_reg_event()) { |
|
1980 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
1981 | 1981 | } |
1982 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
1982 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
1983 | 1983 | |
1984 | 1984 | // gotta start with a clean slate if we're not coming here via ajax |
1985 | - if ( ! defined('DOING_AJAX' ) && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ))) { |
|
1986 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
1985 | + if ( ! defined('DOING_AJAX') && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))) { |
|
1986 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
1987 | 1987 | } |
1988 | 1988 | |
1989 | - $this->_template_args['event_name'] = '' ; |
|
1989 | + $this->_template_args['event_name'] = ''; |
|
1990 | 1990 | // event name |
1991 | - if ( $this->_reg_event ) { |
|
1991 | + if ($this->_reg_event) { |
|
1992 | 1992 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
1993 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
1994 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1995 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1993 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
1994 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1995 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1996 | 1996 | } |
1997 | 1997 | |
1998 | 1998 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
1999 | 1999 | |
2000 | - if ( defined('DOING_AJAX' ) ) |
|
2000 | + if (defined('DOING_AJAX')) |
|
2001 | 2001 | $this->_return_json(); |
2002 | 2002 | |
2003 | 2003 | |
2004 | 2004 | // grab header |
2005 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2006 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2005 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2006 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2007 | 2007 | |
2008 | 2008 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2009 | 2009 | // the details template wrapper |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | */ |
2022 | 2022 | protected function _get_registration_step_content() { |
2023 | 2023 | |
2024 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php'; |
|
2024 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php'; |
|
2025 | 2025 | $template_args = array( |
2026 | 2026 | 'title' => '', |
2027 | 2027 | 'content' => '', |
@@ -2042,11 +2042,11 @@ discard block |
||
2042 | 2042 | |
2043 | 2043 | //if the cart is empty then we know we're at step one so we'll display ticket selector |
2044 | 2044 | $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
2045 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2046 | - switch ( $step ) { |
|
2045 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2046 | + switch ($step) { |
|
2047 | 2047 | case 'ticket' : |
2048 | 2048 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2049 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2049 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2050 | 2050 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2051 | 2051 | $template_args['show_notification_toggle'] = FALSE; |
2052 | 2052 | break; |
@@ -2059,9 +2059,9 @@ discard block |
||
2059 | 2059 | break; |
2060 | 2060 | } |
2061 | 2061 | |
2062 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2062 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2063 | 2063 | |
2064 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
2064 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
2065 | 2065 | } |
2066 | 2066 | |
2067 | 2067 | |
@@ -2075,11 +2075,11 @@ discard block |
||
2075 | 2075 | * @return boolean |
2076 | 2076 | */ |
2077 | 2077 | private function _set_reg_event() { |
2078 | - if ( is_object( $this->_reg_event )) { |
|
2078 | + if (is_object($this->_reg_event)) { |
|
2079 | 2079 | return TRUE; |
2080 | 2080 | } |
2081 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2082 | - if ( ! $EVT_ID ) { |
|
2081 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2082 | + if ( ! $EVT_ID) { |
|
2083 | 2083 | return FALSE; |
2084 | 2084 | } |
2085 | 2085 | |
@@ -2100,59 +2100,59 @@ discard block |
||
2100 | 2100 | public function process_reg_step() { |
2101 | 2101 | |
2102 | 2102 | $this->_set_reg_event(); |
2103 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2103 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2104 | 2104 | |
2105 | 2105 | //what step are we on? |
2106 | - $cart = EE_Registry::instance()->SSN->get_session_data( 'cart' ); |
|
2107 | - $step = empty( $cart ) ? 'ticket' : 'questions'; |
|
2106 | + $cart = EE_Registry::instance()->SSN->get_session_data('cart'); |
|
2107 | + $step = empty($cart) ? 'ticket' : 'questions'; |
|
2108 | 2108 | |
2109 | 2109 | //if doing ajax then we need to verify the nonce |
2110 | - if ( 'DOING_AJAX' ) { |
|
2111 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2112 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2110 | + if ('DOING_AJAX') { |
|
2111 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2112 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2113 | 2113 | } |
2114 | 2114 | |
2115 | - switch ( $step ) { |
|
2115 | + switch ($step) { |
|
2116 | 2116 | case 'ticket' : |
2117 | 2117 | //process ticket selection |
2118 | 2118 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2119 | - if ( $success ) { |
|
2120 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2119 | + if ($success) { |
|
2120 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2121 | 2121 | } else { |
2122 | 2122 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2123 | 2123 | } |
2124 | - if ( defined('DOING_AJAX') ) { |
|
2124 | + if (defined('DOING_AJAX')) { |
|
2125 | 2125 | $this->new_registration(); //display next step |
2126 | 2126 | } else { |
2127 | 2127 | $query_args['action'] = 'new_registration'; |
2128 | 2128 | $query_args['processing_registration'] = true; |
2129 | 2129 | $query_args['event_id'] = $this->_reg_event->ID(); |
2130 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2130 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2131 | 2131 | } |
2132 | 2132 | break; |
2133 | 2133 | case 'questions' : |
2134 | 2134 | //process registration |
2135 | 2135 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2136 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2136 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2137 | 2137 | $query_args = array( |
2138 | 2138 | 'action' => 'new_registration', |
2139 | 2139 | 'processing_registration' => true, |
2140 | 2140 | 'event_id' => $this->_reg_event->ID() |
2141 | 2141 | ); |
2142 | 2142 | |
2143 | - if ( defined('DOING_AJAX' )) { |
|
2143 | + if (defined('DOING_AJAX')) { |
|
2144 | 2144 | //display registration form again because there are errors (maybe validation?) |
2145 | 2145 | $this->new_registration(); |
2146 | 2146 | return; |
2147 | 2147 | } else { |
2148 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2148 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2149 | 2149 | return; |
2150 | 2150 | } |
2151 | 2151 | } |
2152 | 2152 | /** @type EE_Transaction_Payments $transaction_payments */ |
2153 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2153 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2154 | 2154 | // maybe update status, and make sure to save transaction if not done already |
2155 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2155 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2156 | 2156 | $transaction->save(); |
2157 | 2157 | } |
2158 | 2158 | $query_args = array( |
@@ -2160,8 +2160,8 @@ discard block |
||
2160 | 2160 | 'TXN_ID' => $transaction->ID(), |
2161 | 2161 | 'page' => 'espresso_transactions' |
2162 | 2162 | ); |
2163 | - EE_Error::add_success( __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') ); |
|
2164 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2163 | + EE_Error::add_success(__('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso')); |
|
2164 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2165 | 2165 | break; |
2166 | 2166 | } |
2167 | 2167 | |
@@ -2181,7 +2181,7 @@ discard block |
||
2181 | 2181 | * @return void |
2182 | 2182 | */ |
2183 | 2183 | protected function _attendee_contact_list_table() { |
2184 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2184 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2185 | 2185 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2186 | 2186 | $this->display_admin_list_table_page_with_no_sidebar(); |
2187 | 2187 | } |
@@ -2196,13 +2196,13 @@ discard block |
||
2196 | 2196 | * @access public |
2197 | 2197 | * @return array |
2198 | 2198 | */ |
2199 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2199 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2200 | 2200 | |
2201 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2201 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2202 | 2202 | // start with an empty array |
2203 | 2203 | $attendees = array(); |
2204 | 2204 | |
2205 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2205 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2206 | 2206 | $ATT_MDL = EEM_Attendee::instance(); |
2207 | 2207 | |
2208 | 2208 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2230,47 +2230,47 @@ discard block |
||
2230 | 2230 | $orderby = 'ATT_lname'; |
2231 | 2231 | } |
2232 | 2232 | |
2233 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2233 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2234 | 2234 | |
2235 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2236 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2237 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2235 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2236 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2237 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2238 | 2238 | |
2239 | 2239 | $_where = array(); |
2240 | 2240 | |
2241 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2242 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2241 | + if (isset($this->_req_data['s'])) { |
|
2242 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2243 | 2243 | $_where['OR'] = array( |
2244 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2245 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2246 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2247 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2248 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2249 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2250 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2251 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2252 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2253 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2254 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2255 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2256 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2257 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2258 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2259 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2260 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2244 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2245 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2246 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2247 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2248 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2249 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2250 | + 'ATT_email' => array('LIKE', $sstr), |
|
2251 | + 'ATT_address' => array('LIKE', $sstr), |
|
2252 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2253 | + 'ATT_city' => array('LIKE', $sstr), |
|
2254 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2255 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2256 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2257 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2258 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2259 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2260 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2261 | 2261 | ); |
2262 | 2262 | } |
2263 | 2263 | |
2264 | 2264 | |
2265 | - $offset = ($current_page-1)*$per_page; |
|
2266 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2265 | + $offset = ($current_page - 1) * $per_page; |
|
2266 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2267 | 2267 | |
2268 | - if ( $trash ) { |
|
2269 | - $_where['status'] = array( '!=', 'publish' ); |
|
2270 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2268 | + if ($trash) { |
|
2269 | + $_where['status'] = array('!=', 'publish'); |
|
2270 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2271 | 2271 | } else { |
2272 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2273 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2272 | + $_where['status'] = array('IN', array('publish')); |
|
2273 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2274 | 2274 | } |
2275 | 2275 | |
2276 | 2276 | return $all_attendees; |
@@ -2287,10 +2287,10 @@ discard block |
||
2287 | 2287 | */ |
2288 | 2288 | protected function _resend_registration() { |
2289 | 2289 | $this->_process_resend_registration(); |
2290 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2290 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2291 | 2291 | 'action' => 'default' |
2292 | 2292 | ); |
2293 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2293 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2294 | 2294 | } |
2295 | 2295 | |
2296 | 2296 | |
@@ -2298,17 +2298,17 @@ discard block |
||
2298 | 2298 | |
2299 | 2299 | |
2300 | 2300 | |
2301 | - public function _registrations_report(){ |
|
2302 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2301 | + public function _registrations_report() { |
|
2302 | + EE_Registry::instance()->load_helper('File'); |
|
2303 | 2303 | $new_request_args = array( |
2304 | 2304 | 'export' => 'report', |
2305 | 2305 | 'action' => 'registrations_report_for_event', |
2306 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2306 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2307 | 2307 | ); |
2308 | 2308 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2309 | 2309 | |
2310 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2311 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2310 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2311 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2312 | 2312 | $EE_Export = EE_Export::instance($this->_req_data); |
2313 | 2313 | $EE_Export->export(); |
2314 | 2314 | } |
@@ -2316,19 +2316,19 @@ discard block |
||
2316 | 2316 | |
2317 | 2317 | |
2318 | 2318 | |
2319 | - public function _contact_list_export(){ |
|
2320 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2321 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2322 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2319 | + public function _contact_list_export() { |
|
2320 | + EE_Registry::instance()->load_helper('File'); |
|
2321 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2322 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2323 | 2323 | $EE_Export = EE_Export::instance($this->_req_data); |
2324 | 2324 | $EE_Export->export_attendees(); |
2325 | 2325 | } |
2326 | 2326 | } |
2327 | 2327 | |
2328 | - public function _contact_list_report(){ |
|
2329 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2330 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2331 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2328 | + public function _contact_list_report() { |
|
2329 | + EE_Registry::instance()->load_helper('File'); |
|
2330 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2331 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2332 | 2332 | $EE_Export = EE_Export::instance($this->_req_data); |
2333 | 2333 | $EE_Export->report_attendees(); |
2334 | 2334 | } |
@@ -2347,73 +2347,73 @@ discard block |
||
2347 | 2347 | * @return void |
2348 | 2348 | */ |
2349 | 2349 | protected function _duplicate_attendee() { |
2350 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2350 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2351 | 2351 | //verify we have necessary info |
2352 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2353 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2354 | - $query_args = array( 'action' => $action ); |
|
2352 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2353 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2354 | + $query_args = array('action' => $action); |
|
2355 | 2355 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2356 | 2356 | } |
2357 | 2357 | |
2358 | 2358 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2359 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2359 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2360 | 2360 | $attendee = $registration->attendee(); |
2361 | 2361 | |
2362 | 2362 | //remove relation of existing attendee on registration |
2363 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2363 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2364 | 2364 | //new attendee |
2365 | 2365 | $new_attendee = clone $attendee; |
2366 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2366 | + $new_attendee->set('ATT_ID', 0); |
|
2367 | 2367 | $new_attendee->save(); |
2368 | 2368 | |
2369 | 2369 | //add new attendee to reg |
2370 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2370 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2371 | 2371 | |
2372 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2372 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2373 | 2373 | |
2374 | 2374 | //redirect to edit page for attendee |
2375 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2375 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2376 | 2376 | |
2377 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2377 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2378 | 2378 | } |
2379 | 2379 | |
2380 | 2380 | |
2381 | 2381 | //related to cpt routes |
2382 | 2382 | protected function _insert_update_cpt_item($post_id, $post) { |
2383 | 2383 | $success = true; |
2384 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2384 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2385 | 2385 | //for attendee updates |
2386 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2386 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2387 | 2387 | //note we should only be UPDATING attendees at this point. |
2388 | 2388 | $updated_fields = array( |
2389 | 2389 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2390 | 2390 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2391 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2391 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2392 | 2392 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2393 | 2393 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2394 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2395 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2396 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2397 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2398 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2399 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2394 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2395 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2396 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2397 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2398 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2399 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2400 | 2400 | ); |
2401 | - foreach ( $updated_fields as $field => $value ) { |
|
2401 | + foreach ($updated_fields as $field => $value) { |
|
2402 | 2402 | $attendee->set($field, $value); |
2403 | 2403 | } |
2404 | 2404 | |
2405 | 2405 | $success = $attendee->save(); |
2406 | 2406 | |
2407 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2408 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2409 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2410 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2407 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2408 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2409 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2410 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2411 | 2411 | } |
2412 | 2412 | } |
2413 | 2413 | } |
2414 | 2414 | |
2415 | - if ( $success === FALSE ) |
|
2416 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2415 | + if ($success === FALSE) |
|
2416 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2417 | 2417 | |
2418 | 2418 | } |
2419 | 2419 | |
@@ -2433,17 +2433,17 @@ discard block |
||
2433 | 2433 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2434 | 2434 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2435 | 2435 | |
2436 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2437 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2436 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2437 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2438 | 2438 | } |
2439 | 2439 | |
2440 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2440 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2441 | 2441 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2442 | 2442 | } |
2443 | 2443 | |
2444 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2445 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2446 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2444 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2445 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2446 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2447 | 2447 | } |
2448 | 2448 | |
2449 | 2449 | |
@@ -2452,10 +2452,10 @@ discard block |
||
2452 | 2452 | * @param WP_Post $post wp post object |
2453 | 2453 | * @return string attendee contact info ( and form ) |
2454 | 2454 | */ |
2455 | - public function attendee_contact_info( $post ) { |
|
2455 | + public function attendee_contact_info($post) { |
|
2456 | 2456 | //get attendee object ( should already have it ) |
2457 | 2457 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2458 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2458 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2459 | 2459 | EEH_Template::display_template($template, $this->_template_args); |
2460 | 2460 | } |
2461 | 2461 | |
@@ -2471,12 +2471,12 @@ discard block |
||
2471 | 2471 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2472 | 2472 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2473 | 2473 | new EE_Question_Form_Input( |
2474 | - EE_Question::new_instance( array( |
|
2474 | + EE_Question::new_instance(array( |
|
2475 | 2475 | 'QST_ID' => 0, |
2476 | 2476 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2477 | 2477 | 'QST_system' => 'admin-state' |
2478 | 2478 | )), |
2479 | - EE_Answer::new_instance( array( |
|
2479 | + EE_Answer::new_instance(array( |
|
2480 | 2480 | 'ANS_ID' => 0, |
2481 | 2481 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2482 | 2482 | )), |
@@ -2489,12 +2489,12 @@ discard block |
||
2489 | 2489 | )); |
2490 | 2490 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2491 | 2491 | new EE_Question_Form_Input( |
2492 | - EE_Question::new_instance( array( |
|
2492 | + EE_Question::new_instance(array( |
|
2493 | 2493 | 'QST_ID' => 0, |
2494 | 2494 | 'QST_display_text' => __('Country', 'event_espresso'), |
2495 | 2495 | 'QST_system' => 'admin-country' |
2496 | 2496 | )), |
2497 | - EE_Answer::new_instance( array( |
|
2497 | + EE_Answer::new_instance(array( |
|
2498 | 2498 | 'ANS_ID' => 0, |
2499 | 2499 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2500 | 2500 | )), |
@@ -2505,8 +2505,8 @@ discard block |
||
2505 | 2505 | 'append_qstn_id' => FALSE |
2506 | 2506 | ) |
2507 | 2507 | )); |
2508 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2509 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2508 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2509 | + EEH_Template::display_template($template, $this->_template_args); |
|
2510 | 2510 | |
2511 | 2511 | } |
2512 | 2512 | |
@@ -2516,11 +2516,11 @@ discard block |
||
2516 | 2516 | * @access protected |
2517 | 2517 | * @return void |
2518 | 2518 | */ |
2519 | - public function attendee_registrations_meta_box( $post ) { |
|
2519 | + public function attendee_registrations_meta_box($post) { |
|
2520 | 2520 | |
2521 | 2521 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2522 | 2522 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2523 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2523 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2524 | 2524 | EEH_Template::display_template($template, $this->_template_args); |
2525 | 2525 | |
2526 | 2526 | } |
@@ -2534,8 +2534,8 @@ discard block |
||
2534 | 2534 | * @return string html for new form. |
2535 | 2535 | */ |
2536 | 2536 | public function after_title_form_fields($post) { |
2537 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2538 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2537 | + if ($post->post_type == 'espresso_attendees') { |
|
2538 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2539 | 2539 | $template_args['attendee'] = $this->_cpt_model_obj; |
2540 | 2540 | EEH_Template::display_template($template, $template_args); |
2541 | 2541 | } |
@@ -2552,21 +2552,21 @@ discard block |
||
2552 | 2552 | * @access protected |
2553 | 2553 | * @return void |
2554 | 2554 | */ |
2555 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2555 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2556 | 2556 | |
2557 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2557 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2558 | 2558 | |
2559 | 2559 | $ATT_MDL = EEM_Attendee::instance(); |
2560 | 2560 | |
2561 | 2561 | $success = 1; |
2562 | 2562 | //Checkboxes |
2563 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2563 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2564 | 2564 | // if array has more than one element than success message should be plural |
2565 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2565 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2566 | 2566 | // cycle thru checkboxes |
2567 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2568 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2569 | - if ( !$updated ) { |
|
2567 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2568 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2569 | + if ( ! $updated) { |
|
2570 | 2570 | $success = 0; |
2571 | 2571 | } |
2572 | 2572 | } |
@@ -2575,18 +2575,18 @@ discard block |
||
2575 | 2575 | // grab single id and delete |
2576 | 2576 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2577 | 2577 | //get attendee |
2578 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2578 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2579 | 2579 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2580 | 2580 | $updated = $att->save(); |
2581 | - if ( ! $updated ) { |
|
2581 | + if ( ! $updated) { |
|
2582 | 2582 | $success = 0; |
2583 | 2583 | } |
2584 | 2584 | |
2585 | 2585 | } |
2586 | 2586 | |
2587 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2588 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2589 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2587 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2588 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2589 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2590 | 2590 | |
2591 | 2591 | } |
2592 | 2592 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -79,8 +81,9 @@ discard block |
||
79 | 81 | public function clear_comment_link( $link, $comment, $args ) { |
80 | 82 | //gotta make sure this only happens on this route |
81 | 83 | $post_type = get_post_type( $comment->comment_post_ID); |
82 | - if ( $post_type == 'espresso_attendees' ) |
|
83 | - return '#commentsdiv'; |
|
84 | + if ( $post_type == 'espresso_attendees' ) { |
|
85 | + return '#commentsdiv'; |
|
86 | + } |
|
84 | 87 | return $link; |
85 | 88 | } |
86 | 89 | |
@@ -834,9 +837,9 @@ discard block |
||
834 | 837 | |
835 | 838 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
836 | 839 | |
837 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
838 | - return TRUE; |
|
839 | - else { |
|
840 | + if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) { |
|
841 | + return TRUE; |
|
842 | + } else { |
|
840 | 843 | $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
841 | 844 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
842 | 845 | $this->_registration = NULL; |
@@ -933,7 +936,7 @@ discard block |
||
933 | 936 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
934 | 937 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
935 | 938 | )); |
936 | - }elseif($this_month_a || $this_month){ |
|
939 | + } elseif($this_month_a || $this_month){ |
|
937 | 940 | $this_month_r = date('m', current_time('timestamp')); |
938 | 941 | $days_this_month = date( 't', current_time('timestamp') ); |
939 | 942 | $_where['REG_date']= array('BETWEEN', |
@@ -941,18 +944,18 @@ discard block |
||
941 | 944 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
942 | 945 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
943 | 946 | )); |
944 | - }elseif($month_range){ |
|
947 | + } elseif($month_range){ |
|
945 | 948 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
946 | 949 | $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
947 | 950 | $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
948 | 951 | $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
949 | 952 | $_where['REG_date']= array('BETWEEN', |
950 | 953 | array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
951 | - }elseif($start_date && $end_date){ |
|
954 | + } elseif($start_date && $end_date){ |
|
952 | 955 | throw new EE_Error("not yet supported"); |
953 | - }elseif($start_date){ |
|
956 | + } elseif($start_date){ |
|
954 | 957 | throw new EE_Error("not yet supported"); |
955 | - }elseif($end_date){ |
|
958 | + } elseif($end_date){ |
|
956 | 959 | throw new EE_Error("not yet supported"); |
957 | 960 | } |
958 | 961 | |
@@ -1876,8 +1879,9 @@ discard block |
||
1876 | 1879 | // cycle thru checkboxes |
1877 | 1880 | while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
1878 | 1881 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1879 | - if ( ! $REG instanceof EE_Registration ) |
|
1880 | - continue; |
|
1882 | + if ( ! $REG instanceof EE_Registration ) { |
|
1883 | + continue; |
|
1884 | + } |
|
1881 | 1885 | $deleted = $this->_delete_registration($REG); |
1882 | 1886 | if ( !$deleted ) { |
1883 | 1887 | $success = 0; |
@@ -1916,8 +1920,9 @@ discard block |
||
1916 | 1920 | |
1917 | 1921 | $all_trashed = TRUE; |
1918 | 1922 | foreach ( $REGS as $registration ) { |
1919 | - if ( ! $registration->get('REG_deleted') ) |
|
1920 | - $all_trashed = FALSE; |
|
1923 | + if ( ! $registration->get('REG_deleted') ) { |
|
1924 | + $all_trashed = FALSE; |
|
1925 | + } |
|
1921 | 1926 | } |
1922 | 1927 | |
1923 | 1928 | if ( ! $all_trashed ) { |
@@ -1943,8 +1948,10 @@ discard block |
||
1943 | 1948 | //now delete permanently the checkins related to this registration. |
1944 | 1949 | $registration->delete_related_permanently('Checkin'); |
1945 | 1950 | |
1946 | - if ( $registration->ID() === $REG->ID() ) |
|
1947 | - continue; //we don't want to delete permanently the existing registration just yet. |
|
1951 | + if ( $registration->ID() === $REG->ID() ) { |
|
1952 | + continue; |
|
1953 | + } |
|
1954 | + //we don't want to delete permanently the existing registration just yet. |
|
1948 | 1955 | |
1949 | 1956 | //remove relation to transaction for these registrations if NOT the existing registrations |
1950 | 1957 | $registration->_remove_relations('Transaction'); |
@@ -1997,8 +2004,9 @@ discard block |
||
1997 | 2004 | |
1998 | 2005 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
1999 | 2006 | |
2000 | - if ( defined('DOING_AJAX' ) ) |
|
2001 | - $this->_return_json(); |
|
2007 | + if ( defined('DOING_AJAX' ) ) { |
|
2008 | + $this->_return_json(); |
|
2009 | + } |
|
2002 | 2010 | |
2003 | 2011 | |
2004 | 2012 | // grab header |
@@ -2412,8 +2420,9 @@ discard block |
||
2412 | 2420 | } |
2413 | 2421 | } |
2414 | 2422 | |
2415 | - if ( $success === FALSE ) |
|
2416 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2423 | + if ( $success === FALSE ) { |
|
2424 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2425 | + } |
|
2417 | 2426 | |
2418 | 2427 | } |
2419 | 2428 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | * |
94 | 94 | * @abstract |
95 | 95 | * @access protected |
96 | - * @return array |
|
96 | + * @return string[] |
|
97 | 97 | */ |
98 | 98 | protected function _get_table_filters() { |
99 | 99 | $filters = array(); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -244,10 +246,11 @@ discard block |
||
244 | 246 | */ |
245 | 247 | function column_ATT_email( EE_Transaction $item ){ |
246 | 248 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
247 | - if ( !empty( $attendee ) ) |
|
248 | - return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
249 | - else |
|
250 | - return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
|
249 | + if ( !empty( $attendee ) ) { |
|
250 | + return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
251 | + } else { |
|
252 | + return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
|
253 | + } |
|
251 | 254 | ; |
252 | 255 | } |
253 | 256 |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | - * @ link {@link http://www.eventespresso.com} |
|
12 | - * @ since 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Transactions Table class |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/admin_screens/Transactions_List_Table.class.php |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | + * @ link {@link http://www.eventespresso.com} |
|
12 | + * @ since 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Transactions Table class |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/admin_screens/Transactions_List_Table.class.php |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | |
25 | 25 | |
26 | 26 | class EE_Admin_Transactions_List_Table extends EE_Admin_List_Table { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function column_TXN_ID( EE_Transaction $item ){ |
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | 144 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
145 | 145 | |
146 | 146 | //txn timestamp |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | * @param \EE_Transaction $item |
276 | 276 | * @return string|void |
277 | 277 | */ |
278 | - function column_event_name( EE_Transaction $item ){ |
|
279 | - $actions = array(); |
|
278 | + function column_event_name( EE_Transaction $item ){ |
|
279 | + $actions = array(); |
|
280 | 280 | $event = $item->primary_registration()->get_first_related('Event'); |
281 | 281 | if ( !empty( $event ) ) { |
282 | 282 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -300,21 +300,21 @@ discard block |
||
300 | 300 | * @param \EE_Transaction $item |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - function column_actions( EE_Transaction $item ){ |
|
303 | + function column_actions( EE_Transaction $item ){ |
|
304 | 304 | |
305 | - $registration = $item->primary_registration(); |
|
306 | - $attendee = $registration->attendee(); |
|
305 | + $registration = $item->primary_registration(); |
|
306 | + $attendee = $registration->attendee(); |
|
307 | 307 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
308 | 308 | |
309 | - //Build row actions |
|
309 | + //Build row actions |
|
310 | 310 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
311 | 311 | $dl_invoice_lnk_url = $registration->invoice_url(); |
312 | 312 | $dl_receipt_lnk_url = $registration->receipt_url(); |
313 | 313 | $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
314 | 314 | $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
315 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
316 | - 'TXN_ID' => $item->ID() |
|
317 | - )); |
|
315 | + $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
316 | + 'TXN_ID' => $item->ID() |
|
317 | + )); |
|
318 | 318 | |
319 | 319 | //Build row actions |
320 | 320 | $view_lnk = ' |
@@ -349,8 +349,8 @@ discard block |
||
349 | 349 | $dl_receipt_lnk = ''; |
350 | 350 | } |
351 | 351 | |
352 | - //only show payment reminder link if the message type is active. |
|
353 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
352 | + //only show payment reminder link if the message type is active. |
|
353 | + if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
354 | 354 | $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
355 | 355 | <li> |
356 | 356 | <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
379 | - } |
|
379 | + } |
|
380 | 380 | |
381 | 381 | |
382 | 382 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param \EE_Admin_Page $admin_page |
34 | 34 | * @return EE_Admin_Transactions_List_Table |
35 | 35 | */ |
36 | - function __construct( EE_Admin_Page $admin_page ){ |
|
37 | - parent::__construct( $admin_page ); |
|
36 | + function __construct(EE_Admin_Page $admin_page) { |
|
37 | + parent::__construct($admin_page); |
|
38 | 38 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
39 | 39 | |
40 | 40 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | |
46 | 46 | protected function _setup_data() { |
47 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
48 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
49 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
47 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
48 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
49 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_columns = array( |
68 | - 'TXN_ID' => __( 'ID', 'event_espresso' ), |
|
69 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
70 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
71 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
72 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
73 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
74 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_ID' => __('ID', 'event_espresso'), |
|
69 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
70 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
71 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
72 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
73 | + 'event_name' => __('Event', 'event_espresso'), |
|
74 | + 'actions' => __('Actions', 'event_espresso') |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | $this->_sortable_columns = array( |
78 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
79 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
80 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
81 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
78 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
79 | + 'event_name' => array('event_name'=> FALSE), |
|
80 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
81 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | $this->_primary_column = 'TXN_ID'; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | |
90 | 90 | |
91 | - protected function _get_row_class( $item ) { |
|
92 | - $class = parent::_get_row_class( $item ); |
|
91 | + protected function _get_row_class($item) { |
|
92 | + $class = parent::_get_row_class($item); |
|
93 | 93 | //add status class |
94 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
95 | - if ( $this->_has_checkbox_column ) { |
|
94 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
95 | + if ($this->_has_checkbox_column) { |
|
96 | 96 | $class .= ' has-checkbox-column'; |
97 | 97 | } |
98 | 98 | return $class; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function _get_table_filters() { |
111 | 111 | $filters = array(); |
112 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
113 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
112 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
113 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
114 | 114 | ob_start(); |
115 | 115 | ?> |
116 | 116 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | |
130 | 130 | protected function _add_view_counts() { |
131 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
132 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
133 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
131 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
132 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
133 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -139,29 +139,29 @@ discard block |
||
139 | 139 | * @param \EE_Transaction $item |
140 | 140 | * @return string |
141 | 141 | */ |
142 | - function column_TXN_ID( EE_Transaction $item ){ |
|
143 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
144 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
142 | + function column_TXN_ID(EE_Transaction $item) { |
|
143 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
144 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
145 | 145 | |
146 | 146 | //txn timestamp |
147 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
147 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
148 | 148 | return $content; |
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
153 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
154 | 154 | //txn timestamp |
155 | 155 | // is TXN less than 2 hours old ? |
156 | 156 | if ( |
157 | - ( ( time() - EE_Registry::instance()->SSN->lifespan() ) |
|
158 | - < $item->datetime( false, true ) |
|
157 | + ((time() - EE_Registry::instance()->SSN->lifespan()) |
|
158 | + < $item->datetime(false, true) |
|
159 | 159 | ) |
160 | - && ( $item->failed() || $item->is_abandoned() ) |
|
160 | + && ($item->failed() || $item->is_abandoned()) |
|
161 | 161 | ) { |
162 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
162 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
163 | 163 | } else { |
164 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
164 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
165 | 165 | } |
166 | 166 | return $timestamp; |
167 | 167 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param \EE_Transaction $item |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - function column_cb($item ){ |
|
177 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
176 | + function column_cb($item) { |
|
177 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | * @param \EE_Transaction $item |
186 | 186 | * @return string |
187 | 187 | */ |
188 | - function column_TXN_timestamp( EE_Transaction $item ){ |
|
189 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
190 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
188 | + function column_TXN_timestamp(EE_Transaction $item) { |
|
189 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
190 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
191 | 191 | return $txn_date; |
192 | 192 | } |
193 | 193 | |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | * @param \EE_Transaction $item |
198 | 198 | * @return string |
199 | 199 | */ |
200 | - function column_TXN_total( EE_Transaction $item ){ |
|
201 | - if ( $item->get('TXN_total') > 0 ) { |
|
202 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
200 | + function column_TXN_total(EE_Transaction $item) { |
|
201 | + if ($item->get('TXN_total') > 0) { |
|
202 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
203 | 203 | } else { |
204 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
204 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -211,19 +211,19 @@ discard block |
||
211 | 211 | * @param \EE_Transaction $item |
212 | 212 | * @return mixed|string |
213 | 213 | */ |
214 | - function column_TXN_paid( EE_Transaction $item ){ |
|
214 | + function column_TXN_paid(EE_Transaction $item) { |
|
215 | 215 | $transaction_total = $item->get('TXN_total'); |
216 | 216 | $transaction_paid = $item->get('TXN_paid'); |
217 | 217 | |
218 | - if (( $transaction_total > 0 ) && ( $transaction_paid >= $transaction_total )) { |
|
218 | + if (($transaction_total > 0) && ($transaction_paid >= $transaction_total)) { |
|
219 | 219 | // paid in full |
220 | 220 | $span_class = 'txn-overview-full-payment-spn'; |
221 | 221 | |
222 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid > 0 )) { |
|
222 | + } elseif (($transaction_total > 0) && ($transaction_paid > 0)) { |
|
223 | 223 | // monies owing |
224 | 224 | $span_class = 'txn-overview-part-payment-spn'; |
225 | 225 | |
226 | - } elseif (( $transaction_total > 0 ) && ( $transaction_paid == 0 )) { |
|
226 | + } elseif (($transaction_total > 0) && ($transaction_paid == 0)) { |
|
227 | 227 | // no payments made |
228 | 228 | $span_class = 'txn-overview-no-payment-spn'; |
229 | 229 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $transaction_paid = 0; |
233 | 233 | } |
234 | 234 | |
235 | - return '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
235 | + return '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
236 | 236 | |
237 | 237 | } |
238 | 238 | |
@@ -242,13 +242,13 @@ discard block |
||
242 | 242 | * @param \EE_Transaction $item |
243 | 243 | * @return string|void |
244 | 244 | */ |
245 | - function column_ATT_fname( EE_Transaction $item ){ |
|
245 | + function column_ATT_fname(EE_Transaction $item) { |
|
246 | 246 | $primary_reg = $item->primary_registration(); |
247 | 247 | $attendee = $primary_reg->get_first_related('Attendee'); |
248 | - if ( $attendee instanceof EE_Attendee ) { |
|
249 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
250 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
251 | - $content .= '<br>' . $attendee->email(); |
|
248 | + if ($attendee instanceof EE_Attendee) { |
|
249 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
250 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
251 | + $content .= '<br>'.$attendee->email(); |
|
252 | 252 | return $content; |
253 | 253 | } |
254 | 254 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | * @param \EE_Transaction $item |
261 | 261 | * @return string|void |
262 | 262 | */ |
263 | - function column_ATT_email( EE_Transaction $item ){ |
|
263 | + function column_ATT_email(EE_Transaction $item) { |
|
264 | 264 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
265 | - if ( !empty( $attendee ) ) |
|
266 | - return '<a href="mailto:' . $attendee->get('ATT_email') . '">' . $attendee->get('ATT_email') . '</a>'; |
|
265 | + if ( ! empty($attendee)) |
|
266 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
267 | 267 | else |
268 | 268 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
269 | 269 | ; |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | * @param \EE_Transaction $item |
276 | 276 | * @return string|void |
277 | 277 | */ |
278 | - function column_event_name( EE_Transaction $item ){ |
|
278 | + function column_event_name(EE_Transaction $item) { |
|
279 | 279 | $actions = array(); |
280 | 280 | $event = $item->primary_registration()->get_first_related('Event'); |
281 | - if ( !empty( $event ) ) { |
|
282 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
281 | + if ( ! empty($event)) { |
|
282 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
283 | 283 | $event_name = $event->get('EVT_name'); |
284 | 284 | |
285 | 285 | //filter this view by transactions for this event |
286 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
287 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
288 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
286 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
287 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
288 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
289 | 289 | } |
290 | 290 | |
291 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
291 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
292 | 292 | } else { |
293 | 293 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
294 | 294 | } |
@@ -300,36 +300,36 @@ discard block |
||
300 | 300 | * @param \EE_Transaction $item |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - function column_actions( EE_Transaction $item ){ |
|
303 | + function column_actions(EE_Transaction $item) { |
|
304 | 304 | |
305 | 305 | $registration = $item->primary_registration(); |
306 | 306 | $attendee = $registration->attendee(); |
307 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
307 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
308 | 308 | |
309 | 309 | //Build row actions |
310 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
310 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
311 | 311 | $dl_invoice_lnk_url = $registration->invoice_url(); |
312 | 312 | $dl_receipt_lnk_url = $registration->receipt_url(); |
313 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
314 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
315 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
313 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
314 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
315 | + $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array( |
|
316 | 316 | 'TXN_ID' => $item->ID() |
317 | 317 | )); |
318 | 318 | |
319 | 319 | //Build row actions |
320 | 320 | $view_lnk = ' |
321 | 321 | <li> |
322 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
322 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
323 | 323 | <span class="dashicons dashicons-cart"></span> |
324 | 324 | </a> |
325 | 325 | </li>'; |
326 | 326 | |
327 | 327 | |
328 | 328 | //only show invoice link if message type is active. |
329 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
329 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
330 | 330 | $dl_invoice_lnk = ' |
331 | 331 | <li> |
332 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
332 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
333 | 333 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
334 | 334 | </a> |
335 | 335 | </li>'; |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | //only show receipt link if message type is active. |
341 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
341 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
342 | 342 | $dl_receipt_lnk = ' |
343 | 343 | <li> |
344 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
344 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
345 | 345 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
346 | 346 | </a> |
347 | 347 | </li>'; |
@@ -350,10 +350,10 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | //only show payment reminder link if the message type is active. |
353 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
354 | - $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ? ' |
|
353 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
354 | + $send_pay_lnk = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder') ? ' |
|
355 | 355 | <li> |
356 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
356 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
357 | 357 | <span class="dashicons dashicons-email-alt"></span> |
358 | 358 | </a> |
359 | 359 | </li>' : ''; |
@@ -362,20 +362,20 @@ discard block |
||
362 | 362 | $send_pay_lnk = ''; |
363 | 363 | } |
364 | 364 | |
365 | - $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
365 | + $view_reg_lnk = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
366 | 366 | <li> |
367 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
367 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
368 | 368 | <span class="dashicons dashicons-clipboard"></span> |
369 | 369 | </a> |
370 | 370 | </li>' : ''; |
371 | 371 | |
372 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_messages', 'view_filtered_messages' ) ) { |
|
373 | - $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>'; |
|
372 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_messages', 'view_filtered_messages')) { |
|
373 | + $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>'; |
|
374 | 374 | } else { |
375 | 375 | $view_related_messages_lnk = ''; |
376 | 376 | } |
377 | 377 | |
378 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
378 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 |
@@ -94,7 +94,7 @@ |
||
94 | 94 | * Handles attaching Message Templates to the Event on save. |
95 | 95 | * @param EE_Event $evtobj EE event object |
96 | 96 | * @param array $data The request data from the form |
97 | - * @return bool success or fail |
|
97 | + * @return integer success or fail |
|
98 | 98 | */ |
99 | 99 | public function attach_evt_message_templates( $evtobj, $data ) { |
100 | 100 | //first we remove all existing relations on the Event for message types. |
@@ -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 | /** |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
33 | + public function __construct(EE_Admin_Page $adminpage) { |
|
34 | 34 | /** |
35 | 35 | * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages |
36 | 36 | */ |
37 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) { |
|
37 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
41 | - parent::__construct( $adminpage ); |
|
40 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
41 | + parent::__construct($adminpage); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function _extend_properties() { |
51 | 51 | |
52 | - define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' ); |
|
52 | + define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
53 | 53 | $this->_ajax_func = array( |
54 | 54 | 'ee_msgs_create_new_custom' => 'create_new_custom' |
55 | 55 | ); |
56 | 56 | $this->_metaboxes = array( |
57 | 57 | 0 => array( |
58 | - 'page_route' => array('edit','create_new'), |
|
58 | + 'page_route' => array('edit', 'create_new'), |
|
59 | 59 | 'func' => 'messages_metabox', |
60 | 60 | 'label' => __('Notifications', 'event_espresso'), |
61 | 61 | 'priority' => 'high' |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $this->_scripts_styles = array( |
67 | 67 | 'registers' => array( |
68 | 68 | 'events_msg_admin' => array( |
69 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
69 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js', |
|
70 | 70 | 'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array') |
71 | 71 | ), |
72 | 72 | 'events_msg_admin_css' => array( |
73 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
73 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css', |
|
74 | 74 | 'type' => 'css' |
75 | 75 | ) |
76 | 76 | ), |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | - public function caf_updates( $update_callbacks ) { |
|
86 | - $update_callbacks[] = array( $this, 'attach_evt_message_templates' ); |
|
85 | + public function caf_updates($update_callbacks) { |
|
86 | + $update_callbacks[] = array($this, 'attach_evt_message_templates'); |
|
87 | 87 | return $update_callbacks; |
88 | 88 | } |
89 | 89 | |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | * @param array $data The request data from the form |
97 | 97 | * @return bool success or fail |
98 | 98 | */ |
99 | - public function attach_evt_message_templates( $evtobj, $data ) { |
|
99 | + public function attach_evt_message_templates($evtobj, $data) { |
|
100 | 100 | //first we remove all existing relations on the Event for message types. |
101 | 101 | $evtobj->_remove_relations('Message_Template_Group'); |
102 | 102 | |
103 | 103 | //now let's just loop throught the selected templates and add relations! |
104 | - foreach( $data['event_message_templates_relation'] as $grp_ID ) { |
|
105 | - $evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' ); |
|
104 | + foreach ($data['event_message_templates_relation'] as $grp_ID) { |
|
105 | + $evtobj->_add_relation_to($grp_ID, 'Message_Template_Group'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | //now save |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | |
116 | 116 | //let's get the active messengers (b/c messenger objects have the active message templates) |
117 | 117 | //convert 'evt_id' to 'EVT_ID' |
118 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL; |
|
119 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID']; |
|
118 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; |
|
119 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID']; |
|
120 | 120 | |
121 | - $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID']; |
|
121 | + $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID']; |
|
122 | 122 | |
123 | 123 | |
124 | 124 | $EEM_controller = new EE_messages; |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | //empty messengers? |
129 | 129 | //Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected. |
130 | - if ( empty( $active_messengers ) ) { |
|
131 | - $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL ); |
|
132 | - $error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events. You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>'); |
|
133 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
134 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
130 | + if (empty($active_messengers)) { |
|
131 | + $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL); |
|
132 | + $error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events. You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>'); |
|
133 | + $error_content = '<div class="error"><p>'.$error_msg.'</p></div>'; |
|
134 | + $internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>'; |
|
135 | 135 | |
136 | 136 | echo $error_content; |
137 | 137 | echo $internal_content; |
@@ -140,36 +140,36 @@ discard block |
||
140 | 140 | |
141 | 141 | $event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; |
142 | 142 | //get content for active messengers |
143 | - foreach ( $active_messengers as $name => $messenger ) { |
|
143 | + foreach ($active_messengers as $name => $messenger) { |
|
144 | 144 | //first check if there are any active message types for this messenger. |
145 | - $active_mts = $EEM_controller->get_active_message_types_per_messenger( $name ); |
|
146 | - if ( empty( $active_mts ) ) { |
|
145 | + $active_mts = $EEM_controller->get_active_message_types_per_messenger($name); |
|
146 | + if (empty($active_mts)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
150 | - $tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) ); |
|
150 | + $tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id)); |
|
151 | 151 | |
152 | - if ( ! empty( $tcont ) ) { |
|
152 | + if ( ! empty($tcont)) { |
|
153 | 153 | $tabs[$name] = $tcont; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | 157 | |
158 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
158 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
159 | 159 | //we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. |
160 | 160 | $tabbed_content = EEH_Tabbed_Content::display($tabs); |
161 | - if ( is_wp_error($tabbed_content) ) { |
|
161 | + if (is_wp_error($tabbed_content)) { |
|
162 | 162 | $tabbed_content = $tabbed_content->get_error_message(); |
163 | 163 | } |
164 | 164 | |
165 | 165 | $notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey"> |
166 | - <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span> |
|
166 | + <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span> |
|
167 | 167 | </div><div class="ee-notices"></div>'; |
168 | 168 | |
169 | - if ( defined('DOING_AJAX' ) ) |
|
169 | + if (defined('DOING_AJAX')) |
|
170 | 170 | return $tabbed_content; |
171 | 171 | |
172 | - echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; |
|
172 | + echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>'; |
|
173 | 173 | |
174 | 174 | } |
175 | 175 | |
@@ -183,22 +183,22 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function create_new_custom() { |
185 | 185 | |
186 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) { |
|
187 | - wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) ); |
|
186 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
187 | + wp_die(__('You don\'t have privileges to do this action', 'event_espresso')); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | //let's clean up the _POST global a bit for downstream usage of name and description. |
191 | - $_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : ''; |
|
192 | - $_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : ''; |
|
191 | + $_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : ''; |
|
192 | + $_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : ''; |
|
193 | 193 | |
194 | 194 | |
195 | 195 | //set EE_Admin_Page object (see method details in EE_Admin_Hooks parent |
196 | 196 | $this->_set_page_object(); |
197 | 197 | |
198 | 198 | //is this a template switch if so EE_Admin_Page child needs this object |
199 | - $this->_page_object->set_hook_object( $this ); |
|
199 | + $this->_page_object->set_hook_object($this); |
|
200 | 200 | |
201 | - $this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] ); |
|
201 | + $this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @return string (admin_footer contents) |
214 | 214 | */ |
215 | 215 | public function edit_admin_footer() { |
216 | - $template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php'; |
|
216 | + $template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php'; |
|
217 | 217 | EEH_Template::display_template($template_path, array()); |
218 | 218 | } |
219 | 219 |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -166,8 +167,9 @@ discard block |
||
166 | 167 | <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span> |
167 | 168 | </div><div class="ee-notices"></div>'; |
168 | 169 | |
169 | - if ( defined('DOING_AJAX' ) ) |
|
170 | - return $tabbed_content; |
|
170 | + if ( defined('DOING_AJAX' ) ) { |
|
171 | + return $tabbed_content; |
|
172 | + } |
|
171 | 173 | |
172 | 174 | echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; |
173 | 175 |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | /** |
479 | 479 | * generates Business Report showing total registratiopns per day |
480 | 480 | * @access private |
481 | - * @return void |
|
481 | + * @return string |
|
482 | 482 | */ |
483 | 483 | private function _registrations_per_day_report( $period = '-1 month' ) { |
484 | 484 | |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | /** |
536 | 536 | * generates Business Report showing total registratiopns per event |
537 | 537 | * @access private |
538 | - * @return void |
|
538 | + * @return string |
|
539 | 539 | */ |
540 | 540 | private function _get_registrations_per_event_report( $period = '-1 month' ) { |
541 | 541 | |
@@ -650,8 +650,6 @@ discard block |
||
650 | 650 | /** |
651 | 651 | * handles toggleing the checkin status for the registration, |
652 | 652 | * @access protected |
653 | - * @param boolean $check_in |
|
654 | - * @return void |
|
655 | 653 | */ |
656 | 654 | protected function _toggle_checkin_status() { |
657 | 655 | //first let's get the query args out of the way for the redirect |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | |
448 | 448 | /** |
449 | 449 | * generates Business Reports regarding Registrations |
450 | - * @access protected |
|
451 | - * @return void |
|
452 | - */ |
|
450 | + * @access protected |
|
451 | + * @return void |
|
452 | + */ |
|
453 | 453 | protected function _registration_reports() { |
454 | 454 | |
455 | 455 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -477,9 +477,9 @@ discard block |
||
477 | 477 | |
478 | 478 | /** |
479 | 479 | * generates Business Report showing total registratiopns per day |
480 | - * @access private |
|
481 | - * @return void |
|
482 | - */ |
|
480 | + * @access private |
|
481 | + * @return void |
|
482 | + */ |
|
483 | 483 | private function _registrations_per_day_report( $period = '-1 month' ) { |
484 | 484 | |
485 | 485 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
@@ -534,9 +534,9 @@ discard block |
||
534 | 534 | |
535 | 535 | /** |
536 | 536 | * generates Business Report showing total registratiopns per event |
537 | - * @access private |
|
538 | - * @return void |
|
539 | - */ |
|
537 | + * @access private |
|
538 | + * @return void |
|
539 | + */ |
|
540 | 540 | private function _get_registrations_per_event_report( $period = '-1 month' ) { |
541 | 541 | |
542 | 542 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | |
650 | 650 | /** |
651 | 651 | * handles toggleing the checkin status for the registration, |
652 | - * @access protected |
|
653 | - * @param boolean $check_in |
|
654 | - * @return void |
|
655 | - */ |
|
652 | + * @access protected |
|
653 | + * @param boolean $check_in |
|
654 | + * @return void |
|
655 | + */ |
|
656 | 656 | protected function _toggle_checkin_status() { |
657 | 657 | //first let's get the query args out of the way for the redirect |
658 | 658 | $query_args = array( |
@@ -773,9 +773,9 @@ discard block |
||
773 | 773 | |
774 | 774 | /** |
775 | 775 | * generates HTML for the Event Registrations List Table |
776 | - * @access protected |
|
777 | - * @return void |
|
778 | - */ |
|
776 | + * @access protected |
|
777 | + * @return void |
|
778 | + */ |
|
779 | 779 | protected function _event_registrations_list_table() { |
780 | 780 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
781 | 781 | $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
@@ -805,11 +805,11 @@ discard block |
||
805 | 805 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
806 | 806 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
807 | 807 | ), |
808 | - 'cancelled_status' => array( |
|
808 | + 'cancelled_status' => array( |
|
809 | 809 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
810 | 810 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
811 | 811 | ), |
812 | - 'declined_status' => array( |
|
812 | + 'declined_status' => array( |
|
813 | 813 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
814 | 814 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
815 | 815 | ), |
@@ -837,9 +837,9 @@ discard block |
||
837 | 837 | /** |
838 | 838 | * get_attendees |
839 | 839 | * @param bool $count whether to return count or data. |
840 | - * @access public |
|
841 | - * @return array |
|
842 | - */ |
|
840 | + * @access public |
|
841 | + * @return array |
|
842 | + */ |
|
843 | 843 | public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
844 | 844 | |
845 | 845 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -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 | /** |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class Extend_Registrations_Admin_Page extends Registrations_Admin_Page { |
31 | 31 | |
32 | - public function __construct( $routing = TRUE ) { |
|
33 | - parent::__construct( $routing ); |
|
34 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
35 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
36 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
32 | + public function __construct($routing = TRUE) { |
|
33 | + parent::__construct($routing); |
|
34 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
35 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
36 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | protected function _extend_page_config() { |
45 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
45 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
46 | 46 | |
47 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
48 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0; |
|
49 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
47 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
48 | + $att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0; |
|
49 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
50 | 50 | |
51 | 51 | $new_page_routes = array( |
52 | 52 | 'reports' => array( |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ) |
86 | 86 | ); |
87 | 87 | |
88 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
88 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
89 | 89 | |
90 | 90 | $new_page_config = array( |
91 | 91 | 'reports' => array( |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'filename' => 'registrations_reports' |
100 | 100 | ) |
101 | 101 | ), |
102 | - 'help_tour' => array( 'Registration_Reports_Help_Tour' ), |
|
102 | + 'help_tour' => array('Registration_Reports_Help_Tour'), |
|
103 | 103 | 'require_nonce' => FALSE |
104 | 104 | ), |
105 | 105 | 'event_registrations' => array( |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | 'filename' => 'registrations_event_checkin_other' |
131 | 131 | ) |
132 | 132 | ), |
133 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ), |
|
134 | - 'qtips' => array('Registration_List_Table_Tips' ), |
|
133 | + 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
134 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
135 | 135 | 'list_table' => 'EE_Event_Registrations_List_Table', |
136 | 136 | 'metaboxes' => array(), |
137 | 137 | 'require_nonce' => FALSE |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // var_dump($this->_req_data); |
153 | 153 | // exit(); |
154 | 154 | |
155 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
155 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
156 | 156 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
157 | 157 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
158 | 158 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | protected function _ajax_hooks() { |
163 | 163 | parent::_ajax_hooks(); |
164 | - add_action('wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content') ); |
|
164 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | |
172 | 172 | //if newsletter message type is active then let's add filter and load js for it. |
173 | 173 | EE_Registry::instance()->load_helper('MSG_Template'); |
174 | - if ( EEH_MSG_Template::is_mt_active('newsletter') ) { |
|
174 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
175 | 175 | //enqueue newsletter js |
176 | - wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
177 | - wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION ); |
|
176 | + wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE); |
|
177 | + wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION); |
|
178 | 178 | //hook in buttons for newsletter message type trigger. |
179 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 ); |
|
179 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | |
189 | 189 | //scripts |
190 | 190 | global $is_IE; |
191 | - if ( $is_IE ) { |
|
192 | - wp_enqueue_script( 'excanvas' ); |
|
191 | + if ($is_IE) { |
|
192 | + wp_enqueue_script('excanvas'); |
|
193 | 193 | } |
194 | 194 | |
195 | - wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
196 | - wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL . 'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
195 | + wp_register_script('espresso_reg_admin_regs_per_day', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_day_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE); |
|
196 | + wp_register_script('espresso_reg_admin_regs_per_event', REG_CAF_ASSETS_URL.'espresso_reg_admin_regs_per_event_report.js', array('jqplot-all'), EVENT_ESPRESSO_VERSION, TRUE); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | 'slug' => 'all', |
225 | 225 | 'label' => __('All', 'event_espresso'), |
226 | 226 | 'count' => 0, |
227 | - 'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array( |
|
227 | + 'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array( |
|
228 | 228 | 'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), |
229 | 229 | //'trash_registrations' => __('Trash Registrations', 'event_espresso') |
230 | 230 | ) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | 'slug' => 'all', |
243 | 243 | 'label' => __('All', 'event_espresso'), |
244 | 244 | 'count' => 0, |
245 | - 'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') ) |
|
245 | + 'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')) |
|
246 | 246 | ), |
247 | 247 | ); |
248 | 248 | } |
@@ -258,20 +258,20 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function get_newsletter_form_content() { |
260 | 260 | //do a nonce check cause we're not coming in from an normal route here. |
261 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : ''; |
|
261 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : ''; |
|
262 | 262 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
263 | 263 | |
264 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
264 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
265 | 265 | //let's get the mtp for the incoming MTP_ ID |
266 | - if ( !isset( $this->_req_data['GRP_ID'] ) ) { |
|
267 | - EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
266 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
267 | + EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
268 | 268 | $this->_template_args['success'] = FALSE; |
269 | 269 | $this->_template_args['error'] = TRUE; |
270 | 270 | $this->_return_json(); |
271 | 271 | } |
272 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] ); |
|
273 | - if ( ! $MTPG instanceof EE_Message_Template_Group ) { |
|
274 | - EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
272 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
273 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
274 | + EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__); |
|
275 | 275 | $this->_template_args['success'] = FALSE; |
276 | 276 | $this->_template_args['error'] = TRUE; |
277 | 277 | $this->_return_json(); |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | $MTPs = $MTPG->context_templates(); |
281 | 281 | $MTPs = $MTPs['attendee']; |
282 | 282 | $template_fields = array(); |
283 | - foreach ( $MTPs as $MTP ) { |
|
283 | + foreach ($MTPs as $MTP) { |
|
284 | 284 | $field = $MTP->get('MTP_template_field'); |
285 | - if ( $field == 'content' ) { |
|
285 | + if ($field == 'content') { |
|
286 | 286 | $content = $MTP->get('MTP_content'); |
287 | - if ( !empty( $content['newsletter_content'] ) ) { |
|
287 | + if ( ! empty($content['newsletter_content'])) { |
|
288 | 288 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
289 | 289 | } |
290 | 290 | continue; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $this->_template_args['data'] = array( |
298 | 298 | 'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '', |
299 | 299 | 'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '', |
300 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : '' |
|
300 | + 'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : '' |
|
301 | 301 | ); |
302 | 302 | $this->_return_json(); |
303 | 303 | } |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | * @param EE_Admin_List_Table $list_table |
314 | 314 | * @return string html string for extra buttons |
315 | 315 | */ |
316 | - public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { |
|
317 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) { |
|
316 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { |
|
317 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) { |
|
318 | 318 | return ''; |
319 | 319 | } |
320 | 320 | |
@@ -323,13 +323,13 @@ discard block |
||
323 | 323 | 'event_registrations', |
324 | 324 | 'default' |
325 | 325 | ); |
326 | - if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
|
327 | - if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) { |
|
326 | + if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
327 | + if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) { |
|
328 | 328 | echo ''; |
329 | 329 | } else { |
330 | - $button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' ); |
|
331 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>'; |
|
332 | - add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') ); |
|
330 | + $button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>'); |
|
331 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>'; |
|
332 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | } |
@@ -341,38 +341,38 @@ discard block |
||
341 | 341 | $list_table = $this->_list_table_object; |
342 | 342 | $codes = array(); |
343 | 343 | //need to templates for the newsletter message type for the template selector. |
344 | - $values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 ); |
|
345 | - $mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) ); |
|
346 | - foreach ( $mtps as $mtp ) { |
|
344 | + $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
345 | + $mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); |
|
346 | + foreach ($mtps as $mtp) { |
|
347 | 347 | $name = $mtp->name(); |
348 | 348 | $values[] = array( |
349 | - 'text' => empty( $name ) ? __('Global', 'event_espresso') : $name, |
|
349 | + 'text' => empty($name) ? __('Global', 'event_espresso') : $name, |
|
350 | 350 | 'id' => $mtp->ID() |
351 | 351 | ); |
352 | 352 | } |
353 | 353 | |
354 | 354 | //need to get a list of shortcodes that are available for the newsletter message type. |
355 | 355 | EE_Registry::instance()->load_helper('MSG_Template'); |
356 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE ); |
|
357 | - foreach ( $shortcodes as $field => $shortcode_array ) { |
|
358 | - $codes[$field] = implode(', ', array_keys($shortcode_array ) ); |
|
356 | + $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); |
|
357 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
358 | + $codes[$field] = implode(', ', array_keys($shortcode_array)); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $shortcodes = $codes; |
362 | 362 | |
363 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
363 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
364 | 364 | $form_template_args = array( |
365 | 365 | 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
366 | 366 | 'form_route' => 'newsletter_selected_send', |
367 | 367 | 'form_nonce_name' => 'newsletter_selected_send_nonce', |
368 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ), |
|
368 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
369 | 369 | 'redirect_back_to' => $this->_req_action, |
370 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'), |
|
371 | - 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ), |
|
370 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
371 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
372 | 372 | 'shortcodes' => $shortcodes, |
373 | 373 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration' |
374 | 374 | ); |
375 | - EEH_Template::display_template( $form_template, $form_template_args ); |
|
375 | + EEH_Template::display_template($form_template, $form_template_args); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -387,35 +387,35 @@ discard block |
||
387 | 387 | protected function _newsletter_selected_send() { |
388 | 388 | $success = TRUE; |
389 | 389 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
390 | - if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { |
|
391 | - EE_Error::add_error( __('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
390 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
391 | + EE_Error::add_error(__('In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
392 | 392 | $success = FALSE; |
393 | 393 | } |
394 | 394 | |
395 | - if ( $success ) { |
|
395 | + if ($success) { |
|
396 | 396 | //update Message template in case there are any changes |
397 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['newsletter_mtp_selected'] ); |
|
397 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['newsletter_mtp_selected']); |
|
398 | 398 | $MTPs = $MTPG instanceof EE_Message_Template_Group ? $MTPG->context_templates() : array(); |
399 | - if ( empty( $MTPs ) ) { |
|
400 | - EE_Error::add_error( __('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
399 | + if (empty($MTPs)) { |
|
400 | + EE_Error::add_error(__('Unable to retrieve message template fields from the db. Messages not sent.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
401 | 401 | $success = FALSE; |
402 | 402 | } |
403 | 403 | |
404 | 404 | //let's just update the specific fields |
405 | - foreach ( $MTPs['attendee'] as $MTP ) { |
|
405 | + foreach ($MTPs['attendee'] as $MTP) { |
|
406 | 406 | $field = $MTP->get('MTP_template_field'); |
407 | 407 | $content = $MTP->get('MTP_content'); |
408 | 408 | $new_content = $content; |
409 | - switch( $field ) { |
|
409 | + switch ($field) { |
|
410 | 410 | case 'from' : |
411 | - $new_content = !empty( $this->_req_data['batch_message']['from'] ) ? $this->_req_data['batch_message']['from'] : $content; |
|
411 | + $new_content = ! empty($this->_req_data['batch_message']['from']) ? $this->_req_data['batch_message']['from'] : $content; |
|
412 | 412 | break; |
413 | 413 | case 'subject' : |
414 | - $new_content = !empty( $this->_req_data['batch_message']['subject'] ) ? $this->_req_data['batch_message']['subject'] : $content; |
|
414 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) ? $this->_req_data['batch_message']['subject'] : $content; |
|
415 | 415 | break; |
416 | 416 | case 'content' : |
417 | 417 | $new_content = $content; |
418 | - $new_content['newsletter_content'] = !empty( $this->_req_data['batch_message']['content'] ) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content']; |
|
418 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) ? $this->_req_data['batch_message']['content'] : $content['newsletter_content']; |
|
419 | 419 | break; |
420 | 420 | default : |
421 | 421 | continue; |
@@ -426,20 +426,20 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
429 | - $id_type = !empty( $this->_req_data['batch_message']['id_type'] ) ? $this->_req_data['batch_message']['id_type'] : 'registration'; |
|
429 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) ? $this->_req_data['batch_message']['id_type'] : 'registration'; |
|
430 | 430 | |
431 | 431 | //id_type will affect how we assemble the ids. |
432 | - $ids = !empty( $this->_req_data['batch_message']['ids'] ) ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) : array(); |
|
432 | + $ids = ! empty($this->_req_data['batch_message']['ids']) ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) : array(); |
|
433 | 433 | |
434 | - $contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) ); |
|
434 | + $contacts = $id_type == 'registration' ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
435 | 435 | |
436 | 436 | //we do _action because ALL triggers are handled in EED_Messages. |
437 | - do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID() ); |
|
437 | + do_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', $contacts, $MTPG->ID()); |
|
438 | 438 | } |
439 | 439 | $query_args = array( |
440 | - 'action' => !empty( $this->_req_data['redirect_back_to'] ) ? $this->_req_data['redirect_back_to'] : 'default' |
|
440 | + 'action' => ! empty($this->_req_data['redirect_back_to']) ? $this->_req_data['redirect_back_to'] : 'default' |
|
441 | 441 | ); |
442 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
442 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -452,16 +452,16 @@ discard block |
||
452 | 452 | */ |
453 | 453 | protected function _registration_reports() { |
454 | 454 | |
455 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
455 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
456 | 456 | |
457 | 457 | $page_args = array(); |
458 | 458 | |
459 | - $page_args['admin_reports'][] = $this->_registrations_per_day_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
460 | - $page_args['admin_reports'][] = $this->_get_registrations_per_event_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
459 | + $page_args['admin_reports'][] = $this->_registrations_per_day_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
460 | + $page_args['admin_reports'][] = $this->_get_registrations_per_event_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
461 | 461 | // $page_args['admin_reports'][] = 'chart1'; |
462 | 462 | |
463 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
464 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE ); |
|
463 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
464 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE); |
|
465 | 465 | |
466 | 466 | // EEH_Debug_Tools::printr( $page_args, '$page_args' ); |
467 | 467 | |
@@ -480,36 +480,36 @@ discard block |
||
480 | 480 | * @access private |
481 | 481 | * @return void |
482 | 482 | */ |
483 | - private function _registrations_per_day_report( $period = '-1 month' ) { |
|
483 | + private function _registrations_per_day_report($period = '-1 month') { |
|
484 | 484 | |
485 | 485 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
486 | 486 | $report_JS = 'espresso_reg_admin_regs_per_day'; |
487 | 487 | |
488 | - wp_enqueue_script( $report_JS ); |
|
488 | + wp_enqueue_script($report_JS); |
|
489 | 489 | |
490 | 490 | $REG = EEM_Registration::instance(); |
491 | 491 | |
492 | - $results = $REG->get_registrations_per_day_report( $period ); |
|
492 | + $results = $REG->get_registrations_per_day_report($period); |
|
493 | 493 | |
494 | 494 | //EEH_Debug_Tools::printr( $results, '$registrations_per_day' ); |
495 | 495 | $regs = array(); |
496 | - $xmin = date( 'Y-m-d', strtotime( '+1 year' )); |
|
496 | + $xmin = date('Y-m-d', strtotime('+1 year')); |
|
497 | 497 | $xmax = 0; |
498 | 498 | $ymax = 0; |
499 | 499 | $results = (array) $results; |
500 | - foreach ( $results as $result ) { |
|
501 | - $regs[] = array( $result->regDate, (int)$result->total ); |
|
502 | - $xmin = strtotime( $result->regDate ) < strtotime( $xmin ) ? $result->regDate : $xmin; |
|
503 | - $xmax = strtotime( $result->regDate ) > strtotime( $xmax ) ? $result->regDate : $xmax; |
|
500 | + foreach ($results as $result) { |
|
501 | + $regs[] = array($result->regDate, (int) $result->total); |
|
502 | + $xmin = strtotime($result->regDate) < strtotime($xmin) ? $result->regDate : $xmin; |
|
503 | + $xmax = strtotime($result->regDate) > strtotime($xmax) ? $result->regDate : $xmax; |
|
504 | 504 | $ymax = $result->total > $ymax ? $result->total : $ymax; |
505 | 505 | } |
506 | 506 | |
507 | - $xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' )); |
|
508 | - $xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' )); |
|
507 | + $xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day')); |
|
508 | + $xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day')); |
|
509 | 509 | // calculate # days between our min and max dates |
510 | - $span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1; |
|
510 | + $span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1; |
|
511 | 511 | |
512 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' ); |
|
512 | + $report_title = __('Total Registrations per Day', 'event_espresso'); |
|
513 | 513 | |
514 | 514 | $report_params = array( |
515 | 515 | 'title' => $report_title, |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | 'ymax' => ceil($ymax * 1.25), |
521 | 521 | 'span' => $span, |
522 | 522 | 'width' => ceil(900 / $span), |
523 | - 'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
523 | + 'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
524 | 524 | ); |
525 | - wp_localize_script( $report_JS, 'regPerDay', $report_params ); |
|
525 | + wp_localize_script($report_JS, 'regPerDay', $report_params); |
|
526 | 526 | |
527 | 527 | return $report_ID; |
528 | 528 | } |
@@ -537,29 +537,29 @@ discard block |
||
537 | 537 | * @access private |
538 | 538 | * @return void |
539 | 539 | */ |
540 | - private function _get_registrations_per_event_report( $period = '-1 month' ) { |
|
540 | + private function _get_registrations_per_event_report($period = '-1 month') { |
|
541 | 541 | |
542 | 542 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
543 | 543 | $report_JS = 'espresso_reg_admin_regs_per_event'; |
544 | 544 | |
545 | - wp_enqueue_script( $report_JS ); |
|
545 | + wp_enqueue_script($report_JS); |
|
546 | 546 | |
547 | - require_once ( EE_MODELS . 'EEM_Registration.model.php' ); |
|
547 | + require_once (EE_MODELS.'EEM_Registration.model.php'); |
|
548 | 548 | $REG = EEM_Registration::instance(); |
549 | 549 | |
550 | - $results = $REG->get_registrations_per_event_report( $period ); |
|
550 | + $results = $REG->get_registrations_per_event_report($period); |
|
551 | 551 | //EEH_Debug_Tools::printr( $results, '$registrations_per_event' ); |
552 | 552 | $regs = array(); |
553 | 553 | $ymax = 0; |
554 | 554 | $results = (array) $results; |
555 | - foreach ( $results as $result ) { |
|
556 | - $regs[] = array( wp_trim_words( $result->event_name, 4, '...' ), (int)$result->total ); |
|
555 | + foreach ($results as $result) { |
|
556 | + $regs[] = array(wp_trim_words($result->event_name, 4, '...'), (int) $result->total); |
|
557 | 557 | $ymax = $result->total > $ymax ? $result->total : $ymax; |
558 | 558 | } |
559 | 559 | |
560 | 560 | $span = $period == 'week' ? 9 : 33; |
561 | 561 | |
562 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' ); |
|
562 | + $report_title = __('Total Registrations per Event', 'event_espresso'); |
|
563 | 563 | |
564 | 564 | $report_params = array( |
565 | 565 | 'title' => $report_title, |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | 'ymax' => ceil($ymax * 1.25), |
569 | 569 | 'span' => $span, |
570 | 570 | 'width' => ceil(900 / $span), |
571 | - 'noRegsMsg' => sprintf( __('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
571 | + 'noRegsMsg' => sprintf(__('<h2>%s</h2><p>There are currently no registration records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
572 | 572 | ); |
573 | - wp_localize_script( $report_JS, 'regPerEvent', $report_params ); |
|
573 | + wp_localize_script($report_JS, 'regPerEvent', $report_params); |
|
574 | 574 | |
575 | 575 | return $report_ID; |
576 | 576 | } |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | * @return void |
585 | 585 | */ |
586 | 586 | protected function _registration_checkin_list_table() { |
587 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
588 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
|
587 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
588 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null; |
|
589 | 589 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
590 | 590 | $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $reg->event_ID()), 'add-new-h2'); |
591 | 591 | |
@@ -599,15 +599,15 @@ discard block |
||
599 | 599 | 'desc' => __('This indicates the attendee has been checked out', 'event_espresso') |
600 | 600 | ) |
601 | 601 | ); |
602 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
602 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
603 | 603 | |
604 | 604 | |
605 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
606 | - $go_back_url = !empty( $reg_id ) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : ''; |
|
605 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
606 | + $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : ''; |
|
607 | 607 | |
608 | - $this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : ''; |
|
609 | - $this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : ''; |
|
610 | - $this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
608 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : ''; |
|
609 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : ''; |
|
610 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
611 | 611 | |
612 | 612 | $this->display_admin_list_table_page_with_no_sidebar(); |
613 | 613 | } |
@@ -620,24 +620,24 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function toggle_checkin_status() { |
622 | 622 | //first make sure we have the necessary data |
623 | - if ( !isset( $this->_req_data['_regid'] ) ) { |
|
624 | - EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
623 | + if ( ! isset($this->_req_data['_regid'])) { |
|
624 | + EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
625 | 625 | $this->_template_args['success'] = FALSE; |
626 | 626 | $this->_template_args['error'] = TRUE; |
627 | 627 | $this->_return_json(); |
628 | 628 | }; |
629 | 629 | |
630 | 630 | //do a nonce check cause we're not coming in from an normal route here. |
631 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : ''; |
|
631 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : ''; |
|
632 | 632 | $nonce_ref = 'checkin_nonce'; |
633 | 633 | |
634 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
634 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
635 | 635 | |
636 | 636 | //beautiful! Made it this far so let's get the status. |
637 | 637 | $new_status = $this->_toggle_checkin_status(); |
638 | 638 | |
639 | 639 | //setup new class to return via ajax |
640 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status; |
|
640 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status; |
|
641 | 641 | $this->_template_args['success'] = TRUE; |
642 | 642 | $this->_return_json(); |
643 | 643 | } |
@@ -657,32 +657,32 @@ discard block |
||
657 | 657 | //first let's get the query args out of the way for the redirect |
658 | 658 | $query_args = array( |
659 | 659 | 'action' => 'event_registrations', |
660 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL, |
|
661 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL |
|
660 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL, |
|
661 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL |
|
662 | 662 | ); |
663 | 663 | $new_status = FALSE; |
664 | 664 | |
665 | 665 | // bulk action check in toggle |
666 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
666 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
667 | 667 | // cycle thru checkboxes |
668 | - while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
669 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
668 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
669 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
670 | 670 | $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
671 | 671 | } |
672 | 672 | |
673 | - } elseif ( isset( $this->_req_data['_regid'] ) ) { |
|
673 | + } elseif (isset($this->_req_data['_regid'])) { |
|
674 | 674 | //coming from ajax request |
675 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL; |
|
675 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL; |
|
676 | 676 | $query_args['DTT_ID'] = $DTT_ID; |
677 | 677 | $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
678 | 678 | } else { |
679 | - EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
679 | + EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
680 | 680 | } |
681 | 681 | |
682 | - if ( defined('DOING_AJAX' ) ) |
|
682 | + if (defined('DOING_AJAX')) |
|
683 | 683 | return $new_status; |
684 | 684 | |
685 | - $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
|
685 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
686 | 686 | |
687 | 687 | } |
688 | 688 | |
@@ -698,11 +698,11 @@ discard block |
||
698 | 698 | */ |
699 | 699 | private function _toggle_checkin($REG_ID, $DTT_ID) { |
700 | 700 | $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
701 | - $new_status = $REG->toggle_checkin_status( $DTT_ID ); |
|
702 | - if ( $new_status !== FALSE ) { |
|
703 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID) ); |
|
701 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
702 | + if ($new_status !== FALSE) { |
|
703 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
704 | 704 | } else { |
705 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ ); |
|
705 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__); |
|
706 | 706 | $new_status = FALSE; |
707 | 707 | } |
708 | 708 | return $new_status; |
@@ -718,28 +718,28 @@ discard block |
||
718 | 718 | protected function _delete_checkin_rows() { |
719 | 719 | $query_args = array( |
720 | 720 | 'action' => 'registration_checkins', |
721 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
722 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
721 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
722 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
723 | 723 | ); |
724 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
725 | - while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
724 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
725 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
726 | 726 | $errors = 0; |
727 | - if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) { |
|
727 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
728 | 728 | $errors++; |
729 | 729 | } |
730 | 730 | } |
731 | 731 | } else { |
732 | - EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
733 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
732 | + EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
733 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
734 | 734 | } |
735 | 735 | |
736 | - if ( $errors > 0 ) { |
|
737 | - EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ ); |
|
736 | + if ($errors > 0) { |
|
737 | + EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 738 | } else { |
739 | - EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') ); |
|
739 | + EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); |
|
740 | 740 | } |
741 | 741 | |
742 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
742 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | |
@@ -751,20 +751,20 @@ discard block |
||
751 | 751 | protected function _delete_checkin_row() { |
752 | 752 | $query_args = array( |
753 | 753 | 'action' => 'registration_checkins', |
754 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
755 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
754 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
755 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
756 | 756 | ); |
757 | 757 | |
758 | - if ( !empty( $this->_req_data['CHK_ID'] ) ) { |
|
759 | - if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) { |
|
760 | - EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
758 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
759 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
760 | + EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
761 | 761 | } else { |
762 | - EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') ); |
|
762 | + EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); |
|
763 | 763 | } |
764 | 764 | } else { |
765 | - EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
765 | + EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
766 | 766 | } |
767 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
767 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | * @return void |
778 | 778 | */ |
779 | 779 | protected function _event_registrations_list_table() { |
780 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
781 | - $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
780 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
781 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) ? $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $this->_req_data['event_id']), 'add-new-h2') : ''; |
|
782 | 782 | |
783 | 783 | $legend_items = array( |
784 | 784 | 'star-icon' => array( |
@@ -802,31 +802,31 @@ discard block |
||
802 | 802 | 'desc' => __('View All Check-in Records for this Registrant', 'event_espresso') |
803 | 803 | ), |
804 | 804 | 'approved_status' => array( |
805 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
806 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
805 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
806 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
807 | 807 | ), |
808 | 808 | 'cancelled_status' => array( |
809 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
810 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
809 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
810 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
811 | 811 | ), |
812 | 812 | 'declined_status' => array( |
813 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
814 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
813 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
814 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
815 | 815 | ), |
816 | 816 | 'not_approved' => array( |
817 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
818 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
817 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
818 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
819 | 819 | ), |
820 | 820 | 'pending_status' => array( |
821 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
822 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
821 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
822 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
823 | 823 | )/**/ |
824 | 824 | ); |
825 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
825 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
826 | 826 | |
827 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
828 | - $this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : ''; |
|
829 | - $this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : ''; |
|
827 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
828 | + $this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : ''; |
|
829 | + $this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : ''; |
|
830 | 830 | |
831 | 831 | $this->display_admin_list_table_page_with_no_sidebar(); |
832 | 832 | } |
@@ -840,15 +840,15 @@ discard block |
||
840 | 840 | * @access public |
841 | 841 | * @return array |
842 | 842 | */ |
843 | - public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
|
843 | + public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') { |
|
844 | 844 | |
845 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
846 | - require_once(EE_MODELS . 'EEM_Attendee.model.php'); |
|
845 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
846 | + require_once(EE_MODELS.'EEM_Attendee.model.php'); |
|
847 | 847 | //$ATT_MDL = EEM_Attendee::instance(); |
848 | 848 | |
849 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
850 | - $CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE; |
|
851 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
849 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
850 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE; |
|
851 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
852 | 852 | |
853 | 853 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
854 | 854 | |
@@ -861,92 +861,92 @@ discard block |
||
861 | 861 | // $orderby = 'reg.REG_final_price'; |
862 | 862 | } |
863 | 863 | |
864 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
864 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
865 | 865 | |
866 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
867 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
866 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
867 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
868 | 868 | |
869 | 869 | |
870 | - $offset = ($current_page-1)*$per_page; |
|
871 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
872 | - $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
873 | - if ($EVT_ID){ |
|
874 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
870 | + $offset = ($current_page - 1) * $per_page; |
|
871 | + $limit = $count ? NULL : array($offset, $per_page); |
|
872 | + $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
873 | + if ($EVT_ID) { |
|
874 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
875 | 875 | } |
876 | - if($CAT_ID){ |
|
876 | + if ($CAT_ID) { |
|
877 | 877 | throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?"); |
878 | 878 | } |
879 | 879 | |
880 | 880 | //if DTT is included we do multiple datetimes. |
881 | - if ( $DTT_ID ) { |
|
881 | + if ($DTT_ID) { |
|
882 | 882 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
883 | 883 | $query_params['default_where_conditions'] = 'this_model_only'; |
884 | 884 | } |
885 | 885 | |
886 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
886 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
887 | 887 | |
888 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
888 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
889 | 889 | |
890 | - if($trash){ |
|
891 | - $query_params[0]['Attendee.status']= EEM_CPT_Base::post_status_trashed; |
|
890 | + if ($trash) { |
|
891 | + $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed; |
|
892 | 892 | } |
893 | 893 | |
894 | - if ( isset( $this->_req_data['s'] ) ) { |
|
895 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
894 | + if (isset($this->_req_data['s'])) { |
|
895 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
896 | 896 | $query_params[0]['OR'] = array( |
897 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
898 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
899 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
900 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
901 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
902 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
903 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
904 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
905 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
906 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
907 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
908 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
909 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
910 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
911 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
912 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ) |
|
897 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
898 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
899 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
900 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
901 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
902 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
903 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
904 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
905 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
906 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
907 | + 'REG_final_price' => array('LIKE', $sstr), |
|
908 | + 'REG_code' => array('LIKE', $sstr), |
|
909 | + 'REG_count' => array('LIKE', $sstr), |
|
910 | + 'REG_group_size' => array('LIKE', $sstr), |
|
911 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
912 | + 'Ticket.TKT_description' => array('LIKE', $sstr) |
|
913 | 913 | ); |
914 | 914 | } |
915 | 915 | |
916 | 916 | $query_params['order_by'][$orderby] = $sort; |
917 | 917 | $query_params['limit'] = $limit; |
918 | - $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
919 | - if($count){ |
|
918 | + $query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
919 | + if ($count) { |
|
920 | 920 | $registrations = EEM_Registration::instance()->count(array($query_params[0])); |
921 | - }else{ |
|
921 | + } else { |
|
922 | 922 | $registrations = EEM_Registration::instance()->get_all($query_params); |
923 | 923 | |
924 | 924 | |
925 | 925 | // $registrations = EEM_Registration::instance(); |
926 | 926 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output ); |
927 | - if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { |
|
927 | + if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { |
|
928 | 928 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
929 | 929 | // name |
930 | 930 | $first_registration = $registrations[0]; |
931 | 931 | $event_obj = $first_registration->event_obj(); |
932 | - if($event_obj){ |
|
932 | + if ($event_obj) { |
|
933 | 933 | $event_name = $first_registration->event_obj()->name(); |
934 | - $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
934 | + $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
935 | 935 | // edit event link |
936 | - if ( $event_name != '' ) { |
|
937 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
938 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
939 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
936 | + if ($event_name != '') { |
|
937 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
938 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
939 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
940 | 940 | } |
941 | 941 | |
942 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
943 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
942 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
943 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
944 | 944 | |
945 | 945 | $this->_template_args['before_admin_page_content'] = ' |
946 | 946 | <div id="admin-page-header"> |
947 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
948 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
949 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
947 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
948 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
949 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
950 | 950 | </div> |
951 | 951 | '; |
952 | 952 | } |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -679,8 +680,9 @@ discard block |
||
679 | 680 | EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
680 | 681 | } |
681 | 682 | |
682 | - if ( defined('DOING_AJAX' ) ) |
|
683 | - return $new_status; |
|
683 | + if ( defined('DOING_AJAX' ) ) { |
|
684 | + return $new_status; |
|
685 | + } |
|
684 | 686 | |
685 | 687 | $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
686 | 688 | |
@@ -918,7 +920,7 @@ discard block |
||
918 | 920 | $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
919 | 921 | if($count){ |
920 | 922 | $registrations = EEM_Registration::instance()->count(array($query_params[0])); |
921 | - }else{ |
|
923 | + } else{ |
|
922 | 924 | $registrations = EEM_Registration::instance()->get_all($query_params); |
923 | 925 | |
924 | 926 |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @access private |
137 | 137 | * @param string $period |
138 | - * @return int |
|
138 | + * @return string |
|
139 | 139 | */ |
140 | 140 | private function _revenue_per_day_report( $period = '-1 month' ) { |
141 | 141 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @access private |
195 | 195 | * @param string $period |
196 | - * @return int |
|
196 | + * @return string |
|
197 | 197 | */ |
198 | 198 | private function _revenue_per_event_report( $period = '-1 month' ) { |
199 | 199 |
@@ -105,10 +105,10 @@ |
||
105 | 105 | /** |
106 | 106 | * _transaction_reports |
107 | 107 | * generates Business Reports regarding Transactions |
108 | - * |
|
108 | + * |
|
109 | 109 | * @access protected |
110 | - * @return void |
|
111 | - */ |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | protected function _transaction_reports() { |
113 | 113 | |
114 | 114 | $page_args = array(); |
@@ -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 | /** |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | * @param bool $routing |
36 | 36 | * @return \Extend_Transactions_Admin_Page |
37 | 37 | */ |
38 | - public function __construct( $routing = TRUE ) { |
|
39 | - parent::__construct( $routing ); |
|
40 | - define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/'); |
|
41 | - define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/'); |
|
42 | - define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/'); |
|
38 | + public function __construct($routing = TRUE) { |
|
39 | + parent::__construct($routing); |
|
40 | + define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/'); |
|
41 | + define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/'); |
|
42 | + define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | protected function _extend_page_config() { |
54 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions'; |
|
54 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions'; |
|
55 | 55 | |
56 | 56 | $new_page_routes = array( |
57 | 57 | 'reports' => array( |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | ) |
61 | 61 | ); |
62 | 62 | |
63 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
63 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
64 | 64 | |
65 | 65 | $new_page_config = array( |
66 | 66 | 'reports' => array( |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | 'filename' => 'transactions_reports' |
75 | 75 | ) |
76 | 76 | ), |
77 | - 'help_tour' => array( 'Transaction_Reports_Help_Tour' ), |
|
77 | + 'help_tour' => array('Transaction_Reports_Help_Tour'), |
|
78 | 78 | 'require_nonce' => FALSE |
79 | 79 | ) |
80 | 80 | ); |
81 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
81 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | wp_enqueue_style('jquery-jqplot-css'); |
95 | 95 | //scripts |
96 | 96 | global $is_IE; |
97 | - if ( $is_IE ) { |
|
98 | - wp_enqueue_script( 'excanvas' ); |
|
97 | + if ($is_IE) { |
|
98 | + wp_enqueue_script('excanvas'); |
|
99 | 99 | } |
100 | 100 | wp_enqueue_script('jqplot-all'); |
101 | 101 | } |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | |
114 | 114 | $page_args = array(); |
115 | 115 | |
116 | - $page_args['admin_reports'][] = $this->_revenue_per_day_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
117 | - $page_args['admin_reports'][] = $this->_revenue_per_event_report( '-1 month' ); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
116 | + $page_args['admin_reports'][] = $this->_revenue_per_day_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
117 | + $page_args['admin_reports'][] = $this->_revenue_per_event_report('-1 month'); // option: '-1 week', '-2 weeks' defaults to '-1 month' |
|
118 | 118 | // $page_args['admin_reports'][] = 'chart1'; |
119 | 119 | |
120 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
120 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
121 | 121 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
122 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $page_args, TRUE ); |
|
122 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $page_args, TRUE); |
|
123 | 123 | |
124 | 124 | |
125 | 125 | // the final template wrapper |
@@ -137,37 +137,37 @@ discard block |
||
137 | 137 | * @param string $period |
138 | 138 | * @return int |
139 | 139 | */ |
140 | - private function _revenue_per_day_report( $period = '-1 month' ) { |
|
140 | + private function _revenue_per_day_report($period = '-1 month') { |
|
141 | 141 | |
142 | 142 | $report_ID = 'txn-admin-revenue-per-day-report-dv'; |
143 | 143 | $report_JS = 'espresso_txn_admin_revenue_per_day'; |
144 | 144 | |
145 | - wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); |
|
145 | + wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); |
|
146 | 146 | |
147 | 147 | $TXN = EEM_Transaction::instance(); |
148 | 148 | |
149 | - $results = $TXN->get_revenue_per_day_report( $period ); |
|
149 | + $results = $TXN->get_revenue_per_day_report($period); |
|
150 | 150 | //EEH_Debug_Tools::printr( $results, '$registrations_per_day' ); |
151 | 151 | $revenue = array(); |
152 | - $xmin = date( 'Y-m-d', strtotime( '+1 year' )); |
|
152 | + $xmin = date('Y-m-d', strtotime('+1 year')); |
|
153 | 153 | $xmax = 0; |
154 | 154 | $ymax = 0; |
155 | 155 | |
156 | 156 | $results = (array) $results; |
157 | 157 | |
158 | - foreach ( $results as $result ) { |
|
159 | - $revenue[] = array( $result->txnDate, (float)$result->revenue ); |
|
160 | - $xmin = strtotime( $result->txnDate ) < strtotime( $xmin ) ? $result->txnDate : $xmin; |
|
161 | - $xmax = strtotime( $result->txnDate ) > strtotime( $xmax ) ? $result->txnDate : $xmax; |
|
158 | + foreach ($results as $result) { |
|
159 | + $revenue[] = array($result->txnDate, (float) $result->revenue); |
|
160 | + $xmin = strtotime($result->txnDate) < strtotime($xmin) ? $result->txnDate : $xmin; |
|
161 | + $xmax = strtotime($result->txnDate) > strtotime($xmax) ? $result->txnDate : $xmax; |
|
162 | 162 | $ymax = $result->revenue > $ymax ? $result->revenue : $ymax; |
163 | 163 | } |
164 | 164 | |
165 | - $xmin = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmin)) . ' -1 day' )); |
|
166 | - $xmax = date( 'Y-m-d', strtotime( date( 'Y-m-d', strtotime($xmax)) . ' +1 day' )); |
|
165 | + $xmin = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmin)).' -1 day')); |
|
166 | + $xmax = date('Y-m-d', strtotime(date('Y-m-d', strtotime($xmax)).' +1 day')); |
|
167 | 167 | // calculate # days between our min and max dates |
168 | - $span = floor( (strtotime($xmax) - strtotime($xmin)) / (60*60*24)) + 1; |
|
168 | + $span = floor((strtotime($xmax) - strtotime($xmin)) / (60 * 60 * 24)) + 1; |
|
169 | 169 | |
170 | - $report_title = __( 'Total Revenue per Day' ); |
|
170 | + $report_title = __('Total Revenue per Day'); |
|
171 | 171 | |
172 | 172 | $report_params = array( |
173 | 173 | 'title' => $report_title, |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | 'ymax' => ceil($ymax * 1.25), |
179 | 179 | 'span' => $span, |
180 | 180 | 'width' => ceil(900 / $span), |
181 | - 'noTxnMsg' => sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
181 | + 'noTxnMsg' => sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
182 | 182 | ); |
183 | - wp_localize_script( $report_JS, 'txnRevPerDay', $report_params ); |
|
183 | + wp_localize_script($report_JS, 'txnRevPerDay', $report_params); |
|
184 | 184 | |
185 | 185 | return $report_ID; |
186 | 186 | } |
@@ -195,29 +195,29 @@ discard block |
||
195 | 195 | * @param string $period |
196 | 196 | * @return int |
197 | 197 | */ |
198 | - private function _revenue_per_event_report( $period = '-1 month' ) { |
|
198 | + private function _revenue_per_event_report($period = '-1 month') { |
|
199 | 199 | |
200 | 200 | $report_ID = 'txn-admin-revenue-per-event-report-dv'; |
201 | 201 | $report_JS = 'espresso_txn_admin_revenue_per_event'; |
202 | 202 | |
203 | - wp_enqueue_script( $report_JS, TXN_CAF_ASSETS_URL . $report_JS . '_report.js', array('jqplot-all'), '1.0', TRUE); |
|
203 | + wp_enqueue_script($report_JS, TXN_CAF_ASSETS_URL.$report_JS.'_report.js', array('jqplot-all'), '1.0', TRUE); |
|
204 | 204 | |
205 | 205 | $TXN = EEM_Transaction::instance(); |
206 | 206 | |
207 | - $results = $TXN->get_revenue_per_event_report( $period ); |
|
207 | + $results = $TXN->get_revenue_per_event_report($period); |
|
208 | 208 | |
209 | 209 | //EEH_Debug_Tools::printr( $results, '$registrations_per_event' ); |
210 | 210 | $revenue = array(); |
211 | 211 | $results = (array) $results; |
212 | - foreach ( $results as $result ) { |
|
213 | - $event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' )); |
|
214 | - $event_name = wp_trim_words( $event_name, 5, '...' ); |
|
215 | - $revenue[] = array( $event_name, (float)$result->revenue ); |
|
212 | + foreach ($results as $result) { |
|
213 | + $event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8')); |
|
214 | + $event_name = wp_trim_words($event_name, 5, '...'); |
|
215 | + $revenue[] = array($event_name, (float) $result->revenue); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $span = $period == 'week' ? 9 : 33; |
219 | 219 | |
220 | - $report_title = __( 'Total Revenue per Event' ); |
|
220 | + $report_title = __('Total Revenue per Event'); |
|
221 | 221 | |
222 | 222 | $report_params = array( |
223 | 223 | 'title' => $report_title, |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | 'revenue' => $revenue, |
226 | 226 | 'span' => $span, |
227 | 227 | 'width' => ceil(900 / $span), |
228 | - 'noTxnMsg' => sprintf( __('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title ) |
|
228 | + 'noTxnMsg' => sprintf(__('<h2>%s</h2><p>There are currently no transaction records in the last month for this report.</p>', 'event_espresso'), $report_title) |
|
229 | 229 | ); |
230 | - wp_localize_script( $report_JS, 'revenuePerEvent', $report_params ); |
|
230 | + wp_localize_script($report_JS, 'revenuePerEvent', $report_params); |
|
231 | 231 | |
232 | 232 | return $report_ID; |
233 | 233 | } |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * Handles saving everything related to Tickets (datetimes, tickets, prices) |
182 | 182 | * @param EE_Event $evtobj The Event object we're attaching data to |
183 | 183 | * @param array $data The request data from the form |
184 | - * @return bool success or fail |
|
184 | + * @return boolean|null success or fail |
|
185 | 185 | */ |
186 | 186 | public function dtt_and_tickets_caf_update( $evtobj, $data ) { |
187 | 187 | //first we need to start with datetimes cause they are the "root" items attached to events. |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param bool $new_prices Whether attach existing incoming prices or create new ones. |
614 | 614 | * @param int|bool $base_price if FALSE then NOT doing a base price add. |
615 | 615 | * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
616 | - * @return void |
|
616 | + * @return EE_Ticket |
|
617 | 617 | */ |
618 | 618 | protected function _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) { |
619 | 619 | |
@@ -825,6 +825,9 @@ discard block |
||
825 | 825 | |
826 | 826 | |
827 | 827 | |
828 | + /** |
|
829 | + * @param integer $dttrow |
|
830 | + */ |
|
828 | 831 | protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
829 | 832 | |
830 | 833 | $dtt_display_template_args = array( |
@@ -848,6 +851,7 @@ discard block |
||
848 | 851 | * object. |
849 | 852 | * @param bool $default Whether a default row is being generated or not. |
850 | 853 | * @param EE_Datetime[] $all_dtts This is the array of all datetimes used in the editor. |
854 | + * @param EE_Datetime|null $dtt |
|
851 | 855 | * |
852 | 856 | * @return string Generated edit row. |
853 | 857 | */ |
@@ -882,6 +886,10 @@ discard block |
||
882 | 886 | } |
883 | 887 | |
884 | 888 | |
889 | + /** |
|
890 | + * @param EE_Datetime|null $dtt |
|
891 | + * @param boolean $default |
|
892 | + */ |
|
885 | 893 | protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
886 | 894 | |
887 | 895 | $template_args = array( |
@@ -1088,6 +1096,9 @@ discard block |
||
1088 | 1096 | |
1089 | 1097 | |
1090 | 1098 | |
1099 | + /** |
|
1100 | + * @param integer $tktrow |
|
1101 | + */ |
|
1091 | 1102 | protected function _get_tax_rows( $tktrow, $ticket ) { |
1092 | 1103 | $tax_rows = ''; |
1093 | 1104 | $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
@@ -1121,6 +1132,9 @@ discard block |
||
1121 | 1132 | |
1122 | 1133 | |
1123 | 1134 | |
1135 | + /** |
|
1136 | + * @param boolean $default |
|
1137 | + */ |
|
1124 | 1138 | protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
1125 | 1139 | $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
1126 | 1140 | $template_args = array( |
@@ -1227,6 +1241,9 @@ discard block |
||
1227 | 1241 | |
1228 | 1242 | |
1229 | 1243 | |
1244 | + /** |
|
1245 | + * @param boolean $default |
|
1246 | + */ |
|
1230 | 1247 | protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
1231 | 1248 | $dttid = !empty($dtt) ? $dtt->ID() : 0; |
1232 | 1249 | $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
@@ -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 | /** |
@@ -54,23 +54,23 @@ discard block |
||
54 | 54 | $this->_name = 'pricing'; |
55 | 55 | |
56 | 56 | //capability check |
57 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) { |
|
57 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
61 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
62 | 62 | |
63 | 63 | //if we were going to add our own metaboxes we'd use the below. |
64 | 64 | $this->_metaboxes = array( |
65 | 65 | 0 => array( |
66 | - 'page_route' => array('edit','create_new'), |
|
66 | + 'page_route' => array('edit', 'create_new'), |
|
67 | 67 | 'func' => 'pricing_metabox', |
68 | 68 | 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
69 | 69 | 'priority' => 'high', |
70 | 70 | 'context' => 'normal' |
71 | 71 | ), |
72 | 72 | |
73 | - );/**/ |
|
73 | + ); /**/ |
|
74 | 74 | |
75 | 75 | $this->_remove_metaboxes = array( |
76 | 76 | 0 => array( |
@@ -89,24 +89,24 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @var array Expected an array returned with 'date' and 'time' keys. |
91 | 91 | */ |
92 | - $this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
92 | + $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
93 | 93 | 'date' => 'Y-m-d', |
94 | 94 | 'time' => 'h:i a' |
95 | 95 | )); |
96 | 96 | |
97 | 97 | //validate |
98 | - $this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null; |
|
99 | - $this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null; |
|
98 | + $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
99 | + $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
100 | 100 | |
101 | 101 | //validate format strings |
102 | - $format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
103 | - if ( is_array( $format_validation ) ) { |
|
104 | - $msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>'; |
|
105 | - foreach ( $format_validation as $error ) { |
|
106 | - $msg .= '<li>' . $error . '</li>'; |
|
102 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
103 | + if (is_array($format_validation)) { |
|
104 | + $msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>'; |
|
105 | + foreach ($format_validation as $error) { |
|
106 | + $msg .= '<li>'.$error.'</li>'; |
|
107 | 107 | } |
108 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
109 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
108 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
109 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
110 | 110 | $this->_date_format_strings = array( |
111 | 111 | 'date' => 'Y-m-d', |
112 | 112 | 'time' => 'h:i a' |
@@ -117,60 +117,60 @@ discard block |
||
117 | 117 | $this->_scripts_styles = array( |
118 | 118 | 'registers' => array( |
119 | 119 | 'ee-tickets-datetimes-css' => array( |
120 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
120 | + 'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css', |
|
121 | 121 | 'type' => 'css' |
122 | 122 | ), |
123 | 123 | 'ee-dtt-ticket-metabox' => array( |
124 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
124 | + 'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js', |
|
125 | 125 | 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
126 | 126 | ) |
127 | 127 | ), |
128 | 128 | 'deregisters' => array( |
129 | - 'event-editor-css' => array('type' => 'css' ), |
|
129 | + 'event-editor-css' => array('type' => 'css'), |
|
130 | 130 | 'event-datetime-metabox' => array('type' => 'js') |
131 | 131 | ), |
132 | 132 | 'enqueues' => array( |
133 | - 'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ), |
|
134 | - 'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' ) |
|
133 | + 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
134 | + 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
135 | 135 | ), |
136 | 136 | 'localize' => array( |
137 | 137 | 'ee-dtt-ticket-metabox' => array( |
138 | 138 | 'DTT_TRASH_BLOCK' => array( |
139 | 139 | 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'), |
140 | 140 | 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'), |
141 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>', |
|
141 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>', |
|
142 | 142 | 'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
143 | 143 | 'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'), |
144 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>' |
|
144 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>' |
|
145 | 145 | ), |
146 | 146 | 'DTT_ERROR_MSG' => array( |
147 | 147 | 'no_ticket_name' => __('General Admission', 'event_espresso'), |
148 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>' |
|
148 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>' |
|
149 | 149 | ), |
150 | 150 | 'DTT_OVERSELL_WARNING' => array( |
151 | 151 | 'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'), |
152 | 152 | 'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso') |
153 | 153 | ), |
154 | - 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ), |
|
155 | - 'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) ) |
|
154 | + 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']), |
|
155 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')) |
|
156 | 156 | ) |
157 | 157 | ) |
158 | 158 | ); |
159 | 159 | |
160 | 160 | |
161 | - add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 ); |
|
162 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
161 | + add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10); |
|
162 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | |
167 | - public function caf_updates( $update_callbacks ) { |
|
168 | - foreach ( $update_callbacks as $key => $callback ) { |
|
169 | - if ( $callback[1] == '_default_tickets_update' ) |
|
170 | - unset( $update_callbacks[$key] ); |
|
167 | + public function caf_updates($update_callbacks) { |
|
168 | + foreach ($update_callbacks as $key => $callback) { |
|
169 | + if ($callback[1] == '_default_tickets_update') |
|
170 | + unset($update_callbacks[$key]); |
|
171 | 171 | } |
172 | 172 | |
173 | - $update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' ); |
|
173 | + $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
174 | 174 | return $update_callbacks; |
175 | 175 | } |
176 | 176 | |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param array $data The request data from the form |
184 | 184 | * @return bool success or fail |
185 | 185 | */ |
186 | - public function dtt_and_tickets_caf_update( $evtobj, $data ) { |
|
186 | + public function dtt_and_tickets_caf_update($evtobj, $data) { |
|
187 | 187 | //first we need to start with datetimes cause they are the "root" items attached to events. |
188 | - $saved_dtts = $this->_update_dtts( $evtobj, $data ); |
|
188 | + $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
189 | 189 | //next tackle the tickets (and prices?) |
190 | - $success = $this->_update_tkts( $evtobj, $saved_dtts, $data ); |
|
190 | + $success = $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -198,56 +198,56 @@ discard block |
||
198 | 198 | * @param array $data the request data from the form |
199 | 199 | * @return EE_Datetime array of EE_Datetime ids created/updated. |
200 | 200 | */ |
201 | - protected function _update_dtts( $evt_obj, $data ) { |
|
202 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
201 | + protected function _update_dtts($evt_obj, $data) { |
|
202 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
203 | 203 | $success = TRUE; |
204 | 204 | |
205 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
206 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
205 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
206 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
207 | 207 | $datetime_values = array( |
208 | - 'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
209 | - 'DTT_name' => !empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '', |
|
210 | - 'DTT_description' => !empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '', |
|
208 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
209 | + 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
210 | + 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
211 | 211 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
212 | 212 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
213 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'], |
|
214 | - 'DTT_order' => !isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'], |
|
213 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'], |
|
214 | + 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
215 | 215 | ); |
216 | 216 | |
217 | 217 | //if we have an id then let's get existing object first and then set the new values. Otherwise we instantiate a new object for save. |
218 | 218 | |
219 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
220 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
219 | + if ( ! empty($dtt['DTT_ID'])) { |
|
220 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
221 | 221 | |
222 | 222 | //set date and time format according to what is set in this class. |
223 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
224 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
223 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
224 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
225 | 225 | |
226 | - foreach ( $datetime_values as $field => $value ) { |
|
227 | - $DTM->set( $field, $value ); |
|
226 | + foreach ($datetime_values as $field => $value) { |
|
227 | + $DTM->set($field, $value); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | //make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. We need to do this so we dont' TRASH the parent DTT. |
231 | 231 | $saved_dtts[$DTM->ID()] = $DTM; |
232 | 232 | |
233 | 233 | } else { |
234 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE ); |
|
234 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE); |
|
235 | 235 | |
236 | 236 | //reset date and times to match the format |
237 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
238 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
239 | - foreach( $datetime_values as $field => $value ) { |
|
240 | - $DTM->set( $field, $value ); |
|
237 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
238 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
239 | + foreach ($datetime_values as $field => $value) { |
|
240 | + $DTM->set($field, $value); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | 244 | |
245 | 245 | $DTM->save(); |
246 | - $DTT = $evt_obj->_add_relation_to( $DTM, 'Datetime' ); |
|
246 | + $DTT = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
247 | 247 | |
248 | 248 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
249 | - if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) { |
|
250 | - $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') ); |
|
249 | + if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) { |
|
250 | + $DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start')); |
|
251 | 251 | EE_Registry::instance()->load_helper('DTT_Helper'); |
252 | 252 | $DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days'); |
253 | 253 | $DTT->save(); |
@@ -257,30 +257,30 @@ discard block |
||
257 | 257 | $saved_dtts[$DTT->ID()] = $DTT; |
258 | 258 | $saved_dtt_objs[$row] = $DTT; |
259 | 259 | |
260 | - $success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
260 | + $success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now. |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | //now we need to REMOVE any dtts that got deleted. Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point. |
264 | - $old_datetimes = explode(',', $data['datetime_IDs'] ); |
|
264 | + $old_datetimes = explode(',', $data['datetime_IDs']); |
|
265 | 265 | $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
266 | 266 | |
267 | - if ( is_array( $old_datetimes ) ) { |
|
268 | - $dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) ); |
|
269 | - foreach ( $dtts_to_delete as $id ) { |
|
270 | - $id = absint( $id ); |
|
271 | - if ( empty( $id ) ) |
|
267 | + if (is_array($old_datetimes)) { |
|
268 | + $dtts_to_delete = array_diff($old_datetimes, array_keys($saved_dtts)); |
|
269 | + foreach ($dtts_to_delete as $id) { |
|
270 | + $id = absint($id); |
|
271 | + if (empty($id)) |
|
272 | 272 | continue; |
273 | 273 | |
274 | 274 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
275 | 275 | |
276 | 276 | //remove tkt relationships. |
277 | 277 | $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
278 | - foreach ( $related_tickets as $tkt ) { |
|
278 | + foreach ($related_tickets as $tkt) { |
|
279 | 279 | $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
280 | 280 | } |
281 | 281 | |
282 | 282 | |
283 | - $evt_obj->_remove_relation_to( $id, 'Datetime' ); |
|
283 | + $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
@@ -299,77 +299,77 @@ discard block |
||
299 | 299 | * @param array $data incoming request data |
300 | 300 | * @return EE_Ticket[] |
301 | 301 | */ |
302 | - protected function _update_tkts( $evtobj, $saved_dtts, $data ) { |
|
302 | + protected function _update_tkts($evtobj, $saved_dtts, $data) { |
|
303 | 303 | //stripslashes because WP filtered the $_POST ($data) array to add slashes |
304 | 304 | $data = stripslashes_deep($data); |
305 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
305 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
306 | 306 | $saved_tickets = $dtts_on_existing = array(); |
307 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
307 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
308 | 308 | |
309 | 309 | //load money helper |
310 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
310 | + EE_Registry::instance()->load_helper('Money'); |
|
311 | 311 | |
312 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
312 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
313 | 313 | |
314 | 314 | $update_prices = $create_new_TKT = $ticket_sold = FALSE; |
315 | 315 | $new_default = $new_tkt = NULL; |
316 | 316 | |
317 | 317 | //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
318 | 318 | |
319 | - $starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]); |
|
320 | - $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] ); |
|
319 | + $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
320 | + $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
321 | 321 | $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
322 | 322 | $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
323 | 323 | |
324 | 324 | //note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models. |
325 | 325 | //note incoming ['TKT_price'] value is already in standard notation (via js). |
326 | - $ticket_price = isset( $tkt['TKT_price'] ) ? round ( (float) $tkt['TKT_price'], 3 ) : 0; |
|
326 | + $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0; |
|
327 | 327 | |
328 | 328 | //note incoming base price needs converted from localized value. |
329 | - $base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0; |
|
329 | + $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
330 | 330 | //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
331 | 331 | $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
332 | - $base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0; |
|
332 | + $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
333 | 333 | |
334 | 334 | $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
335 | 335 | |
336 | 336 | $now = null; |
337 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
337 | + if (empty($tkt['TKT_start_date'])) { |
|
338 | 338 | //lets' use now in the set timezone. |
339 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
340 | - $tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
339 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
340 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
341 | 341 | } |
342 | 342 | |
343 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
343 | + if (empty($tkt['TKT_end_date'])) { |
|
344 | 344 | /** |
345 | 345 | * set the TKT_end_date to the first datetime attached to the ticket. |
346 | 346 | */ |
347 | - $first_dtt = $saved_dtts[reset( $tkt_dtt_rows )]; |
|
348 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] ); |
|
347 | + $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
348 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | $TKT_values = array( |
352 | - 'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
353 | - 'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
354 | - 'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
355 | - 'TKT_description' => !empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
352 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
353 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
354 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
355 | + 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
356 | 356 | 'TKT_start_date' => $tkt['TKT_start_date'], |
357 | 357 | 'TKT_end_date' => $tkt['TKT_end_date'], |
358 | - 'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'], |
|
359 | - 'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'], |
|
360 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
361 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'], |
|
358 | + 'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'], |
|
359 | + 'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'], |
|
360 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
361 | + 'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'], |
|
362 | 362 | 'TKT_row' => $row, |
363 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0, |
|
364 | - 'TKT_taxable' => !empty( $tkt['TKT_taxable'] ) ? 1 : 0, |
|
365 | - 'TKT_required' => !empty( $tkt['TKT_required'] ) ? 1 : 0, |
|
363 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
364 | + 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
365 | + 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
366 | 366 | 'TKT_price' => $ticket_price |
367 | 367 | ); |
368 | 368 | |
369 | 369 | |
370 | 370 | |
371 | 371 | //if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well. |
372 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
372 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
373 | 373 | $TKT_values['TKT_ID'] = 0; |
374 | 374 | $TKT_values['TKT_is_default'] = 0; |
375 | 375 | $update_prices = TRUE; |
@@ -379,28 +379,28 @@ discard block |
||
379 | 379 | //we actually do our saves ahead of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified. |
380 | 380 | //keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
381 | 381 | |
382 | - if ( !empty( $TKT_values['TKT_ID'] ) ) { |
|
383 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
382 | + if ( ! empty($TKT_values['TKT_ID'])) { |
|
383 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
384 | 384 | |
385 | 385 | //set ticket formats |
386 | - $ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false; |
|
387 | - $TKT->set_date_format( $this->_date_format_strings['date'] ); |
|
388 | - $TKT->set_time_format( $this->_date_format_strings['time'] ); |
|
386 | + $ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false; |
|
387 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
388 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
389 | 389 | |
390 | 390 | //let's just check the total price for the existing ticket and determine if it matches the new total price. if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket. |
391 | 391 | $orig_price = $TKT->price(); |
392 | - $create_new_TKT = $ticket_sold && $ticket_price != $orig_price && !$TKT->get('TKT_deleted') ? TRUE : FALSE; |
|
392 | + $create_new_TKT = $ticket_sold && $ticket_price != $orig_price && ! $TKT->get('TKT_deleted') ? TRUE : FALSE; |
|
393 | 393 | |
394 | 394 | //set new values |
395 | - foreach ( $TKT_values as $field => $value ) { |
|
396 | - $TKT->set( $field, $value ); |
|
395 | + foreach ($TKT_values as $field => $value) { |
|
396 | + $TKT->set($field, $value); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | //make sure price is set if it hasn't been already |
400 | - $TKT->set( 'TKT_price', $ticket_price ); |
|
400 | + $TKT->set('TKT_price', $ticket_price); |
|
401 | 401 | |
402 | 402 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
403 | - if ( $create_new_TKT ) { |
|
403 | + if ($create_new_TKT) { |
|
404 | 404 | //@TODO need to move this logic into its own method that just receives the ticket object (and other necessary info) |
405 | 405 | $new_tkt = clone($TKT); |
406 | 406 | |
@@ -410,26 +410,26 @@ discard block |
||
410 | 410 | //TKT will get archived later b/c we are NOT adding it to the saved_tickets array. |
411 | 411 | |
412 | 412 | //if existing $TKT has sold amount, then we need to adjust the qty for the new TKT to = the remaining available. |
413 | - if ( $TKT->get('TKT_sold') > 0 ) { |
|
413 | + if ($TKT->get('TKT_sold') > 0) { |
|
414 | 414 | $new_qty = $TKT->get('TKT_qty') - $TKT->get('TKT_sold'); |
415 | 415 | $new_tkt->set_qty($new_qty); |
416 | 416 | } |
417 | 417 | |
418 | 418 | |
419 | 419 | //create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it. |
420 | - $new_tkt->set( 'TKT_ID', 0 ); |
|
421 | - $new_tkt->set( 'TKT_deleted', 0 ); |
|
422 | - $new_tkt->set( 'TKT_price', $ticket_price ); |
|
423 | - $new_tkt->set( 'TKT_sold', 0 ); |
|
420 | + $new_tkt->set('TKT_ID', 0); |
|
421 | + $new_tkt->set('TKT_deleted', 0); |
|
422 | + $new_tkt->set('TKT_price', $ticket_price); |
|
423 | + $new_tkt->set('TKT_sold', 0); |
|
424 | 424 | |
425 | 425 | //now we update the prices just for this ticket |
426 | - $new_tkt = $this->_add_prices_to_ticket( $price_rows, $new_tkt, TRUE ); |
|
426 | + $new_tkt = $this->_add_prices_to_ticket($price_rows, $new_tkt, TRUE); |
|
427 | 427 | |
428 | 428 | //and we update the base price |
429 | - $new_tkt = $this->_add_prices_to_ticket( array(), $new_tkt, TRUE, $base_price, $base_price_id ); |
|
429 | + $new_tkt = $this->_add_prices_to_ticket(array(), $new_tkt, TRUE, $base_price, $base_price_id); |
|
430 | 430 | |
431 | - foreach ( $dtts_on_existing as $adddtt ) { |
|
432 | - $new_tkt->_add_relation_to( $adddtt, 'Datetime' ); |
|
431 | + foreach ($dtts_on_existing as $adddtt) { |
|
432 | + $new_tkt->_add_relation_to($adddtt, 'Datetime'); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | } |
@@ -437,15 +437,15 @@ discard block |
||
437 | 437 | } else { |
438 | 438 | //no TKT_id so a new TKT |
439 | 439 | $TKT_values['TKT_price'] = $ticket_price; |
440 | - $TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values, $timezone ), FALSE, FALSE ); |
|
440 | + $TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values, $timezone), FALSE, FALSE); |
|
441 | 441 | |
442 | 442 | //reset values so that new formats are correctly considered when converting date and time strings |
443 | - $TKT->set_date_format( $this->_date_format_strings['date'] ); |
|
444 | - $TKT->set_time_format( $this->_date_format_strings['time'] ); |
|
443 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
444 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
445 | 445 | |
446 | 446 | //reset values |
447 | - foreach ( $TKT_values as $field => $value ) { |
|
448 | - $TKT->set( $field, $value ); |
|
447 | + foreach ($TKT_values as $field => $value) { |
|
448 | + $TKT->set($field, $value); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | $update_prices = TRUE; |
@@ -454,31 +454,31 @@ discard block |
||
454 | 454 | $TKT->save(); //make sure any current values have been saved. |
455 | 455 | |
456 | 456 | //before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date. |
457 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
458 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
457 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
458 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
459 | 459 | EE_Registry::instance()->load_helper('DTT_Helper'); |
460 | 460 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
461 | 461 | } |
462 | 462 | |
463 | 463 | //let's make sure the base price is handled |
464 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT; |
|
464 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT; |
|
465 | 465 | |
466 | 466 | //add/update price_modifiers |
467 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT; |
|
467 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
468 | 468 | |
469 | 469 | //need to make sue that the TKT_price is accurate after saving the prices. |
470 | 470 | $TKT->ensure_TKT_Price_correct(); |
471 | 471 | |
472 | 472 | |
473 | 473 | //handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave. |
474 | - if ( ! defined('DOING_AUTOSAVE' ) ) { |
|
475 | - if ( !empty($tkt['TKT_is_default_selector'] ) ) { |
|
474 | + if ( ! defined('DOING_AUTOSAVE')) { |
|
475 | + if ( ! empty($tkt['TKT_is_default_selector'])) { |
|
476 | 476 | $update_prices = TRUE; |
477 | 477 | $new_default = clone $TKT; |
478 | - $new_default->set( 'TKT_ID', 0 ); |
|
479 | - $new_default->set( 'TKT_is_default', 1 ); |
|
480 | - $new_default->set( 'TKT_row', 1 ); |
|
481 | - $new_default->set( 'TKT_price', $ticket_price ); |
|
478 | + $new_default->set('TKT_ID', 0); |
|
479 | + $new_default->set('TKT_is_default', 1); |
|
480 | + $new_default->set('TKT_row', 1); |
|
481 | + $new_default->set('TKT_price', $ticket_price); |
|
482 | 482 | //remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object) |
483 | 483 | $new_default->_remove_relations('Datetime'); |
484 | 484 | $new_default->save(); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
487 | 487 | |
488 | 488 | //don't forget the base price! |
489 | - $new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id ); |
|
489 | + $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id); |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
@@ -494,42 +494,42 @@ discard block |
||
494 | 494 | |
495 | 495 | |
496 | 496 | //first let's do the add_relation_to() |
497 | - $dtts_added = empty( $dtts_added ) || ( is_array( $dtts_added ) && ( isset( $dtts_added[0] ) && $dtts_added[0] == '' ) ) ? array() : $dtts_added; |
|
497 | + $dtts_added = empty($dtts_added) || (is_array($dtts_added) && (isset($dtts_added[0]) && $dtts_added[0] == '')) ? array() : $dtts_added; |
|
498 | 498 | |
499 | - foreach ( $dtts_added as $dttrow ) { |
|
499 | + foreach ($dtts_added as $dttrow) { |
|
500 | 500 | $dttrow = (int) $dttrow; |
501 | 501 | $TKT->_add_relation_to($saved_dtts[$dttrow], 'Datetime'); |
502 | 502 | |
503 | 503 | //now wait a minute. Does this tkt have any sold? Cause if it does then we need to add that to the DTT sold because this DTT is getting added. |
504 | - if ( $TKT->get('TKT_sold') > 0 ) { |
|
505 | - $saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold') ); |
|
504 | + if ($TKT->get('TKT_sold') > 0) { |
|
505 | + $saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold')); |
|
506 | 506 | $saved_dtts[$dttrow]->save(); |
507 | 507 | } |
508 | 508 | |
509 | 509 | //if we have a new_tkt... let's add to it as well |
510 | - if ( !empty( $new_tkt ) ) |
|
511 | - $new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' ); |
|
510 | + if ( ! empty($new_tkt)) |
|
511 | + $new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime'); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | |
515 | - $dtts_removed = empty( $dtts_removed ) || ( is_array( $dtts_removed ) && isset( $dtts_removed[0] ) && $dtts_removed[0] == '' ) ? array() : $dtts_removed; |
|
515 | + $dtts_removed = empty($dtts_removed) || (is_array($dtts_removed) && isset($dtts_removed[0]) && $dtts_removed[0] == '') ? array() : $dtts_removed; |
|
516 | 516 | |
517 | 517 | //now let's do the remove_relation_to() |
518 | - foreach ( $dtts_removed as $dttrow ) { |
|
518 | + foreach ($dtts_removed as $dttrow) { |
|
519 | 519 | $dttrow = (int) $dttrow; |
520 | 520 | //its entirely possible that a datetime got deleted (instead of just removed from relationship. So make sure we skip over this if the dtt isn't in the saved_dtts array) |
521 | - if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) |
|
521 | + if (empty($saved_dtts[$dttrow]) || ! $saved_dtts[$dttrow] instanceof EE_Datetime) |
|
522 | 522 | continue; |
523 | 523 | |
524 | 524 | $TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime'); |
525 | 525 | |
526 | 526 | //now wait a minute. Does this tkt have any sold? Cause if it does then we need to remove it's sold from the DTT_sold. |
527 | - if ( $TKT->get('TKT_sold') > 0 ) { |
|
528 | - $saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold') ); |
|
527 | + if ($TKT->get('TKT_sold') > 0) { |
|
528 | + $saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold')); |
|
529 | 529 | $saved_dtts[$dttrow]->save(); |
530 | 530 | } |
531 | 531 | |
532 | - if ( !empty( $new_tkt ) ) |
|
532 | + if ( ! empty($new_tkt)) |
|
533 | 533 | $new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime'); |
534 | 534 | } |
535 | 535 | |
@@ -540,43 +540,43 @@ discard block |
||
540 | 540 | //let's assign any tickets that have been setup to the saved_tickets tracker |
541 | 541 | //save existing TKT |
542 | 542 | $TKT->save(); |
543 | - if ( $create_new_TKT ) { |
|
543 | + if ($create_new_TKT) { |
|
544 | 544 | //save new TKT |
545 | 545 | $new_tkt->save(); |
546 | 546 | //add new ticket to array |
547 | 547 | $saved_tickets[$new_tkt->ID()] = $new_tkt; |
548 | 548 | |
549 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data ); |
|
549 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
550 | 550 | |
551 | 551 | } else { |
552 | 552 | //add tkt to saved tkts |
553 | 553 | //save existing TKT |
554 | 554 | $saved_tickets[$TKT->ID()] = $TKT; |
555 | 555 | |
556 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data ); |
|
556 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | } |
560 | 560 | |
561 | 561 | //now we need to handle tickets actually "deleted permanently". There are cases where we'd want this to happen (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). Or a draft event was saved and in the process of editing a ticket is trashed. No sense in keeping all the related data in the db! |
562 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
563 | - $tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) ); |
|
562 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
563 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
564 | 564 | /*var_dump($old_tickets); |
565 | 565 | var_dump($saved_tickets); |
566 | 566 | var_dump($tickets_removed);*/ |
567 | 567 | |
568 | - foreach ( $tickets_removed as $id ) { |
|
569 | - $id = absint( $id ); |
|
568 | + foreach ($tickets_removed as $id) { |
|
569 | + $id = absint($id); |
|
570 | 570 | |
571 | 571 | //get the ticket for this id |
572 | 572 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
573 | 573 | |
574 | 574 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
575 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
575 | + if ($tkt_to_remove->get('TKT_is_default')) |
|
576 | 576 | continue; |
577 | 577 | |
578 | 578 | //if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets. |
579 | - if ( $tkt_to_remove->count_related('Registration') > 0 ) { |
|
579 | + if ($tkt_to_remove->count_related('Registration') > 0) { |
|
580 | 580 | $tkt_to_remove->delete(); |
581 | 581 | continue; |
582 | 582 | } |
@@ -584,14 +584,14 @@ discard block |
||
584 | 584 | //need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold) |
585 | 585 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
586 | 586 | |
587 | - foreach( $dtts as $dtt ) { |
|
587 | + foreach ($dtts as $dtt) { |
|
588 | 588 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
589 | 589 | } |
590 | 590 | |
591 | 591 | //need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
592 | 592 | $tkt_to_remove->delete_related_permanently('Price'); |
593 | 593 | |
594 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove ); |
|
594 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
595 | 595 | |
596 | 596 | //finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships) |
597 | 597 | $tkt_to_remove->delete_permanently(); |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
616 | 616 | * @return void |
617 | 617 | */ |
618 | - protected function _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) { |
|
618 | + protected function _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) { |
|
619 | 619 | |
620 | 620 | //let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session. |
621 | 621 | $current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers(); |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $updated_prices = array(); |
624 | 624 | |
625 | 625 | // if $base_price ! FALSE then updating a base price. |
626 | - if ( $base_price !== FALSE ) { |
|
626 | + if ($base_price !== FALSE) { |
|
627 | 627 | $prices[1] = array( |
628 | 628 | 'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id, |
629 | 629 | 'PRT_ID' => 1, |
@@ -634,47 +634,47 @@ discard block |
||
634 | 634 | } |
635 | 635 | |
636 | 636 | //possibly need to save tkt |
637 | - if ( ! $ticket->ID() ) |
|
637 | + if ( ! $ticket->ID()) |
|
638 | 638 | $ticket->save(); |
639 | 639 | |
640 | - foreach ( $prices as $row => $prc ) { |
|
641 | - $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
|
642 | - if ( empty($prt_id) ) |
|
640 | + foreach ($prices as $row => $prc) { |
|
641 | + $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL; |
|
642 | + if (empty($prt_id)) |
|
643 | 643 | continue; //prices MUST have a price type id. |
644 | 644 | $PRC_values = array( |
645 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
645 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
646 | 646 | 'PRT_ID' => $prt_id, |
647 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
648 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
649 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
647 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
648 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
649 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
650 | 650 | 'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor |
651 | 651 | 'PRC_order' => $row |
652 | 652 | ); |
653 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
653 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
654 | 654 | $PRC_values['PRC_ID'] = 0; |
655 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
655 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
656 | 656 | } else { |
657 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
657 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
658 | 658 | //update this price with new values |
659 | - foreach ( $PRC_values as $field => $newprc ) { |
|
660 | - $PRC->set( $field, $newprc ); |
|
659 | + foreach ($PRC_values as $field => $newprc) { |
|
660 | + $PRC->set($field, $newprc); |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | $PRC->save(); |
664 | 664 | $prcid = $PRC->ID(); |
665 | 665 | $updated_prices[$prcid] = $PRC; |
666 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
666 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | //now let's remove any prices that got removed from the ticket |
670 | - if ( !empty ( $current_prices_on_ticket ) ) { |
|
670 | + if ( ! empty ($current_prices_on_ticket)) { |
|
671 | 671 | $current = array_keys($current_prices_on_ticket); |
672 | 672 | $updated = array_keys($updated_prices); |
673 | 673 | $prices_to_remove = array_diff($current, $updated); |
674 | - if ( !empty( $prices_to_remove ) ) { |
|
675 | - foreach ( $prices_to_remove as $prc_id ) { |
|
674 | + if ( ! empty($prices_to_remove)) { |
|
675 | + foreach ($prices_to_remove as $prc_id) { |
|
676 | 676 | $p = $current_prices_on_ticket[$prc_id]; |
677 | - $ticket->_remove_relation_to( $p, 'Price' ); |
|
677 | + $ticket->_remove_relation_to($p, 'Price'); |
|
678 | 678 | |
679 | 679 | //delete permanently the price |
680 | 680 | $p->delete_permanently(); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | |
688 | 688 | |
689 | 689 | |
690 | - public function autosave_handling( $event_admin_obj ) { |
|
690 | + public function autosave_handling($event_admin_obj) { |
|
691 | 691 | return $event_admin_obj; //doing nothing for the moment. |
692 | 692 | //todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method) |
693 | 693 | |
@@ -721,12 +721,12 @@ discard block |
||
721 | 721 | |
722 | 722 | //default main template args |
723 | 723 | $main_template_args = array( |
724 | - 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
724 | + 'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help |
|
725 | 725 | 'existing_datetime_ids' => '', |
726 | 726 | 'total_dtt_rows' => 1, |
727 | - 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
727 | + 'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
728 | 728 | 'datetime_rows' => '', |
729 | - 'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
729 | + 'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
730 | 730 | 'ticket_rows' => '', |
731 | 731 | 'existing_ticket_ids' => '', |
732 | 732 | 'total_ticket_rows' => 1, |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | |
737 | 737 | $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL; |
738 | 738 | |
739 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
739 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
740 | 740 | |
741 | 741 | /** |
742 | 742 | * 1. Start with retrieving Datetimes |
@@ -744,25 +744,25 @@ discard block |
||
744 | 744 | * 3. For each ticket get related prices |
745 | 745 | */ |
746 | 746 | |
747 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) ); |
|
748 | - $times = $DTM->get_all_event_dates( $evtID ); |
|
747 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
748 | + $times = $DTM->get_all_event_dates($evtID); |
|
749 | 749 | |
750 | 750 | |
751 | 751 | |
752 | 752 | $main_template_args['total_dtt_rows'] = count($times); |
753 | - foreach ( $times as $time ) { |
|
753 | + foreach ($times as $time) { |
|
754 | 754 | $dttid = $time->get('DTT_ID'); |
755 | 755 | $dttrow = $time->get('DTT_order'); |
756 | 756 | $existing_datetime_ids[] = $dttid; |
757 | 757 | |
758 | 758 | //tickets attached |
759 | - $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array(); |
|
759 | + $related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array(); |
|
760 | 760 | |
761 | 761 | //if there are no related tickets this is likely a new event OR autodraft |
762 | 762 | // event so we need to generate the default tickets because dtts |
763 | 763 | // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
764 | 764 | // datetime on the event. |
765 | - if ( empty ( $related_tickets ) && count( $times ) < 2 ) { |
|
765 | + if (empty ($related_tickets) && count($times) < 2) { |
|
766 | 766 | $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
767 | 767 | } |
768 | 768 | |
@@ -771,11 +771,11 @@ discard block |
||
771 | 771 | |
772 | 772 | //loop through and setup the ticket rows and make sure the order is set. |
773 | 773 | $order = 0; |
774 | - foreach ( $related_tickets as $ticket ) { |
|
774 | + foreach ($related_tickets as $ticket) { |
|
775 | 775 | $tktid = $ticket->get('TKT_ID'); |
776 | 776 | $tktrow = $ticket->get('TKT_row'); |
777 | 777 | //we only want unique tickets in our final display!! |
778 | - if ( !in_array( $tktid, $existing_ticket_ids ) ) { |
|
778 | + if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
779 | 779 | $existing_ticket_ids[] = $tktid; |
780 | 780 | $all_tickets[] = $ticket; |
781 | 781 | } |
@@ -784,56 +784,56 @@ discard block |
||
784 | 784 | $datetime_tickets[$dttid][] = $tktrow; |
785 | 785 | |
786 | 786 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
787 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
787 | + if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) |
|
788 | 788 | $ticket_datetimes[$tktid][] = $dttrow; |
789 | 789 | } |
790 | 790 | } |
791 | 791 | |
792 | - $main_template_args['total_ticket_rows'] = count( $existing_ticket_ids ); |
|
793 | - $main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
794 | - $main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
792 | + $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
793 | + $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
794 | + $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
795 | 795 | |
796 | 796 | //sort $all_tickets by order |
797 | - usort( $all_tickets, function( $a, $b ) { |
|
797 | + usort($all_tickets, function($a, $b) { |
|
798 | 798 | $a_order = (int) $a->get('TKT_order'); |
799 | 799 | $b_order = (int) $b->get('TKT_order'); |
800 | - if ( $a_order == $b_order ) { |
|
800 | + if ($a_order == $b_order) { |
|
801 | 801 | return 0; |
802 | 802 | } |
803 | - return ( $a_order < $b_order ) ? -1 : 1; |
|
803 | + return ($a_order < $b_order) ? -1 : 1; |
|
804 | 804 | }); |
805 | 805 | |
806 | 806 | //k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again. |
807 | 807 | $dttrow = 1; |
808 | - foreach ( $times as $time ) { |
|
809 | - $main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times ); |
|
808 | + foreach ($times as $time) { |
|
809 | + $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times); |
|
810 | 810 | $dttrow++; |
811 | 811 | } |
812 | 812 | |
813 | 813 | //then loop through all tickets for the ticket rows. |
814 | 814 | $tktrow = 1; |
815 | - foreach ( $all_tickets as $ticket ) { |
|
816 | - $main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets ); |
|
815 | + foreach ($all_tickets as $ticket) { |
|
816 | + $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets); |
|
817 | 817 | $tktrow++; |
818 | 818 | } |
819 | 819 | |
820 | 820 | $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
821 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
822 | - EEH_Template::display_template( $template, $main_template_args ); |
|
821 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'; |
|
822 | + EEH_Template::display_template($template, $main_template_args); |
|
823 | 823 | return; |
824 | 824 | } |
825 | 825 | |
826 | 826 | |
827 | 827 | |
828 | - protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
|
828 | + protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) { |
|
829 | 829 | |
830 | 830 | $dtt_display_template_args = array( |
831 | - 'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ), |
|
832 | - 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ), |
|
831 | + 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
832 | + 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default), |
|
833 | 833 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
834 | 834 | ); |
835 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
836 | - return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE); |
|
835 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php'; |
|
836 | + return EEH_Template::display_template($template, $dtt_display_template_args, TRUE); |
|
837 | 837 | } |
838 | 838 | |
839 | 839 | |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | * |
852 | 852 | * @return string Generated edit row. |
853 | 853 | */ |
854 | - protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) { |
|
854 | + protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) { |
|
855 | 855 | |
856 | 856 | // if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true. |
857 | 857 | $default = ! $dtt instanceof EE_Datetime ? true : false; |
@@ -859,30 +859,30 @@ discard block |
||
859 | 859 | $template_args = array( |
860 | 860 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
861 | 861 | 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
862 | - 'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
862 | + 'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
863 | 863 | 'DTT_ID' => $default ? '' : $dtt->ID(), |
864 | 864 | 'DTT_name' => $default ? '' : $dtt->name(), |
865 | 865 | 'DTT_description' => $default ? '' : $dtt->description(), |
866 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
867 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
868 | - 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'), |
|
866 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
867 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
868 | + 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
869 | 869 | 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
870 | 870 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
871 | - 'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
872 | - 'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
871 | + 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
872 | + 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
873 | 873 | ); |
874 | 874 | |
875 | - $template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
875 | + $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
876 | 876 | |
877 | 877 | //allow filtering of template args at this point. |
878 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event ); |
|
878 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event); |
|
879 | 879 | |
880 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
881 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
880 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php'; |
|
881 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | |
885 | - protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
|
885 | + protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) { |
|
886 | 886 | |
887 | 887 | $template_args = array( |
888 | 888 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
@@ -890,47 +890,47 @@ discard block |
||
890 | 890 | 'DTT_description' => $default ? '' : $dtt->description(), |
891 | 891 | 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
892 | 892 | 'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
893 | - 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
893 | + 'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here. |
|
894 | 894 | 'DTT_ID' => $default ? '' : $dtt->ID() |
895 | 895 | ); |
896 | 896 | |
897 | 897 | //need to setup the list items (but only if this isnt' a default skeleton setup) |
898 | - if ( !$default ) { |
|
898 | + if ( ! $default) { |
|
899 | 899 | $tktrow = 1; |
900 | - foreach ( $all_tickets as $ticket ) { |
|
901 | - $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ); |
|
900 | + foreach ($all_tickets as $ticket) { |
|
901 | + $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default); |
|
902 | 902 | $tktrow++; |
903 | 903 | } |
904 | 904 | } |
905 | 905 | |
906 | 906 | //filter template args at this point |
907 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event ); |
|
907 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event); |
|
908 | 908 | |
909 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
910 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
909 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php'; |
|
910 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | |
914 | 914 | |
915 | - protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) { |
|
916 | - $tktid = !empty( $ticket ) ? $ticket->ID() : 0; |
|
917 | - $dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array(); |
|
915 | + protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) { |
|
916 | + $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
917 | + $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
918 | 918 | |
919 | - $displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0; |
|
919 | + $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
920 | 920 | $template_args = array( |
921 | 921 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
922 | - 'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow, |
|
922 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
923 | 923 | 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
924 | 924 | 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
925 | - 'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
926 | - 'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
925 | + 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
926 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(), |
|
927 | 927 | ); |
928 | 928 | |
929 | 929 | //filter template args |
930 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event ); |
|
930 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event); |
|
931 | 931 | |
932 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
933 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
932 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
933 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
934 | 934 | } |
935 | 935 | |
936 | 936 | |
@@ -952,32 +952,32 @@ discard block |
||
952 | 952 | * |
953 | 953 | * @return [type] [description] |
954 | 954 | */ |
955 | - protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) { |
|
955 | + protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) { |
|
956 | 956 | |
957 | 957 | //if $ticket is not an instance of EE_Ticket then force default to true. |
958 | - $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
958 | + $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
959 | 959 | |
960 | 960 | |
961 | - $prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array(); |
|
961 | + $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
962 | 962 | |
963 | 963 | // check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket). This will future proof in case there is ever any behaviour change between what the primary_key defaults to. |
964 | - $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE; |
|
964 | + $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE; |
|
965 | 965 | |
966 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
966 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
967 | 967 | |
968 | 968 | $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
969 | - $base_price = $default ? NULL : $ticket->base_price(); |
|
969 | + $base_price = $default ? NULL : $ticket->base_price(); |
|
970 | 970 | $count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE); |
971 | 971 | |
972 | 972 | //breaking out complicated condition for ticket_status |
973 | - if ( $default ) { |
|
974 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
973 | + if ($default) { |
|
974 | + $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale; |
|
975 | 975 | } else { |
976 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
976 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | //breaking out complicated condition for TKT_taxable |
980 | - if ( $default ) { |
|
980 | + if ($default) { |
|
981 | 981 | $TKT_taxable = ''; |
982 | 982 | } else { |
983 | 983 | $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
@@ -992,19 +992,19 @@ discard block |
||
992 | 992 | 'edit_tkt_expanded' => '', |
993 | 993 | 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
994 | 994 | 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
995 | - 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
996 | - 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
997 | - 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
995 | + 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
996 | + 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
997 | + 'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE), |
|
998 | 998 | 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE), |
999 | 999 | 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
1000 | 1000 | 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
1001 | - 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'), |
|
1002 | - 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'), |
|
1003 | - 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'), |
|
1004 | - 'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ), |
|
1005 | - 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max','input'), |
|
1001 | + 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1002 | + 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1003 | + 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1004 | + 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1005 | + 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1006 | 1006 | 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
1007 | - 'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ), |
|
1007 | + 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))), |
|
1008 | 1008 | 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
1009 | 1009 | 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
1010 | 1010 | 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
@@ -1013,99 +1013,99 @@ discard block |
||
1013 | 1013 | 'ticket_price_rows' => '', |
1014 | 1014 | 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'), |
1015 | 1015 | 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
1016 | - 'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"', |
|
1017 | - 'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '', |
|
1016 | + 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1017 | + 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1018 | 1018 | 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
1019 | 1019 | 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
1020 | 1020 | 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
1021 | 1021 | 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
1022 | - 'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ), |
|
1022 | + 'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)), |
|
1023 | 1023 | 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
1024 | 1024 | 'TKT_taxable' => $TKT_taxable, |
1025 | 1025 | 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
1026 | 1026 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1027 | - 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ), |
|
1027 | + 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE), |
|
1028 | 1028 | 'TKT_subtotal_amount' => $ticket_subtotal, |
1029 | - 'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ), |
|
1030 | - 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE, |
|
1029 | + 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1030 | + 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE, |
|
1031 | 1031 | 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
1032 | 1032 | 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
1033 | 1033 | 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
1034 | 1034 | ); |
1035 | 1035 | |
1036 | - $template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1036 | + $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1037 | 1037 | |
1038 | 1038 | //handle rows that should NOT be empty |
1039 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1039 | + if (empty($template_args['TKT_start_date'])) { |
|
1040 | 1040 | //if empty then the start date will be now. |
1041 | - $template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp')); |
|
1042 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1041 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp')); |
|
1042 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1045 | + if (empty($template_args['TKT_end_date'])) { |
|
1046 | 1046 | |
1047 | 1047 | //get the earliest datetime (if present); |
1048 | - $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL; |
|
1048 | + $earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL; |
|
1049 | 1049 | |
1050 | - if ( !empty( $earliest_dtt ) ) { |
|
1051 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
1050 | + if ( ! empty($earliest_dtt)) { |
|
1051 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
1052 | 1052 | } else { |
1053 | 1053 | //default so let's just use what's been set for the default date-time which is 30 days from now. |
1054 | - $template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") ) ); |
|
1054 | + $template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y"))); |
|
1055 | 1055 | } |
1056 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1056 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | //generate ticket_datetime items |
1060 | - if ( ! $default ) { |
|
1060 | + if ( ! $default) { |
|
1061 | 1061 | $dttrow = 1; |
1062 | - foreach ( $all_dtts as $dtt ) { |
|
1063 | - $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ); |
|
1062 | + foreach ($all_dtts as $dtt) { |
|
1063 | + $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default); |
|
1064 | 1064 | $dttrow++; |
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | $prcrow = 1; |
1069 | - foreach ( $prices as $price ) { |
|
1070 | - if ( $price->is_base_price() ) { |
|
1069 | + foreach ($prices as $price) { |
|
1070 | + if ($price->is_base_price()) { |
|
1071 | 1071 | $prcrow++; |
1072 | 1072 | continue; |
1073 | 1073 | } |
1074 | - $show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1 ? FALSE : TRUE; |
|
1075 | - $show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE; |
|
1076 | - $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create ); |
|
1074 | + $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE; |
|
1075 | + $show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE; |
|
1076 | + $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create); |
|
1077 | 1077 | $prcrow++; |
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | //filter $template_args |
1081 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event ); |
|
1081 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event); |
|
1082 | 1082 | |
1083 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1084 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1083 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php'; |
|
1084 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | |
1088 | 1088 | |
1089 | 1089 | |
1090 | 1090 | |
1091 | - protected function _get_tax_rows( $tktrow, $ticket ) { |
|
1091 | + protected function _get_tax_rows($tktrow, $ticket) { |
|
1092 | 1092 | $tax_rows = ''; |
1093 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1093 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1094 | 1094 | $template_args = array(); |
1095 | - $taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1096 | - foreach ( $taxes as $tax ) { |
|
1097 | - $tax_added = $this->_get_tax_added( $tax, $ticket ); |
|
1095 | + $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1096 | + foreach ($taxes as $tax) { |
|
1097 | + $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1098 | 1098 | $template_args = array( |
1099 | - 'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1099 | + 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1100 | 1100 | 'tax_id' => $tax->ID(), |
1101 | 1101 | 'tkt_row' => $tktrow, |
1102 | 1102 | 'tax_label' => $tax->get('PRC_name'), |
1103 | 1103 | 'tax_added' => $tax_added, |
1104 | - 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ), |
|
1104 | + 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE), |
|
1105 | 1105 | 'tax_amount' => $tax->get('PRC_amount') |
1106 | 1106 | ); |
1107 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event ); |
|
1108 | - $tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1107 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1108 | + $tax_rows .= EEH_Template::display_template($template, $template_args, TRUE); |
|
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | |
@@ -1113,81 +1113,81 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | |
1116 | - protected function _get_tax_added( EE_Price $tax, $ticket ) { |
|
1117 | - $subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal(); |
|
1116 | + protected function _get_tax_added(EE_Price $tax, $ticket) { |
|
1117 | + $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1118 | 1118 | return $subtotal * $tax->get('PRC_amount') / 100; |
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
1122 | 1122 | |
1123 | 1123 | |
1124 | - protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
|
1125 | - $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1124 | + protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) { |
|
1125 | + $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1126 | 1126 | $template_args = array( |
1127 | 1127 | 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
1128 | 1128 | 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
1129 | 1129 | 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
1130 | - 'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ), |
|
1130 | + 'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled), |
|
1131 | 1131 | 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
1132 | 1132 | 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
1133 | 1133 | 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
1134 | 1134 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1135 | 1135 | 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
1136 | - 'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1137 | - 'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1138 | - 'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ), |
|
1139 | - 'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1140 | - 'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ), |
|
1136 | + 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1137 | + 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1138 | + 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1139 | + 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1140 | + 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1141 | 1141 | 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
1142 | 1142 | 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
1143 | - 'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'), |
|
1144 | - 'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1143 | + 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1144 | + 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1145 | 1145 | ); |
1146 | 1146 | |
1147 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event ); |
|
1147 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event); |
|
1148 | 1148 | |
1149 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1150 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1149 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php'; |
|
1150 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | |
1154 | - protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1155 | - if ( $price->is_base_price() ) { |
|
1156 | - return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ); |
|
1154 | + protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1155 | + if ($price->is_base_price()) { |
|
1156 | + return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1157 | 1157 | } else { |
1158 | - return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled ); |
|
1158 | + return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | |
1164 | - protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) { |
|
1164 | + protected function _get_base_price_template($tktrow, $prcrow, $price, $default) { |
|
1165 | 1165 | $template_args = array( |
1166 | 1166 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1167 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1168 | - 'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'), |
|
1167 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1168 | + 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1169 | 1169 | 'PRT_name' => __('Price', 'event_espresso'), |
1170 | 1170 | 'price_selected_operator' => '+', |
1171 | 1171 | 'price_selected_is_percent' => 0 |
1172 | 1172 | ); |
1173 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1173 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php'; |
|
1174 | 1174 | |
1175 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event ); |
|
1175 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event); |
|
1176 | 1176 | |
1177 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1177 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | |
1181 | 1181 | |
1182 | - protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1183 | - $select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1184 | - $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) ); |
|
1185 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1186 | - $all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array(); |
|
1187 | - $selected_price_type_id = $default && empty( $price ) ? 0 : $price->type(); |
|
1182 | + protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1183 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]'; |
|
1184 | + $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3')))); |
|
1185 | + $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php'; |
|
1186 | + $all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array(); |
|
1187 | + $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1188 | 1188 | $price_option_spans = ''; |
1189 | 1189 | //setup pricetypes for selector |
1190 | - foreach ( $price_types as $price_type ) { |
|
1190 | + foreach ($price_types as $price_type) { |
|
1191 | 1191 | $all_price_types[] = array( |
1192 | 1192 | 'id' => $price_type->ID(), |
1193 | 1193 | 'text' => $price_type->get('PRT_name'), |
@@ -1199,50 +1199,50 @@ discard block |
||
1199 | 1199 | 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
1200 | 1200 | 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
1201 | 1201 | ); |
1202 | - $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE ); |
|
1202 | + $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | - $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1205 | + $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1206 | 1206 | $main_name = $select_name; |
1207 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1207 | + $select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name; |
|
1208 | 1208 | |
1209 | 1209 | $template_args = array( |
1210 | 1210 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1211 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1212 | - 'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ), |
|
1211 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1212 | + 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1213 | 1213 | 'main_name' => $main_name, |
1214 | 1214 | 'selected_price_type_id' => $selected_price_type_id, |
1215 | 1215 | 'price_option_spans' => $price_option_spans, |
1216 | - 'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ), |
|
1217 | - 'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ), |
|
1216 | + 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1217 | + 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1218 | 1218 | 'disabled' => $disabled |
1219 | 1219 | ); |
1220 | 1220 | |
1221 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event ); |
|
1221 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event); |
|
1222 | 1222 | |
1223 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1223 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1224 | 1224 | |
1225 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1225 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | |
1229 | 1229 | |
1230 | - protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
|
1231 | - $dttid = !empty($dtt) ? $dtt->ID() : 0; |
|
1232 | - $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1233 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1230 | + protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) { |
|
1231 | + $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1232 | + $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1233 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1234 | 1234 | $template_args = array( |
1235 | - 'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow, |
|
1235 | + 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1236 | 1236 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1237 | - 'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '', |
|
1238 | - 'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '', |
|
1239 | - 'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ), |
|
1237 | + 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1238 | + 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1239 | + 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE), |
|
1240 | 1240 | 'tkt_status_class' => '', |
1241 | 1241 | ); |
1242 | 1242 | |
1243 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event ); |
|
1244 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1245 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1243 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event); |
|
1244 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1245 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | |
@@ -1250,53 +1250,53 @@ discard block |
||
1250 | 1250 | protected function _get_ticket_js_structure($all_dtts, $all_tickets) { |
1251 | 1251 | $template_args = array( |
1252 | 1252 | 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts), |
1253 | - 'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE), |
|
1254 | - 'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ), |
|
1253 | + 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE), |
|
1254 | + 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL), |
|
1255 | 1255 | 'default_price_rows' => '', |
1256 | 1256 | 'default_base_price_amount' => 0, |
1257 | 1257 | 'default_base_price_name' => '', |
1258 | 1258 | 'default_base_price_description' => '', |
1259 | - 'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ), |
|
1260 | - 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ), |
|
1259 | + 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE), |
|
1260 | + 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE), |
|
1261 | 1261 | 'existing_available_datetime_tickets_list' => '', |
1262 | 1262 | 'existing_available_ticket_datetimes_list' => '', |
1263 | - 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ), |
|
1264 | - 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ) |
|
1263 | + 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE), |
|
1264 | + 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE) |
|
1265 | 1265 | ); |
1266 | 1266 | |
1267 | 1267 | $tktrow = 1; |
1268 | - foreach ( $all_tickets as $ticket ) { |
|
1269 | - $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE ); |
|
1268 | + foreach ($all_tickets as $ticket) { |
|
1269 | + $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE); |
|
1270 | 1270 | $tktrow++; |
1271 | 1271 | } |
1272 | 1272 | |
1273 | 1273 | |
1274 | 1274 | $dttrow = 1; |
1275 | - foreach ( $all_dtts as $dtt ) { |
|
1276 | - $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE ); |
|
1275 | + foreach ($all_dtts as $dtt) { |
|
1276 | + $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE); |
|
1277 | 1277 | $dttrow++; |
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
1281 | 1281 | $prcrow = 1; |
1282 | - foreach ( $default_prices as $price ) { |
|
1283 | - if ( $price->is_base_price() ) { |
|
1282 | + foreach ($default_prices as $price) { |
|
1283 | + if ($price->is_base_price()) { |
|
1284 | 1284 | $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
1285 | 1285 | $template_args['default_base_price_name'] = $price->get('PRC_name'); |
1286 | 1286 | $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
1287 | 1287 | $prcrow++; |
1288 | 1288 | continue; |
1289 | 1289 | } |
1290 | - $show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1 ? FALSE : TRUE; |
|
1291 | - $show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE; |
|
1292 | - $template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create ); |
|
1290 | + $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE; |
|
1291 | + $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE; |
|
1292 | + $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create); |
|
1293 | 1293 | $prcrow++; |
1294 | 1294 | } |
1295 | 1295 | |
1296 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event ); |
|
1296 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event); |
|
1297 | 1297 | |
1298 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1299 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1298 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1299 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -166,8 +167,9 @@ discard block |
||
166 | 167 | |
167 | 168 | public function caf_updates( $update_callbacks ) { |
168 | 169 | foreach ( $update_callbacks as $key => $callback ) { |
169 | - if ( $callback[1] == '_default_tickets_update' ) |
|
170 | - unset( $update_callbacks[$key] ); |
|
170 | + if ( $callback[1] == '_default_tickets_update' ) { |
|
171 | + unset( $update_callbacks[$key] ); |
|
172 | + } |
|
171 | 173 | } |
172 | 174 | |
173 | 175 | $update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' ); |
@@ -268,8 +270,9 @@ discard block |
||
268 | 270 | $dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) ); |
269 | 271 | foreach ( $dtts_to_delete as $id ) { |
270 | 272 | $id = absint( $id ); |
271 | - if ( empty( $id ) ) |
|
272 | - continue; |
|
273 | + if ( empty( $id ) ) { |
|
274 | + continue; |
|
275 | + } |
|
273 | 276 | |
274 | 277 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
275 | 278 | |
@@ -507,8 +510,9 @@ discard block |
||
507 | 510 | } |
508 | 511 | |
509 | 512 | //if we have a new_tkt... let's add to it as well |
510 | - if ( !empty( $new_tkt ) ) |
|
511 | - $new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' ); |
|
513 | + if ( !empty( $new_tkt ) ) { |
|
514 | + $new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' ); |
|
515 | + } |
|
512 | 516 | } |
513 | 517 | |
514 | 518 | |
@@ -518,8 +522,9 @@ discard block |
||
518 | 522 | foreach ( $dtts_removed as $dttrow ) { |
519 | 523 | $dttrow = (int) $dttrow; |
520 | 524 | //its entirely possible that a datetime got deleted (instead of just removed from relationship. So make sure we skip over this if the dtt isn't in the saved_dtts array) |
521 | - if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) |
|
522 | - continue; |
|
525 | + if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) { |
|
526 | + continue; |
|
527 | + } |
|
523 | 528 | |
524 | 529 | $TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime'); |
525 | 530 | |
@@ -529,8 +534,9 @@ discard block |
||
529 | 534 | $saved_dtts[$dttrow]->save(); |
530 | 535 | } |
531 | 536 | |
532 | - if ( !empty( $new_tkt ) ) |
|
533 | - $new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime'); |
|
537 | + if ( !empty( $new_tkt ) ) { |
|
538 | + $new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime'); |
|
539 | + } |
|
534 | 540 | } |
535 | 541 | |
536 | 542 | |
@@ -572,8 +578,9 @@ discard block |
||
572 | 578 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
573 | 579 | |
574 | 580 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
575 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
576 | - continue; |
|
581 | + if ( $tkt_to_remove->get('TKT_is_default') ) { |
|
582 | + continue; |
|
583 | + } |
|
577 | 584 | |
578 | 585 | //if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets. |
579 | 586 | if ( $tkt_to_remove->count_related('Registration') > 0 ) { |
@@ -634,13 +641,16 @@ discard block |
||
634 | 641 | } |
635 | 642 | |
636 | 643 | //possibly need to save tkt |
637 | - if ( ! $ticket->ID() ) |
|
638 | - $ticket->save(); |
|
644 | + if ( ! $ticket->ID() ) { |
|
645 | + $ticket->save(); |
|
646 | + } |
|
639 | 647 | |
640 | 648 | foreach ( $prices as $row => $prc ) { |
641 | 649 | $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
642 | - if ( empty($prt_id) ) |
|
643 | - continue; //prices MUST have a price type id. |
|
650 | + if ( empty($prt_id) ) { |
|
651 | + continue; |
|
652 | + } |
|
653 | + //prices MUST have a price type id. |
|
644 | 654 | $PRC_values = array( |
645 | 655 | 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
646 | 656 | 'PRT_ID' => $prt_id, |
@@ -784,8 +794,9 @@ discard block |
||
784 | 794 | $datetime_tickets[$dttid][] = $tktrow; |
785 | 795 | |
786 | 796 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
787 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
788 | - $ticket_datetimes[$tktid][] = $dttrow; |
|
797 | + if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) { |
|
798 | + $ticket_datetimes[$tktid][] = $dttrow; |
|
799 | + } |
|
789 | 800 | } |
790 | 801 | } |
791 | 802 |