@@ -1,37 +1,37 @@ |
||
1 | 1 | |
2 | 2 | <h4 id="reg-page-totals-hdr" class=""> |
3 | - <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?> |
|
3 | + <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?> |
|
4 | 4 | </h4> |
5 | 5 | |
6 | 6 | <div class="spco-payment-info-dv"> |
7 | 7 | <table id="spco-payment-info-table"> |
8 | 8 | <thead> |
9 | 9 | <tr> |
10 | - <th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th> |
|
11 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th> |
|
12 | - <th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th> |
|
13 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th> |
|
14 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?> |
|
10 | + <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th> |
|
11 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th> |
|
12 | + <th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th> |
|
13 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th> |
|
14 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?> |
|
15 | 15 | </tr> |
16 | 16 | </thead> |
17 | 17 | <tbody> |
18 | - <?php echo $transaction_details;?> |
|
19 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?> |
|
18 | + <?php echo $transaction_details; ?> |
|
19 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?> |
|
20 | 20 | </tbody> |
21 | 21 | </table> |
22 | 22 | </div> |
23 | 23 | <div class="clear-float"> </div> |
24 | 24 | |
25 | - <?php echo $before_payment_options; ?> |
|
25 | + <?php echo $before_payment_options; ?> |
|
26 | 26 | |
27 | 27 | <div id="methods-of-payment"> |
28 | 28 | <?php echo $payment_options; ?> |
29 | - <a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters( 'FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __( 'select a different method of payment:', 'event_espresso' )); ?></a> |
|
29 | + <a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters('FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __('select a different method of payment:', 'event_espresso')); ?></a> |
|
30 | 30 | </div> |
31 | 31 | <!-- end #methods-of-payment --> |
32 | 32 | |
33 | - <?php echo $after_payment_options; ?> |
|
33 | + <?php echo $after_payment_options; ?> |
|
34 | 34 | |
35 | - <?php echo $default_hidden_inputs; ?> |
|
36 | - <?php echo $extra_hidden_inputs; ?> |
|
35 | + <?php echo $default_hidden_inputs; ?> |
|
36 | + <?php echo $extra_hidden_inputs; ?> |
|
37 | 37 |
@@ -1,43 +1,43 @@ |
||
1 | 1 | <?php //echo '<h1>' . __FILE__ . '</h1>'; ?> |
2 | 2 | <?php global $post; ?> |
3 | 3 | <div class="venue-content"> |
4 | -<?php if ( apply_filters( 'FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE )): ?> |
|
4 | +<?php if (apply_filters('FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE)): ?> |
|
5 | 5 | <div class="entry-meta"> |
6 | - <span class="tags-links"><?php espresso_venue_categories( $post->ID, TRUE, TRUE ); ?></span> |
|
6 | + <span class="tags-links"><?php espresso_venue_categories($post->ID, TRUE, TRUE); ?></span> |
|
7 | 7 | <?php |
8 | - if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : |
|
8 | + if ( ! post_password_required() && (comments_open() || get_comments_number())) : |
|
9 | 9 | ?> |
10 | - <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span> |
|
10 | + <span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span> |
|
11 | 11 | <?php |
12 | 12 | endif; |
13 | 13 | |
14 | - edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' ); |
|
14 | + edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>'); |
|
15 | 15 | ?> |
16 | 16 | </div> |
17 | 17 | <?php endif; ?> |
18 | 18 | |
19 | 19 | <h3 class="event-venues-h3 ee-event-h3"> |
20 | - <?php _e( 'Details', 'event_espresso' ); ?> |
|
20 | + <?php _e('Details', 'event_espresso'); ?> |
|
21 | 21 | </h3> |
22 | 22 | |
23 | - <?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
23 | + <?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
24 | 24 | <p> |
25 | - <span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?> </strong></span><?php echo $venue_phone; ?> |
|
25 | + <span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?> </strong></span><?php echo $venue_phone; ?> |
|
26 | 26 | </p> |
27 | 27 | <?php endif; ?> |
28 | - <?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?> |
|
28 | + <?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?> |
|
29 | 29 | <p> |
30 | - <span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?> </strong></span><?php echo $venue_website; ?> |
|
30 | + <span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?> </strong></span><?php echo $venue_website; ?> |
|
31 | 31 | </p> |
32 | 32 | <?php endif; ?> |
33 | 33 | <?php |
34 | - do_action( 'AHEE__content_espresso_venues_details_template__before_the_content', $post ); |
|
35 | - if ( is_archive() && has_excerpt( $post->ID )) { |
|
34 | + do_action('AHEE__content_espresso_venues_details_template__before_the_content', $post); |
|
35 | + if (is_archive() && has_excerpt($post->ID)) { |
|
36 | 36 | the_excerpt(); |
37 | 37 | } else { |
38 | 38 | the_content(); |
39 | 39 | } |
40 | - do_action( 'AHEE__content_espresso_venues_details_template__after_the_content', $post ); |
|
40 | + do_action('AHEE__content_espresso_venues_details_template__after_the_content', $post); |
|
41 | 41 | ?> |
42 | 42 | </div> |
43 | 43 | <!-- .venue-content --> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | * |
32 | 32 | * ------------------------------------------------------------------------ |
33 | 33 | */ |
34 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
34 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
35 | 35 | |
36 | 36 | class EEM_Post_Meta extends EEM_Base { |
37 | 37 | |
38 | 38 | // private instance of the EE_Post_Meta object |
39 | 39 | protected static $_instance = NULL; |
40 | 40 | |
41 | - protected function __construct( $timezone = NULL ) { |
|
42 | - $this->singular_item = __('Post Meta','event_espresso'); |
|
43 | - $this->plural_item = __('Post Metas','event_espresso'); |
|
41 | + protected function __construct($timezone = NULL) { |
|
42 | + $this->singular_item = __('Post Meta', 'event_espresso'); |
|
43 | + $this->plural_item = __('Post Metas', 'event_espresso'); |
|
44 | 44 | $this->_tables = array( |
45 | 45 | 'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id') |
46 | 46 | ); |
47 | - $models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() ); |
|
47 | + $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models()); |
|
48 | 48 | $this->_fields = array( |
49 | 49 | 'Post_Meta'=>array( |
50 | 50 | 'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")), |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | 'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true) |
54 | 54 | )); |
55 | 55 | $this->_model_relations = array(); |
56 | - foreach($models_this_can_attach_to as $model){ |
|
56 | + foreach ($models_this_can_attach_to as $model) { |
|
57 | 57 | $this->_model_relations[$model] = new EE_Belongs_To_Relation(); |
58 | 58 | } |
59 | - foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) { |
|
60 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' ); |
|
59 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
60 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value'); |
|
61 | 61 | } |
62 | - parent::__construct( $timezone ); |
|
62 | + parent::__construct($timezone); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 |
@@ -944,7 +944,7 @@ |
||
944 | 944 | * @access private |
945 | 945 | * @param int $VNU_ID |
946 | 946 | * @param string $venue_status |
947 | - * @return void |
|
947 | + * @return boolean |
|
948 | 948 | */ |
949 | 949 | private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
950 | 950 | // grab venue id |
@@ -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 |
@@ -893,8 +894,9 @@ discard block |
||
893 | 894 | } |
894 | 895 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
895 | 896 | |
896 | - if ( $redirect_after ) |
|
897 | - $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
897 | + if ( $redirect_after ) { |
|
898 | + $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
899 | + } |
|
898 | 900 | |
899 | 901 | } |
900 | 902 | |
@@ -1013,8 +1015,9 @@ discard block |
||
1013 | 1015 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1014 | 1016 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1015 | 1017 | } |
1016 | - if ( $redirect_after ) |
|
1017 | - $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1018 | + if ( $redirect_after ) { |
|
1019 | + $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1020 | + } |
|
1018 | 1021 | } |
1019 | 1022 | |
1020 | 1023 | |
@@ -1185,8 +1188,10 @@ discard block |
||
1185 | 1188 | * @return void |
1186 | 1189 | */ |
1187 | 1190 | private function _set_category_object() { |
1188 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1189 | - return; //already have the category object so get out. |
|
1191 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
1192 | + return; |
|
1193 | + } |
|
1194 | + //already have the category object so get out. |
|
1190 | 1195 | |
1191 | 1196 | //set default category object |
1192 | 1197 | $this->_set_empty_category_object(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _init_page_props() { |
65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
68 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
68 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
70 | 70 | $this->_cpt_model_names = array( |
71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => __('Update Venue', 'event_espresso'), |
109 | 109 | 'add_category' => __('Save New Category', 'event_espresso'), |
110 | 110 | 'edit_category' => __('Update Category', 'event_espresso'), |
111 | - 'google_map_settings' => __( 'Update Settings', 'event_espresso' ) |
|
111 | + 'google_map_settings' => __('Update Settings', 'event_espresso') |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | //load field generator helper |
124 | 124 | |
125 | 125 | //is there a vnu_id in the request? |
126 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
126 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
128 | 128 | |
129 | 129 | $this->_page_routes = array( |
130 | 130 | 'default' => array( |
@@ -142,27 +142,27 @@ discard block |
||
142 | 142 | ), |
143 | 143 | 'trash_venue' => array( |
144 | 144 | 'func' => '_trash_or_restore_venue', |
145 | - 'args' => array( 'venue_status' => 'trash' ), |
|
145 | + 'args' => array('venue_status' => 'trash'), |
|
146 | 146 | 'noheader' => TRUE, |
147 | 147 | 'capability' => 'ee_delete_venue', |
148 | 148 | 'obj_id' => $vnu_id |
149 | 149 | ), |
150 | 150 | 'trash_venues' => array( |
151 | 151 | 'func' => '_trash_or_restore_venues', |
152 | - 'args' => array( 'venue_status' => 'trash' ), |
|
152 | + 'args' => array('venue_status' => 'trash'), |
|
153 | 153 | 'noheader' => TRUE, |
154 | 154 | 'capability' => 'ee_delete_venues' |
155 | 155 | ), |
156 | 156 | 'restore_venue' => array( |
157 | 157 | 'func' => '_trash_or_restore_venue', |
158 | - 'args' => array( 'venue_status' => 'draft' ), |
|
158 | + 'args' => array('venue_status' => 'draft'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_delete_venue', |
161 | 161 | 'obj_id' => $vnu_id |
162 | 162 | ), |
163 | 163 | 'restore_venues' => array( |
164 | 164 | 'func' => '_trash_or_restore_venues', |
165 | - 'args' => array( 'venue_status' => 'draft' ), |
|
165 | + 'args' => array('venue_status' => 'draft'), |
|
166 | 166 | 'noheader' => TRUE, |
167 | 167 | 'capability' => 'ee_delete_venues' |
168 | 168 | ), |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'filename' => 'venues_overview_views_bulk_actions_search' |
265 | 265 | ) |
266 | 266 | ), |
267 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
267 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
268 | 268 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
269 | 269 | 'require_nonce' => FALSE |
270 | 270 | ), |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'filename' => 'venues_editor_other' |
301 | 301 | ) |
302 | 302 | ), |
303 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
303 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
304 | 304 | 'metaboxes' => array('_venue_editor_metaboxes'), |
305 | 305 | 'require_nonce' => FALSE |
306 | 306 | ), |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | 'label' => __('Edit Venue', 'event_espresso'), |
310 | 310 | 'order' => 5, |
311 | 311 | 'persistent' => FALSE, |
312 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
312 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
313 | 313 | ), |
314 | 314 | 'help_tabs' => array( |
315 | 315 | 'venues_editor_help_tab' => array( |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | 'label' => __('Google Maps'), |
347 | 347 | 'order' => 40 |
348 | 348 | ), |
349 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
349 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
350 | 350 | 'help_tabs' => array( |
351 | 351 | 'general_settings_google_maps_help_tab' => array( |
352 | 352 | 'title' => __('Google Maps', 'event_espresso'), |
353 | 353 | 'filename' => 'general_settings_google_maps' |
354 | 354 | ) |
355 | 355 | ), |
356 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
356 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
357 | 357 | 'require_nonce' => FALSE |
358 | 358 | ), |
359 | 359 | //venue category stuff |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | 'filename' => 'venues_add_category' |
370 | 370 | ) |
371 | 371 | ), |
372 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
372 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
373 | 373 | 'require_nonce' => FALSE |
374 | 374 | ), |
375 | 375 | 'edit_category' => array( |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'label' => __('Edit Category', 'event_espresso'), |
378 | 378 | 'order' => 15, |
379 | 379 | 'persistent' => FALSE, |
380 | - '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 |
|
380 | + '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 |
|
381 | 381 | ), |
382 | 382 | 'metaboxes' => array('_publish_post_box'), |
383 | 383 | 'help_tabs' => array( |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | 'filename' => 'venues_categories_other' |
414 | 414 | ) |
415 | 415 | ), |
416 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
416 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
417 | 417 | 'metaboxes' => $this->_default_espresso_metaboxes, |
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ) |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | |
472 | 472 | public function load_scripts_styles() { |
473 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
473 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
474 | 474 | wp_enqueue_style('ee-cat-admin'); |
475 | 475 | } |
476 | 476 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | public function load_scripts_styles_edit() { |
494 | 494 | //styles |
495 | 495 | wp_enqueue_style('espresso-ui-theme'); |
496 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
496 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
497 | 497 | wp_enqueue_style('espresso_venues'); |
498 | 498 | } |
499 | 499 | |
@@ -512,13 +512,13 @@ discard block |
||
512 | 512 | ) |
513 | 513 | ); |
514 | 514 | |
515 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
515 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
516 | 516 | $this->_views['all']['bulk_action'] = array( |
517 | 517 | 'trash_venues' => __('Move to Trash', 'event_espresso') |
518 | 518 | ); |
519 | 519 | $this->_views['trash'] = array( |
520 | 520 | 'slug' => 'trash', |
521 | - 'label' => __( 'Trash', 'event_espresso' ), |
|
521 | + 'label' => __('Trash', 'event_espresso'), |
|
522 | 522 | 'count' => 0, |
523 | 523 | 'bulk_action' => array( |
524 | 524 | 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | |
552 | 552 | |
553 | 553 | protected function _overview_list_table() { |
554 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
555 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' ); |
|
554 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
555 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button'); |
|
556 | 556 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
557 | 557 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
558 | 558 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
567 | 567 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
568 | 568 | ); |
569 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
570 | - EEH_Template::display_template( $template, $extra_rows ); |
|
569 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
570 | + EEH_Template::display_template($template, $extra_rows); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | |
@@ -582,115 +582,115 @@ discard block |
||
582 | 582 | $default_map_settings = new stdClass(); |
583 | 583 | $default_map_settings->use_google_maps = TRUE; |
584 | 584 | // for event details pages (reg page) |
585 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
586 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
587 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
588 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
589 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
590 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
591 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
585 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
586 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
587 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
588 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
589 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
590 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
591 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
592 | 592 | // for event list pages |
593 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
594 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
595 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
596 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
597 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
598 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
599 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
593 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
594 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
595 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
596 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
597 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
598 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
599 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
600 | 600 | |
601 | 601 | $this->_template_args['map_settings'] = |
602 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
603 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
602 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
603 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
604 | 604 | : $default_map_settings; |
605 | 605 | |
606 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
607 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
608 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE ); |
|
606 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
607 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
608 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE); |
|
609 | 609 | $this->display_admin_page_with_sidebar(); |
610 | 610 | } |
611 | 611 | |
612 | 612 | protected function _update_google_map_settings() { |
613 | 613 | |
614 | 614 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
615 | - isset( $this->_req_data['use_google_maps'] ) |
|
616 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
615 | + isset($this->_req_data['use_google_maps']) |
|
616 | + ? absint($this->_req_data['use_google_maps']) |
|
617 | 617 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
618 | 618 | |
619 | 619 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
620 | - isset( $this->_req_data['event_details_map_width'] ) |
|
621 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
620 | + isset($this->_req_data['event_details_map_width']) |
|
621 | + ? absint($this->_req_data['event_details_map_width']) |
|
622 | 622 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
623 | 623 | |
624 | 624 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
625 | - isset( $this->_req_data['event_details_map_height'] ) |
|
626 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
625 | + isset($this->_req_data['event_details_map_height']) |
|
626 | + ? absint($this->_req_data['event_details_map_height']) |
|
627 | 627 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
628 | 628 | |
629 | 629 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
630 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
631 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
630 | + isset($this->_req_data['event_details_map_zoom']) |
|
631 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
632 | 632 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
633 | 633 | |
634 | 634 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
635 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
636 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
635 | + isset($this->_req_data['event_details_display_nav']) |
|
636 | + ? absint($this->_req_data['event_details_display_nav']) |
|
637 | 637 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
638 | 638 | |
639 | 639 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
640 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
641 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
640 | + isset($this->_req_data['event_details_nav_size']) |
|
641 | + ? absint($this->_req_data['event_details_nav_size']) |
|
642 | 642 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
643 | 643 | |
644 | 644 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
645 | - isset( $this->_req_data['event_details_control_type'] ) |
|
646 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
645 | + isset($this->_req_data['event_details_control_type']) |
|
646 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
647 | 647 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
648 | 648 | |
649 | 649 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
650 | - isset( $this->_req_data['event_details_map_align'] ) |
|
651 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
650 | + isset($this->_req_data['event_details_map_align']) |
|
651 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
652 | 652 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
653 | 653 | |
654 | 654 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
655 | - isset( $this->_req_data['event_list_map_width'] ) |
|
656 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
655 | + isset($this->_req_data['event_list_map_width']) |
|
656 | + ? absint($this->_req_data['event_list_map_width']) |
|
657 | 657 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
658 | 658 | |
659 | 659 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
660 | - isset( $this->_req_data['event_list_map_height'] ) |
|
661 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
660 | + isset($this->_req_data['event_list_map_height']) |
|
661 | + ? absint($this->_req_data['event_list_map_height']) |
|
662 | 662 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
663 | 663 | |
664 | 664 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
665 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
666 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
665 | + isset($this->_req_data['event_list_map_zoom']) |
|
666 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
667 | 667 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
668 | 668 | |
669 | 669 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
670 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
671 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
670 | + isset($this->_req_data['event_list_display_nav']) |
|
671 | + ? absint($this->_req_data['event_list_display_nav']) |
|
672 | 672 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
673 | 673 | |
674 | 674 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
675 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
676 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
675 | + isset($this->_req_data['event_list_nav_size']) |
|
676 | + ? absint($this->_req_data['event_list_nav_size']) |
|
677 | 677 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
678 | 678 | |
679 | 679 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
680 | - isset( $this->_req_data['event_list_control_type'] ) |
|
681 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
680 | + isset($this->_req_data['event_list_control_type']) |
|
681 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
682 | 682 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
683 | 683 | |
684 | 684 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
685 | - isset( $this->_req_data['event_list_map_align'] ) |
|
686 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
685 | + isset($this->_req_data['event_list_map_align']) |
|
686 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
687 | 687 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
688 | 688 | |
689 | - EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings ); |
|
689 | + EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings); |
|
690 | 690 | |
691 | 691 | $what = 'Google Map Settings'; |
692 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
693 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
692 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__); |
|
693 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
694 | 694 | |
695 | 695 | } |
696 | 696 | |
@@ -699,9 +699,9 @@ discard block |
||
699 | 699 | protected function _venue_editor_metaboxes() { |
700 | 700 | $this->verify_cpt_object(); |
701 | 701 | |
702 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
703 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
704 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
702 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
703 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
704 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
705 | 705 | |
706 | 706 | } |
707 | 707 | |
@@ -709,23 +709,23 @@ discard block |
||
709 | 709 | |
710 | 710 | public function venue_gmap_metabox() { |
711 | 711 | $template_args = array( |
712 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
712 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
713 | 713 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
714 | 714 | ); |
715 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
716 | - EEH_Template::display_template( $template, $template_args ); |
|
715 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
716 | + EEH_Template::display_template($template, $template_args); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | |
720 | 720 | |
721 | 721 | public function venue_address_metabox() { |
722 | 722 | |
723 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
723 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
724 | 724 | |
725 | 725 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
726 | 726 | $QFI = new EE_Question_Form_Input( |
727 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
728 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
727 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
728 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
729 | 729 | array( |
730 | 730 | 'input_name' => 'sta_id', |
731 | 731 | 'input_id' => 'sta_id', |
@@ -737,8 +737,8 @@ discard block |
||
737 | 737 | ); |
738 | 738 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
739 | 739 | $QFI = new EE_Question_Form_Input( |
740 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
741 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
740 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
741 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
742 | 742 | array( |
743 | 743 | 'input_name' => 'cnt_iso', |
744 | 744 | 'input_id' => 'cnt_iso', |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | ) |
750 | 750 | ); |
751 | 751 | |
752 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
753 | - EEH_Template::display_template( $template, $template_args ); |
|
752 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
753 | + EEH_Template::display_template($template, $template_args); |
|
754 | 754 | } |
755 | 755 | |
756 | 756 | |
@@ -762,8 +762,8 @@ discard block |
||
762 | 762 | $template_args = array( |
763 | 763 | '_venue' => $this->_cpt_model_obj |
764 | 764 | ); |
765 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
766 | - EEH_Template::display_template( $template, $template_args ); |
|
765 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
766 | + EEH_Template::display_template($template, $template_args); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | |
@@ -786,52 +786,52 @@ discard block |
||
786 | 786 | * @param object $post Post object (with "blessed" WP properties) |
787 | 787 | * @return void |
788 | 788 | */ |
789 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
789 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
790 | 790 | |
791 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) { |
|
792 | - return;// get out we're not processing the saving of venues. |
|
791 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
792 | + return; // get out we're not processing the saving of venues. |
|
793 | 793 | } |
794 | 794 | |
795 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
795 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
796 | 796 | |
797 | 797 | $venue_values = array( |
798 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
799 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
800 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
801 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
802 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
803 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
804 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
805 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF, |
|
806 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
807 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
808 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
809 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
810 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
798 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
799 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
800 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
801 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
802 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
803 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
804 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
805 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF, |
|
806 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
807 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
808 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
809 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
810 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
811 | 811 | ); |
812 | 812 | |
813 | 813 | //update venue |
814 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
814 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
815 | 815 | |
816 | 816 | //get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
817 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
818 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
817 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
818 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
819 | 819 | |
820 | 820 | //notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
821 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
821 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
822 | 822 | |
823 | 823 | $att_success = TRUE; |
824 | 824 | |
825 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
826 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
827 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
825 | + foreach ($venue_update_callbacks as $v_callback) { |
|
826 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
827 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | //any errors? |
831 | - if ( $success && !$att_success ) { |
|
832 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
833 | - } else if ( $success === FALSE ) { |
|
834 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
831 | + if ($success && ! $att_success) { |
|
832 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
833 | + } else if ($success === FALSE) { |
|
834 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
835 | 835 | } |
836 | 836 | } |
837 | 837 | |
@@ -839,9 +839,9 @@ discard block |
||
839 | 839 | |
840 | 840 | |
841 | 841 | |
842 | - public function trash_cpt_item( $post_id ) { |
|
842 | + public function trash_cpt_item($post_id) { |
|
843 | 843 | $this->_req_data['VNU_ID'] = $post_id; |
844 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
844 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | |
@@ -849,18 +849,18 @@ discard block |
||
849 | 849 | |
850 | 850 | |
851 | 851 | |
852 | - public function restore_cpt_item( $post_id ) { |
|
852 | + public function restore_cpt_item($post_id) { |
|
853 | 853 | $this->_req_data['VNU_ID'] = $post_id; |
854 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
854 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | |
858 | 858 | |
859 | 859 | |
860 | 860 | |
861 | - public function delete_cpt_item( $post_id ) { |
|
861 | + public function delete_cpt_item($post_id) { |
|
862 | 862 | $this->_req_data['VNU_ID'] = $post_id; |
863 | - $this->_delete_venue( FALSE ); |
|
863 | + $this->_delete_venue(FALSE); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | |
@@ -875,15 +875,15 @@ discard block |
||
875 | 875 | |
876 | 876 | |
877 | 877 | |
878 | - protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
879 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
878 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) { |
|
879 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
880 | 880 | |
881 | 881 | //loop thru venues |
882 | - if ( $VNU_ID ) { |
|
882 | + if ($VNU_ID) { |
|
883 | 883 | //clean status |
884 | - $venue_status = sanitize_key( $venue_status ); |
|
884 | + $venue_status = sanitize_key($venue_status); |
|
885 | 885 | // grab status |
886 | - if (!empty($venue_status)) { |
|
886 | + if ( ! empty($venue_status)) { |
|
887 | 887 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
888 | 888 | } else { |
889 | 889 | $success = FALSE; |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | } |
898 | 898 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
899 | 899 | |
900 | - if ( $redirect_after ) |
|
900 | + if ($redirect_after) |
|
901 | 901 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
902 | 902 | |
903 | 903 | } |
@@ -906,11 +906,11 @@ discard block |
||
906 | 906 | |
907 | 907 | |
908 | 908 | |
909 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
909 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
910 | 910 | // clean status |
911 | 911 | $venue_status = sanitize_key($venue_status); |
912 | 912 | // grab status |
913 | - if (!empty($venue_status)) { |
|
913 | + if ( ! empty($venue_status)) { |
|
914 | 914 | $success = TRUE; |
915 | 915 | //determine the event id and set to array. |
916 | 916 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -950,20 +950,20 @@ discard block |
||
950 | 950 | * @param string $venue_status |
951 | 951 | * @return void |
952 | 952 | */ |
953 | - private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
|
953 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') { |
|
954 | 954 | // grab venue id |
955 | - if (! $VNU_ID) { |
|
955 | + if ( ! $VNU_ID) { |
|
956 | 956 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
957 | 957 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
958 | 958 | return FALSE; |
959 | 959 | } |
960 | 960 | |
961 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
961 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
962 | 962 | |
963 | 963 | // clean status |
964 | 964 | $venue_status = sanitize_key($venue_status); |
965 | 965 | // grab status |
966 | - if ( ! $venue_status ) { |
|
966 | + if ( ! $venue_status) { |
|
967 | 967 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
968 | 968 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
969 | 969 | return FALSE; |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | $hook = FALSE; |
985 | 985 | } |
986 | 986 | //use class to change status |
987 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
987 | + $this->_cpt_model_obj->set_status($venue_status); |
|
988 | 988 | $success = $this->_cpt_model_obj->save(); |
989 | 989 | |
990 | 990 | if ($success === FALSE) { |
@@ -1003,21 +1003,21 @@ discard block |
||
1003 | 1003 | * @param bool $redirect_after |
1004 | 1004 | * @return void |
1005 | 1005 | */ |
1006 | - protected function _delete_venue( $redirect_after = true ) { |
|
1006 | + protected function _delete_venue($redirect_after = true) { |
|
1007 | 1007 | //determine the venue id and set to array. |
1008 | 1008 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
1009 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID; |
|
1009 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1010 | 1010 | |
1011 | 1011 | |
1012 | 1012 | // loop thru venues |
1013 | 1013 | if ($VNU_ID) { |
1014 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
1014 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1015 | 1015 | } else { |
1016 | 1016 | $success = FALSE; |
1017 | 1017 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1018 | 1018 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1019 | 1019 | } |
1020 | - if ( $redirect_after ) |
|
1020 | + if ($redirect_after) |
|
1021 | 1021 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
1022 | 1022 | } |
1023 | 1023 | |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | //todo: put in parent |
1050 | 1050 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
1051 | 1051 | // grab event id |
1052 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
1052 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1053 | 1053 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1054 | 1054 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1055 | 1055 | return FALSE; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1070 | 1070 | return FALSE; |
1071 | 1071 | } |
1072 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
1072 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1073 | 1073 | return TRUE; |
1074 | 1074 | } |
1075 | 1075 | |
@@ -1080,11 +1080,11 @@ discard block |
||
1080 | 1080 | /* QUERIES */ |
1081 | 1081 | |
1082 | 1082 | |
1083 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
1083 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
1084 | 1084 | |
1085 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
1085 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1086 | 1086 | |
1087 | - switch ( $_orderby ) { |
|
1087 | + switch ($_orderby) { |
|
1088 | 1088 | case 'id': |
1089 | 1089 | $orderby = 'VNU_ID'; |
1090 | 1090 | break; |
@@ -1102,43 +1102,43 @@ discard block |
||
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | |
1105 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
1105 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1106 | 1106 | |
1107 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1108 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
1109 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1107 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1108 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1109 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1110 | 1110 | |
1111 | 1111 | |
1112 | - $offset = ($current_page-1)*$per_page; |
|
1112 | + $offset = ($current_page - 1) * $per_page; |
|
1113 | 1113 | $limit = array($offset, $per_page); |
1114 | 1114 | |
1115 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1115 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1116 | 1116 | $where = array(); |
1117 | 1117 | |
1118 | 1118 | //only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
1119 | - if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) { |
|
1119 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1120 | 1120 | $where['status'] = $this->_req_data['status']; |
1121 | 1121 | } |
1122 | 1122 | |
1123 | - if ( isset( $this->_req_data['venue_status'] ) ) { |
|
1123 | + if (isset($this->_req_data['venue_status'])) { |
|
1124 | 1124 | $where['status'] = $this->_req_data['venue_status']; |
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | |
1128 | - if ( $category ) { |
|
1128 | + if ($category) { |
|
1129 | 1129 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
1130 | 1130 | $where['Term_Taxonomy.term_id'] = $category; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | |
1134 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
1135 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1134 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1135 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1136 | 1136 | } else { |
1137 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
1137 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1138 | 1138 | $where['OR'] = array( |
1139 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1139 | + 'status*restrict_private' => array('!=', 'private'), |
|
1140 | 1140 | 'AND' => array( |
1141 | - 'status*inclusive' => array( '=', 'private' ), |
|
1141 | + 'status*inclusive' => array('=', 'private'), |
|
1142 | 1142 | 'VNU_wp_user' => get_current_user_id() |
1143 | 1143 | ) |
1144 | 1144 | ); |
@@ -1148,30 +1148,30 @@ discard block |
||
1148 | 1148 | |
1149 | 1149 | |
1150 | 1150 | |
1151 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1152 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1151 | + if (isset($this->_req_data['s'])) { |
|
1152 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1153 | 1153 | $where['OR'] = array( |
1154 | - 'VNU_name' => array('LIKE',$sstr ), |
|
1155 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
1156 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
1157 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
1158 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
1159 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
1160 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
1161 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
1162 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
1163 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
1164 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
1165 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
1166 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
1167 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
1168 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
1169 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
1154 | + 'VNU_name' => array('LIKE', $sstr), |
|
1155 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1156 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1157 | + 'VNU_address' => array('LIKE', $sstr), |
|
1158 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1159 | + 'VNU_city' => array('LIKE', $sstr), |
|
1160 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1161 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1162 | + 'VNU_url' => array('LIKE', $sstr), |
|
1163 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1164 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1165 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1166 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1167 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1168 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1169 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1170 | 1170 | ); |
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | |
1174 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
1174 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
1175 | 1175 | |
1176 | 1176 | return $venues; |
1177 | 1177 | |
@@ -1189,22 +1189,22 @@ discard block |
||
1189 | 1189 | * @return void |
1190 | 1190 | */ |
1191 | 1191 | private function _set_category_object() { |
1192 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1192 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
1193 | 1193 | return; //already have the category object so get out. |
1194 | 1194 | |
1195 | 1195 | //set default category object |
1196 | 1196 | $this->_set_empty_category_object(); |
1197 | 1197 | |
1198 | 1198 | //only set if we've got an id |
1199 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
1199 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1200 | 1200 | return; |
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
1204 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
1204 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1205 | 1205 | |
1206 | 1206 | |
1207 | - if ( !empty( $term ) ) { |
|
1207 | + if ( ! empty($term)) { |
|
1208 | 1208 | $this->_category->category_name = $term->name; |
1209 | 1209 | $this->_category->category_identifier = $term->slug; |
1210 | 1210 | $this->_category->category_desc = $term->description; |
@@ -1218,14 +1218,14 @@ discard block |
||
1218 | 1218 | |
1219 | 1219 | private function _set_empty_category_object() { |
1220 | 1220 | $this->_category = new stdClass(); |
1221 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1221 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1222 | 1222 | $this->_category->id = $this->_category->parent = 0; |
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | |
1226 | 1226 | |
1227 | 1227 | protected function _category_list_table() { |
1228 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1228 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1229 | 1229 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
1230 | 1230 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
1231 | 1231 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -1241,13 +1241,13 @@ discard block |
||
1241 | 1241 | $this->_set_add_edit_form_tags($route); |
1242 | 1242 | |
1243 | 1243 | $this->_set_category_object(); |
1244 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
1244 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1245 | 1245 | |
1246 | 1246 | $delete_action = 'delete_category'; |
1247 | 1247 | |
1248 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
1248 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1249 | 1249 | |
1250 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
1250 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1251 | 1251 | |
1252 | 1252 | //take care of contents |
1253 | 1253 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1261,25 +1261,25 @@ discard block |
||
1261 | 1261 | 'type' => 'wp_editor', |
1262 | 1262 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
1263 | 1263 | 'class' => 'my_editor_custom', |
1264 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
1264 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
1265 | 1265 | ); |
1266 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
1266 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1267 | 1267 | |
1268 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
1268 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
1269 | 1269 | |
1270 | 1270 | //setup category select for term parents. |
1271 | 1271 | $category_select_values[] = array( |
1272 | 1272 | 'text' => __('No Parent', 'event_espresso'), |
1273 | 1273 | 'id' => 0 |
1274 | 1274 | ); |
1275 | - foreach ( $all_terms as $term ) { |
|
1275 | + foreach ($all_terms as $term) { |
|
1276 | 1276 | $category_select_values[] = array( |
1277 | 1277 | 'text' => $term->name, |
1278 | 1278 | 'id' => $term->term_id |
1279 | 1279 | ); |
1280 | 1280 | } |
1281 | 1281 | |
1282 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
1282 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
1283 | 1283 | $template_args = array( |
1284 | 1284 | 'category' => $this->_category, |
1285 | 1285 | 'category_select' => $category_select, |
@@ -1288,15 +1288,15 @@ discard block |
||
1288 | 1288 | 'disable' => '', |
1289 | 1289 | 'disabled_message' =>FALSE |
1290 | 1290 | ); |
1291 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1292 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
1291 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1292 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1293 | 1293 | } |
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | protected function _delete_categories() { |
1297 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1297 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1298 | 1298 | |
1299 | - foreach ( $cat_ids as $cat_id ) { |
|
1299 | + foreach ($cat_ids as $cat_id) { |
|
1300 | 1300 | $this->_delete_category($cat_id); |
1301 | 1301 | } |
1302 | 1302 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | $query_args = array( |
1305 | 1305 | 'action' => 'category_list' |
1306 | 1306 | ); |
1307 | - $this->_redirect_after_action(0,'','',$query_args); |
|
1307 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1308 | 1308 | |
1309 | 1309 | } |
1310 | 1310 | |
@@ -1313,58 +1313,58 @@ discard block |
||
1313 | 1313 | |
1314 | 1314 | |
1315 | 1315 | protected function _delete_category($cat_id) { |
1316 | - $cat_id = absint( $cat_id ); |
|
1317 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
1316 | + $cat_id = absint($cat_id); |
|
1317 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | |
1321 | 1321 | |
1322 | 1322 | protected function _insert_or_update_category($new_category) { |
1323 | 1323 | |
1324 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
1324 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
1325 | 1325 | $success = 0; //we already have a success message so lets not send another. |
1326 | - if ( $cat_id ) { |
|
1326 | + if ($cat_id) { |
|
1327 | 1327 | $query_args = array( |
1328 | 1328 | 'action' => 'edit_category', |
1329 | 1329 | 'VEN_CAT_ID' => $cat_id |
1330 | 1330 | ); |
1331 | 1331 | } else { |
1332 | - $query_args = array( 'action' => 'add_category' ); |
|
1332 | + $query_args = array('action' => 'add_category'); |
|
1333 | 1333 | } |
1334 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
1334 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
1335 | 1335 | |
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | |
1339 | 1339 | |
1340 | - private function _insert_category( $update = FALSE ) { |
|
1340 | + private function _insert_category($update = FALSE) { |
|
1341 | 1341 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
1342 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
1343 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
1344 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
1342 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1343 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1344 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1345 | 1345 | |
1346 | - if ( empty( $category_name ) ) { |
|
1347 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
1348 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + if (empty($category_name)) { |
|
1347 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1348 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1349 | 1349 | return false; |
1350 | 1350 | } |
1351 | 1351 | |
1352 | 1352 | |
1353 | - $term_args=array( |
|
1353 | + $term_args = array( |
|
1354 | 1354 | 'name'=>$category_name, |
1355 | 1355 | 'description'=>$category_desc, |
1356 | 1356 | 'parent'=>$category_parent |
1357 | 1357 | ); |
1358 | 1358 | |
1359 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1359 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
1360 | 1360 | |
1361 | - if ( !is_array( $insert_ids ) ) { |
|
1362 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1363 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1361 | + if ( ! is_array($insert_ids)) { |
|
1362 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1363 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1364 | 1364 | } else { |
1365 | 1365 | $cat_id = $insert_ids['term_id']; |
1366 | - $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
1367 | - EE_Error::add_success( $msg ); |
|
1366 | + $msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name); |
|
1367 | + EE_Error::add_success($msg); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | return $cat_id; |
@@ -1384,11 +1384,11 @@ discard block |
||
1384 | 1384 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
1385 | 1385 | ); |
1386 | 1386 | |
1387 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
1387 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1388 | 1388 | |
1389 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
1390 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
1391 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
1389 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1390 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1391 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1392 | 1392 | $EE_Export->export(); |
1393 | 1393 | } |
1394 | 1394 | |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | |
1401 | 1401 | protected function _import_categories() { |
1402 | 1402 | |
1403 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1403 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1404 | 1404 | EE_Import::instance()->import(); |
1405 | 1405 | |
1406 | 1406 | } |
@@ -1408,29 +1408,29 @@ discard block |
||
1408 | 1408 | |
1409 | 1409 | |
1410 | 1410 | |
1411 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1411 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
1412 | 1412 | |
1413 | 1413 | //testing term stuff |
1414 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1415 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1416 | - $limit = ($current_page-1)*$per_page; |
|
1417 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1418 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1419 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1414 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1415 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1416 | + $limit = ($current_page - 1) * $per_page; |
|
1417 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1418 | + if (isset($this->_req_data['s'])) { |
|
1419 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1420 | 1420 | $where['OR'] = array( |
1421 | - 'Term.name' => array( 'LIKE', $sstr), |
|
1422 | - 'description' => array( 'LIKE', $sstr ) |
|
1421 | + 'Term.name' => array('LIKE', $sstr), |
|
1422 | + 'description' => array('LIKE', $sstr) |
|
1423 | 1423 | ); |
1424 | 1424 | } |
1425 | 1425 | |
1426 | 1426 | $query_params = array( |
1427 | 1427 | $where, |
1428 | - 'order_by' => array( $orderby => $order ), |
|
1429 | - 'limit' => $limit . ',' . $per_page, |
|
1428 | + 'order_by' => array($orderby => $order), |
|
1429 | + 'limit' => $limit.','.$per_page, |
|
1430 | 1430 | 'force_join' => array('Term') |
1431 | 1431 | ); |
1432 | 1432 | |
1433 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1433 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1434 | 1434 | |
1435 | 1435 | return $categories; |
1436 | 1436 | } |
@@ -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. |
@@ -879,6 +879,9 @@ discard block |
||
879 | 879 | |
880 | 880 | |
881 | 881 | |
882 | + /** |
|
883 | + * @param integer $dttrow |
|
884 | + */ |
|
882 | 885 | protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
883 | 886 | |
884 | 887 | $dtt_display_template_args = array( |
@@ -902,6 +905,7 @@ discard block |
||
902 | 905 | * object. |
903 | 906 | * @param bool $default Whether a default row is being generated or not. |
904 | 907 | * @param EE_Datetime[] $all_dtts This is the array of all datetimes used in the editor. |
908 | + * @param EE_Datetime|null $dtt |
|
905 | 909 | * |
906 | 910 | * @return string Generated edit row. |
907 | 911 | */ |
@@ -936,6 +940,10 @@ discard block |
||
936 | 940 | } |
937 | 941 | |
938 | 942 | |
943 | + /** |
|
944 | + * @param EE_Datetime|null $dtt |
|
945 | + * @param boolean $default |
|
946 | + */ |
|
939 | 947 | protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
940 | 948 | |
941 | 949 | $template_args = array( |
@@ -1142,6 +1150,9 @@ discard block |
||
1142 | 1150 | |
1143 | 1151 | |
1144 | 1152 | |
1153 | + /** |
|
1154 | + * @param integer $tktrow |
|
1155 | + */ |
|
1145 | 1156 | protected function _get_tax_rows( $tktrow, $ticket ) { |
1146 | 1157 | $tax_rows = ''; |
1147 | 1158 | $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
@@ -1175,6 +1186,9 @@ discard block |
||
1175 | 1186 | |
1176 | 1187 | |
1177 | 1188 | |
1189 | + /** |
|
1190 | + * @param boolean $default |
|
1191 | + */ |
|
1178 | 1192 | protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
1179 | 1193 | $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
1180 | 1194 | $template_args = array( |
@@ -1281,6 +1295,9 @@ discard block |
||
1281 | 1295 | |
1282 | 1296 | |
1283 | 1297 | |
1298 | + /** |
|
1299 | + * @param boolean $default |
|
1300 | + */ |
|
1284 | 1301 | protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
1285 | 1302 | $dttid = !empty($dtt) ? $dtt->ID() : 0; |
1286 | 1303 | $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
@@ -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' ); |
@@ -273,8 +275,9 @@ discard block |
||
273 | 275 | $dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids ); |
274 | 276 | foreach ( $dtts_to_delete as $id ) { |
275 | 277 | $id = absint( $id ); |
276 | - if ( empty( $id ) ) |
|
277 | - continue; |
|
278 | + if ( empty( $id ) ) { |
|
279 | + continue; |
|
280 | + } |
|
278 | 281 | |
279 | 282 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
280 | 283 | |
@@ -512,8 +515,9 @@ discard block |
||
512 | 515 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
513 | 516 | |
514 | 517 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
515 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
516 | - continue; |
|
518 | + if ( $tkt_to_remove->get('TKT_is_default') ) { |
|
519 | + continue; |
|
520 | + } |
|
517 | 521 | |
518 | 522 | // if this tkt has any registrations attached so then we just ARCHIVE |
519 | 523 | // because we don't actually permanently delete these tickets. |
@@ -688,13 +692,16 @@ discard block |
||
688 | 692 | } |
689 | 693 | |
690 | 694 | //possibly need to save tkt |
691 | - if ( ! $ticket->ID() ) |
|
692 | - $ticket->save(); |
|
695 | + if ( ! $ticket->ID() ) { |
|
696 | + $ticket->save(); |
|
697 | + } |
|
693 | 698 | |
694 | 699 | foreach ( $prices as $row => $prc ) { |
695 | 700 | $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
696 | - if ( empty($prt_id) ) |
|
697 | - continue; //prices MUST have a price type id. |
|
701 | + if ( empty($prt_id) ) { |
|
702 | + continue; |
|
703 | + } |
|
704 | + //prices MUST have a price type id. |
|
698 | 705 | $PRC_values = array( |
699 | 706 | 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
700 | 707 | 'PRT_ID' => $prt_id, |
@@ -838,8 +845,9 @@ discard block |
||
838 | 845 | $datetime_tickets[$dttid][] = $tktrow; |
839 | 846 | |
840 | 847 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
841 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
842 | - $ticket_datetimes[$tktid][] = $dttrow; |
|
848 | + if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) { |
|
849 | + $ticket_datetimes[$tktid][] = $dttrow; |
|
850 | + } |
|
843 | 851 | } |
844 | 852 | } |
845 | 853 |
@@ -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,7 +54,7 @@ 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 | |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | //if we were going to add our own metaboxes we'd use the below. |
63 | 63 | $this->_metaboxes = array( |
64 | 64 | 0 => array( |
65 | - 'page_route' => array('edit','create_new'), |
|
65 | + 'page_route' => array('edit', 'create_new'), |
|
66 | 66 | 'func' => 'pricing_metabox', |
67 | 67 | 'label' => __('Event Tickets & Datetimes', 'event_espresso'), |
68 | 68 | 'priority' => 'high', |
69 | 69 | 'context' => 'normal' |
70 | 70 | ), |
71 | 71 | |
72 | - );/**/ |
|
72 | + ); /**/ |
|
73 | 73 | |
74 | 74 | $this->_remove_metaboxes = array( |
75 | 75 | 0 => array( |
@@ -88,24 +88,24 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @var array Expected an array returned with 'date' and 'time' keys. |
90 | 90 | */ |
91 | - $this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
91 | + $this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array( |
|
92 | 92 | 'date' => 'Y-m-d', |
93 | 93 | 'time' => 'h:i a' |
94 | 94 | )); |
95 | 95 | |
96 | 96 | //validate |
97 | - $this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null; |
|
98 | - $this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null; |
|
97 | + $this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null; |
|
98 | + $this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null; |
|
99 | 99 | |
100 | 100 | //validate format strings |
101 | - $format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
102 | - if ( is_array( $format_validation ) ) { |
|
103 | - $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>'; |
|
104 | - foreach ( $format_validation as $error ) { |
|
105 | - $msg .= '<li>' . $error . '</li>'; |
|
101 | + $format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
102 | + if (is_array($format_validation)) { |
|
103 | + $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>'; |
|
104 | + foreach ($format_validation as $error) { |
|
105 | + $msg .= '<li>'.$error.'</li>'; |
|
106 | 106 | } |
107 | - $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>'; |
|
108 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
107 | + $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>'; |
|
108 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
109 | 109 | $this->_date_format_strings = array( |
110 | 110 | 'date' => 'Y-m-d', |
111 | 111 | 'time' => 'h:i a' |
@@ -116,60 +116,60 @@ discard block |
||
116 | 116 | $this->_scripts_styles = array( |
117 | 117 | 'registers' => array( |
118 | 118 | 'ee-tickets-datetimes-css' => array( |
119 | - 'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css', |
|
119 | + 'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css', |
|
120 | 120 | 'type' => 'css' |
121 | 121 | ), |
122 | 122 | 'ee-dtt-ticket-metabox' => array( |
123 | - 'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js', |
|
123 | + 'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js', |
|
124 | 124 | 'depends' => array('ee-datepicker', 'ee-dialog', 'underscore') |
125 | 125 | ) |
126 | 126 | ), |
127 | 127 | 'deregisters' => array( |
128 | - 'event-editor-css' => array('type' => 'css' ), |
|
128 | + 'event-editor-css' => array('type' => 'css'), |
|
129 | 129 | 'event-datetime-metabox' => array('type' => 'js') |
130 | 130 | ), |
131 | 131 | 'enqueues' => array( |
132 | - 'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ), |
|
133 | - 'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' ) |
|
132 | + 'ee-tickets-datetimes-css' => array('edit', 'create_new'), |
|
133 | + 'ee-dtt-ticket-metabox' => array('edit', 'create_new') |
|
134 | 134 | ), |
135 | 135 | 'localize' => array( |
136 | 136 | 'ee-dtt-ticket-metabox' => array( |
137 | 137 | 'DTT_TRASH_BLOCK' => array( |
138 | 138 | 'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'), |
139 | 139 | 'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'), |
140 | - 'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>', |
|
140 | + 'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>', |
|
141 | 141 | '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'), |
142 | 142 | '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'), |
143 | - 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>' |
|
143 | + 'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>' |
|
144 | 144 | ), |
145 | 145 | 'DTT_ERROR_MSG' => array( |
146 | 146 | 'no_ticket_name' => __('General Admission', 'event_espresso'), |
147 | - 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>' |
|
147 | + 'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>' |
|
148 | 148 | ), |
149 | 149 | 'DTT_OVERSELL_WARNING' => array( |
150 | 150 | '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'), |
151 | 151 | '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') |
152 | 152 | ), |
153 | - 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ), |
|
154 | - 'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) ) |
|
153 | + 'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']), |
|
154 | + 'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week')) |
|
155 | 155 | ) |
156 | 156 | ) |
157 | 157 | ); |
158 | 158 | |
159 | 159 | |
160 | - add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 ); |
|
161 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
160 | + add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10); |
|
161 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | 165 | |
166 | - public function caf_updates( $update_callbacks ) { |
|
167 | - foreach ( $update_callbacks as $key => $callback ) { |
|
168 | - if ( $callback[1] == '_default_tickets_update' ) |
|
169 | - unset( $update_callbacks[$key] ); |
|
166 | + public function caf_updates($update_callbacks) { |
|
167 | + foreach ($update_callbacks as $key => $callback) { |
|
168 | + if ($callback[1] == '_default_tickets_update') |
|
169 | + unset($update_callbacks[$key]); |
|
170 | 170 | } |
171 | 171 | |
172 | - $update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' ); |
|
172 | + $update_callbacks[] = array($this, 'dtt_and_tickets_caf_update'); |
|
173 | 173 | return $update_callbacks; |
174 | 174 | } |
175 | 175 | |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | * @param array $data The request data from the form |
183 | 183 | * @return bool success or fail |
184 | 184 | */ |
185 | - public function dtt_and_tickets_caf_update( $evtobj, $data ) { |
|
185 | + public function dtt_and_tickets_caf_update($evtobj, $data) { |
|
186 | 186 | //first we need to start with datetimes cause they are the "root" items attached to events. |
187 | - $saved_dtts = $this->_update_dtts( $evtobj, $data ); |
|
187 | + $saved_dtts = $this->_update_dtts($evtobj, $data); |
|
188 | 188 | //next tackle the tickets (and prices?) |
189 | - $this->_update_tkts( $evtobj, $saved_dtts, $data ); |
|
189 | + $this->_update_tkts($evtobj, $saved_dtts, $data); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -197,41 +197,41 @@ discard block |
||
197 | 197 | * @param array $data the request data from the form |
198 | 198 | * @return EE_Datetime[] |
199 | 199 | */ |
200 | - protected function _update_dtts( $evt_obj, $data ) { |
|
201 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
200 | + protected function _update_dtts($evt_obj, $data) { |
|
201 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
202 | 202 | $saved_dtt_ids = array(); |
203 | 203 | $saved_dtt_objs = array(); |
204 | 204 | |
205 | - foreach ( $data['edit_event_datetimes'] as $row => $dtt ) { |
|
205 | + foreach ($data['edit_event_datetimes'] as $row => $dtt) { |
|
206 | 206 | //trim all values to ensure any excess whitespace is removed. |
207 | 207 | $dtt = array_map( |
208 | - function( $datetime_data ) { |
|
209 | - return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data ); |
|
208 | + function($datetime_data) { |
|
209 | + return is_array($datetime_data) ? $datetime_data : trim($datetime_data); |
|
210 | 210 | }, |
211 | 211 | $dtt |
212 | 212 | ); |
213 | - $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
213 | + $dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start']; |
|
214 | 214 | $datetime_values = array( |
215 | - 'DTT_ID' => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL, |
|
216 | - 'DTT_name' => ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '', |
|
217 | - 'DTT_description' => ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '', |
|
215 | + 'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL, |
|
216 | + 'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '', |
|
217 | + 'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '', |
|
218 | 218 | 'DTT_EVT_start' => $dtt['DTT_EVT_start'], |
219 | 219 | 'DTT_EVT_end' => $dtt['DTT_EVT_end'], |
220 | - 'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ], |
|
221 | - 'DTT_order' => ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'], |
|
220 | + 'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'], |
|
221 | + 'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'], |
|
222 | 222 | ); |
223 | 223 | |
224 | 224 | //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. |
225 | 225 | |
226 | - if ( !empty( $dtt['DTT_ID'] ) ) { |
|
227 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] ); |
|
226 | + if ( ! empty($dtt['DTT_ID'])) { |
|
227 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']); |
|
228 | 228 | |
229 | 229 | //set date and time format according to what is set in this class. |
230 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
231 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
230 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
231 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
232 | 232 | |
233 | - foreach ( $datetime_values as $field => $value ) { |
|
234 | - $DTM->set( $field, $value ); |
|
233 | + foreach ($datetime_values as $field => $value) { |
|
234 | + $DTM->set($field, $value); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it. |
@@ -239,24 +239,24 @@ discard block |
||
239 | 239 | $saved_dtt_ids[$DTM->ID()] = $DTM->ID(); |
240 | 240 | |
241 | 241 | } else { |
242 | - $DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE ); |
|
242 | + $DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE); |
|
243 | 243 | |
244 | 244 | //reset date and times to match the format |
245 | - $DTM->set_date_format( $this->_date_format_strings['date'] ); |
|
246 | - $DTM->set_time_format( $this->_date_format_strings['time'] ); |
|
247 | - foreach( $datetime_values as $field => $value ) { |
|
248 | - $DTM->set( $field, $value ); |
|
245 | + $DTM->set_date_format($this->_date_format_strings['date']); |
|
246 | + $DTM->set_time_format($this->_date_format_strings['time']); |
|
247 | + foreach ($datetime_values as $field => $value) { |
|
248 | + $DTM->set($field, $value); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | 252 | |
253 | 253 | $DTM->save(); |
254 | - $DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' ); |
|
254 | + $DTM = $evt_obj->_add_relation_to($DTM, 'Datetime'); |
|
255 | 255 | $evt_obj->save(); |
256 | 256 | |
257 | 257 | //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. |
258 | - if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) { |
|
259 | - $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') ); |
|
258 | + if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) { |
|
259 | + $DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start')); |
|
260 | 260 | $DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days'); |
261 | 261 | $DTM->save(); |
262 | 262 | } |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | //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. |
274 | - $old_datetimes = explode(',', $data['datetime_IDs'] ); |
|
274 | + $old_datetimes = explode(',', $data['datetime_IDs']); |
|
275 | 275 | $old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes; |
276 | 276 | |
277 | - if ( is_array( $old_datetimes ) ) { |
|
278 | - $dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids ); |
|
279 | - foreach ( $dtts_to_delete as $id ) { |
|
280 | - $id = absint( $id ); |
|
281 | - if ( empty( $id ) ) |
|
277 | + if (is_array($old_datetimes)) { |
|
278 | + $dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids); |
|
279 | + foreach ($dtts_to_delete as $id) { |
|
280 | + $id = absint($id); |
|
281 | + if (empty($id)) |
|
282 | 282 | continue; |
283 | 283 | |
284 | 284 | $dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id); |
285 | 285 | |
286 | 286 | //remove tkt relationships. |
287 | 287 | $related_tickets = $dtt_to_remove->get_many_related('Ticket'); |
288 | - foreach ( $related_tickets as $tkt ) { |
|
288 | + foreach ($related_tickets as $tkt) { |
|
289 | 289 | $dtt_to_remove->_remove_relation_to($tkt, 'Ticket'); |
290 | 290 | } |
291 | 291 | |
292 | - $evt_obj->_remove_relation_to( $id, 'Datetime' ); |
|
292 | + $evt_obj->_remove_relation_to($id, 'Datetime'); |
|
293 | 293 | $dtt_to_remove->refresh_cache_of_related_objects(); |
294 | 294 | |
295 | 295 | } |
@@ -310,85 +310,85 @@ discard block |
||
310 | 310 | * @param array $data incoming request data |
311 | 311 | * @return EE_Ticket[] |
312 | 312 | */ |
313 | - protected function _update_tkts( $evtobj, $saved_dtts, $data ) { |
|
313 | + protected function _update_tkts($evtobj, $saved_dtts, $data) { |
|
314 | 314 | |
315 | 315 | $new_tkt = null; |
316 | 316 | $new_default = null; |
317 | 317 | //stripslashes because WP filtered the $_POST ($data) array to add slashes |
318 | 318 | $data = stripslashes_deep($data); |
319 | - $timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL; |
|
319 | + $timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL; |
|
320 | 320 | $saved_tickets = $dtts_on_existing = array(); |
321 | - $old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array(); |
|
321 | + $old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array(); |
|
322 | 322 | |
323 | 323 | //load money helper |
324 | 324 | |
325 | - foreach ( $data['edit_tickets'] as $row => $tkt ) { |
|
325 | + foreach ($data['edit_tickets'] as $row => $tkt) { |
|
326 | 326 | |
327 | 327 | $update_prices = $create_new_TKT = FALSE; |
328 | 328 | |
329 | 329 | //figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session. |
330 | 330 | |
331 | - $starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]); |
|
332 | - $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] ); |
|
331 | + $starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]); |
|
332 | + $tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]); |
|
333 | 333 | $dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows); |
334 | 334 | $dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows); |
335 | 335 | |
336 | 336 | // trim inputs to ensure any excess whitespace is removed. |
337 | 337 | $tkt = array_map( |
338 | - function( $ticket_data ) { |
|
339 | - return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data ); |
|
338 | + function($ticket_data) { |
|
339 | + return is_array($ticket_data) ? $ticket_data : trim($ticket_data); |
|
340 | 340 | }, |
341 | 341 | $tkt |
342 | 342 | ); |
343 | 343 | |
344 | 344 | //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. |
345 | 345 | //note incoming ['TKT_price'] value is already in standard notation (via js). |
346 | - $ticket_price = isset( $tkt['TKT_price'] ) ? round ( (float) $tkt['TKT_price'], 3 ) : 0; |
|
346 | + $ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0; |
|
347 | 347 | |
348 | 348 | //note incoming base price needs converted from localized value. |
349 | - $base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0; |
|
349 | + $base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0; |
|
350 | 350 | //if ticket price == 0 and $base_price != 0 then ticket price == base_price |
351 | 351 | $ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price; |
352 | - $base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0; |
|
352 | + $base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0; |
|
353 | 353 | |
354 | 354 | $price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array(); |
355 | 355 | |
356 | 356 | $now = null; |
357 | - if ( empty( $tkt['TKT_start_date'] ) ) { |
|
357 | + if (empty($tkt['TKT_start_date'])) { |
|
358 | 358 | //lets' use now in the set timezone. |
359 | - $now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) ); |
|
360 | - $tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
359 | + $now = new DateTime('now', new DateTimeZone($evtobj->get_timezone())); |
|
360 | + $tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
361 | 361 | } |
362 | 362 | |
363 | - if ( empty( $tkt['TKT_end_date'] ) ) { |
|
363 | + if (empty($tkt['TKT_end_date'])) { |
|
364 | 364 | /** |
365 | 365 | * set the TKT_end_date to the first datetime attached to the ticket. |
366 | 366 | */ |
367 | - $first_dtt = $saved_dtts[reset( $tkt_dtt_rows )]; |
|
368 | - $tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] ); |
|
367 | + $first_dtt = $saved_dtts[reset($tkt_dtt_rows)]; |
|
368 | + $tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | $TKT_values = array( |
372 | - 'TKT_ID' => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL, |
|
373 | - 'TTM_ID' => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0, |
|
374 | - 'TKT_name' => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '', |
|
375 | - 'TKT_description' => ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
372 | + 'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL, |
|
373 | + 'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0, |
|
374 | + 'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '', |
|
375 | + 'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '', |
|
376 | 376 | 'TKT_start_date' => $tkt['TKT_start_date'], |
377 | 377 | 'TKT_end_date' => $tkt['TKT_end_date'], |
378 | - 'TKT_qty' => ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ], |
|
379 | - 'TKT_uses' => ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'], |
|
380 | - 'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'], |
|
381 | - 'TKT_max' => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'], |
|
378 | + 'TKT_qty' => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'], |
|
379 | + 'TKT_uses' => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'], |
|
380 | + 'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'], |
|
381 | + 'TKT_max' => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'], |
|
382 | 382 | 'TKT_row' => $row, |
383 | - 'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0, |
|
384 | - 'TKT_taxable' => ! empty( $tkt['TKT_taxable'] ) ? 1 : 0, |
|
385 | - 'TKT_required' => ! empty( $tkt['TKT_required'] ) ? 1 : 0, |
|
383 | + 'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0, |
|
384 | + 'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0, |
|
385 | + 'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0, |
|
386 | 386 | 'TKT_price' => $ticket_price |
387 | 387 | ); |
388 | 388 | |
389 | 389 | |
390 | 390 | //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. |
391 | - if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) { |
|
391 | + if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) { |
|
392 | 392 | $TKT_values['TKT_ID'] = 0; |
393 | 393 | $TKT_values['TKT_is_default'] = 0; |
394 | 394 | $update_prices = TRUE; |
@@ -400,21 +400,21 @@ discard block |
||
400 | 400 | // but DID have it's items modified. |
401 | 401 | // keep in mind that if the TKT has been sold (and we have changed pricing information), |
402 | 402 | // then we won't be updating the tkt but instead a new tkt will be created and the old one archived. |
403 | - if ( absint( $TKT_values['TKT_ID'] ) ) { |
|
404 | - $TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] ); |
|
405 | - if ( $TKT instanceof EE_Ticket ) { |
|
403 | + if (absint($TKT_values['TKT_ID'])) { |
|
404 | + $TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']); |
|
405 | + if ($TKT instanceof EE_Ticket) { |
|
406 | 406 | |
407 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
407 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
408 | 408 | // are there any registrations using this ticket ? |
409 | 409 | $tickets_sold = $TKT->count_related( |
410 | 410 | 'Registration', |
411 | - array( array( |
|
412 | - 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) |
|
413 | - ) ) |
|
411 | + array(array( |
|
412 | + 'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete)) |
|
413 | + )) |
|
414 | 414 | ); |
415 | 415 | //set ticket formats |
416 | - $TKT->set_date_format( $this->_date_format_strings['date'] ); |
|
417 | - $TKT->set_time_format( $this->_date_format_strings['time'] ); |
|
416 | + $TKT->set_date_format($this->_date_format_strings['date']); |
|
417 | + $TKT->set_time_format($this->_date_format_strings['time']); |
|
418 | 418 | |
419 | 419 | // let's just check the total price for the existing ticket |
420 | 420 | // and determine if it matches the new total price. |
@@ -424,17 +424,17 @@ discard block |
||
424 | 424 | ? TRUE : FALSE; |
425 | 425 | |
426 | 426 | //set new values |
427 | - foreach ( $TKT_values as $field => $value ) { |
|
428 | - if ( $field === 'TKT_qty' ) { |
|
429 | - $TKT->set_qty( $value ); |
|
427 | + foreach ($TKT_values as $field => $value) { |
|
428 | + if ($field === 'TKT_qty') { |
|
429 | + $TKT->set_qty($value); |
|
430 | 430 | } else { |
431 | - $TKT->set( $field, $value ); |
|
431 | + $TKT->set($field, $value); |
|
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | 435 | //if $create_new_TKT is false then we can safely update the existing ticket. Otherwise we have to create a new ticket. |
436 | - if ( $create_new_TKT ) { |
|
437 | - $new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id ); |
|
436 | + if ($create_new_TKT) { |
|
437 | + $new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id); |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | |
@@ -443,12 +443,12 @@ discard block |
||
443 | 443 | $TKT = EE_Ticket::new_instance( |
444 | 444 | $TKT_values, |
445 | 445 | $timezone, |
446 | - array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ] ) |
|
446 | + array($this->_date_format_strings['date'], $this->_date_format_strings['time']) |
|
447 | 447 | ); |
448 | - if ( $TKT instanceof EE_Ticket ) { |
|
448 | + if ($TKT instanceof EE_Ticket) { |
|
449 | 449 | // make sure ticket has an ID of setting relations won't work |
450 | 450 | $TKT->save(); |
451 | - $TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed ); |
|
451 | + $TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed); |
|
452 | 452 | $update_prices = TRUE; |
453 | 453 | } |
454 | 454 | } |
@@ -456,37 +456,37 @@ discard block |
||
456 | 456 | //$TKT->save(); |
457 | 457 | |
458 | 458 | //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. |
459 | - if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) { |
|
460 | - $TKT->set('TKT_end_date', $TKT->get('TKT_start_date') ); |
|
459 | + if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) { |
|
460 | + $TKT->set('TKT_end_date', $TKT->get('TKT_start_date')); |
|
461 | 461 | $TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days'); |
462 | 462 | } |
463 | 463 | |
464 | 464 | //let's make sure the base price is handled |
465 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT; |
|
465 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT; |
|
466 | 466 | |
467 | 467 | //add/update price_modifiers |
468 | - $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT; |
|
468 | + $TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT; |
|
469 | 469 | |
470 | 470 | //need to make sue that the TKT_price is accurate after saving the prices. |
471 | 471 | $TKT->ensure_TKT_Price_correct(); |
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 | //todo we need to add the current attached prices as new prices to the new default ticket. |
485 | - $new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices ); |
|
485 | + $new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices); |
|
486 | 486 | //don't forget the base price! |
487 | - $new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id ); |
|
487 | + $new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id); |
|
488 | 488 | $new_default->save(); |
489 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data ); |
|
489 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data); |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
@@ -497,19 +497,19 @@ discard block |
||
497 | 497 | //let's assign any tickets that have been setup to the saved_tickets tracker |
498 | 498 | //save existing TKT |
499 | 499 | $TKT->save(); |
500 | - if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) { |
|
500 | + if ($create_new_TKT && $new_tkt instanceof EE_Ticket) { |
|
501 | 501 | //save new TKT |
502 | 502 | $new_tkt->save(); |
503 | 503 | //add new ticket to array |
504 | - $saved_tickets[ $new_tkt->ID() ] = $new_tkt; |
|
504 | + $saved_tickets[$new_tkt->ID()] = $new_tkt; |
|
505 | 505 | |
506 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data ); |
|
506 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data); |
|
507 | 507 | |
508 | 508 | } else { |
509 | 509 | //add tkt to saved tkts |
510 | - $saved_tickets[ $TKT->ID() ] = $TKT; |
|
510 | + $saved_tickets[$TKT->ID()] = $TKT; |
|
511 | 511 | |
512 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data ); |
|
512 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data); |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | } |
@@ -519,22 +519,22 @@ discard block |
||
519 | 519 | // (i.e. autosaves are happening and then in between autosaves the user trashes a ticket). |
520 | 520 | // Or a draft event was saved and in the process of editing a ticket is trashed. |
521 | 521 | // No sense in keeping all the related data in the db! |
522 | - $old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
523 | - $tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) ); |
|
522 | + $old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets; |
|
523 | + $tickets_removed = array_diff($old_tickets, array_keys($saved_tickets)); |
|
524 | 524 | |
525 | - foreach ( $tickets_removed as $id ) { |
|
526 | - $id = absint( $id ); |
|
525 | + foreach ($tickets_removed as $id) { |
|
526 | + $id = absint($id); |
|
527 | 527 | |
528 | 528 | //get the ticket for this id |
529 | 529 | $tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id); |
530 | 530 | |
531 | 531 | //if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime |
532 | - if ( $tkt_to_remove->get('TKT_is_default') ) |
|
532 | + if ($tkt_to_remove->get('TKT_is_default')) |
|
533 | 533 | continue; |
534 | 534 | |
535 | 535 | // if this tkt has any registrations attached so then we just ARCHIVE |
536 | 536 | // because we don't actually permanently delete these tickets. |
537 | - if ( $tkt_to_remove->count_related('Registration') > 0 ) { |
|
537 | + if ($tkt_to_remove->count_related('Registration') > 0) { |
|
538 | 538 | $tkt_to_remove->delete(); |
539 | 539 | continue; |
540 | 540 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | // (remember this process can ONLY kick off if there are NO tkts_sold) |
544 | 544 | $dtts = $tkt_to_remove->get_many_related('Datetime'); |
545 | 545 | |
546 | - foreach( $dtts as $dtt ) { |
|
546 | + foreach ($dtts as $dtt) { |
|
547 | 547 | $tkt_to_remove->_remove_relation_to($dtt, 'Datetime'); |
548 | 548 | } |
549 | 549 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | // tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived)) |
552 | 552 | $tkt_to_remove->delete_related_permanently('Price'); |
553 | 553 | |
554 | - do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove ); |
|
554 | + do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove); |
|
555 | 555 | |
556 | 556 | // finally let's delete this ticket |
557 | 557 | // (which should not be blocked at this point b/c we've removed all our relationships) |
@@ -583,39 +583,39 @@ discard block |
||
583 | 583 | // and removing the ticket from datetimes it got removed from. |
584 | 584 | |
585 | 585 | // first let's add datetimes |
586 | - if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) { |
|
587 | - foreach ( $added_datetimes as $row_id ) { |
|
586 | + if ( ! empty($added_datetimes) && is_array($added_datetimes)) { |
|
587 | + foreach ($added_datetimes as $row_id) { |
|
588 | 588 | $row_id = (int) $row_id; |
589 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
590 | - $ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
589 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
590 | + $ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
591 | 591 | // Is this an existing ticket (has an ID) and does it have any sold? |
592 | 592 | // If so, then we need to add that to the DTT sold because this DTT is getting added. |
593 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
594 | - $saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() ); |
|
595 | - $saved_datetimes[ $row_id ]->save(); |
|
593 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
594 | + $saved_datetimes[$row_id]->increase_sold($ticket->sold()); |
|
595 | + $saved_datetimes[$row_id]->save(); |
|
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |
599 | 599 | } |
600 | 600 | // then remove datetimes |
601 | - if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) { |
|
602 | - foreach ( $removed_datetimes as $row_id ) { |
|
603 | - $row_id = (int)$row_id; |
|
601 | + if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) { |
|
602 | + foreach ($removed_datetimes as $row_id) { |
|
603 | + $row_id = (int) $row_id; |
|
604 | 604 | // its entirely possible that a datetime got deleted (instead of just removed from relationship. |
605 | 605 | // So make sure we skip over this if the dtt isn't in the $saved_datetimes array) |
606 | - if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) { |
|
607 | - $ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' ); |
|
606 | + if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) { |
|
607 | + $ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime'); |
|
608 | 608 | // Is this an existing ticket (has an ID) and does it have any sold? |
609 | 609 | // If so, then we need to remove it's sold from the DTT_sold. |
610 | - if ( $ticket->ID() && $ticket->sold() > 0 ) { |
|
611 | - $saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() ); |
|
612 | - $saved_datetimes[ $row_id ]->save(); |
|
610 | + if ($ticket->ID() && $ticket->sold() > 0) { |
|
611 | + $saved_datetimes[$row_id]->decrease_sold($ticket->sold()); |
|
612 | + $saved_datetimes[$row_id]->save(); |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | } |
616 | 616 | } |
617 | 617 | // cap ticket qty by datetime reg limits |
618 | - $ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) ); |
|
618 | + $ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit'))); |
|
619 | 619 | return $ticket; |
620 | 620 | } |
621 | 621 | |
@@ -636,39 +636,39 @@ discard block |
||
636 | 636 | EE_Ticket $ticket, |
637 | 637 | $price_rows = array(), |
638 | 638 | $ticket_price = 0, |
639 | - $base_price = 0 , |
|
639 | + $base_price = 0, |
|
640 | 640 | $base_price_id = 0 |
641 | 641 | ) { |
642 | 642 | |
643 | 643 | // create new ticket that's a copy of the existing |
644 | 644 | // except a new id of course (and not archived) |
645 | 645 | // AND has the new TKT_price associated with it. |
646 | - $new_ticket = clone( $ticket ); |
|
647 | - $new_ticket->set( 'TKT_ID', 0 ); |
|
648 | - $new_ticket->set( 'TKT_deleted', 0 ); |
|
649 | - $new_ticket->set( 'TKT_price', $ticket_price ); |
|
650 | - $new_ticket->set( 'TKT_sold', 0 ); |
|
646 | + $new_ticket = clone($ticket); |
|
647 | + $new_ticket->set('TKT_ID', 0); |
|
648 | + $new_ticket->set('TKT_deleted', 0); |
|
649 | + $new_ticket->set('TKT_price', $ticket_price); |
|
650 | + $new_ticket->set('TKT_sold', 0); |
|
651 | 651 | // let's get a new ID for this ticket |
652 | 652 | $new_ticket->save(); |
653 | 653 | // we also need to make sure this new ticket gets the same datetime attachments as the archived ticket |
654 | - $datetimes_on_existing = $ticket->get_many_related( 'Datetime' ); |
|
654 | + $datetimes_on_existing = $ticket->get_many_related('Datetime'); |
|
655 | 655 | $new_ticket = $this->_update_ticket_datetimes( |
656 | 656 | $new_ticket, |
657 | 657 | $datetimes_on_existing, |
658 | - array_keys( $datetimes_on_existing ) |
|
658 | + array_keys($datetimes_on_existing) |
|
659 | 659 | ); |
660 | 660 | |
661 | 661 | // $ticket will get archived later b/c we are NOT adding it to the saved_tickets array. |
662 | 662 | // if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining |
663 | 663 | // available. |
664 | - if ( $ticket->sold() > 0 ) { |
|
664 | + if ($ticket->sold() > 0) { |
|
665 | 665 | $new_qty = $ticket->qty() - $ticket->sold(); |
666 | - $new_ticket->set_qty( $new_qty ); |
|
666 | + $new_ticket->set_qty($new_qty); |
|
667 | 667 | } |
668 | 668 | //now we update the prices just for this ticket |
669 | - $new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true ); |
|
669 | + $new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true); |
|
670 | 670 | //and we update the base price |
671 | - $new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id ); |
|
671 | + $new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id); |
|
672 | 672 | return $new_ticket; |
673 | 673 | } |
674 | 674 | |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | * @param int|bool $base_price_id if present then this is the base_price_id being updated. |
689 | 689 | * @return EE_Ticket |
690 | 690 | */ |
691 | - protected function _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) { |
|
691 | + protected function _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) { |
|
692 | 692 | |
693 | 693 | //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. |
694 | 694 | $current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers(); |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | $updated_prices = array(); |
697 | 697 | |
698 | 698 | // if $base_price ! FALSE then updating a base price. |
699 | - if ( $base_price !== FALSE ) { |
|
699 | + if ($base_price !== FALSE) { |
|
700 | 700 | $prices[1] = array( |
701 | 701 | 'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id, |
702 | 702 | 'PRT_ID' => 1, |
@@ -707,47 +707,47 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | //possibly need to save tkt |
710 | - if ( ! $ticket->ID() ) |
|
710 | + if ( ! $ticket->ID()) |
|
711 | 711 | $ticket->save(); |
712 | 712 | |
713 | - foreach ( $prices as $row => $prc ) { |
|
714 | - $prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL; |
|
715 | - if ( empty($prt_id) ) |
|
713 | + foreach ($prices as $row => $prc) { |
|
714 | + $prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL; |
|
715 | + if (empty($prt_id)) |
|
716 | 716 | continue; //prices MUST have a price type id. |
717 | 717 | $PRC_values = array( |
718 | - 'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL, |
|
718 | + 'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL, |
|
719 | 719 | 'PRT_ID' => $prt_id, |
720 | - 'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0, |
|
721 | - 'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '', |
|
722 | - 'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '', |
|
720 | + 'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0, |
|
721 | + 'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '', |
|
722 | + 'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '', |
|
723 | 723 | 'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor |
724 | 724 | 'PRC_order' => $row |
725 | 725 | ); |
726 | - if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) { |
|
726 | + if ($new_prices || empty($PRC_values['PRC_ID'])) { |
|
727 | 727 | $PRC_values['PRC_ID'] = 0; |
728 | - $PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE); |
|
728 | + $PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE); |
|
729 | 729 | } else { |
730 | - $PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] ); |
|
730 | + $PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']); |
|
731 | 731 | //update this price with new values |
732 | - foreach ( $PRC_values as $field => $newprc ) { |
|
733 | - $PRC->set( $field, $newprc ); |
|
732 | + foreach ($PRC_values as $field => $newprc) { |
|
733 | + $PRC->set($field, $newprc); |
|
734 | 734 | } |
735 | 735 | } |
736 | 736 | $PRC->save(); |
737 | 737 | $prcid = $PRC->ID(); |
738 | 738 | $updated_prices[$prcid] = $PRC; |
739 | - $ticket->_add_relation_to( $PRC, 'Price' ); |
|
739 | + $ticket->_add_relation_to($PRC, 'Price'); |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | //now let's remove any prices that got removed from the ticket |
743 | - if ( !empty ( $current_prices_on_ticket ) ) { |
|
743 | + if ( ! empty ($current_prices_on_ticket)) { |
|
744 | 744 | $current = array_keys($current_prices_on_ticket); |
745 | 745 | $updated = array_keys($updated_prices); |
746 | 746 | $prices_to_remove = array_diff($current, $updated); |
747 | - if ( !empty( $prices_to_remove ) ) { |
|
748 | - foreach ( $prices_to_remove as $prc_id ) { |
|
747 | + if ( ! empty($prices_to_remove)) { |
|
748 | + foreach ($prices_to_remove as $prc_id) { |
|
749 | 749 | $p = $current_prices_on_ticket[$prc_id]; |
750 | - $ticket->_remove_relation_to( $p, 'Price' ); |
|
750 | + $ticket->_remove_relation_to($p, 'Price'); |
|
751 | 751 | |
752 | 752 | //delete permanently the price |
753 | 753 | $p->delete_permanently(); |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | |
761 | 761 | |
762 | 762 | |
763 | - public function autosave_handling( $event_admin_obj ) { |
|
763 | + public function autosave_handling($event_admin_obj) { |
|
764 | 764 | return $event_admin_obj; //doing nothing for the moment. |
765 | 765 | //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) |
766 | 766 | |
@@ -794,12 +794,12 @@ discard block |
||
794 | 794 | |
795 | 795 | //default main template args |
796 | 796 | $main_template_args = array( |
797 | - '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 |
|
797 | + '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 |
|
798 | 798 | 'existing_datetime_ids' => '', |
799 | 799 | 'total_dtt_rows' => 1, |
800 | - '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. |
|
800 | + '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. |
|
801 | 801 | 'datetime_rows' => '', |
802 | - 'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
802 | + 'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '', |
|
803 | 803 | 'ticket_rows' => '', |
804 | 804 | 'existing_ticket_ids' => '', |
805 | 805 | 'total_ticket_rows' => 1, |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | |
810 | 810 | $timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL; |
811 | 811 | |
812 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
812 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
813 | 813 | |
814 | 814 | /** |
815 | 815 | * 1. Start with retrieving Datetimes |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | * 3. For each ticket get related prices |
818 | 818 | */ |
819 | 819 | |
820 | - $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) ); |
|
821 | - $times = $DTM->get_all_event_dates( $evtID ); |
|
820 | + $DTM = EE_Registry::instance()->load_model('Datetime', array($timezone)); |
|
821 | + $times = $DTM->get_all_event_dates($evtID); |
|
822 | 822 | |
823 | 823 | |
824 | 824 | |
@@ -826,31 +826,31 @@ discard block |
||
826 | 826 | |
827 | 827 | /** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */ |
828 | 828 | $dttrow = 1; |
829 | - foreach ( $times as $time ) { |
|
829 | + foreach ($times as $time) { |
|
830 | 830 | $dttid = $time->get('DTT_ID'); |
831 | - $time->set( 'DTT_order', $dttrow ); |
|
831 | + $time->set('DTT_order', $dttrow); |
|
832 | 832 | $existing_datetime_ids[] = $dttid; |
833 | 833 | |
834 | 834 | //tickets attached |
835 | - $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(); |
|
835 | + $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(); |
|
836 | 836 | |
837 | 837 | //if there are no related tickets this is likely a new event OR autodraft |
838 | 838 | // event so we need to generate the default tickets because dtts |
839 | 839 | // ALWAYS have at least one related ticket!!. EXCEPT, we dont' do this if there is already more than one |
840 | 840 | // datetime on the event. |
841 | - if ( empty ( $related_tickets ) && count( $times ) < 2 ) { |
|
841 | + if (empty ($related_tickets) && count($times) < 2) { |
|
842 | 842 | $related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets(); |
843 | 843 | |
844 | 844 | //this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save). |
845 | 845 | $default_prices = EEM_Price::instance()->get_all_default_prices(); |
846 | 846 | |
847 | - $main_default_ticket = reset( $related_tickets ); |
|
848 | - if ( $main_default_ticket instanceof EE_Ticket ) { |
|
849 | - foreach ( $default_prices as $default_price ) { |
|
850 | - if ( $default_price->is_base_price() ) { |
|
847 | + $main_default_ticket = reset($related_tickets); |
|
848 | + if ($main_default_ticket instanceof EE_Ticket) { |
|
849 | + foreach ($default_prices as $default_price) { |
|
850 | + if ($default_price->is_base_price()) { |
|
851 | 851 | continue; |
852 | 852 | } |
853 | - $main_default_ticket->cache( 'Price', $default_price ); |
|
853 | + $main_default_ticket->cache('Price', $default_price); |
|
854 | 854 | } |
855 | 855 | } |
856 | 856 | } |
@@ -859,11 +859,11 @@ discard block |
||
859 | 859 | //we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information. |
860 | 860 | |
861 | 861 | //loop through and setup the ticket rows and make sure the order is set. |
862 | - foreach ( $related_tickets as $ticket ) { |
|
862 | + foreach ($related_tickets as $ticket) { |
|
863 | 863 | $tktid = $ticket->get('TKT_ID'); |
864 | 864 | $tktrow = $ticket->get('TKT_row'); |
865 | 865 | //we only want unique tickets in our final display!! |
866 | - if ( !in_array( $tktid, $existing_ticket_ids ) ) { |
|
866 | + if ( ! in_array($tktid, $existing_ticket_ids)) { |
|
867 | 867 | $existing_ticket_ids[] = $tktid; |
868 | 868 | $all_tickets[] = $ticket; |
869 | 869 | } |
@@ -872,57 +872,57 @@ discard block |
||
872 | 872 | $datetime_tickets[$dttid][] = $tktrow; |
873 | 873 | |
874 | 874 | //temporary cache of this datetime info for this ticket for later processing of ticket rows. |
875 | - if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) |
|
875 | + if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid])) |
|
876 | 876 | $ticket_datetimes[$tktid][] = $dttrow; |
877 | 877 | } |
878 | 878 | $dttrow++; |
879 | 879 | } |
880 | 880 | |
881 | - $main_template_args['total_ticket_rows'] = count( $existing_ticket_ids ); |
|
882 | - $main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids ); |
|
883 | - $main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids ); |
|
881 | + $main_template_args['total_ticket_rows'] = count($existing_ticket_ids); |
|
882 | + $main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids); |
|
883 | + $main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids); |
|
884 | 884 | |
885 | 885 | //sort $all_tickets by order |
886 | - usort( $all_tickets, function( $a, $b ) { |
|
886 | + usort($all_tickets, function($a, $b) { |
|
887 | 887 | $a_order = (int) $a->get('TKT_order'); |
888 | 888 | $b_order = (int) $b->get('TKT_order'); |
889 | - if ( $a_order == $b_order ) { |
|
889 | + if ($a_order == $b_order) { |
|
890 | 890 | return 0; |
891 | 891 | } |
892 | - return ( $a_order < $b_order ) ? -1 : 1; |
|
892 | + return ($a_order < $b_order) ? -1 : 1; |
|
893 | 893 | }); |
894 | 894 | |
895 | 895 | //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. |
896 | 896 | $dttrow = 1; |
897 | - foreach ( $times as $time ) { |
|
898 | - $main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times ); |
|
897 | + foreach ($times as $time) { |
|
898 | + $main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times); |
|
899 | 899 | $dttrow++; |
900 | 900 | } |
901 | 901 | |
902 | 902 | //then loop through all tickets for the ticket rows. |
903 | 903 | $tktrow = 1; |
904 | - foreach ( $all_tickets as $ticket ) { |
|
905 | - $main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets ); |
|
904 | + foreach ($all_tickets as $ticket) { |
|
905 | + $main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets); |
|
906 | 906 | $tktrow++; |
907 | 907 | } |
908 | 908 | |
909 | 909 | $main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets); |
910 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'; |
|
911 | - EEH_Template::display_template( $template, $main_template_args ); |
|
910 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'; |
|
911 | + EEH_Template::display_template($template, $main_template_args); |
|
912 | 912 | return; |
913 | 913 | } |
914 | 914 | |
915 | 915 | |
916 | 916 | |
917 | - protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) { |
|
917 | + protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) { |
|
918 | 918 | |
919 | 919 | $dtt_display_template_args = array( |
920 | - 'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ), |
|
921 | - 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ), |
|
920 | + 'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts), |
|
921 | + 'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default), |
|
922 | 922 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow |
923 | 923 | ); |
924 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php'; |
|
925 | - return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE); |
|
924 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php'; |
|
925 | + return EEH_Template::display_template($template, $dtt_display_template_args, TRUE); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return string Generated edit row. |
942 | 942 | */ |
943 | - protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) { |
|
943 | + protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) { |
|
944 | 944 | |
945 | 945 | // if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true. |
946 | 946 | $default = ! $dtt instanceof EE_Datetime ? true : false; |
@@ -948,30 +948,30 @@ discard block |
||
948 | 948 | $template_args = array( |
949 | 949 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
950 | 950 | 'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes', |
951 | - 'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
951 | + 'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing', |
|
952 | 952 | 'DTT_ID' => $default ? '' : $dtt->ID(), |
953 | 953 | 'DTT_name' => $default ? '' : $dtt->name(), |
954 | 954 | 'DTT_description' => $default ? '' : $dtt->description(), |
955 | - 'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
956 | - 'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
957 | - 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'), |
|
955 | + 'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
956 | + 'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
957 | + 'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'), |
|
958 | 958 | 'DTT_order' => $default ? 'DTTNUM' : $dttrow, |
959 | 959 | 'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'), |
960 | - 'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
961 | - 'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
960 | + 'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable', |
|
961 | + 'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable' |
|
962 | 962 | ); |
963 | 963 | |
964 | - $template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
964 | + $template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
965 | 965 | |
966 | 966 | //allow filtering of template args at this point. |
967 | - $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 ); |
|
967 | + $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); |
|
968 | 968 | |
969 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php'; |
|
970 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
969 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php'; |
|
970 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
971 | 971 | } |
972 | 972 | |
973 | 973 | |
974 | - protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) { |
|
974 | + protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) { |
|
975 | 975 | |
976 | 976 | $template_args = array( |
977 | 977 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
@@ -979,47 +979,47 @@ discard block |
||
979 | 979 | 'DTT_description' => $default ? '' : $dtt->description(), |
980 | 980 | 'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '', |
981 | 981 | 'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '', |
982 | - '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. |
|
982 | + '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. |
|
983 | 983 | 'DTT_ID' => $default ? '' : $dtt->ID() |
984 | 984 | ); |
985 | 985 | |
986 | 986 | //need to setup the list items (but only if this isnt' a default skeleton setup) |
987 | - if ( !$default ) { |
|
987 | + if ( ! $default) { |
|
988 | 988 | $tktrow = 1; |
989 | - foreach ( $all_tickets as $ticket ) { |
|
990 | - $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ); |
|
989 | + foreach ($all_tickets as $ticket) { |
|
990 | + $template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default); |
|
991 | 991 | $tktrow++; |
992 | 992 | } |
993 | 993 | } |
994 | 994 | |
995 | 995 | //filter template args at this point |
996 | - $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 ); |
|
996 | + $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); |
|
997 | 997 | |
998 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php'; |
|
999 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
998 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php'; |
|
999 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | |
1003 | 1003 | |
1004 | - protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) { |
|
1005 | - $tktid = !empty( $ticket ) ? $ticket->ID() : 0; |
|
1006 | - $dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1004 | + protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) { |
|
1005 | + $tktid = ! empty($ticket) ? $ticket->ID() : 0; |
|
1006 | + $dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array(); |
|
1007 | 1007 | |
1008 | - $displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0; |
|
1008 | + $displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0; |
|
1009 | 1009 | $template_args = array( |
1010 | 1010 | 'dtt_row' => $default ? 'DTTNUM' : $dttrow, |
1011 | - 'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow, |
|
1011 | + 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
|
1012 | 1012 | 'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '', |
1013 | 1013 | 'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '', |
1014 | - 'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1015 | - 'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(), |
|
1014 | + 'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'), |
|
1015 | + 'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(), |
|
1016 | 1016 | ); |
1017 | 1017 | |
1018 | 1018 | //filter template args |
1019 | - $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 ); |
|
1019 | + $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); |
|
1020 | 1020 | |
1021 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1022 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1021 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php'; |
|
1022 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1041,37 +1041,37 @@ discard block |
||
1041 | 1041 | * |
1042 | 1042 | * @return [type] [description] |
1043 | 1043 | */ |
1044 | - protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) { |
|
1044 | + protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) { |
|
1045 | 1045 | |
1046 | 1046 | //if $ticket is not an instance of EE_Ticket then force default to true. |
1047 | - $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1047 | + $default = ! $ticket instanceof EE_Ticket ? true : false; |
|
1048 | 1048 | |
1049 | - $prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array(); |
|
1049 | + $prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array(); |
|
1050 | 1050 | |
1051 | 1051 | //if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on |
1052 | 1052 | //the object. This is done by not including any query_params. |
1053 | - if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1 || empty( $prices ) ) ) { |
|
1054 | - $prices = $ticket->get_many_related( 'Price' ); |
|
1053 | + if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) { |
|
1054 | + $prices = $ticket->get_many_related('Price'); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | // 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. |
1058 | - $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE; |
|
1058 | + $default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE; |
|
1059 | 1059 | |
1060 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1060 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1061 | 1061 | |
1062 | 1062 | $ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal(); |
1063 | - $base_price = $default ? NULL : $ticket->base_price(); |
|
1063 | + $base_price = $default ? NULL : $ticket->base_price(); |
|
1064 | 1064 | $count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE); |
1065 | 1065 | |
1066 | 1066 | //breaking out complicated condition for ticket_status |
1067 | - if ( $default ) { |
|
1068 | - $ticket_status_class = ' tkt-status-' . EE_Ticket::onsale; |
|
1067 | + if ($default) { |
|
1068 | + $ticket_status_class = ' tkt-status-'.EE_Ticket::onsale; |
|
1069 | 1069 | } else { |
1070 | - $ticket_status_class = $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(); |
|
1070 | + $ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | //breaking out complicated condition for TKT_taxable |
1074 | - if ( $default ) { |
|
1074 | + if ($default) { |
|
1075 | 1075 | $TKT_taxable = ''; |
1076 | 1076 | } else { |
1077 | 1077 | $TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : ''; |
@@ -1086,19 +1086,19 @@ discard block |
||
1086 | 1086 | 'edit_tkt_expanded' => '', |
1087 | 1087 | 'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets', |
1088 | 1088 | 'TKT_name' => $default ? '' : $ticket->get('TKT_name'), |
1089 | - 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1090 | - 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ), |
|
1091 | - '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), |
|
1089 | + 'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1090 | + 'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']), |
|
1091 | + '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), |
|
1092 | 1092 | 'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE), |
1093 | 1093 | 'TKT_price_code' => EE_Registry::instance()->CFG->currency->code, |
1094 | 1094 | 'TKT_price_amount' => $default ? 0 : $ticket_subtotal, |
1095 | - 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'), |
|
1096 | - 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'), |
|
1097 | - 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'), |
|
1098 | - 'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ), |
|
1099 | - 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max','input'), |
|
1095 | + 'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'), |
|
1096 | + 'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'), |
|
1097 | + 'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'), |
|
1098 | + 'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')), |
|
1099 | + 'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'), |
|
1100 | 1100 | 'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'), |
1101 | - 'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ), |
|
1101 | + 'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))), |
|
1102 | 1102 | 'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'), |
1103 | 1103 | 'TKT_description' => $default ? '' : $ticket->get('TKT_description'), |
1104 | 1104 | 'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'), |
@@ -1107,99 +1107,99 @@ discard block |
||
1107 | 1107 | 'ticket_price_rows' => '', |
1108 | 1108 | 'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'), |
1109 | 1109 | 'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(), |
1110 | - 'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"', |
|
1111 | - 'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '', |
|
1110 | + 'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"', |
|
1111 | + 'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '', |
|
1112 | 1112 | 'total_price_rows' => count($prices) > 1 ? count($prices) : 1, |
1113 | 1113 | 'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '', |
1114 | 1114 | 'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts), |
1115 | 1115 | 'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts), |
1116 | - 'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ), |
|
1116 | + 'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)), |
|
1117 | 1117 | 'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'), |
1118 | 1118 | 'TKT_taxable' => $TKT_taxable, |
1119 | 1119 | 'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"', |
1120 | 1120 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1121 | - 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ), |
|
1121 | + 'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE), |
|
1122 | 1122 | 'TKT_subtotal_amount' => $ticket_subtotal, |
1123 | - 'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ), |
|
1124 | - 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE, |
|
1123 | + 'tax_rows' => $this->_get_tax_rows($tktrow, $ticket), |
|
1124 | + 'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE, |
|
1125 | 1125 | 'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '', |
1126 | 1126 | 'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable', |
1127 | 1127 | 'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable' |
1128 | 1128 | ); |
1129 | 1129 | |
1130 | - $template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1130 | + $template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : ''; |
|
1131 | 1131 | |
1132 | 1132 | //handle rows that should NOT be empty |
1133 | - if ( empty( $template_args['TKT_start_date'] ) ) { |
|
1133 | + if (empty($template_args['TKT_start_date'])) { |
|
1134 | 1134 | //if empty then the start date will be now. |
1135 | - $template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp')); |
|
1136 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1135 | + $template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp')); |
|
1136 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | - if ( empty( $template_args['TKT_end_date'] ) ) { |
|
1139 | + if (empty($template_args['TKT_end_date'])) { |
|
1140 | 1140 | |
1141 | 1141 | //get the earliest datetime (if present); |
1142 | - $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; |
|
1142 | + $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; |
|
1143 | 1143 | |
1144 | - if ( !empty( $earliest_dtt ) ) { |
|
1145 | - $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ); |
|
1144 | + if ( ! empty($earliest_dtt)) { |
|
1145 | + $template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']); |
|
1146 | 1146 | } else { |
1147 | 1147 | //default so let's just use what's been set for the default date-time which is 30 days from now. |
1148 | - $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") ) ); |
|
1148 | + $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"))); |
|
1149 | 1149 | } |
1150 | - $template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale; |
|
1150 | + $template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale; |
|
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | //generate ticket_datetime items |
1154 | - if ( ! $default ) { |
|
1154 | + if ( ! $default) { |
|
1155 | 1155 | $dttrow = 1; |
1156 | - foreach ( $all_dtts as $dtt ) { |
|
1157 | - $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ); |
|
1156 | + foreach ($all_dtts as $dtt) { |
|
1157 | + $template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default); |
|
1158 | 1158 | $dttrow++; |
1159 | 1159 | } |
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | $prcrow = 1; |
1163 | - foreach ( $prices as $price ) { |
|
1164 | - if ( $price->is_base_price() ) { |
|
1163 | + foreach ($prices as $price) { |
|
1164 | + if ($price->is_base_price()) { |
|
1165 | 1165 | $prcrow++; |
1166 | 1166 | continue; |
1167 | 1167 | } |
1168 | - $show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1 ? FALSE : TRUE; |
|
1169 | - $show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE; |
|
1170 | - $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create ); |
|
1168 | + $show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE; |
|
1169 | + $show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE; |
|
1170 | + $template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create); |
|
1171 | 1171 | $prcrow++; |
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | //filter $template_args |
1175 | - $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 ); |
|
1175 | + $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); |
|
1176 | 1176 | |
1177 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php'; |
|
1178 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1177 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php'; |
|
1178 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | |
1182 | 1182 | |
1183 | 1183 | |
1184 | 1184 | |
1185 | - protected function _get_tax_rows( $tktrow, $ticket ) { |
|
1185 | + protected function _get_tax_rows($tktrow, $ticket) { |
|
1186 | 1186 | $tax_rows = ''; |
1187 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1187 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php'; |
|
1188 | 1188 | $template_args = array(); |
1189 | - $taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1190 | - foreach ( $taxes as $tax ) { |
|
1191 | - $tax_added = $this->_get_tax_added( $tax, $ticket ); |
|
1189 | + $taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin(); |
|
1190 | + foreach ($taxes as $tax) { |
|
1191 | + $tax_added = $this->_get_tax_added($tax, $ticket); |
|
1192 | 1192 | $template_args = array( |
1193 | - 'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1193 | + 'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"', |
|
1194 | 1194 | 'tax_id' => $tax->ID(), |
1195 | 1195 | 'tkt_row' => $tktrow, |
1196 | 1196 | 'tax_label' => $tax->get('PRC_name'), |
1197 | 1197 | 'tax_added' => $tax_added, |
1198 | - 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ), |
|
1198 | + 'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE), |
|
1199 | 1199 | 'tax_amount' => $tax->get('PRC_amount') |
1200 | 1200 | ); |
1201 | - $template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event ); |
|
1202 | - $tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1201 | + $template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event); |
|
1202 | + $tax_rows .= EEH_Template::display_template($template, $template_args, TRUE); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | |
@@ -1207,81 +1207,81 @@ discard block |
||
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | - protected function _get_tax_added( EE_Price $tax, $ticket ) { |
|
1211 | - $subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal(); |
|
1210 | + protected function _get_tax_added(EE_Price $tax, $ticket) { |
|
1211 | + $subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal(); |
|
1212 | 1212 | return $subtotal * $tax->get('PRC_amount') / 100; |
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | |
1216 | 1216 | |
1217 | 1217 | |
1218 | - protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) { |
|
1219 | - $send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1218 | + protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) { |
|
1219 | + $send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE; |
|
1220 | 1220 | $template_args = array( |
1221 | 1221 | 'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow, |
1222 | 1222 | 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
1223 | 1223 | 'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices', |
1224 | - '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 ), |
|
1224 | + '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), |
|
1225 | 1225 | 'PRC_ID' => $default && empty($price) ? 0 : $price->ID(), |
1226 | 1226 | 'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'), |
1227 | 1227 | 'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'), |
1228 | 1228 | 'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign, |
1229 | 1229 | 'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"', |
1230 | - 'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1231 | - 'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1232 | - 'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ), |
|
1233 | - 'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1234 | - 'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ), |
|
1230 | + 'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''), |
|
1231 | + 'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'), |
|
1232 | + 'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''), |
|
1233 | + 'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'), |
|
1234 | + 'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'), |
|
1235 | 1235 | 'show_trash_icon' => $show_trash ? '' : ' style="display:none;"', |
1236 | 1236 | 'show_create_button' => $show_create ? '' : ' style="display:none;"', |
1237 | - 'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'), |
|
1238 | - 'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1237 | + 'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'), |
|
1238 | + 'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE |
|
1239 | 1239 | ); |
1240 | 1240 | |
1241 | - $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 ); |
|
1241 | + $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); |
|
1242 | 1242 | |
1243 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php'; |
|
1244 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1243 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php'; |
|
1244 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | |
1248 | - protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1249 | - if ( $price->is_base_price() ) { |
|
1250 | - return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ); |
|
1248 | + protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1249 | + if ($price->is_base_price()) { |
|
1250 | + return $this->_get_base_price_template($tktrow, $prcrow, $price, $default); |
|
1251 | 1251 | } else { |
1252 | - return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled ); |
|
1252 | + return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
1258 | - protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) { |
|
1258 | + protected function _get_base_price_template($tktrow, $prcrow, $price, $default) { |
|
1259 | 1259 | $template_args = array( |
1260 | 1260 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1261 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1262 | - 'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'), |
|
1261 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1262 | + 'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'), |
|
1263 | 1263 | 'PRT_name' => __('Price', 'event_espresso'), |
1264 | 1264 | 'price_selected_operator' => '+', |
1265 | 1265 | 'price_selected_is_percent' => 0 |
1266 | 1266 | ); |
1267 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php'; |
|
1267 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php'; |
|
1268 | 1268 | |
1269 | - $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 ); |
|
1269 | + $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); |
|
1270 | 1270 | |
1271 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1271 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1272 | 1272 | } |
1273 | 1273 | |
1274 | 1274 | |
1275 | 1275 | |
1276 | - protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) { |
|
1277 | - $select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]'; |
|
1278 | - $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) ); |
|
1279 | - $price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php'; |
|
1280 | - $all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array(); |
|
1281 | - $selected_price_type_id = $default && empty( $price ) ? 0 : $price->type(); |
|
1276 | + protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) { |
|
1277 | + $select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]'; |
|
1278 | + $price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3')))); |
|
1279 | + $price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php'; |
|
1280 | + $all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array(); |
|
1281 | + $selected_price_type_id = $default && empty($price) ? 0 : $price->type(); |
|
1282 | 1282 | $price_option_spans = ''; |
1283 | 1283 | //setup pricetypes for selector |
1284 | - foreach ( $price_types as $price_type ) { |
|
1284 | + foreach ($price_types as $price_type) { |
|
1285 | 1285 | $all_price_types[] = array( |
1286 | 1286 | 'id' => $price_type->ID(), |
1287 | 1287 | 'text' => $price_type->get('PRT_name'), |
@@ -1293,50 +1293,50 @@ discard block |
||
1293 | 1293 | 'PRT_operator' => $price_type->is_discount() ? '-' : '+', |
1294 | 1294 | 'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0 |
1295 | 1295 | ); |
1296 | - $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE ); |
|
1296 | + $price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | - $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1299 | + $select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"'; |
|
1300 | 1300 | $main_name = $select_name; |
1301 | - $select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name; |
|
1301 | + $select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name; |
|
1302 | 1302 | |
1303 | 1303 | $template_args = array( |
1304 | 1304 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1305 | - 'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow, |
|
1306 | - 'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ), |
|
1305 | + 'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow, |
|
1306 | + 'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'), |
|
1307 | 1307 | 'main_name' => $main_name, |
1308 | 1308 | 'selected_price_type_id' => $selected_price_type_id, |
1309 | 1309 | 'price_option_spans' => $price_option_spans, |
1310 | - 'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ), |
|
1311 | - 'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ), |
|
1310 | + 'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'), |
|
1311 | + 'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0), |
|
1312 | 1312 | 'disabled' => $disabled |
1313 | 1313 | ); |
1314 | 1314 | |
1315 | - $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 ); |
|
1315 | + $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); |
|
1316 | 1316 | |
1317 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1317 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php'; |
|
1318 | 1318 | |
1319 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1319 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | |
1323 | 1323 | |
1324 | - protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) { |
|
1325 | - $dttid = !empty($dtt) ? $dtt->ID() : 0; |
|
1326 | - $displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1327 | - $tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1324 | + protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) { |
|
1325 | + $dttid = ! empty($dtt) ? $dtt->ID() : 0; |
|
1326 | + $displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0; |
|
1327 | + $tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array(); |
|
1328 | 1328 | $template_args = array( |
1329 | - 'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow, |
|
1329 | + 'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow, |
|
1330 | 1330 | 'tkt_row' => $default ? 'TICKETNUM' : $tktrow, |
1331 | - 'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '', |
|
1332 | - 'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '', |
|
1333 | - 'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ), |
|
1331 | + 'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '', |
|
1332 | + 'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '', |
|
1333 | + 'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE), |
|
1334 | 1334 | 'tkt_status_class' => '', |
1335 | 1335 | ); |
1336 | 1336 | |
1337 | - $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 ); |
|
1338 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1339 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1337 | + $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); |
|
1338 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php'; |
|
1339 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | |
@@ -1344,53 +1344,53 @@ discard block |
||
1344 | 1344 | protected function _get_ticket_js_structure($all_dtts, $all_tickets) { |
1345 | 1345 | $template_args = array( |
1346 | 1346 | 'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts), |
1347 | - 'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE), |
|
1348 | - 'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ), |
|
1347 | + 'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE), |
|
1348 | + 'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL), |
|
1349 | 1349 | 'default_price_rows' => '', |
1350 | 1350 | 'default_base_price_amount' => 0, |
1351 | 1351 | 'default_base_price_name' => '', |
1352 | 1352 | 'default_base_price_description' => '', |
1353 | - 'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ), |
|
1354 | - 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ), |
|
1353 | + 'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE), |
|
1354 | + 'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE), |
|
1355 | 1355 | 'existing_available_datetime_tickets_list' => '', |
1356 | 1356 | 'existing_available_ticket_datetimes_list' => '', |
1357 | - 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ), |
|
1358 | - 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ) |
|
1357 | + 'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE), |
|
1358 | + 'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE) |
|
1359 | 1359 | ); |
1360 | 1360 | |
1361 | 1361 | $tktrow = 1; |
1362 | - foreach ( $all_tickets as $ticket ) { |
|
1363 | - $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE ); |
|
1362 | + foreach ($all_tickets as $ticket) { |
|
1363 | + $template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE); |
|
1364 | 1364 | $tktrow++; |
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | |
1368 | 1368 | $dttrow = 1; |
1369 | - foreach ( $all_dtts as $dtt ) { |
|
1370 | - $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE ); |
|
1369 | + foreach ($all_dtts as $dtt) { |
|
1370 | + $template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE); |
|
1371 | 1371 | $dttrow++; |
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | $default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices(); |
1375 | 1375 | $prcrow = 1; |
1376 | - foreach ( $default_prices as $price ) { |
|
1377 | - if ( $price->is_base_price() ) { |
|
1376 | + foreach ($default_prices as $price) { |
|
1377 | + if ($price->is_base_price()) { |
|
1378 | 1378 | $template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float'); |
1379 | 1379 | $template_args['default_base_price_name'] = $price->get('PRC_name'); |
1380 | 1380 | $template_args['default_base_price_description'] = $price->get('PRC_desc'); |
1381 | 1381 | $prcrow++; |
1382 | 1382 | continue; |
1383 | 1383 | } |
1384 | - $show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1 ? FALSE : TRUE; |
|
1385 | - $show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE; |
|
1386 | - $template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create ); |
|
1384 | + $show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE; |
|
1385 | + $show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE; |
|
1386 | + $template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create); |
|
1387 | 1387 | $prcrow++; |
1388 | 1388 | } |
1389 | 1389 | |
1390 | - $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 ); |
|
1390 | + $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); |
|
1391 | 1391 | |
1392 | - $template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1393 | - return EEH_Template::display_template( $template, $template_args, TRUE ); |
|
1392 | + $template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php'; |
|
1393 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 |
@@ -173,7 +173,7 @@ |
||
173 | 173 | * |
174 | 174 | * @param array $update_info unused. We just use the $transaction |
175 | 175 | * @param EEI_Transaction $transaction |
176 | - * @return \EEI_Payment|null |
|
176 | + * @return EEI_Payment |
|
177 | 177 | */ |
178 | 178 | public function handle_payment_update($update_info, $transaction) { |
179 | 179 |
@@ -99,45 +99,45 @@ |
||
99 | 99 | 'body'=> json_encode($order) |
100 | 100 | ); |
101 | 101 | $response = wp_remote_post( $this->_mijireh_api_orders_url, $args ); |
102 | - $problems_string = false; |
|
102 | + $problems_string = false; |
|
103 | 103 | $this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment); |
104 | 104 | if( ! $response instanceof WP_Error ){ |
105 | 105 | $response_body = json_decode($response['body']); |
106 | 106 | if($response_body && isset($response_body->checkout_url)){ |
107 | - $payment->set_redirect_url($response_body->checkout_url); |
|
108 | - $payment->set_txn_id_chq_nmbr($response_body->order_number); |
|
109 | - $payment->set_details($response['body']); |
|
107 | + $payment->set_redirect_url($response_body->checkout_url); |
|
108 | + $payment->set_txn_id_chq_nmbr($response_body->order_number); |
|
109 | + $payment->set_details($response['body']); |
|
110 | 110 | } else { |
111 | - if( is_array( $response_body ) || is_object( $response_body)){ |
|
112 | - $response_body_as_array = (array)$response_body; |
|
113 | - foreach($response_body_as_array as $problem_parameter => $problems){ |
|
114 | - $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
115 | - } |
|
116 | - }else{ |
|
117 | - $problems_string = $response['body']; |
|
118 | - } |
|
119 | - if( ! $problems_string ) { |
|
120 | - //no message to show? wack |
|
121 | - if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
122 | - $problems_string = $response[ 'headers' ][ 'status' ]; |
|
123 | - }else{ |
|
124 | - $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
125 | - } |
|
126 | - } |
|
127 | - } |
|
111 | + if( is_array( $response_body ) || is_object( $response_body)){ |
|
112 | + $response_body_as_array = (array)$response_body; |
|
113 | + foreach($response_body_as_array as $problem_parameter => $problems){ |
|
114 | + $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
115 | + } |
|
116 | + }else{ |
|
117 | + $problems_string = $response['body']; |
|
118 | + } |
|
119 | + if( ! $problems_string ) { |
|
120 | + //no message to show? wack |
|
121 | + if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
122 | + $problems_string = $response[ 'headers' ][ 'status' ]; |
|
123 | + }else{ |
|
124 | + $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | 128 | }else{ |
129 | - $problems_string = implode( ",", $response->get_error_messages() ); |
|
129 | + $problems_string = implode( ",", $response->get_error_messages() ); |
|
130 | 130 | } |
131 | 131 | |
132 | - if( $problems_string ) { |
|
133 | - $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
134 | - $payment->set_details( $response ); |
|
135 | - $payment->set_redirect_url( null ); |
|
136 | - //even though the payment's status is failed at this point anyways, |
|
137 | - //let's be explicit about it. The fact that the redirect url is null |
|
138 | - //should be enough to client code that they can't redirect the user |
|
139 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
140 | - } |
|
132 | + if( $problems_string ) { |
|
133 | + $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
134 | + $payment->set_details( $response ); |
|
135 | + $payment->set_redirect_url( null ); |
|
136 | + //even though the payment's status is failed at this point anyways, |
|
137 | + //let's be explicit about it. The fact that the redirect url is null |
|
138 | + //should be enough to client code that they can't redirect the user |
|
139 | + $payment->set_status( $this->_pay_model->failed_status() ); |
|
140 | + } |
|
141 | 141 | return $payment; |
142 | 142 | } |
143 | 143 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | 'quantity'=>$line_item->quantity() |
49 | 49 | ); |
50 | 50 | } |
51 | - }else{//its a partial payment |
|
51 | + } else{//its a partial payment |
|
52 | 52 | $tax_total = 0; |
53 | 53 | //partial payment, so just add 1 item |
54 | 54 | $items[] = array( |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | foreach($response_body_as_array as $problem_parameter => $problems){ |
114 | 114 | $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
115 | 115 | } |
116 | - }else{ |
|
116 | + } else{ |
|
117 | 117 | $problems_string = $response['body']; |
118 | 118 | } |
119 | 119 | if( ! $problems_string ) { |
120 | 120 | //no message to show? wack |
121 | 121 | if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
122 | 122 | $problems_string = $response[ 'headers' ][ 'status' ]; |
123 | - }else{ |
|
123 | + } else{ |
|
124 | 124 | $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | - }else{ |
|
128 | + } else{ |
|
129 | 129 | $problems_string = implode( ",", $response->get_error_messages() ); |
130 | 130 | } |
131 | 131 | |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum ); |
157 | 157 | } |
158 | 158 | return $prepared_data; |
159 | - }elseif(is_string( $data ) ){ |
|
159 | + } elseif(is_string( $data ) ){ |
|
160 | 160 | return str_replace( '%', 'percent', $data ); |
161 | - }else{ |
|
161 | + } else{ |
|
162 | 162 | return $data; |
163 | 163 | } |
164 | 164 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Mike Nelson |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEG_Mijireh extends EE_Offsite_Gateway{ |
|
11 | +class EEG_Mijireh extends EE_Offsite_Gateway { |
|
12 | 12 | |
13 | 13 | protected $_access_key; |
14 | 14 | |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | $primary_attendee = $primary_registrant->attendee(); |
38 | 38 | $items = array(); |
39 | 39 | //if we're are charging for the full amount, show the normal line items |
40 | - if( $this->_can_easily_itemize_transaction_for( $payment )){ |
|
40 | + if ($this->_can_easily_itemize_transaction_for($payment)) { |
|
41 | 41 | $total_line_item = $transaction->total_line_item(); |
42 | 42 | $tax_total = $total_line_item->get_total_tax(); |
43 | - foreach($total_line_item->get_items() as $line_item){ |
|
43 | + foreach ($total_line_item->get_items() as $line_item) { |
|
44 | 44 | $items[] = array( |
45 | 45 | 'name'=>apply_filters( |
46 | 46 | 'FHEE__EEG_Mijireh__set_redirection_info__full_amount_line_item_name', |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'quantity'=>$line_item->quantity() |
55 | 55 | ); |
56 | 56 | } |
57 | - }else{//its a partial payment |
|
57 | + } else {//its a partial payment |
|
58 | 58 | $tax_total = 0; |
59 | 59 | //partial payment, so just add 1 item |
60 | 60 | $items[] = array( |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'FHEE__EEG_Mijireh__set_redirection_info__partial_amount_line_item_name', |
63 | 63 | sprintf( |
64 | 64 | __("Payment of %s for %s", 'event_espresso'), |
65 | - $payment->get_pretty( 'PAY_amount', 'no_currency_code' ), |
|
65 | + $payment->get_pretty('PAY_amount', 'no_currency_code'), |
|
66 | 66 | $primary_registrant->event_name() |
67 | 67 | ), |
68 | 68 | $payment, |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | $order = array( |
77 | 77 | 'total'=>$this->format_currency($payment->amount()), |
78 | 78 | 'return_url'=>$return_url, |
79 | - 'items'=>$this->_prepare_for_mijireh( $items ), |
|
79 | + 'items'=>$this->_prepare_for_mijireh($items), |
|
80 | 80 | 'email'=>$primary_attendee->email(), |
81 | 81 | 'first_name'=>$primary_attendee->fname(), |
82 | 82 | 'last_name'=>$primary_attendee->lname(), |
83 | 83 | 'tax'=>$this->format_currency($tax_total), |
84 | 84 | 'partner_id'=>'ee'); |
85 | 85 | //setup address? |
86 | - if( $primary_attendee->address() && |
|
87 | - $primary_attendee->city() && |
|
88 | - $primary_attendee->state_ID() && |
|
89 | - $primary_attendee->country_ID() && |
|
90 | - $primary_attendee->zip() ){ |
|
86 | + if ($primary_attendee->address() && |
|
87 | + $primary_attendee->city() && |
|
88 | + $primary_attendee->state_ID() && |
|
89 | + $primary_attendee->country_ID() && |
|
90 | + $primary_attendee->zip()) { |
|
91 | 91 | $shipping_address = array( |
92 | 92 | 'first_name'=>$primary_attendee->fname(), |
93 | 93 | 'last_name'=>$primary_attendee->lname(), |
@@ -97,62 +97,62 @@ discard block |
||
97 | 97 | 'zip_code' => $primary_attendee->zip(), |
98 | 98 | 'country' => $primary_attendee->country_ID() |
99 | 99 | ); |
100 | - if( $primary_attendee->address2() ){ |
|
101 | - $shipping_address[ 'apt_suite' ] = $primary_attendee->address2(); |
|
100 | + if ($primary_attendee->address2()) { |
|
101 | + $shipping_address['apt_suite'] = $primary_attendee->address2(); |
|
102 | 102 | } |
103 | - if( $primary_attendee->phone() ){ |
|
104 | - $shipping_address[ 'phone' ] = $primary_attendee->phone(); |
|
103 | + if ($primary_attendee->phone()) { |
|
104 | + $shipping_address['phone'] = $primary_attendee->phone(); |
|
105 | 105 | } |
106 | - $order[ 'shipping_address' ] = $shipping_address; |
|
106 | + $order['shipping_address'] = $shipping_address; |
|
107 | 107 | } |
108 | - $order = apply_filters( 'FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant ); |
|
109 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)) ); |
|
108 | + $order = apply_filters('FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant); |
|
109 | + do_action('AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this))); |
|
110 | 110 | $args = array( |
111 | 111 | 'headers' => array( |
112 | - 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
112 | + 'Authorization' => 'Basic '.base64_encode($this->_access_key.':'), |
|
113 | 113 | 'Accept'=>'application/json' |
114 | 114 | ), |
115 | 115 | 'body'=> json_encode($order) |
116 | 116 | ); |
117 | - $response = wp_remote_post( $this->_mijireh_api_orders_url, $args ); |
|
117 | + $response = wp_remote_post($this->_mijireh_api_orders_url, $args); |
|
118 | 118 | $problems_string = false; |
119 | - $this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment); |
|
120 | - if( ! $response instanceof WP_Error ){ |
|
119 | + $this->log(array('get checkout url request_args' => $args, 'response' => $response), $payment); |
|
120 | + if ( ! $response instanceof WP_Error) { |
|
121 | 121 | $response_body = json_decode($response['body']); |
122 | - if($response_body && isset($response_body->checkout_url)){ |
|
122 | + if ($response_body && isset($response_body->checkout_url)) { |
|
123 | 123 | $payment->set_redirect_url($response_body->checkout_url); |
124 | 124 | $payment->set_txn_id_chq_nmbr($response_body->order_number); |
125 | 125 | $payment->set_details($response['body']); |
126 | 126 | } else { |
127 | - if( is_array( $response_body ) || is_object( $response_body)){ |
|
128 | - $response_body_as_array = (array)$response_body; |
|
129 | - foreach($response_body_as_array as $problem_parameter => $problems){ |
|
130 | - $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems)); |
|
127 | + if (is_array($response_body) || is_object($response_body)) { |
|
128 | + $response_body_as_array = (array) $response_body; |
|
129 | + foreach ($response_body_as_array as $problem_parameter => $problems) { |
|
130 | + $problems_string .= sprintf(__('\nProblems with %s: %s', 'event_espresso'), $problem_parameter, implode(", ", $problems)); |
|
131 | 131 | } |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $problems_string = $response['body']; |
134 | 134 | } |
135 | - if( ! $problems_string ) { |
|
135 | + if ( ! $problems_string) { |
|
136 | 136 | //no message to show? wack |
137 | - if( isset( $response[ 'headers' ][ 'status' ] ) ){ |
|
138 | - $problems_string = $response[ 'headers' ][ 'status' ]; |
|
139 | - }else{ |
|
140 | - $problems_string = __( 'No response from Mijireh', 'event_espresso' ); |
|
137 | + if (isset($response['headers']['status'])) { |
|
138 | + $problems_string = $response['headers']['status']; |
|
139 | + } else { |
|
140 | + $problems_string = __('No response from Mijireh', 'event_espresso'); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
144 | - }else{ |
|
145 | - $problems_string = implode( ",", $response->get_error_messages() ); |
|
144 | + } else { |
|
145 | + $problems_string = implode(",", $response->get_error_messages()); |
|
146 | 146 | } |
147 | 147 | |
148 | - if( $problems_string ) { |
|
149 | - $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) ); |
|
150 | - $payment->set_details( $response ); |
|
151 | - $payment->set_redirect_url( null ); |
|
148 | + if ($problems_string) { |
|
149 | + $payment->set_gateway_response(sprintf(__('Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string)); |
|
150 | + $payment->set_details($response); |
|
151 | + $payment->set_redirect_url(null); |
|
152 | 152 | //even though the payment's status is failed at this point anyways, |
153 | 153 | //let's be explicit about it. The fact that the redirect url is null |
154 | 154 | //should be enough to client code that they can't redirect the user |
155 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
155 | + $payment->set_status($this->_pay_model->failed_status()); |
|
156 | 156 | } |
157 | 157 | return $payment; |
158 | 158 | } |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | * @param mixed $data |
166 | 166 | * @return mixed same type as $data |
167 | 167 | */ |
168 | - private function _prepare_for_mijireh( $data ){ |
|
169 | - if( is_array( $data ) ){ |
|
168 | + private function _prepare_for_mijireh($data) { |
|
169 | + if (is_array($data)) { |
|
170 | 170 | $prepared_data = array(); |
171 | - foreach($data as $key => $datum ){ |
|
172 | - $prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum ); |
|
171 | + foreach ($data as $key => $datum) { |
|
172 | + $prepared_data[$key] = $this->_prepare_for_mijireh($datum); |
|
173 | 173 | } |
174 | 174 | return $prepared_data; |
175 | - }elseif(is_string( $data ) ){ |
|
176 | - return str_replace( '%', 'percent', $data ); |
|
177 | - }else{ |
|
175 | + }elseif (is_string($data)) { |
|
176 | + return str_replace('%', 'percent', $data); |
|
177 | + } else { |
|
178 | 178 | return $data; |
179 | 179 | } |
180 | 180 | } |
@@ -195,30 +195,30 @@ discard block |
||
195 | 195 | |
196 | 196 | $payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL; |
197 | 197 | |
198 | - if ( ! $payment instanceof EEI_Payment ){ |
|
199 | - throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) ); |
|
198 | + if ( ! $payment instanceof EEI_Payment) { |
|
199 | + throw new EE_Error(sprintf(__("Could not find Mijireh payment for transaction %s", 'event_espresso'), $transaction->ID())); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | $request_args = array( |
203 | 203 | 'headers' => array( |
204 | - 'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ), |
|
204 | + 'Authorization' => 'Basic '.base64_encode($this->_access_key.':'), |
|
205 | 205 | 'Accept'=>'application/json' |
206 | 206 | ) |
207 | 207 | ); |
208 | 208 | |
209 | 209 | $response = wp_remote_get( |
210 | - $this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(), |
|
210 | + $this->_mijireh_api_orders_url.'/'.$payment->txn_id_chq_nmbr(), |
|
211 | 211 | $request_args |
212 | 212 | ); |
213 | 213 | |
214 | 214 | $this->log( |
215 | - array( 'get payment status request_args' => $request_args, 'response' => $response ), |
|
215 | + array('get payment status request_args' => $request_args, 'response' => $response), |
|
216 | 216 | $payment |
217 | 217 | ); |
218 | 218 | // validate response |
219 | - $response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : ''; |
|
220 | - if( $response && $response_body ){ |
|
221 | - switch( $response_body->status ){ |
|
219 | + $response_body = isset($response['body']) ? json_decode($response['body']) : ''; |
|
220 | + if ($response && $response_body) { |
|
221 | + switch ($response_body->status) { |
|
222 | 222 | case 'paid': |
223 | 223 | $payment->set_status($this->_pay_model->approved_status()); |
224 | 224 | break; |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | } else { |
233 | - $payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) ); |
|
234 | - $payment->set_details( $response ); |
|
235 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
233 | + $payment->set_gateway_response(__('Response from Mijireh could not be understood.', 'event_espresso')); |
|
234 | + $payment->set_details($response); |
|
235 | + $payment->set_status($this->_pay_model->failed_status()); |
|
236 | 236 | } |
237 | 237 | // the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage |
238 | 238 | // $payment->set_status( $this->_pay_model->pending_status() ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * Loads the class file for a given class name. |
112 | 112 | * |
113 | 113 | * @param string $class The fully-qualified class name. |
114 | - * @return mixed The mapped file name on success, or boolean false on |
|
114 | + * @return string|false The mapped file name on success, or boolean false on |
|
115 | 115 | * failure. |
116 | 116 | */ |
117 | 117 | public function loadClass( $class ) { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param string $prefix The namespace prefix. |
146 | 146 | * @param string $relative_class The relative class name. |
147 | - * @return mixed Boolean false if no mapped file can be loaded, or the |
|
147 | + * @return false|string Boolean false if no mapped file can be loaded, or the |
|
148 | 148 | * name of the mapped file that was loaded. |
149 | 149 | */ |
150 | 150 | protected function loadMappedFile( $prefix, $relative_class ) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | public function register() { |
75 | - spl_autoload_register( array( $this, 'loadClass' ) ); |
|
75 | + spl_autoload_register(array($this, 'loadClass')); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -88,20 +88,20 @@ discard block |
||
88 | 88 | * than last. |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function addNamespace( $prefix, $base_dir, $prepend = false ) { |
|
91 | + public function addNamespace($prefix, $base_dir, $prepend = false) { |
|
92 | 92 | // normalize namespace prefix |
93 | - $prefix = trim( $prefix, '\\' ) . '\\'; |
|
93 | + $prefix = trim($prefix, '\\').'\\'; |
|
94 | 94 | // normalize the base directory with a trailing separator |
95 | - $base_dir = rtrim( $base_dir, DIRECTORY_SEPARATOR ) . '/'; |
|
95 | + $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/'; |
|
96 | 96 | // initialize the namespace prefix array |
97 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
98 | - $this->prefixes[ $prefix ] = array(); |
|
97 | + if (isset($this->prefixes[$prefix]) === false) { |
|
98 | + $this->prefixes[$prefix] = array(); |
|
99 | 99 | } |
100 | 100 | // retain the base directory for the namespace prefix |
101 | - if ( $prepend ) { |
|
102 | - array_unshift( $this->prefixes[ $prefix ], $base_dir ); |
|
101 | + if ($prepend) { |
|
102 | + array_unshift($this->prefixes[$prefix], $base_dir); |
|
103 | 103 | } else { |
104 | - array_push( $this->prefixes[ $prefix ], $base_dir ); |
|
104 | + array_push($this->prefixes[$prefix], $base_dir); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
@@ -114,24 +114,24 @@ discard block |
||
114 | 114 | * @return mixed The mapped file name on success, or boolean false on |
115 | 115 | * failure. |
116 | 116 | */ |
117 | - public function loadClass( $class ) { |
|
117 | + public function loadClass($class) { |
|
118 | 118 | // the current namespace prefix |
119 | 119 | $prefix = $class; |
120 | 120 | // work backwards through the namespace names of the fully-qualified |
121 | 121 | // class name to find a mapped file name |
122 | - while ( false !== $pos = strrpos( $prefix, '\\' ) ) { |
|
122 | + while (false !== $pos = strrpos($prefix, '\\')) { |
|
123 | 123 | // retain the trailing namespace separator in the prefix |
124 | - $prefix = substr( $class, 0, $pos + 1 ); |
|
124 | + $prefix = substr($class, 0, $pos + 1); |
|
125 | 125 | // the rest is the relative class name |
126 | - $relative_class = substr( $class, $pos + 1 ); |
|
126 | + $relative_class = substr($class, $pos + 1); |
|
127 | 127 | // try to load a mapped file for the prefix and relative class |
128 | - $mapped_file = $this->loadMappedFile( $prefix, $relative_class ); |
|
129 | - if ( $mapped_file ) { |
|
128 | + $mapped_file = $this->loadMappedFile($prefix, $relative_class); |
|
129 | + if ($mapped_file) { |
|
130 | 130 | return $mapped_file; |
131 | 131 | } |
132 | 132 | // remove the trailing namespace separator for the next iteration |
133 | 133 | // of strrpos() |
134 | - $prefix = rtrim( $prefix, '\\' ); |
|
134 | + $prefix = rtrim($prefix, '\\'); |
|
135 | 135 | } |
136 | 136 | // never found a mapped file |
137 | 137 | return false; |
@@ -147,21 +147,21 @@ discard block |
||
147 | 147 | * @return mixed Boolean false if no mapped file can be loaded, or the |
148 | 148 | * name of the mapped file that was loaded. |
149 | 149 | */ |
150 | - protected function loadMappedFile( $prefix, $relative_class ) { |
|
150 | + protected function loadMappedFile($prefix, $relative_class) { |
|
151 | 151 | // are there any base directories for this namespace prefix? |
152 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
152 | + if (isset($this->prefixes[$prefix]) === false) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | // look through base directories for this namespace prefix |
156 | - foreach ( $this->prefixes[ $prefix ] as $base_dir ) { |
|
156 | + foreach ($this->prefixes[$prefix] as $base_dir) { |
|
157 | 157 | // replace the namespace prefix with the base directory, |
158 | 158 | // replace namespace separators with directory separators |
159 | 159 | // in the relative class name, append with .php |
160 | 160 | $file = $base_dir |
161 | - . str_replace( '\\', '/', $relative_class ) |
|
161 | + . str_replace('\\', '/', $relative_class) |
|
162 | 162 | . '.php'; |
163 | 163 | // if the mapped file exists, require it |
164 | - if ( $this->requireFile( $file ) ) { |
|
164 | + if ($this->requireFile($file)) { |
|
165 | 165 | // yes, we're done |
166 | 166 | return $file; |
167 | 167 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $file The file to require. |
179 | 179 | * @return bool True if the file exists, false if not. |
180 | 180 | */ |
181 | - protected function requireFile( $file ) { |
|
182 | - if ( file_exists( $file ) ) { |
|
181 | + protected function requireFile($file) { |
|
182 | + if (file_exists($file)) { |
|
183 | 183 | require $file; |
184 | 184 | return true; |
185 | 185 | } |
@@ -3,5 +3,5 @@ |
||
3 | 3 | <?php _e('A venue is the place or location that is hosting your event. This setting is optional which means that you are not required to select a venue for your event.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'),'<a href="admin.php?page=espresso_venues">','</a>'); ?> |
|
6 | +<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'), '<a href="admin.php?page=espresso_venues">', '</a>'); ?> |
|
7 | 7 | </p> |
8 | 8 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php do_action( 'AHEE__event_tickets_metabox_main__before_content' ); ?> |
|
1 | +<?php do_action('AHEE__event_tickets_metabox_main__before_content'); ?> |
|
2 | 2 | <div id="event-and-ticket-form-content"> |
3 | 3 | <h4 class="event-tickets-datetimes-title"><?php _e('Event Datetime', 'event_espresso'); ?></h4><?php echo $event_datetime_help_link; ?> |
4 | 4 | <div class="event-datetimes-container"> |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | </td> |
30 | 30 | <td class="event-datetime-column reg-limit-column"> |
31 | 31 | <?php |
32 | - $reg_limit = $time->get_pretty('DTT_reg_limit','input'); |
|
32 | + $reg_limit = $time->get_pretty('DTT_reg_limit', 'input'); |
|
33 | 33 | ?> |
34 | 34 | <input type="text" name="edit_event_datetimes[1][DTT_reg_limit]" id="event-datetime-DTT_reg_limit-1" class="ee-small-text-inp ee-inp-right event-datetime-DTT_reg_limit" value="<?php echo $reg_limit; ?>"> |
35 | 35 | </td> |
36 | - <td class="datetime-tickets-sold"><?php printf( __('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold') ); ?></td> |
|
36 | + <td class="datetime-tickets-sold"><?php printf(__('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold')); ?></td> |
|
37 | 37 | </tr> |
38 | 38 | </tbody> |
39 | 39 | </table> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <div style="clear:both"></div> |
72 | 72 | </div> <!-- end #event-and-ticket-form-content --> |
73 | 73 | |
74 | -<?php do_action( 'AHEE__event_tickets_metabox_main__after_content' ); ?> |
|
74 | +<?php do_action('AHEE__event_tickets_metabox_main__after_content'); ?> |
|
75 | 75 | |
76 | 76 | <table id="new-ticket-row-form" class="hidden"> |
77 | 77 | <tbody><?php echo $ticket_js_structure; ?></tbody> |