@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | class Extend_Events_Admin_Page extends Events_Admin_Page { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $routing = TRUE ) { |
|
34 | - parent::__construct( $routing ); |
|
35 | - define( 'EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'events/templates/'); |
|
36 | - define( 'EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'events/assets/'); |
|
37 | - define( 'EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'events/assets/'); |
|
33 | + public function __construct($routing = TRUE) { |
|
34 | + parent::__construct($routing); |
|
35 | + define('EVENTS_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'events/templates/'); |
|
36 | + define('EVENTS_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'events/assets/'); |
|
37 | + define('EVENTS_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'events/assets/'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _extend_page_config() { |
42 | 42 | |
43 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'events'; |
|
43 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'events'; |
|
44 | 44 | $default_espresso_boxes = $this->_default_espresso_metaboxes; |
45 | 45 | |
46 | 46 | //is there a evt_id in the request? |
47 | - $evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | - $evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id; |
|
47 | + $evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0; |
|
48 | + $evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id; |
|
49 | 49 | |
50 | 50 | //tkt_id? |
51 | - $tkt_id = !empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
51 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
52 | 52 | |
53 | 53 | $new_page_routes = array( |
54 | 54 | 'duplicate_event' => array( |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'capability' => 'ee_delete_default_ticket', |
67 | 67 | 'obj_id' => $tkt_id, |
68 | 68 | 'noheader' => TRUE, |
69 | - 'args' => array( 'trash' => TRUE ) |
|
69 | + 'args' => array('trash' => TRUE) |
|
70 | 70 | ), |
71 | 71 | 'trash_tickets' => array( |
72 | 72 | 'func' => '_trash_or_restore_ticket', |
73 | 73 | 'capability' => 'ee_delete_default_tickets', |
74 | 74 | 'noheader' => TRUE, |
75 | - 'args' => array( 'trash' => TRUE ) |
|
75 | + 'args' => array('trash' => TRUE) |
|
76 | 76 | ), |
77 | 77 | 'restore_ticket' => array( |
78 | 78 | 'func' => '_trash_or_restore_ticket', |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | ); |
134 | 134 | |
135 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
135 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //partial route/config override |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | $this->_page_config['default']['list_table'] = 'Extend_Events_Admin_List_Table'; |
145 | 145 | |
146 | 146 | //add tickets tab but only if there are more than one default ticket! |
147 | - $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array( array('TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ); |
|
148 | - if ( $tkt_count > 1 ) { |
|
147 | + $tkt_count = EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE); |
|
148 | + if ($tkt_count > 1) { |
|
149 | 149 | $new_page_config = array( |
150 | 150 | 'ticket_list_table' => array( |
151 | 151 | 'nav' => array( |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | 'label' => esc_html__('Templates', 'event_espresso'), |
165 | 165 | 'order' => 30 |
166 | 166 | ), |
167 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
167 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
168 | 168 | 'help_tabs' => array( |
169 | 169 | 'general_settings_templates_help_tab' => array( |
170 | 170 | 'title' => __('Templates', 'event_espresso'), |
171 | 171 | 'filename' => 'general_settings_templates' |
172 | 172 | ) |
173 | 173 | ), |
174 | - 'help_tour' => array( 'Templates_Help_Tour' ), |
|
174 | + 'help_tour' => array('Templates_Help_Tour'), |
|
175 | 175 | 'require_nonce' => FALSE |
176 | 176 | ); |
177 | 177 | |
@@ -190,26 +190,26 @@ discard block |
||
190 | 190 | // 'metaboxes' => $default_espresso_boxes, |
191 | 191 | // 'require_nonce' => FALSE |
192 | 192 | // ); |
193 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
193 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
194 | 194 | |
195 | 195 | //add filters and actions |
196 | 196 | //modifying _views |
197 | - add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array( $this, 'add_additional_datetime_button' ), 10, 2 ); |
|
198 | - add_filter('FHEE_event_datetime_metabox_clone_button_template', array( $this, 'add_datetime_clone_button' ), 10, 2 ); |
|
199 | - add_filter('FHEE_event_datetime_metabox_timezones_template', array( $this, 'datetime_timezones_template'), 10, 2 ); |
|
197 | + add_filter('FHEE_event_datetime_metabox_add_additional_date_time_template', array($this, 'add_additional_datetime_button'), 10, 2); |
|
198 | + add_filter('FHEE_event_datetime_metabox_clone_button_template', array($this, 'add_datetime_clone_button'), 10, 2); |
|
199 | + add_filter('FHEE_event_datetime_metabox_timezones_template', array($this, 'datetime_timezones_template'), 10, 2); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | //filters for event list table |
203 | - add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array( $this, 'list_table_filters'), 10, 2); |
|
204 | - add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array( $this, 'extra_list_table_actions'), 10, 2 ); |
|
203 | + add_filter('FHEE__Extend_Events_Admin_List_Table__filters', array($this, 'list_table_filters'), 10, 2); |
|
204 | + add_filter('FHEE__Events_Admin_List_Table__column_actions__action_links', array($this, 'extra_list_table_actions'), 10, 2); |
|
205 | 205 | |
206 | 206 | //legend item |
207 | - add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array( $this, 'additional_legend_items') ); |
|
207 | + add_filter('FHEE__Events_Admin_Page___event_legend_items__items', array($this, 'additional_legend_items')); |
|
208 | 208 | |
209 | - add_action('admin_init', array( $this, 'admin_init') ); |
|
209 | + add_action('admin_init', array($this, 'admin_init')); |
|
210 | 210 | |
211 | 211 | //heartbeat stuff |
212 | - add_filter( 'heartbeat_received', array( $this, 'heartbeat_response' ), 10, 2 ); |
|
212 | + add_filter('heartbeat_received', array($this, 'heartbeat_response'), 10, 2); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | EE_Registry::$i18n_js_strings = array_merge( |
223 | 223 | EE_Registry::$i18n_js_strings, |
224 | 224 | array( |
225 | - 'image_confirm' => __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' ), |
|
226 | - 'event_starts_on' => __( 'Event Starts on', 'event_espresso' ), |
|
227 | - 'event_ends_on' => __( 'Event Ends on', 'event_espresso' ), |
|
228 | - 'event_datetime_actions' => __( 'Actions', 'event_espresso' ), |
|
229 | - 'event_clone_dt_msg' => __( 'Clone this Event Date and Time', 'event_espresso' ), |
|
230 | - 'remove_event_dt_msg' => __( 'Remove this Event Time', 'event_espresso' ) |
|
225 | + 'image_confirm' => __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso'), |
|
226 | + 'event_starts_on' => __('Event Starts on', 'event_espresso'), |
|
227 | + 'event_ends_on' => __('Event Ends on', 'event_espresso'), |
|
228 | + 'event_datetime_actions' => __('Actions', 'event_espresso'), |
|
229 | + 'event_clone_dt_msg' => __('Clone this Event Date and Time', 'event_espresso'), |
|
230 | + 'remove_event_dt_msg' => __('Remove this Event Time', 'event_espresso') |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return array possibly appended response. |
244 | 244 | */ |
245 | - public function heartbeat_response( $response, $data ) { |
|
245 | + public function heartbeat_response($response, $data) { |
|
246 | 246 | /** |
247 | 247 | * check whether count of tickets is approaching the potential |
248 | 248 | * limits for the server. |
249 | 249 | */ |
250 | - if ( ! empty( $data['input_count'] ) ) { |
|
250 | + if ( ! empty($data['input_count'])) { |
|
251 | 251 | $response['max_input_vars_check'] = EE_Registry::instance()->CFG->environment->max_input_vars_limit_check($data['input_count']); |
252 | 252 | } |
253 | 253 | |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | |
263 | 263 | |
264 | 264 | |
265 | - public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) { |
|
266 | - $return = parent::extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ); |
|
265 | + public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) { |
|
266 | + $return = parent::extra_permalink_field_buttons($return, $id, $new_title, $new_slug); |
|
267 | 267 | //make sure this is only when editing |
268 | - if ( !empty( $id ) ) { |
|
269 | - $href = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url ); |
|
268 | + if ( ! empty($id)) { |
|
269 | + $href = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_event', 'EVT_ID' => $id), $this->_admin_base_url); |
|
270 | 270 | $title = esc_attr__('Duplicate Event', 'event_espresso'); |
271 | - $return .= '<a href="' . $href . '" title="' . $title . '" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">' . $title . '</button>'; |
|
271 | + $return .= '<a href="'.$href.'" title="'.$title.'" id="ee-duplicate-event-button" class="button button-small" value="duplicate_event">'.$title.'</button>'; |
|
272 | 272 | } |
273 | 273 | return $return; |
274 | 274 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | 'label' => __('Trash', 'event_espresso'), |
292 | 292 | 'count' => 0, |
293 | 293 | 'bulk_action' => array( |
294 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
294 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
295 | 295 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
296 | 296 | ) |
297 | 297 | ) |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | |
303 | 303 | public function load_scripts_styles_edit() { |
304 | - wp_register_script( 'ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL . 'event-editor-heartbeat.js', array( 'ee_admin_js', 'heartbeat' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
304 | + wp_register_script('ee-event-editor-heartbeat', EVENTS_CAF_ASSETS_URL.'event-editor-heartbeat.js', array('ee_admin_js', 'heartbeat'), EVENT_ESPRESSO_VERSION, TRUE); |
|
305 | 305 | |
306 | 306 | /** |
307 | 307 | * load accounting js. |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - public function add_additional_datetime_button( $template, $template_args ) { |
|
324 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
323 | + public function add_additional_datetime_button($template, $template_args) { |
|
324 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_add_additional_time.template.php', $template_args, TRUE); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | - public function add_datetime_clone_button( $template, $template_args ) { |
|
330 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_metabox_clone_button.template.php', $template_args, TRUE ); |
|
329 | + public function add_datetime_clone_button($template, $template_args) { |
|
330 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_metabox_clone_button.template.php', $template_args, TRUE); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
334 | 334 | |
335 | - public function datetime_timezones_template( $template, $template_args ) { |
|
336 | - return EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'event_datetime_timezones.template.php', $template_args, TRUE ); |
|
335 | + public function datetime_timezones_template($template, $template_args) { |
|
336 | + return EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'event_datetime_timezones.template.php', $template_args, TRUE); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | protected function _set_list_table_views_default() { |
343 | 343 | parent::_set_list_table_views_default(); |
344 | 344 | $export_label = __('Export Events', 'event_espresso'); |
345 | - if ( EE_Registry::instance()->CAP->current_user_can( 'export', 'espresso_events_export' ) ) { |
|
345 | + if (EE_Registry::instance()->CAP->current_user_can('export', 'espresso_events_export')) { |
|
346 | 346 | // $this->_views['all']['bulk_action']['export_events'] = $export_label; |
347 | 347 | // $this->_views['draft']['bulk_action']['export_events'] = $export_label; |
348 | 348 | |
349 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
349 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
350 | 350 | // $this->_views['trash']['bulk_action']['export_events'] = $export_label; |
351 | 351 | } |
352 | 352 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | ) |
373 | 373 | ); |
374 | 374 | |
375 | - $this->_views = array_merge( $this->_views, $new_views); |
|
375 | + $this->_views = array_merge($this->_views, $new_views); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,17 +386,17 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | |
389 | - public function extra_list_table_actions( $actionlinks, $event ) { |
|
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports', $event->ID() ) ) { |
|
389 | + public function extra_list_table_actions($actionlinks, $event) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports', $event->ID())) { |
|
391 | 391 | $reports_query_args = array( |
392 | 392 | 'action' => 'reports', |
393 | 393 | 'EVT_ID' => $event->ID() |
394 | 394 | ); |
395 | - $reports_link = EE_Admin_Page::add_query_args_and_nonce( $reports_query_args, REG_ADMIN_URL ); |
|
396 | - $actionlinks[] = '<a href="' . $reports_link . '" title="' . esc_attr__('View Report', 'event_espresso') . '"><div class="dashicons dashicons-chart-bar"></div></a>' . "\n\t"; |
|
395 | + $reports_link = EE_Admin_Page::add_query_args_and_nonce($reports_query_args, REG_ADMIN_URL); |
|
396 | + $actionlinks[] = '<a href="'.$reports_link.'" title="'.esc_attr__('View Report', 'event_espresso').'"><div class="dashicons dashicons-chart-bar"></div></a>'."\n\t"; |
|
397 | 397 | } |
398 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
399 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
398 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
399 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
400 | 400 | $actionlinks[] = EEH_MSG_Template::get_message_action_link( |
401 | 401 | 'see_notifications_for', |
402 | 402 | null, |
@@ -411,15 +411,15 @@ discard block |
||
411 | 411 | |
412 | 412 | |
413 | 413 | public function additional_legend_items($items) { |
414 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_reports' ) ) { |
|
414 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_reports')) { |
|
415 | 415 | $items['reports'] = array( |
416 | 416 | 'class' => 'dashicons dashicons-chart-bar', |
417 | 417 | 'desc' => __('Event Reports', 'event_espresso') |
418 | 418 | ); |
419 | 419 | } |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
421 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
422 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
421 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
422 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
423 | 423 | $items['view_related_messages'] = array( |
424 | 424 | 'class' => $related_for_icon['css_class'], |
425 | 425 | 'desc' => $related_for_icon['label'], |
@@ -444,17 +444,17 @@ discard block |
||
444 | 444 | */ |
445 | 445 | protected function _duplicate_event() { |
446 | 446 | //first make sure the ID for the event is in the request. If it isnt' then we need to bail and redirect back to overview list table (cause how did we get here?) |
447 | - if ( !isset( $this->_req_data['EVT_ID'] ) ) { |
|
448 | - EE_Error::add_error( __('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
449 | - $this->_redirect_after_action( FALSE, '', '', array(), TRUE ); |
|
447 | + if ( ! isset($this->_req_data['EVT_ID'])) { |
|
448 | + EE_Error::add_error(__('In order to duplicate an event an Event ID is required. None was given.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
449 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
450 | 450 | return; |
451 | 451 | } |
452 | 452 | |
453 | 453 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
454 | - $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
|
454 | + $orig_event = EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']); |
|
455 | 455 | |
456 | - if ( ! $orig_event instanceof EE_Event ) |
|
457 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
456 | + if ( ! $orig_event instanceof EE_Event) |
|
457 | + throw new EE_Error(sprintf(__('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'])); |
|
458 | 458 | |
459 | 459 | //k now let's clone the $orig_event before getting relations |
460 | 460 | $new_event = clone $orig_event; |
@@ -467,43 +467,43 @@ discard block |
||
467 | 467 | |
468 | 468 | |
469 | 469 | //reset the ID and modify other details to make it clear this is a dupe |
470 | - $new_event->set( 'EVT_ID', 0 ); |
|
471 | - $new_name = $new_event->name() . ' ' . __('**DUPLICATE**', 'event_espresso'); |
|
472 | - $new_event->set( 'EVT_name', $new_name ); |
|
473 | - $new_event->set( 'EVT_slug', wp_unique_post_slug( sanitize_title( $orig_event->name() ), 0, 'publish', 'espresso_events', 0 ) ); |
|
474 | - $new_event->set( 'status', 'draft' ); |
|
470 | + $new_event->set('EVT_ID', 0); |
|
471 | + $new_name = $new_event->name().' '.__('**DUPLICATE**', 'event_espresso'); |
|
472 | + $new_event->set('EVT_name', $new_name); |
|
473 | + $new_event->set('EVT_slug', wp_unique_post_slug(sanitize_title($orig_event->name()), 0, 'publish', 'espresso_events', 0)); |
|
474 | + $new_event->set('status', 'draft'); |
|
475 | 475 | |
476 | 476 | //duplicate discussion settings |
477 | - $new_event->set( 'comment_status', $orig_event->get('comment_status') ); |
|
478 | - $new_event->set( 'ping_status', $orig_event->get( 'ping_status' ) ); |
|
477 | + $new_event->set('comment_status', $orig_event->get('comment_status')); |
|
478 | + $new_event->set('ping_status', $orig_event->get('ping_status')); |
|
479 | 479 | |
480 | 480 | //save the new event |
481 | 481 | $new_event->save(); |
482 | 482 | |
483 | 483 | //venues |
484 | - foreach( $orig_ven as $ven ) { |
|
485 | - $new_event->_add_relation_to( $ven, 'Venue' ); |
|
484 | + foreach ($orig_ven as $ven) { |
|
485 | + $new_event->_add_relation_to($ven, 'Venue'); |
|
486 | 486 | } |
487 | 487 | $new_event->save(); |
488 | 488 | |
489 | 489 | |
490 | 490 | //now we need to get the question group relations and handle that |
491 | 491 | //first primary question groups |
492 | - $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 1 ) ) ); |
|
493 | - if ( !empty( $orig_primary_qgs ) ) { |
|
494 | - foreach ( $orig_primary_qgs as $id => $obj ) { |
|
495 | - if ( $obj instanceof EE_Question_Group ) { |
|
496 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 1 ) ); |
|
492 | + $orig_primary_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))); |
|
493 | + if ( ! empty($orig_primary_qgs)) { |
|
494 | + foreach ($orig_primary_qgs as $id => $obj) { |
|
495 | + if ($obj instanceof EE_Question_Group) { |
|
496 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 1)); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
500 | 500 | |
501 | 501 | //next additional attendee question groups |
502 | - $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array( array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
503 | - if ( !empty( $orig_additional_qgs ) ) { |
|
504 | - foreach ( $orig_additional_qgs as $id => $obj ) { |
|
505 | - if ( $obj instanceof EE_Question_Group ) { |
|
506 | - $new_event->_add_relation_to( $obj, 'Question_Group', array( 'EQG_primary' => 0 ) ); |
|
502 | + $orig_additional_qgs = $orig_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
503 | + if ( ! empty($orig_additional_qgs)) { |
|
504 | + foreach ($orig_additional_qgs as $id => $obj) { |
|
505 | + if ($obj instanceof EE_Question_Group) { |
|
506 | + $new_event->_add_relation_to($obj, 'Question_Group', array('EQG_primary' => 0)); |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | |
515 | 515 | //k now that we have the new event saved we can loop through the datetimes and start adding relations. |
516 | 516 | $cloned_tickets = array(); |
517 | - foreach ( $orig_datetimes as $orig_dtt ) { |
|
517 | + foreach ($orig_datetimes as $orig_dtt) { |
|
518 | 518 | $new_dtt = clone $orig_dtt; |
519 | 519 | $orig_tkts = $orig_dtt->tickets(); |
520 | 520 | |
@@ -522,22 +522,22 @@ discard block |
||
522 | 522 | $new_dtt->set('DTT_ID', 0); |
523 | 523 | $new_dtt->set('DTT_sold', 0); |
524 | 524 | $new_dtt->save(); |
525 | - $new_event->_add_relation_to( $new_dtt, 'Datetime'); |
|
525 | + $new_event->_add_relation_to($new_dtt, 'Datetime'); |
|
526 | 526 | $new_event->save(); |
527 | 527 | |
528 | 528 | //now let's get the ticket relations setup. |
529 | - foreach ( (array) $orig_tkts as $orig_tkt ) { |
|
529 | + foreach ((array) $orig_tkts as $orig_tkt) { |
|
530 | 530 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
531 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
531 | + if ( ! $orig_tkt instanceof EE_Ticket) |
|
532 | 532 | continue; |
533 | 533 | |
534 | 534 | //is this ticket archived? If it is then let's skip |
535 | - if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
|
535 | + if ($orig_tkt->get('TKT_deleted')) { |
|
536 | 536 | continue; |
537 | 537 | } |
538 | 538 | |
539 | 539 | //does this original ticket already exist in the clone_tickets cache? If so we'll just use the new ticket from it. |
540 | - if ( isset( $cloned_tickets[$orig_tkt->ID()] ) ) { |
|
540 | + if (isset($cloned_tickets[$orig_tkt->ID()])) { |
|
541 | 541 | $new_tkt = $cloned_tickets[$orig_tkt->ID()]; |
542 | 542 | } else { |
543 | 543 | $new_tkt = clone $orig_tkt; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $new_tkt->save(); //make sure new ticket has ID. |
550 | 550 | |
551 | 551 | //price relations on new ticket need to be setup. |
552 | - foreach ( $orig_prices as $orig_price ) { |
|
552 | + foreach ($orig_prices as $orig_price) { |
|
553 | 553 | $new_price = clone $orig_price; |
554 | 554 | $new_price->set('PRC_ID', 0); |
555 | 555 | $new_price->save(); |
@@ -566,39 +566,39 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | //clone taxonomy information |
569 | - $taxonomies_to_clone_with = apply_filters( 'FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array( 'espresso_event_categories', 'espresso_event_type', 'post_tag' ) ); |
|
569 | + $taxonomies_to_clone_with = apply_filters('FHEE__Extend_Events_Admin_Page___duplicate_event__taxonomies_to_clone', array('espresso_event_categories', 'espresso_event_type', 'post_tag')); |
|
570 | 570 | |
571 | 571 | //get terms for original event (notice) |
572 | - $orig_terms = wp_get_object_terms( $orig_event->ID(), $taxonomies_to_clone_with ); |
|
572 | + $orig_terms = wp_get_object_terms($orig_event->ID(), $taxonomies_to_clone_with); |
|
573 | 573 | |
574 | 574 | //loop through terms and add them to new event. |
575 | - foreach ( $orig_terms as $term ) { |
|
576 | - wp_set_object_terms( $new_event->ID(), $term->term_id, $term->taxonomy, true ); |
|
575 | + foreach ($orig_terms as $term) { |
|
576 | + wp_set_object_terms($new_event->ID(), $term->term_id, $term->taxonomy, true); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | |
580 | - do_action( 'AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event ); |
|
580 | + do_action('AHEE__Extend_Events_Admin_Page___duplicate_event__after', $new_event, $orig_event); |
|
581 | 581 | |
582 | 582 | //now let's redirect to the edit page for this duplicated event if we have a new event id. |
583 | - if ( $new_event->ID() ) { |
|
583 | + if ($new_event->ID()) { |
|
584 | 584 | $redirect_args = array( |
585 | 585 | 'post' => $new_event->ID(), |
586 | 586 | 'action' => 'edit' |
587 | 587 | ); |
588 | - EE_Error::add_success( __('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso') ); |
|
588 | + EE_Error::add_success(__('Event successfully duplicated. Please review the details below and make any necessary edits', 'event_espresso')); |
|
589 | 589 | } else { |
590 | 590 | $redirect_args = array( |
591 | 591 | 'action' => 'default' |
592 | 592 | ); |
593 | - EE_Error::add_error( __('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
593 | + EE_Error::add_error(__('Not able to duplicate event. Something went wrong.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
594 | 594 | } |
595 | 595 | |
596 | - $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE ); |
|
596 | + $this->_redirect_after_action(FALSE, '', '', $redirect_args, TRUE); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | |
600 | 600 | |
601 | - protected function _import_page(){ |
|
601 | + protected function _import_page() { |
|
602 | 602 | |
603 | 603 | $title = __('Import', 'event_espresso'); |
604 | 604 | $intro = __('If you have a previously exported Event Espresso 4 information in a Comma Separated Value (CSV) file format, you can upload the file here: ', 'event_espresso'); |
@@ -606,8 +606,8 @@ discard block |
||
606 | 606 | $action = 'import_events'; |
607 | 607 | $type = 'csv'; |
608 | 608 | $this->_template_args['form'] = EE_Import::instance()->upload_form($title, $intro, $form_url, $action, $type); |
609 | - $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'),$this->_admin_base_url); |
|
610 | - $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH . 'import_page.template.php',$this->_template_args,true); |
|
609 | + $this->_template_args['sample_file_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'sample_export_file'), $this->_admin_base_url); |
|
610 | + $content = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'import_page.template.php', $this->_template_args, true); |
|
611 | 611 | |
612 | 612 | |
613 | 613 | $this->_template_args['admin_page_content'] = $content; |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | * @return string html |
621 | 621 | */ |
622 | 622 | protected function _import_events() { |
623 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
623 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
624 | 624 | $success = EE_Import::instance()->import(); |
625 | - $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'),true); |
|
625 | + $this->_redirect_after_action($success, 'Import File', 'ran', array('action' => 'import_page'), true); |
|
626 | 626 | |
627 | 627 | } |
628 | 628 | |
@@ -636,23 +636,23 @@ discard block |
||
636 | 636 | * @return file |
637 | 637 | */ |
638 | 638 | protected function _events_export() { |
639 | - if(isset($this->_req_data['EVT_ID'])){ |
|
639 | + if (isset($this->_req_data['EVT_ID'])) { |
|
640 | 640 | $event_ids = $this->_req_data['EVT_ID']; |
641 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
641 | + }elseif (isset($this->_req_data['EVT_IDs'])) { |
|
642 | 642 | $event_ids = $this->_req_data['EVT_IDs']; |
643 | - }else{ |
|
643 | + } else { |
|
644 | 644 | $event_ids = NULL; |
645 | 645 | } |
646 | 646 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
647 | 647 | $new_request_args = array( |
648 | 648 | 'export' => 'report', |
649 | 649 | 'action' => 'all_event_data', |
650 | - 'EVT_ID' => $event_ids , |
|
650 | + 'EVT_ID' => $event_ids, |
|
651 | 651 | ); |
652 | 652 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
653 | 653 | |
654 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
655 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
654 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
655 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
656 | 656 | $EE_Export = EE_Export::instance($this->_req_data); |
657 | 657 | $EE_Export->export(); |
658 | 658 | } |
@@ -674,11 +674,11 @@ discard block |
||
674 | 674 | 'category_ids' => $this->_req_data['EVT_CAT_ID'] |
675 | 675 | ); |
676 | 676 | |
677 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
677 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
678 | 678 | |
679 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
680 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
681 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
679 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
680 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
681 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
682 | 682 | $EE_Export->export(); |
683 | 683 | } |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | /** |
690 | 690 | * Creates a sample CSV file for importing |
691 | 691 | */ |
692 | - protected function _sample_export_file(){ |
|
692 | + protected function _sample_export_file() { |
|
693 | 693 | // require_once(EE_CLASSES . 'EE_Export.class.php'); |
694 | 694 | EE_Export::instance()->export_sample(); |
695 | 695 | } |
@@ -706,10 +706,10 @@ discard block |
||
706 | 706 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
707 | 707 | * from General_Settings_Admin_Page to here. |
708 | 708 | */ |
709 | - $this->_template_args = apply_filters( 'FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args ); |
|
710 | - $this->_set_add_edit_form_tags( 'update_template_settings' ); |
|
711 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
712 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( EVENTS_CAF_TEMPLATE_PATH . 'template_settings.template.php', $this->_template_args, TRUE ); |
|
709 | + $this->_template_args = apply_filters('FHEE__General_Settings_Admin_Page__template_settings__template_args', $this->_template_args); |
|
710 | + $this->_set_add_edit_form_tags('update_template_settings'); |
|
711 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
712 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_CAF_TEMPLATE_PATH.'template_settings.template.php', $this->_template_args, TRUE); |
|
713 | 713 | $this->display_admin_page_with_sidebar(); |
714 | 714 | } |
715 | 715 | |
@@ -721,24 +721,24 @@ discard block |
||
721 | 721 | * Note leaving this filter in for backward compatibility this was moved in 4.6.x |
722 | 722 | * from General_Settings_Admin_Page to here. |
723 | 723 | */ |
724 | - EE_Registry::instance()->CFG->template_settings = apply_filters( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data ); |
|
724 | + EE_Registry::instance()->CFG->template_settings = apply_filters('FHEE__General_Settings_Admin_Page__update_template_settings__data', EE_Registry::instance()->CFG->template_settings, $this->_req_data); |
|
725 | 725 | |
726 | 726 | |
727 | 727 | //update custom post type slugs and detect if we need to flush rewrite rules |
728 | 728 | $old_slug = EE_Registry::instance()->CFG->core->event_cpt_slug; |
729 | - EE_Registry::instance()->CFG->core->event_cpt_slug = empty( $this->_req_data['event_cpt_slug'] ) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes( $this->_req_data['event_cpt_slug'] ); |
|
729 | + EE_Registry::instance()->CFG->core->event_cpt_slug = empty($this->_req_data['event_cpt_slug']) ? EE_Registry::instance()->CFG->core->event_cpt_slug : sanitize_title_with_dashes($this->_req_data['event_cpt_slug']); |
|
730 | 730 | |
731 | 731 | |
732 | 732 | $what = 'Template Settings'; |
733 | - $success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__ ); |
|
733 | + $success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->template_settings, __FILE__, __FUNCTION__, __LINE__); |
|
734 | 734 | |
735 | 735 | |
736 | - if ( EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug ) { |
|
737 | - update_option( 'ee_flush_rewrite_rules', true ); |
|
736 | + if (EE_Registry::instance()->CFG->core->event_cpt_slug != $old_slug) { |
|
737 | + update_option('ee_flush_rewrite_rules', true); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
741 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'template_settings' ) ); |
|
741 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'template_settings')); |
|
742 | 742 | |
743 | 743 | } |
744 | 744 | |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | $this->verify_cpt_object(); |
758 | 758 | |
759 | - add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array( $this, 'registration_options_meta_box' ), $this->page_slug, 'side', 'core'); |
|
759 | + add_meta_box('espresso_event_editor_event_options', __('Event Registration Options', 'event_espresso'), array($this, 'registration_options_meta_box'), $this->page_slug, 'side', 'core'); |
|
760 | 760 | //add_meta_box('espresso_event_types', __('Event Type', 'event_espresso'), array( $this, 'event_type_meta_box' ), $this->page_slug, 'side', 'default' ); //add this back in when the feature is ready. |
761 | 761 | |
762 | 762 | //todo feature in progress |
@@ -780,16 +780,16 @@ discard block |
||
780 | 780 | array('id' => true, 'text' => __('Yes', 'event_espresso')), |
781 | 781 | array('id' => false, 'text' => __('No', 'event_espresso')) |
782 | 782 | ); |
783 | - $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete ), TRUE); |
|
783 | + $default_reg_status_values = EEM_Registration::reg_status_array(array(EEM_Registration::status_id_cancelled, EEM_Registration::status_id_declined, EEM_Registration::status_id_incomplete), TRUE); |
|
784 | 784 | $template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(FALSE); |
785 | 785 | $template_args['_event'] = $this->_cpt_model_obj; |
786 | 786 | $template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit(); |
787 | 787 | $template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
788 | 788 | $template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description()); |
789 | 789 | $template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false); |
790 | - $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status() ); |
|
791 | - $template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values ); |
|
792 | - $templatepath = EVENTS_CAF_TEMPLATE_PATH . 'event_registration_options.template.php'; |
|
790 | + $template_args['EVT_default_registration_status'] = EEH_Form_Fields::select_input('EVT_default_registration_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status()); |
|
791 | + $template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values); |
|
792 | + $templatepath = EVENTS_CAF_TEMPLATE_PATH.'event_registration_options.template.php'; |
|
793 | 793 | EEH_Template::display_template($templatepath, $template_args); |
794 | 794 | } |
795 | 795 | |
@@ -802,9 +802,9 @@ discard block |
||
802 | 802 | * @param array $box metabox args |
803 | 803 | * @return string metabox contents |
804 | 804 | */ |
805 | - public function event_type_meta_box( $post, $box ) { |
|
806 | - $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array( 'taxonomy' => 'espresso_event_type' ) ); |
|
807 | - $template = EVENTS_CAF_TEMPLATE_PATH . 'event_type_metabox_contents.template.php'; |
|
805 | + public function event_type_meta_box($post, $box) { |
|
806 | + $template_args['radio_list'] = $this->wp_terms_radio($post->ID, array('taxonomy' => 'espresso_event_type')); |
|
807 | + $template = EVENTS_CAF_TEMPLATE_PATH.'event_type_metabox_contents.template.php'; |
|
808 | 808 | EEH_Template::display_template($template, $template_args); |
809 | 809 | } |
810 | 810 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | |
816 | 816 | |
817 | - public function wp_terms_radio( $post_id = 0, $args = array() ) { |
|
817 | + public function wp_terms_radio($post_id = 0, $args = array()) { |
|
818 | 818 | $defaults = array( |
819 | 819 | 'descendants_and_self' => 0, |
820 | 820 | 'selected_cats' => false, |
@@ -823,11 +823,11 @@ discard block |
||
823 | 823 | 'taxonomy' => 'category', |
824 | 824 | 'checked_ontop' => true |
825 | 825 | ); |
826 | - $args = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); |
|
826 | + $args = apply_filters('wp_terms_checklist_args', $args, $post_id); |
|
827 | 827 | |
828 | - extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
|
828 | + extract(wp_parse_args($args, $defaults), EXTR_SKIP); |
|
829 | 829 | |
830 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
830 | + if (empty($walker) || ! is_a($walker, 'Walker')) |
|
831 | 831 | $walker = new Walker_Radio_Checklist; |
832 | 832 | |
833 | 833 | $descendants_and_self = (int) $descendants_and_self; |
@@ -835,37 +835,37 @@ discard block |
||
835 | 835 | $args = array('taxonomy' => $taxonomy); |
836 | 836 | |
837 | 837 | $tax = get_taxonomy($taxonomy); |
838 | - $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
|
838 | + $args['disabled'] = ! current_user_can($tax->cap->assign_terms); |
|
839 | 839 | |
840 | - if ( is_array( $selected_cats ) ) |
|
840 | + if (is_array($selected_cats)) |
|
841 | 841 | $args['selected_cats'] = $selected_cats; |
842 | - elseif ( $post_id ) |
|
842 | + elseif ($post_id) |
|
843 | 843 | $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
844 | 844 | else |
845 | 845 | $args['selected_cats'] = array(); |
846 | 846 | |
847 | - if ( is_array( $popular_cats ) ) |
|
847 | + if (is_array($popular_cats)) |
|
848 | 848 | $args['popular_cats'] = $popular_cats; |
849 | 849 | else |
850 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
850 | + $args['popular_cats'] = get_terms($taxonomy, array('fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false)); |
|
851 | 851 | |
852 | - if ( $descendants_and_self ) { |
|
853 | - $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
|
854 | - $self = get_term( $descendants_and_self, $taxonomy ); |
|
855 | - array_unshift( $categories, $self ); |
|
852 | + if ($descendants_and_self) { |
|
853 | + $categories = (array) get_terms($taxonomy, array('child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0)); |
|
854 | + $self = get_term($descendants_and_self, $taxonomy); |
|
855 | + array_unshift($categories, $self); |
|
856 | 856 | } else { |
857 | 857 | $categories = (array) get_terms($taxonomy, array('get' => 'all')); |
858 | 858 | } |
859 | 859 | |
860 | - if ( $checked_ontop ) { |
|
860 | + if ($checked_ontop) { |
|
861 | 861 | // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) |
862 | 862 | $checked_categories = array(); |
863 | - $keys = array_keys( $categories ); |
|
863 | + $keys = array_keys($categories); |
|
864 | 864 | |
865 | - foreach( $keys as $k ) { |
|
866 | - if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) { |
|
865 | + foreach ($keys as $k) { |
|
866 | + if (in_array($categories[$k]->term_id, $args['selected_cats'])) { |
|
867 | 867 | $checked_categories[] = $categories[$k]; |
868 | - unset( $categories[$k] ); |
|
868 | + unset($categories[$k]); |
|
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
@@ -890,18 +890,18 @@ discard block |
||
890 | 890 | * @param array $list_table_obj the list table object |
891 | 891 | * @return array new filters |
892 | 892 | */ |
893 | - public function list_table_filters( $oldfilters, $list_table_obj ) { |
|
893 | + public function list_table_filters($oldfilters, $list_table_obj) { |
|
894 | 894 | $filters = array(); |
895 | 895 | |
896 | 896 | //first month/year filters |
897 | 897 | $filters[] = $this->espresso_event_months_dropdown(); |
898 | 898 | |
899 | 899 | |
900 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
900 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
901 | 901 | |
902 | 902 | //active status dropdown |
903 | - if ( $status !== 'draft' ) |
|
904 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
903 | + if ($status !== 'draft') |
|
904 | + $filter[] = $this->active_status_dropdown(isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : ''); |
|
905 | 905 | |
906 | 906 | //category filter |
907 | 907 | $filters[] = $this->category_dropdown(); |
@@ -923,17 +923,17 @@ discard block |
||
923 | 923 | */ |
924 | 924 | public function espresso_event_months_dropdown() { |
925 | 925 | //what we need to do is get all PRIMARY datetimes for all events to filter on. Note we need to include any other filters that are set! |
926 | - $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
|
926 | + $status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL; |
|
927 | 927 | |
928 | 928 | //categories? |
929 | - $category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
929 | + $category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL; |
|
930 | 930 | |
931 | 931 | //active status? |
932 | - $active_status = isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : NULL; |
|
932 | + $active_status = isset($this->_req_data['active_status']) ? $this->_req_data['active_status'] : NULL; |
|
933 | 933 | |
934 | 934 | $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : ''; |
935 | 935 | |
936 | - return EEH_Form_Fields::generate_event_months_dropdown( $cur_date, $status, $category, $active_status ); |
|
936 | + return EEH_Form_Fields::generate_event_months_dropdown($cur_date, $status, $category, $active_status); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | |
@@ -944,12 +944,12 @@ discard block |
||
944 | 944 | * @param string $current_value whatever the ucrrent active status is |
945 | 945 | * @return string html dropdown. |
946 | 946 | */ |
947 | - public function active_status_dropdown( $current_value = '' ) { |
|
947 | + public function active_status_dropdown($current_value = '') { |
|
948 | 948 | $select_name = 'active_status'; |
949 | - $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso') ); |
|
949 | + $values = array('none' => __('Show Active/Inactive', 'event_espresso'), 'active' => __('Active', 'event_espresso'), 'upcoming' => __('Upcoming', 'event_espresso'), 'expired' => __('Expired', 'event_espresso'), 'inactive' => __('Inactive', 'event_espresso')); |
|
950 | 950 | $id = 'id="espresso-active-status-dropdown-filter"'; |
951 | 951 | $class = 'wide'; |
952 | - echo EEH_Form_Fields::select_input( $select_name, $values, $current_value, $id, $class ); |
|
952 | + echo EEH_Form_Fields::select_input($select_name, $values, $current_value, $id, $class); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -961,9 +961,9 @@ discard block |
||
961 | 961 | * @return string html |
962 | 962 | */ |
963 | 963 | public function category_dropdown() { |
964 | - $cur_cat = isset( $this->_req_data['EVT_CAT'] ) ? $this->_req_data['EVT_CAT'] : -1; |
|
964 | + $cur_cat = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1; |
|
965 | 965 | |
966 | - return EEH_Form_Fields::generate_event_category_dropdown( $cur_cat ); |
|
966 | + return EEH_Form_Fields::generate_event_category_dropdown($cur_cat); |
|
967 | 967 | } |
968 | 968 | |
969 | 969 | |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | * @return int |
976 | 976 | */ |
977 | 977 | public function total_events_today() { |
978 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
979 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', date('Y-m-d' ) . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
978 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
979 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', date('Y-m-d').' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
980 | 980 | |
981 | 981 | $where = array( |
982 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
982 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
983 | 983 | ); |
984 | 984 | |
985 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
985 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
986 | 986 | return $count; |
987 | 987 | } |
988 | 988 | |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | $this_year_r = date('Y'); |
998 | 998 | $this_month_r = date('m'); |
999 | 999 | $days_this_month = date('t'); |
1000 | - $start = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-01 00:00:00', 'Y-m-d H:i:s', 'UTC' ); |
|
1001 | - $end = EEM_Datetime::instance()->convert_datetime_for_query( 'DTT_EVT_start', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' 23:59:59', 'Y-m-d H:i:s', 'UTC' ); |
|
1000 | + $start = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-01 00:00:00', 'Y-m-d H:i:s', 'UTC'); |
|
1001 | + $end = EEM_Datetime::instance()->convert_datetime_for_query('DTT_EVT_start', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' 23:59:59', 'Y-m-d H:i:s', 'UTC'); |
|
1002 | 1002 | |
1003 | 1003 | $where = array( |
1004 | - 'Datetime.DTT_EVT_start' => array( 'BETWEEN', array($start, $end ) ) |
|
1004 | + 'Datetime.DTT_EVT_start' => array('BETWEEN', array($start, $end)) |
|
1005 | 1005 | ); |
1006 | 1006 | |
1007 | - $count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true ); |
|
1007 | + $count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true); |
|
1008 | 1008 | return $count; |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1021,53 +1021,53 @@ discard block |
||
1021 | 1021 | |
1022 | 1022 | |
1023 | 1023 | |
1024 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
1024 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
1025 | 1025 | |
1026 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $this->_req_data['order']; |
|
1026 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
1027 | + $order = empty($this->_req_data['order']) ? 'ASC' : $this->_req_data['order']; |
|
1028 | 1028 | |
1029 | - switch ( $orderby ) { |
|
1029 | + switch ($orderby) { |
|
1030 | 1030 | case 'TKT_name' : |
1031 | - $orderby = array( 'TKT_name' => $order ); |
|
1031 | + $orderby = array('TKT_name' => $order); |
|
1032 | 1032 | break; |
1033 | 1033 | |
1034 | 1034 | case 'TKT_price' : |
1035 | - $orderby = array( 'TKT_price' => $order ); |
|
1035 | + $orderby = array('TKT_price' => $order); |
|
1036 | 1036 | break; |
1037 | 1037 | |
1038 | 1038 | case 'TKT_uses' : |
1039 | - $orderby = array( 'TKT_uses' => $order ); |
|
1039 | + $orderby = array('TKT_uses' => $order); |
|
1040 | 1040 | break; |
1041 | 1041 | |
1042 | 1042 | case 'TKT_min' : |
1043 | - $orderby = array( 'TKT_min' => $order ); |
|
1043 | + $orderby = array('TKT_min' => $order); |
|
1044 | 1044 | break; |
1045 | 1045 | |
1046 | 1046 | case 'TKT_max' : |
1047 | - $orderby = array( 'TKT_max' => $order ); |
|
1047 | + $orderby = array('TKT_max' => $order); |
|
1048 | 1048 | break; |
1049 | 1049 | |
1050 | 1050 | case 'TKT_qty' : |
1051 | - $orderby = array( 'TKT_qty' => $order ); |
|
1051 | + $orderby = array('TKT_qty' => $order); |
|
1052 | 1052 | break; |
1053 | 1053 | } |
1054 | 1054 | |
1055 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1056 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1055 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1056 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1057 | 1057 | |
1058 | 1058 | $_where = array( |
1059 | 1059 | 'TKT_is_default' => 1, |
1060 | 1060 | 'TKT_deleted' => $trashed |
1061 | 1061 | ); |
1062 | 1062 | |
1063 | - $offset = ($current_page-1)*$per_page; |
|
1064 | - $limit = array( $offset, $per_page ); |
|
1063 | + $offset = ($current_page - 1) * $per_page; |
|
1064 | + $limit = array($offset, $per_page); |
|
1065 | 1065 | |
1066 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1067 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1066 | + if (isset($this->_req_data['s'])) { |
|
1067 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1068 | 1068 | $_where['OR'] = array( |
1069 | - 'TKT_name' => array('LIKE',$sstr ), |
|
1070 | - 'TKT_description' => array('LIKE',$sstr ) |
|
1069 | + 'TKT_name' => array('LIKE', $sstr), |
|
1070 | + 'TKT_description' => array('LIKE', $sstr) |
|
1071 | 1071 | ); |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1078,9 +1078,9 @@ discard block |
||
1078 | 1078 | 'group_by'=>'TKT_ID' |
1079 | 1079 | ); |
1080 | 1080 | |
1081 | - if($count){ |
|
1081 | + if ($count) { |
|
1082 | 1082 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1083 | - }else{ |
|
1083 | + } else { |
|
1084 | 1084 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1085 | 1085 | } |
1086 | 1086 | |
@@ -1090,35 +1090,35 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | |
1092 | 1092 | |
1093 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
1093 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
1094 | 1094 | $success = 1; |
1095 | 1095 | |
1096 | 1096 | $TKT = EEM_Ticket::instance(); |
1097 | 1097 | |
1098 | 1098 | //checkboxes? |
1099 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1099 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1100 | 1100 | //if array has more than one element then success message should be plural |
1101 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1101 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1102 | 1102 | |
1103 | 1103 | //cycle thru the boxes |
1104 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1105 | - if ( $trash ) { |
|
1106 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1104 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1105 | + if ($trash) { |
|
1106 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1107 | 1107 | $success = 0; |
1108 | 1108 | } else { |
1109 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1109 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1110 | 1110 | $success = 0; |
1111 | 1111 | } |
1112 | 1112 | } |
1113 | 1113 | } else { |
1114 | 1114 | //grab single id and trash |
1115 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1115 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1116 | 1116 | |
1117 | - if ( $trash ) { |
|
1118 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1117 | + if ($trash) { |
|
1118 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
1119 | 1119 | $success = 0; |
1120 | 1120 | } else { |
1121 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1121 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
1122 | 1122 | $success = 0; |
1123 | 1123 | } |
1124 | 1124 | } |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | 'action' => 'ticket_list_table', |
1129 | 1129 | 'status' => $trash ? '' : 'trashed' |
1130 | 1130 | ); |
1131 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1131 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
@@ -1141,21 +1141,21 @@ discard block |
||
1141 | 1141 | $TKT = EEM_Ticket::instance(); |
1142 | 1142 | |
1143 | 1143 | //checkboxes? |
1144 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
1144 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1145 | 1145 | //if array has more than one element then success message should be plural |
1146 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1146 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1147 | 1147 | |
1148 | 1148 | //cycle thru the boxes |
1149 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
1149 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1150 | 1150 | //delete |
1151 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1151 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1152 | 1152 | $success = 0; |
1153 | 1153 | } |
1154 | 1154 | } |
1155 | 1155 | } else { |
1156 | 1156 | //grab single id and trash |
1157 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
1158 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
1157 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
1158 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
1159 | 1159 | $success = 0; |
1160 | 1160 | } |
1161 | 1161 | } |
@@ -1167,16 +1167,16 @@ discard block |
||
1167 | 1167 | ); |
1168 | 1168 | |
1169 | 1169 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1170 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1170 | + if (EEM_Ticket::instance()->count_deleted_and_undeleted(array(array('TKT_is_default' => 1)), 'TKT_ID', TRUE)) |
|
1171 | 1171 | $query_args = array(); |
1172 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
|
1172 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, $query_args); |
|
1173 | 1173 | } |
1174 | 1174 | |
1175 | 1175 | |
1176 | 1176 | |
1177 | 1177 | |
1178 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
1179 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
1178 | + protected function _delete_the_ticket($TKT_ID) { |
|
1179 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
1180 | 1180 | $tkt->_remove_relations('Datetime'); |
1181 | 1181 | //delete all related prices first |
1182 | 1182 | $tkt->delete_related_permanently('Price'); |
@@ -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 |
@@ -453,8 +454,9 @@ discard block |
||
453 | 454 | //k we've got EVT_ID so let's use that to get the event we'll duplicate |
454 | 455 | $orig_event = EEM_Event::instance()->get_one_by_ID( $this->_req_data['EVT_ID'] ); |
455 | 456 | |
456 | - if ( ! $orig_event instanceof EE_Event ) |
|
457 | - throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
457 | + if ( ! $orig_event instanceof EE_Event ) { |
|
458 | + throw new EE_Error( sprintf( __('An EE_Event object could not be retrieved for the given ID (%s)', 'event_espresso'), $this->_req_data['EVT_ID'] ) ); |
|
459 | + } |
|
458 | 460 | |
459 | 461 | //k now let's clone the $orig_event before getting relations |
460 | 462 | $new_event = clone $orig_event; |
@@ -528,8 +530,9 @@ discard block |
||
528 | 530 | //now let's get the ticket relations setup. |
529 | 531 | foreach ( (array) $orig_tkts as $orig_tkt ) { |
530 | 532 | //it's possible a datetime will have no tickets so let's verify we HAVE a ticket first. |
531 | - if ( ! $orig_tkt instanceof EE_Ticket ) |
|
532 | - continue; |
|
533 | + if ( ! $orig_tkt instanceof EE_Ticket ) { |
|
534 | + continue; |
|
535 | + } |
|
533 | 536 | |
534 | 537 | //is this ticket archived? If it is then let's skip |
535 | 538 | if ( $orig_tkt->get( 'TKT_deleted' ) ) { |
@@ -638,9 +641,9 @@ discard block |
||
638 | 641 | protected function _events_export() { |
639 | 642 | if(isset($this->_req_data['EVT_ID'])){ |
640 | 643 | $event_ids = $this->_req_data['EVT_ID']; |
641 | - }elseif(isset($this->_req_data['EVT_IDs'])){ |
|
644 | + } elseif(isset($this->_req_data['EVT_IDs'])){ |
|
642 | 645 | $event_ids = $this->_req_data['EVT_IDs']; |
643 | - }else{ |
|
646 | + } else{ |
|
644 | 647 | $event_ids = NULL; |
645 | 648 | } |
646 | 649 | //todo: I don't like doing this but it'll do until we modify EE_Export Class. |
@@ -827,8 +830,9 @@ discard block |
||
827 | 830 | |
828 | 831 | extract( wp_parse_args($args, $defaults), EXTR_SKIP ); |
829 | 832 | |
830 | - if ( empty($walker) || !is_a($walker, 'Walker') ) |
|
831 | - $walker = new Walker_Radio_Checklist; |
|
833 | + if ( empty($walker) || !is_a($walker, 'Walker') ) { |
|
834 | + $walker = new Walker_Radio_Checklist; |
|
835 | + } |
|
832 | 836 | |
833 | 837 | $descendants_and_self = (int) $descendants_and_self; |
834 | 838 | |
@@ -837,17 +841,19 @@ discard block |
||
837 | 841 | $tax = get_taxonomy($taxonomy); |
838 | 842 | $args['disabled'] = !current_user_can($tax->cap->assign_terms); |
839 | 843 | |
840 | - if ( is_array( $selected_cats ) ) |
|
841 | - $args['selected_cats'] = $selected_cats; |
|
842 | - elseif ( $post_id ) |
|
843 | - $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
844 | - else |
|
845 | - $args['selected_cats'] = array(); |
|
844 | + if ( is_array( $selected_cats ) ) { |
|
845 | + $args['selected_cats'] = $selected_cats; |
|
846 | + } elseif ( $post_id ) { |
|
847 | + $args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids'))); |
|
848 | + } else { |
|
849 | + $args['selected_cats'] = array(); |
|
850 | + } |
|
846 | 851 | |
847 | - if ( is_array( $popular_cats ) ) |
|
848 | - $args['popular_cats'] = $popular_cats; |
|
849 | - else |
|
850 | - $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
852 | + if ( is_array( $popular_cats ) ) { |
|
853 | + $args['popular_cats'] = $popular_cats; |
|
854 | + } else { |
|
855 | + $args['popular_cats'] = get_terms( $taxonomy, array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) ); |
|
856 | + } |
|
851 | 857 | |
852 | 858 | if ( $descendants_and_self ) { |
853 | 859 | $categories = (array) get_terms($taxonomy, array( 'child_of' => $descendants_and_self, 'hierarchical' => 0, 'hide_empty' => 0 ) ); |
@@ -900,8 +906,9 @@ discard block |
||
900 | 906 | $status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL; |
901 | 907 | |
902 | 908 | //active status dropdown |
903 | - if ( $status !== 'draft' ) |
|
904 | - $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
909 | + if ( $status !== 'draft' ) { |
|
910 | + $filter[] = $this->active_status_dropdown( isset( $this->_req_data['active_status'] ) ? $this->_req_data['active_status'] : '' ); |
|
911 | + } |
|
905 | 912 | |
906 | 913 | //category filter |
907 | 914 | $filters[] = $this->category_dropdown(); |
@@ -1080,7 +1087,7 @@ discard block |
||
1080 | 1087 | |
1081 | 1088 | if($count){ |
1082 | 1089 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
1083 | - }else{ |
|
1090 | + } else{ |
|
1084 | 1091 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
1085 | 1092 | } |
1086 | 1093 | |
@@ -1103,11 +1110,13 @@ discard block |
||
1103 | 1110 | //cycle thru the boxes |
1104 | 1111 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
1105 | 1112 | if ( $trash ) { |
1106 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1107 | - $success = 0; |
|
1113 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1114 | + $success = 0; |
|
1115 | + } |
|
1108 | 1116 | } else { |
1109 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1110 | - $success = 0; |
|
1117 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1118 | + $success = 0; |
|
1119 | + } |
|
1111 | 1120 | } |
1112 | 1121 | } |
1113 | 1122 | } else { |
@@ -1115,11 +1124,13 @@ discard block |
||
1115 | 1124 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
1116 | 1125 | |
1117 | 1126 | if ( $trash ) { |
1118 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
1119 | - $success = 0; |
|
1127 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
1128 | + $success = 0; |
|
1129 | + } |
|
1120 | 1130 | } else { |
1121 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
1122 | - $success = 0; |
|
1131 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
1132 | + $success = 0; |
|
1133 | + } |
|
1123 | 1134 | } |
1124 | 1135 | } |
1125 | 1136 | |
@@ -1167,8 +1178,9 @@ discard block |
||
1167 | 1178 | ); |
1168 | 1179 | |
1169 | 1180 | //failsafe. If the default ticket count === 1 then we need to redirect to event overview. |
1170 | - if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) |
|
1171 | - $query_args = array(); |
|
1181 | + if ( EEM_Ticket::instance()->count_deleted_and_undeleted( array( array( 'TKT_is_default' => 1 ) ), 'TKT_ID', TRUE ) ) { |
|
1182 | + $query_args = array(); |
|
1183 | + } |
|
1172 | 1184 | $this->_redirect_after_action( $success, 'Tickets', $action_desc, $query_args ); |
1173 | 1185 | } |
1174 | 1186 |
@@ -1,69 +1,69 @@ |
||
1 | 1 | <?php |
2 | 2 | //echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>'; |
3 | 3 | if ( |
4 | - ( is_single() && espresso_display_venue_in_event_details() ) |
|
5 | - || ( is_archive() && espresso_display_venue_in_event_list() ) |
|
4 | + (is_single() && espresso_display_venue_in_event_details()) |
|
5 | + || (is_archive() && espresso_display_venue_in_event_list()) |
|
6 | 6 | ) : |
7 | 7 | global $post; |
8 | - do_action( 'AHEE_event_details_before_venue_details', $post ); |
|
9 | - $venue_name = espresso_venue_name( 0, 'details', FALSE ); |
|
10 | - if ( empty( $venue_name ) && espresso_is_venue_private() ) { |
|
11 | - do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
8 | + do_action('AHEE_event_details_before_venue_details', $post); |
|
9 | + $venue_name = espresso_venue_name(0, 'details', FALSE); |
|
10 | + if (empty($venue_name) && espresso_is_venue_private()) { |
|
11 | + do_action('AHEE_event_details_after_venue_details', $post); |
|
12 | 12 | return ''; |
13 | 13 | } |
14 | 14 | ?> |
15 | 15 | |
16 | 16 | <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>"> |
17 | 17 | <h3 class="event-venues-h3 ee-event-h3"> |
18 | - <?php _e( 'Location', 'event_espresso' ); ?> |
|
18 | + <?php _e('Location', 'event_espresso'); ?> |
|
19 | 19 | </h3> |
20 | - <h4><strong><?php _e( 'Venue:', 'event_espresso' ); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
20 | + <h4><strong><?php _e('Venue:', 'event_espresso'); ?></strong> <strong> <?php echo $venue_name; ?></strong></h4> |
|
21 | 21 | <p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p> |
22 | -<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
22 | +<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
23 | 23 | <p> |
24 | - <span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?></strong></span> <?php echo $venue_phone; ?> |
|
24 | + <span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?></strong></span> <?php echo $venue_phone; ?> |
|
25 | 25 | </p> |
26 | -<?php endif; ?> |
|
27 | -<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?> |
|
26 | +<?php endif; ?> |
|
27 | +<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?> |
|
28 | 28 | <p> |
29 | - <span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?></strong></span> <?php echo $venue_website; ?> |
|
29 | + <span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?></strong></span> <?php echo $venue_website; ?> |
|
30 | 30 | </p> |
31 | 31 | <?php endif; ?> |
32 | -<?php if ( espresso_venue_has_address( $post->ID )) : ?> |
|
33 | - <strong><span class="dashicons dashicons-location-alt"></span><?php _e( 'Address:', 'event_espresso' ); ?></strong> |
|
34 | - <?php espresso_venue_address( 'inline' ); ?> |
|
35 | - <?php espresso_venue_gmap( $post->ID ); ?> |
|
32 | +<?php if (espresso_venue_has_address($post->ID)) : ?> |
|
33 | + <strong><span class="dashicons dashicons-location-alt"></span><?php _e('Address:', 'event_espresso'); ?></strong> |
|
34 | + <?php espresso_venue_address('inline'); ?> |
|
35 | + <?php espresso_venue_gmap($post->ID); ?> |
|
36 | 36 | <div class="clear"><br/></div> |
37 | -<?php endif; ?> |
|
37 | +<?php endif; ?> |
|
38 | 38 | |
39 | - <?php $VNU_ID = espresso_venue_id( $post->ID ); ?> |
|
40 | - <?php if ( is_single() ) : ?> |
|
41 | - <?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?> |
|
42 | - <?php if ( $venue_description ) : ?> |
|
39 | + <?php $VNU_ID = espresso_venue_id($post->ID); ?> |
|
40 | + <?php if (is_single()) : ?> |
|
41 | + <?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?> |
|
42 | + <?php if ($venue_description) : ?> |
|
43 | 43 | <p> |
44 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
45 | - <?php echo do_shortcode( $venue_description ); ?> |
|
44 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
45 | + <?php echo do_shortcode($venue_description); ?> |
|
46 | 46 | </p> |
47 | - <?php endif; ?> |
|
47 | + <?php endif; ?> |
|
48 | 48 | <?php else : ?> |
49 | - <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?> |
|
50 | - <?php if ( $venue_excerpt ) : ?> |
|
49 | + <?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?> |
|
50 | + <?php if ($venue_excerpt) : ?> |
|
51 | 51 | <p> |
52 | - <strong><?php _e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
52 | + <strong><?php _e('Description:', 'event_espresso'); ?></strong><br/> |
|
53 | 53 | <?php echo $venue_excerpt; ?> |
54 | 54 | </p> |
55 | - <?php endif; ?> |
|
56 | - <?php endif; ?> |
|
55 | + <?php endif; ?> |
|
56 | + <?php endif; ?> |
|
57 | 57 | </div> |
58 | 58 | <!-- .espresso-venue-dv --> |
59 | 59 | <?php |
60 | -do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
60 | +do_action('AHEE_event_details_after_venue_details', $post); |
|
61 | 61 | else : |
62 | - if ( espresso_venue_is_password_protected() ) : |
|
62 | + if (espresso_venue_is_password_protected()) : |
|
63 | 63 | ?> |
64 | 64 | <div class="espresso-venue-dv espresso-password-protected-venue-dv" > |
65 | 65 | <h3 class="event-venues-h3 ee-event-h3"> |
66 | - <?php _e( 'Location', 'event_espresso' );?> |
|
66 | + <?php _e('Location', 'event_espresso'); ?> |
|
67 | 67 | </h3> |
68 | 68 | <?php echo espresso_password_protected_venue_form(); ?> |
69 | 69 | </div> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | $closing_tag = '</a>'; |
3 | 3 | //if this is decaf, which is put on WordPress.org, we need to inform users that |
4 | 4 | //we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12 |
5 | -if( apply_filters( 'FHEE__ee_show_affiliate_links', true ) ) { |
|
6 | - $closing_tag .= esc_html__( ' (affiliate link)', 'event_espresso' ); |
|
5 | +if (apply_filters('FHEE__ee_show_affiliate_links', true)) { |
|
6 | + $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso'); |
|
7 | 7 | } |
8 | -printf( esc_html__('PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', $closing_tag ); |
|
9 | 8 | \ No newline at end of file |
9 | +printf(esc_html__('PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">', $closing_tag); |
|
10 | 10 | \ No newline at end of file |
@@ -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 | /** |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * @return string |
54 | 54 | * @throws \EE_Error |
55 | 55 | */ |
56 | - public static function get_valid_timezone_string( $timezone_string = '' ) { |
|
56 | + public static function get_valid_timezone_string($timezone_string = '') { |
|
57 | 57 | // if passed a value, then use that, else get WP option |
58 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
58 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
59 | 59 | // value from above exists, use that, else get timezone string from gmt_offset |
60 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
61 | - EEH_DTT_Helper::validate_timezone( $timezone_string ); |
|
60 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
61 | + EEH_DTT_Helper::validate_timezone($timezone_string); |
|
62 | 62 | return $timezone_string; |
63 | 63 | } |
64 | 64 | |
@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | * @return bool |
75 | 75 | * @throws \EE_Error |
76 | 76 | */ |
77 | - public static function validate_timezone( $timezone_string, $throw_error = true ) { |
|
77 | + public static function validate_timezone($timezone_string, $throw_error = true) { |
|
78 | 78 | // easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it |
79 | 79 | try { |
80 | - new DateTimeZone( $timezone_string ); |
|
81 | - } catch ( Exception $e ) { |
|
80 | + new DateTimeZone($timezone_string); |
|
81 | + } catch (Exception $e) { |
|
82 | 82 | // sometimes we take exception to exceptions |
83 | - if ( ! $throw_error ) { |
|
83 | + if ( ! $throw_error) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | throw new EE_Error( |
87 | 87 | sprintf( |
88 | - __( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
88 | + __('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
89 | 89 | $timezone_string, |
90 | 90 | '<a href="http://www.php.net/manual/en/timezones.php">', |
91 | 91 | '</a>' |
@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | * @param string $gmt_offset |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) { |
|
107 | + public static function get_timezone_string_from_gmt_offset($gmt_offset = '') { |
|
108 | 108 | $timezone_string = 'UTC'; |
109 | - $gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' ); |
|
110 | - if ( $gmt_offset !== '' ) { |
|
109 | + $gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset'); |
|
110 | + if ($gmt_offset !== '') { |
|
111 | 111 | // convert GMT offset to seconds |
112 | 112 | $gmt_offset = $gmt_offset * HOUR_IN_SECONDS; |
113 | 113 | // account for WP offsets that aren't valid UTC |
114 | - $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset ); |
|
114 | + $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset); |
|
115 | 115 | // although we don't know the TZ abbreviation, we know the UTC offset |
116 | - $timezone_string = timezone_name_from_abbr( null, $gmt_offset ); |
|
116 | + $timezone_string = timezone_name_from_abbr(null, $gmt_offset); |
|
117 | 117 | } |
118 | 118 | // better have a valid timezone string by now, but if not, sigh... loop thru the timezone_abbreviations_list()... |
119 | - $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset ); |
|
119 | + $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset); |
|
120 | 120 | return $timezone_string; |
121 | 121 | } |
122 | 122 | |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | * @return int seconds offset |
128 | 128 | */ |
129 | 129 | public static function get_site_timezone_gmt_offset() { |
130 | - $timezone_string = get_option( 'timezone_string' ); |
|
131 | - if ( $timezone_string ) { |
|
130 | + $timezone_string = get_option('timezone_string'); |
|
131 | + if ($timezone_string) { |
|
132 | 132 | try { |
133 | - $timezone = new DateTimeZone( $timezone_string ); |
|
134 | - return $timezone->getOffset( new DateTime() ); //in WordPress DateTime defaults to UTC |
|
135 | - } catch( Exception $e ){} |
|
133 | + $timezone = new DateTimeZone($timezone_string); |
|
134 | + return $timezone->getOffset(new DateTime()); //in WordPress DateTime defaults to UTC |
|
135 | + } catch (Exception $e) {} |
|
136 | 136 | } |
137 | - $offset = get_option( 'gmt_offset' ); |
|
138 | - return (int) ( $offset * HOUR_IN_SECONDS ); |
|
137 | + $offset = get_option('gmt_offset'); |
|
138 | + return (int) ($offset * HOUR_IN_SECONDS); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param int $gmt_offset |
148 | 148 | * @return int |
149 | 149 | */ |
150 | - public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) { |
|
150 | + public static function adjust_invalid_gmt_offsets($gmt_offset = 0) { |
|
151 | 151 | //make sure $gmt_offset is int |
152 | 152 | $gmt_offset = (int) $gmt_offset; |
153 | - switch ( $gmt_offset ) { |
|
153 | + switch ($gmt_offset) { |
|
154 | 154 | |
155 | 155 | // case -30600 : |
156 | 156 | // $gmt_offset = -28800; |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | * @return string |
203 | 203 | * @throws \EE_Error |
204 | 204 | */ |
205 | - public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) { |
|
205 | + public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) { |
|
206 | 206 | $abbreviations = timezone_abbreviations_list(); |
207 | - foreach ( $abbreviations as $abbreviation ) { |
|
208 | - foreach ( $abbreviation as $city ) { |
|
209 | - if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) { |
|
207 | + foreach ($abbreviations as $abbreviation) { |
|
208 | + foreach ($abbreviation as $city) { |
|
209 | + if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) { |
|
210 | 210 | // check if the timezone is valid but don't throw any errors if it isn't |
211 | - if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) { |
|
211 | + if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) { |
|
212 | 212 | return $city['timezone_id']; |
213 | 213 | } |
214 | 214 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | throw new EE_Error( |
218 | 218 | sprintf( |
219 | - __( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
219 | + __('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
220 | 220 | $gmt_offset, |
221 | 221 | '<a href="http://www.php.net/manual/en/timezones.php">', |
222 | 222 | '</a>' |
@@ -230,23 +230,23 @@ discard block |
||
230 | 230 | * @access public |
231 | 231 | * @param string $timezone_string |
232 | 232 | */ |
233 | - public static function timezone_select_input( $timezone_string = '' ) { |
|
233 | + public static function timezone_select_input($timezone_string = '') { |
|
234 | 234 | // get WP date time format |
235 | - $datetime_format = get_option('date_format') . ' ' . get_option('time_format'); |
|
235 | + $datetime_format = get_option('date_format').' '.get_option('time_format'); |
|
236 | 236 | // if passed a value, then use that, else get WP option |
237 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
237 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
238 | 238 | // check if the timezone is valid but don't throw any errors if it isn't |
239 | - $timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false ); |
|
239 | + $timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false); |
|
240 | 240 | $gmt_offset = get_option('gmt_offset'); |
241 | 241 | |
242 | 242 | $check_zone_info = true; |
243 | - if ( empty( $timezone_string )) { |
|
243 | + if (empty($timezone_string)) { |
|
244 | 244 | // Create a UTC+- zone if no timezone string exists |
245 | 245 | $check_zone_info = false; |
246 | - if ( $gmt_offset > 0 ) { |
|
247 | - $timezone_string = 'UTC+' . $gmt_offset; |
|
248 | - } elseif ( $gmt_offset < 0 ) { |
|
249 | - $timezone_string = 'UTC' . $gmt_offset; |
|
246 | + if ($gmt_offset > 0) { |
|
247 | + $timezone_string = 'UTC+'.$gmt_offset; |
|
248 | + } elseif ($gmt_offset < 0) { |
|
249 | + $timezone_string = 'UTC'.$gmt_offset; |
|
250 | 250 | } else { |
251 | 251 | $timezone_string = 'UTC'; |
252 | 252 | } |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | __('%1$sUTC%2$s time is %3$s'), |
269 | 269 | '<abbr title="Coordinated Universal Time">', |
270 | 270 | '</abbr>', |
271 | - '<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>' |
|
271 | + '<code>'.date_i18n($datetime_format, false, 'gmt').'</code>' |
|
272 | 272 | ); |
273 | 273 | ?></span> |
274 | - <?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?> |
|
275 | - <br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span> |
|
274 | + <?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?> |
|
275 | + <br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span> |
|
276 | 276 | <?php endif; ?> |
277 | 277 | |
278 | 278 | <?php if ($check_zone_info && $timezone_string) : ?> |
@@ -304,10 +304,9 @@ discard block |
||
304 | 304 | |
305 | 305 | if ($found) { |
306 | 306 | $message = $tr['isdst'] ? |
307 | - __(' Daylight saving time begins on: %s.' ) : |
|
308 | - __(' Standard time begins on: %s.'); |
|
307 | + __(' Daylight saving time begins on: %s.') : __(' Standard time begins on: %s.'); |
|
309 | 308 | // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
310 | - printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' ); |
|
309 | + printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >'); |
|
311 | 310 | } else { |
312 | 311 | _e('This timezone does not observe daylight saving time.'); |
313 | 312 | } |
@@ -337,14 +336,14 @@ discard block |
||
337 | 336 | * |
338 | 337 | * @return int $unix_timestamp with the offset applied for the given timezone. |
339 | 338 | */ |
340 | - public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) { |
|
339 | + public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') { |
|
341 | 340 | $unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp; |
342 | - $timezone_string = self::get_valid_timezone_string( $timezone_string ); |
|
343 | - $TimeZone = new DateTimeZone( $timezone_string ); |
|
341 | + $timezone_string = self::get_valid_timezone_string($timezone_string); |
|
342 | + $TimeZone = new DateTimeZone($timezone_string); |
|
344 | 343 | |
345 | - $DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone ); |
|
346 | - $offset = timezone_offset_get( $TimeZone, $DateTime ); |
|
347 | - return (int)$DateTime->format( 'U' ) + (int)$offset; |
|
344 | + $DateTime = new DateTime('@'.$unix_timestamp, $TimeZone); |
|
345 | + $offset = timezone_offset_get($TimeZone, $DateTime); |
|
346 | + return (int) $DateTime->format('U') + (int) $offset; |
|
348 | 347 | } |
349 | 348 | |
350 | 349 | |
@@ -359,17 +358,17 @@ discard block |
||
359 | 358 | * @param string $datetime_field_name the datetime fieldname to be manipulated |
360 | 359 | * @return EE_Base_Class |
361 | 360 | */ |
362 | - protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) { |
|
361 | + protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) { |
|
363 | 362 | // grab current datetime format |
364 | 363 | $current_format = $obj->get_format(); |
365 | 364 | // set new full timestamp format |
366 | - $obj->set_date_format( EE_Datetime_Field::mysql_date_format ); |
|
367 | - $obj->set_time_format( EE_Datetime_Field::mysql_time_format ); |
|
365 | + $obj->set_date_format(EE_Datetime_Field::mysql_date_format); |
|
366 | + $obj->set_time_format(EE_Datetime_Field::mysql_time_format); |
|
368 | 367 | // set the new date value using a full timestamp format so that no data is lost |
369 | - $obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) ); |
|
368 | + $obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format)); |
|
370 | 369 | // reset datetime formats |
371 | - $obj->set_date_format( $current_format[0] ); |
|
372 | - $obj->set_time_format( $current_format[1] ); |
|
370 | + $obj->set_date_format($current_format[0]); |
|
371 | + $obj->set_time_format($current_format[1]); |
|
373 | 372 | return $obj; |
374 | 373 | } |
375 | 374 | |
@@ -386,11 +385,11 @@ discard block |
||
386 | 385 | * @param integer $value what you want to increment the time by |
387 | 386 | * @return EE_Base_Class return the EE_Base_Class object so right away you can do something with it (chaining) |
388 | 387 | */ |
389 | - public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
388 | + public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
390 | 389 | //get the raw UTC date. |
391 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
392 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value ); |
|
393 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
390 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
391 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value); |
|
392 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
394 | 393 | } |
395 | 394 | |
396 | 395 | |
@@ -405,11 +404,11 @@ discard block |
||
405 | 404 | * @param int $value |
406 | 405 | * @return \EE_Base_Class |
407 | 406 | */ |
408 | - public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
407 | + public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
409 | 408 | //get the raw UTC date |
410 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
411 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' ); |
|
412 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
409 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
410 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-'); |
|
411 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
413 | 412 | } |
414 | 413 | |
415 | 414 | |
@@ -422,44 +421,44 @@ discard block |
||
422 | 421 | * @return \DateTime return whatever type came in. |
423 | 422 | * @throws \EE_Error |
424 | 423 | */ |
425 | - protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) { |
|
426 | - if ( ! $DateTime instanceof DateTime ) { |
|
424 | + protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') { |
|
425 | + if ( ! $DateTime instanceof DateTime) { |
|
427 | 426 | throw new EE_Error( |
428 | 427 | sprintf( |
429 | - __( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ), |
|
430 | - print_r( $DateTime, true ) |
|
428 | + __('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'), |
|
429 | + print_r($DateTime, true) |
|
431 | 430 | ) |
432 | 431 | ); |
433 | 432 | } |
434 | - switch ( $period ) { |
|
433 | + switch ($period) { |
|
435 | 434 | case 'years' : |
436 | - $value = 'P' . $value . 'Y'; |
|
435 | + $value = 'P'.$value.'Y'; |
|
437 | 436 | break; |
438 | 437 | case 'months' : |
439 | - $value = 'P' . $value . 'M'; |
|
438 | + $value = 'P'.$value.'M'; |
|
440 | 439 | break; |
441 | 440 | case 'weeks' : |
442 | - $value = 'P' . $value . 'W'; |
|
441 | + $value = 'P'.$value.'W'; |
|
443 | 442 | break; |
444 | 443 | case 'days' : |
445 | - $value = 'P' . $value . 'D'; |
|
444 | + $value = 'P'.$value.'D'; |
|
446 | 445 | break; |
447 | 446 | case 'hours' : |
448 | - $value = 'PT' . $value . 'H'; |
|
447 | + $value = 'PT'.$value.'H'; |
|
449 | 448 | break; |
450 | 449 | case 'minutes' : |
451 | - $value = 'PT' . $value . 'M'; |
|
450 | + $value = 'PT'.$value.'M'; |
|
452 | 451 | break; |
453 | 452 | case 'seconds' : |
454 | - $value = 'PT' . $value . 'S'; |
|
453 | + $value = 'PT'.$value.'S'; |
|
455 | 454 | break; |
456 | 455 | } |
457 | - switch ( $operand ) { |
|
456 | + switch ($operand) { |
|
458 | 457 | case '+': |
459 | - $DateTime->add( new DateInterval( $value ) ); |
|
458 | + $DateTime->add(new DateInterval($value)); |
|
460 | 459 | break; |
461 | 460 | case '-': |
462 | - $DateTime->sub( new DateInterval( $value ) ); |
|
461 | + $DateTime->sub(new DateInterval($value)); |
|
463 | 462 | break; |
464 | 463 | } |
465 | 464 | return $DateTime; |
@@ -475,16 +474,16 @@ discard block |
||
475 | 474 | * @return \DateTime return whatever type came in. |
476 | 475 | * @throws \EE_Error |
477 | 476 | */ |
478 | - protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
479 | - if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) { |
|
477 | + protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
478 | + if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) { |
|
480 | 479 | throw new EE_Error( |
481 | 480 | sprintf( |
482 | - __( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ), |
|
483 | - print_r( $timestamp, true ) |
|
481 | + __('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'), |
|
482 | + print_r($timestamp, true) |
|
484 | 483 | ) |
485 | 484 | ); |
486 | 485 | } |
487 | - switch ( $period ) { |
|
486 | + switch ($period) { |
|
488 | 487 | case 'years' : |
489 | 488 | $value = YEAR_IN_SECONDS * $value; |
490 | 489 | break; |
@@ -504,9 +503,9 @@ discard block |
||
504 | 503 | $value = MINUTE_IN_SECONDS * $value; |
505 | 504 | break; |
506 | 505 | } |
507 | - switch ( $operand ) { |
|
506 | + switch ($operand) { |
|
508 | 507 | case '+': |
509 | - $timestamp += $value; |
|
508 | + $timestamp += $value; |
|
510 | 509 | break; |
511 | 510 | case '-': |
512 | 511 | $timestamp -= $value; |
@@ -526,11 +525,11 @@ discard block |
||
526 | 525 | * @param string $operand What operand you wish to use for the calculation |
527 | 526 | * @return mixed string|DateTime return whatever type came in. |
528 | 527 | */ |
529 | - public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
530 | - if ( $DateTime_or_timestamp instanceof DateTime ) { |
|
531 | - return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand ); |
|
532 | - } else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) { |
|
533 | - return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand ); |
|
528 | + public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
529 | + if ($DateTime_or_timestamp instanceof DateTime) { |
|
530 | + return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand); |
|
531 | + } else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) { |
|
532 | + return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand); |
|
534 | 533 | } else { |
535 | 534 | //error |
536 | 535 | return $DateTime_or_timestamp; |
@@ -560,24 +559,24 @@ discard block |
||
560 | 559 | * 'moment' => //date and time format. |
561 | 560 | * ) |
562 | 561 | */ |
563 | - public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) { |
|
564 | - if ( $date_format_string === null ) { |
|
565 | - $date_format_string = get_option( 'date_format' ); |
|
562 | + public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) { |
|
563 | + if ($date_format_string === null) { |
|
564 | + $date_format_string = get_option('date_format'); |
|
566 | 565 | } |
567 | 566 | |
568 | - if ( $time_format_string === null ) { |
|
569 | - $time_format_string = get_option( 'time_format' ); |
|
567 | + if ($time_format_string === null) { |
|
568 | + $time_format_string = get_option('time_format'); |
|
570 | 569 | } |
571 | 570 | |
572 | - $date_format = self::_php_to_js_moment_converter( $date_format_string ); |
|
573 | - $time_format = self::_php_to_js_moment_converter( $time_format_string ); |
|
571 | + $date_format = self::_php_to_js_moment_converter($date_format_string); |
|
572 | + $time_format = self::_php_to_js_moment_converter($time_format_string); |
|
574 | 573 | |
575 | 574 | return array( |
576 | 575 | 'js' => array( |
577 | 576 | 'date' => $date_format['js'], |
578 | 577 | 'time' => $time_format['js'] |
579 | 578 | ), |
580 | - 'moment' => $date_format['moment'] . ' ' . $time_format['moment' ] |
|
579 | + 'moment' => $date_format['moment'].' '.$time_format['moment'] |
|
581 | 580 | ); |
582 | 581 | } |
583 | 582 | |
@@ -591,7 +590,7 @@ discard block |
||
591 | 590 | * |
592 | 591 | * @return array js and moment formats. |
593 | 592 | */ |
594 | - protected static function _php_to_js_moment_converter( $format_string ) { |
|
593 | + protected static function _php_to_js_moment_converter($format_string) { |
|
595 | 594 | /** |
596 | 595 | * This is a map of symbols for formats. |
597 | 596 | * The index is the php symbol, the equivalent values are in the array. |
@@ -748,15 +747,15 @@ discard block |
||
748 | 747 | $jquery_ui_format = ""; |
749 | 748 | $moment_format = ""; |
750 | 749 | $escaping = false; |
751 | - for ( $i = 0; $i < strlen($format_string); $i++ ) { |
|
750 | + for ($i = 0; $i < strlen($format_string); $i++) { |
|
752 | 751 | $char = $format_string[$i]; |
753 | - if ( $char === '\\' ) { // PHP date format escaping character |
|
752 | + if ($char === '\\') { // PHP date format escaping character |
|
754 | 753 | $i++; |
755 | - if ( $escaping ) { |
|
754 | + if ($escaping) { |
|
756 | 755 | $jquery_ui_format .= $format_string[$i]; |
757 | 756 | $moment_format .= $format_string[$i]; |
758 | 757 | } else { |
759 | - $jquery_ui_format .= '\'' . $format_string[$i]; |
|
758 | + $jquery_ui_format .= '\''.$format_string[$i]; |
|
760 | 759 | $moment_format .= $format_string[$i]; |
761 | 760 | } |
762 | 761 | $escaping = true; |
@@ -775,7 +774,7 @@ discard block |
||
775 | 774 | } |
776 | 775 | } |
777 | 776 | } |
778 | - return array( 'js' => $jquery_ui_format, 'moment' => $moment_format ); |
|
777 | + return array('js' => $jquery_ui_format, 'moment' => $moment_format); |
|
779 | 778 | } |
780 | 779 | |
781 | 780 | |
@@ -790,25 +789,25 @@ discard block |
||
790 | 789 | * errors is returned. So for client code calling, check for is_array() to |
791 | 790 | * indicate failed validations. |
792 | 791 | */ |
793 | - public static function validate_format_string( $format_string ) { |
|
792 | + public static function validate_format_string($format_string) { |
|
794 | 793 | $error_msg = array(); |
795 | 794 | //time format checks |
796 | - switch ( true ) { |
|
797 | - case strpos( $format_string, 'h' ) !== false : |
|
798 | - case strpos( $format_string, 'g' ) !== false : |
|
795 | + switch (true) { |
|
796 | + case strpos($format_string, 'h') !== false : |
|
797 | + case strpos($format_string, 'g') !== false : |
|
799 | 798 | /** |
800 | 799 | * if the time string has a lowercase 'h' which == 12 hour time format and there |
801 | 800 | * is not any ante meridiem format ('a' or 'A'). Then throw an error because its |
802 | 801 | * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am. |
803 | 802 | */ |
804 | - if ( strpos( strtoupper( $format_string ), 'A' ) === false ) { |
|
805 | - $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' ); |
|
803 | + if (strpos(strtoupper($format_string), 'A') === false) { |
|
804 | + $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso'); |
|
806 | 805 | } |
807 | 806 | break; |
808 | 807 | |
809 | 808 | } |
810 | 809 | |
811 | - return empty( $error_msg ) ? true : $error_msg; |
|
810 | + return empty($error_msg) ? true : $error_msg; |
|
812 | 811 | } |
813 | 812 | |
814 | 813 | |
@@ -830,11 +829,11 @@ discard block |
||
830 | 829 | * @param mixed $date_2 |
831 | 830 | * @return bool |
832 | 831 | */ |
833 | - public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) { |
|
832 | + public static function dates_represent_one_24_hour_date($date_1, $date_2) { |
|
834 | 833 | |
835 | 834 | if ( |
836 | - ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) || |
|
837 | - ( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' ) |
|
835 | + ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) || |
|
836 | + ($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00') |
|
838 | 837 | ) { |
839 | 838 | return false; |
840 | 839 | } |
@@ -851,11 +850,11 @@ discard block |
||
851 | 850 | * @param string $field_for_interval The Database field that is the interval is applied to in the query. |
852 | 851 | * @return string |
853 | 852 | */ |
854 | - public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) { |
|
853 | + public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) { |
|
855 | 854 | try { |
856 | 855 | /** need to account for timezone offset on the selects */ |
857 | - $DateTimeZone = new DateTimeZone( $timezone_string ); |
|
858 | - } catch ( Exception $e ) { |
|
856 | + $DateTimeZone = new DateTimeZone($timezone_string); |
|
857 | + } catch (Exception $e) { |
|
859 | 858 | $DateTimeZone = null; |
860 | 859 | } |
861 | 860 | |
@@ -863,10 +862,10 @@ discard block |
||
863 | 862 | * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds. |
864 | 863 | * Hence we do the calc for DateTimeZone::getOffset. |
865 | 864 | */ |
866 | - $offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' ); |
|
865 | + $offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset'); |
|
867 | 866 | $query_interval = $offset < 0 |
868 | - ? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)' |
|
869 | - : 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)'; |
|
867 | + ? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)' |
|
868 | + : 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)'; |
|
870 | 869 | return $query_interval; |
871 | 870 | } |
872 | 871 | |
@@ -878,47 +877,47 @@ discard block |
||
878 | 877 | * @return string |
879 | 878 | */ |
880 | 879 | public static function get_timezone_string_for_display() { |
881 | - $pretty_timezone = apply_filters( 'FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '' ); |
|
882 | - if( ! empty( $pretty_timezone ) ) { |
|
883 | - return esc_html( $pretty_timezone ); |
|
880 | + $pretty_timezone = apply_filters('FHEE__EEH_DTT_Helper__get_timezone_string_for_display', ''); |
|
881 | + if ( ! empty($pretty_timezone)) { |
|
882 | + return esc_html($pretty_timezone); |
|
884 | 883 | } |
885 | - $timezone_string = get_option( 'timezone_string' ); |
|
886 | - if( $timezone_string ) { |
|
884 | + $timezone_string = get_option('timezone_string'); |
|
885 | + if ($timezone_string) { |
|
887 | 886 | static $mo_loaded = false; |
888 | 887 | // Load translations for continents and cities just like wp_timezone_choice does |
889 | - if ( ! $mo_loaded ) { |
|
888 | + if ( ! $mo_loaded) { |
|
890 | 889 | $locale = get_locale(); |
891 | - $mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo'; |
|
892 | - load_textdomain( 'continents-cities', $mofile ); |
|
890 | + $mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo'; |
|
891 | + load_textdomain('continents-cities', $mofile); |
|
893 | 892 | $mo_loaded = true; |
894 | 893 | } |
895 | 894 | //well that was easy. |
896 | - $parts = explode('/', $timezone_string ); |
|
895 | + $parts = explode('/', $timezone_string); |
|
897 | 896 | //remove the continent |
898 | - unset( $parts[0] ); |
|
897 | + unset($parts[0]); |
|
899 | 898 | $t_parts = array(); |
900 | - foreach( $parts as $part ) { |
|
901 | - $t_parts[] = translate( str_replace( '_', ' ', $part ), 'continents-cities' ); |
|
899 | + foreach ($parts as $part) { |
|
900 | + $t_parts[] = translate(str_replace('_', ' ', $part), 'continents-cities'); |
|
902 | 901 | } |
903 | - return implode( ' - ', $t_parts ); |
|
902 | + return implode(' - ', $t_parts); |
|
904 | 903 | } |
905 | 904 | //they haven't set the timezone string, so let's return a string like "UTC+1" |
906 | - $gmt_offset = get_option( 'gmt_offset' ); |
|
907 | - if( intval( $gmt_offset ) >= 0 ) { |
|
905 | + $gmt_offset = get_option('gmt_offset'); |
|
906 | + if (intval($gmt_offset) >= 0) { |
|
908 | 907 | $prefix = '+'; |
909 | 908 | } else { |
910 | 909 | $prefix = ''; |
911 | 910 | } |
912 | - $parts = explode( '.', (string) $gmt_offset ); |
|
913 | - if( count( $parts ) === 1 ) { |
|
911 | + $parts = explode('.', (string) $gmt_offset); |
|
912 | + if (count($parts) === 1) { |
|
914 | 913 | $parts[1] = '00'; |
915 | 914 | } else { |
916 | 915 | //convert the part after the decimal, eg "5" (from x.5) or "25" (from x.25) |
917 | 916 | //to minutes, eg 30 or 15, respectively |
918 | - $hour_fraction = (float)( '0.' . $parts[1] ); |
|
919 | - $parts[1] = (string)$hour_fraction * 60; |
|
917 | + $hour_fraction = (float) ('0.'.$parts[1]); |
|
918 | + $parts[1] = (string) $hour_fraction * 60; |
|
920 | 919 | } |
921 | - return sprintf( __( 'UTC%1$s', 'event_espresso' ), $prefix . implode( ':', $parts ) ); |
|
920 | + return sprintf(__('UTC%1$s', 'event_espresso'), $prefix.implode(':', $parts)); |
|
922 | 921 | } |
923 | 922 | |
924 | 923 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * @param string $email_address |
15 | 15 | * @return string |
16 | 16 | */ |
17 | - function prepare_for_set($email_address ) { |
|
17 | + function prepare_for_set($email_address) { |
|
18 | 18 | $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
19 | 19 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
20 | 20 | : 'wp_default'; |
@@ -15,27 +15,27 @@ |
||
15 | 15 | * @type bool $show_gravatar whether to show gravatar or not. |
16 | 16 | */ |
17 | 17 | |
18 | -$no_attendees_message = apply_filters( 'FHEE__loop-espresso_attendees-shortcode__template__no_attendees_message', __('No Attendees Yet', 'event_espresso' ) ); |
|
18 | +$no_attendees_message = apply_filters('FHEE__loop-espresso_attendees-shortcode__template__no_attendees_message', __('No Attendees Yet', 'event_espresso')); |
|
19 | 19 | |
20 | 20 | |
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div class="event-attendees"> |
24 | - <?php do_action( 'AHEE__loop-espresso_event_attendees__before', $contacts, $event, $datetime, $ticket, $show_gravatar ); ?> |
|
25 | - <?php if ( $contacts ) : ?> |
|
24 | + <?php do_action('AHEE__loop-espresso_event_attendees__before', $contacts, $event, $datetime, $ticket, $show_gravatar); ?> |
|
25 | + <?php if ($contacts) : ?> |
|
26 | 26 | <ul class="event-attendees-list"> |
27 | - <?php foreach( $contacts as $contact ) : |
|
28 | - EEH_Template::get_template_part( 'content', 'espresso_event_attendees', array( |
|
27 | + <?php foreach ($contacts as $contact) : |
|
28 | + EEH_Template::get_template_part('content', 'espresso_event_attendees', array( |
|
29 | 29 | 'contact' => $contact, |
30 | 30 | 'event' => $event, |
31 | 31 | 'datetime' => $datetime, |
32 | 32 | 'ticket' => $ticket, |
33 | 33 | 'show_gravatar' => $show_gravatar |
34 | - ) ); |
|
34 | + )); |
|
35 | 35 | endforeach; ?> |
36 | 36 | </ul> |
37 | 37 | <?php else : ?> |
38 | 38 | <p><?php echo $no_attendees_message; ?></p> |
39 | 39 | <?php endif; ?> |
40 | - <?php do_action( 'AHEE__loop-espresso_event_attendees__after', $contacts, $event, $datetime, $ticket, $show_gravatar ); ?> |
|
40 | + <?php do_action('AHEE__loop-espresso_event_attendees__after', $contacts, $event, $datetime, $ticket, $show_gravatar); ?> |
|
41 | 41 | </div> |
42 | 42 | \ No newline at end of file |
@@ -58,7 +58,7 @@ |
||
58 | 58 | */ |
59 | 59 | public function processCapCheck($cap_check) |
60 | 60 | { |
61 | - if (is_array($cap_check)){ |
|
61 | + if (is_array($cap_check)) { |
|
62 | 62 | foreach ($cap_check as $check) { |
63 | 63 | $this->processCapCheck($check); |
64 | 64 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use EventEspresso\core\exceptions\InvalidClassException; |
6 | 6 | |
7 | 7 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
8 | - exit('No direct script access allowed'); |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | |
@@ -21,89 +21,89 @@ discard block |
||
21 | 21 | class CapabilitiesChecker |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * @type \EE_Capabilities $capabilities |
|
26 | - */ |
|
27 | - private $capabilities; |
|
28 | - |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * CapabilitiesChecker constructor |
|
33 | - * |
|
34 | - * @param \EE_Capabilities $capabilities |
|
35 | - */ |
|
36 | - public function __construct(\EE_Capabilities $capabilities) |
|
37 | - { |
|
38 | - $this->capabilities = $capabilities; |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @return \EE_Capabilities |
|
45 | - */ |
|
46 | - protected function capabilities() |
|
47 | - { |
|
48 | - return $this->capabilities; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
55 | - * If any of the individual capability checks fails, then the command will NOT be executed. |
|
56 | - * |
|
57 | - * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
58 | - * @return bool |
|
59 | - * @throws InvalidClassException |
|
60 | - * @throws InsufficientPermissionsException |
|
61 | - */ |
|
62 | - public function processCapCheck($cap_check) |
|
63 | - { |
|
64 | - if (is_array($cap_check)){ |
|
65 | - foreach ($cap_check as $check) { |
|
66 | - $this->processCapCheck($check); |
|
67 | - } |
|
68 | - return true; |
|
69 | - } |
|
70 | - // at this point, $cap_check should be an individual instance of CapCheck |
|
71 | - if ( ! $cap_check instanceof CapCheckInterface) { |
|
72 | - throw new InvalidClassException( |
|
73 | - '\EventEspresso\core\domain\services\capabilities\CapCheckInterface' |
|
74 | - ); |
|
75 | - } |
|
76 | - // sometimes cap checks are conditional, and no capabilities are required |
|
77 | - if ($cap_check instanceof PublicCapabilities) { |
|
78 | - return true; |
|
79 | - } |
|
80 | - $capabilities = (array) $cap_check->capability(); |
|
81 | - foreach ($capabilities as $capability) { |
|
82 | - if ( |
|
83 | - ! $this->capabilities()->current_user_can( |
|
84 | - $capability, |
|
85 | - $cap_check->context(), |
|
86 | - $cap_check->ID() |
|
87 | - ) |
|
88 | - ) { |
|
89 | - throw new InsufficientPermissionsException($cap_check->context()); |
|
90 | - } |
|
91 | - } |
|
92 | - return true; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - |
|
97 | - /** |
|
98 | - * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
99 | - * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
100 | - * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
101 | - * @return bool |
|
102 | - */ |
|
103 | - public function process($capability, $context, $ID = 0) |
|
104 | - { |
|
105 | - return $this->processCapCheck(new CapCheck($capability, $context, $ID)); |
|
106 | - } |
|
24 | + /** |
|
25 | + * @type \EE_Capabilities $capabilities |
|
26 | + */ |
|
27 | + private $capabilities; |
|
28 | + |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * CapabilitiesChecker constructor |
|
33 | + * |
|
34 | + * @param \EE_Capabilities $capabilities |
|
35 | + */ |
|
36 | + public function __construct(\EE_Capabilities $capabilities) |
|
37 | + { |
|
38 | + $this->capabilities = $capabilities; |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @return \EE_Capabilities |
|
45 | + */ |
|
46 | + protected function capabilities() |
|
47 | + { |
|
48 | + return $this->capabilities; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
55 | + * If any of the individual capability checks fails, then the command will NOT be executed. |
|
56 | + * |
|
57 | + * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
58 | + * @return bool |
|
59 | + * @throws InvalidClassException |
|
60 | + * @throws InsufficientPermissionsException |
|
61 | + */ |
|
62 | + public function processCapCheck($cap_check) |
|
63 | + { |
|
64 | + if (is_array($cap_check)){ |
|
65 | + foreach ($cap_check as $check) { |
|
66 | + $this->processCapCheck($check); |
|
67 | + } |
|
68 | + return true; |
|
69 | + } |
|
70 | + // at this point, $cap_check should be an individual instance of CapCheck |
|
71 | + if ( ! $cap_check instanceof CapCheckInterface) { |
|
72 | + throw new InvalidClassException( |
|
73 | + '\EventEspresso\core\domain\services\capabilities\CapCheckInterface' |
|
74 | + ); |
|
75 | + } |
|
76 | + // sometimes cap checks are conditional, and no capabilities are required |
|
77 | + if ($cap_check instanceof PublicCapabilities) { |
|
78 | + return true; |
|
79 | + } |
|
80 | + $capabilities = (array) $cap_check->capability(); |
|
81 | + foreach ($capabilities as $capability) { |
|
82 | + if ( |
|
83 | + ! $this->capabilities()->current_user_can( |
|
84 | + $capability, |
|
85 | + $cap_check->context(), |
|
86 | + $cap_check->ID() |
|
87 | + ) |
|
88 | + ) { |
|
89 | + throw new InsufficientPermissionsException($cap_check->context()); |
|
90 | + } |
|
91 | + } |
|
92 | + return true; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + |
|
97 | + /** |
|
98 | + * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
99 | + * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
100 | + * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | + public function process($capability, $context, $ID = 0) |
|
104 | + { |
|
105 | + return $this->processCapCheck(new CapCheck($capability, $context, $ID)); |
|
106 | + } |
|
107 | 107 | |
108 | 108 | |
109 | 109 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // filter to allow global setting of display_code |
448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
449 | 449 | |
450 | 450 | // add currency code ? |
451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
452 | 452 | } |
453 | 453 | // filter results |
454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
455 | 455 | } |
456 | 456 | // clean up vars |
457 | - unset( $mny ); |
|
457 | + unset($mny); |
|
458 | 458 | // return formatted currency amount |
459 | 459 | return $amount_formatted; |
460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
470 | 470 | * @return string The localized label for the status id. |
471 | 471 | */ |
472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
473 | 473 | /** @type EEM_Status $EEM_Status */ |
474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
476 | - return $status[ $status_id ]; |
|
474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
476 | + return $status[$status_id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -488,21 +488,21 @@ discard block |
||
488 | 488 | * @param string $title |
489 | 489 | * @return string the html output for the button |
490 | 490 | */ |
491 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
491 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
492 | 492 | $icon_html = ''; |
493 | - if ( ! empty( $icon ) ) { |
|
494 | - $dashicons = preg_split( "(ee-icon |dashicons )", $icon ); |
|
495 | - $dashicons = array_filter( $dashicons ); |
|
496 | - $count = count( $dashicons ); |
|
493 | + if ( ! empty($icon)) { |
|
494 | + $dashicons = preg_split("(ee-icon |dashicons )", $icon); |
|
495 | + $dashicons = array_filter($dashicons); |
|
496 | + $count = count($dashicons); |
|
497 | 497 | $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : ''; |
498 | - foreach ( $dashicons as $dashicon ) { |
|
499 | - $type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | - $icon_html .= '<span class="' . $type . $dashicon . '"></span>'; |
|
498 | + foreach ($dashicons as $dashicon) { |
|
499 | + $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | + $icon_html .= '<span class="'.$type.$dashicon.'"></span>'; |
|
501 | 501 | } |
502 | 502 | $icon_html .= $count > 1 ? '</span>' : ''; |
503 | 503 | } |
504 | - $label = ! empty( $icon ) ? $icon_html . $label : $label; |
|
505 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
504 | + $label = ! empty($icon) ? $icon_html.$label : $label; |
|
505 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
506 | 506 | return $button; |
507 | 507 | } |
508 | 508 | |
@@ -519,21 +519,21 @@ discard block |
||
519 | 519 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
520 | 520 | * @return string generated link |
521 | 521 | */ |
522 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
522 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
523 | 523 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
524 | + if ( ! $page) |
|
525 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
526 | 526 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
527 | + if ( ! $action) |
|
528 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
529 | 529 | |
530 | 530 | $action = empty($action) ? 'default' : $action; |
531 | 531 | |
532 | 532 | |
533 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
534 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | - $help_text = !$help_text ? '' : $help_text; |
|
536 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
533 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
534 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | + $help_text = ! $help_text ? '' : $help_text; |
|
536 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param EE_Help_Tour |
546 | 546 | * @return string html |
547 | 547 | */ |
548 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
548 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
549 | 549 | $id = $tour->get_slug(); |
550 | 550 | $stops = $tour->get_stops(); |
551 | 551 | |
552 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
552 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
553 | 553 | |
554 | - foreach ( $stops as $stop ) { |
|
555 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
556 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
554 | + foreach ($stops as $stop) { |
|
555 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
556 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
557 | 557 | |
558 | 558 | //if container is set to modal then let's make sure we set the options accordingly |
559 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
559 | + if (empty($data_id) && empty($data_class)) { |
|
560 | 560 | $stop['options']['modal'] = true; |
561 | 561 | $stop['options']['expose'] = true; |
562 | 562 | } |
563 | 563 | |
564 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
565 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
564 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
565 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
566 | 566 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
567 | 567 | |
568 | 568 | //options |
569 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
569 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
570 | 570 | $options = ' data-options="'; |
571 | - foreach ( $stop['options'] as $option => $value ) { |
|
572 | - $options .= $option . ':' . $value . ';'; |
|
571 | + foreach ($stop['options'] as $option => $value) { |
|
572 | + $options .= $option.':'.$value.';'; |
|
573 | 573 | } |
574 | 574 | $options .= '"'; |
575 | 575 | } else { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | //let's put all together |
580 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
580 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $content .= '</ol>'; |
@@ -598,31 +598,31 @@ discard block |
||
598 | 598 | * @throws EE_Error |
599 | 599 | * @return string html structure for status. |
600 | 600 | */ |
601 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
601 | + public static function status_legend($status_array, $active_status = '') { |
|
602 | + if ( ! is_array($status_array)) |
|
603 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
604 | 604 | |
605 | 605 | $setup_array = array(); |
606 | - foreach ( $status_array as $item => $status ) { |
|
606 | + foreach ($status_array as $item => $status) { |
|
607 | 607 | $setup_array[$item] = array( |
608 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
609 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
608 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
609 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
610 | 610 | 'status' => $status |
611 | 611 | ); |
612 | 612 | } |
613 | 613 | |
614 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
615 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
616 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
617 | - foreach ( $setup_array as $item => $details ) { |
|
614 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
615 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
616 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
617 | + foreach ($setup_array as $item => $details) { |
|
618 | 618 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
619 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
620 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
621 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
622 | - $content .= '</dt>' . "\n"; |
|
619 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
620 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
621 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
622 | + $content .= '</dt>'."\n"; |
|
623 | 623 | } |
624 | - $content .= '</dl>' . "\n"; |
|
625 | - $content .= '</div>' . "\n"; |
|
624 | + $content .= '</dl>'."\n"; |
|
625 | + $content .= '</div>'."\n"; |
|
626 | 626 | return $content; |
627 | 627 | } |
628 | 628 | |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | */ |
637 | 637 | public static function layout_array_as_table($data) { |
638 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
639 | - $data = (array)$data; |
|
638 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
639 | + $data = (array) $data; |
|
640 | 640 | } |
641 | 641 | ob_start(); |
642 | 642 | if (is_array($data)) { |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <td> |
652 | - <?php echo $data_key;?> |
|
652 | + <?php echo $data_key; ?> |
|
653 | 653 | </td> |
654 | 654 | <td> |
655 | - <?php echo self::layout_array_as_table($data_values);?> |
|
655 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
656 | 656 | </td> |
657 | 657 | </tr> |
658 | 658 | <?php |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | <ul> |
667 | 667 | <?php |
668 | 668 | foreach ($data as $datum) { |
669 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
669 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
670 | 670 | }?> |
671 | 671 | </ul> |
672 | 672 | <?php |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
700 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
699 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
700 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * ) |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
724 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
725 | 725 | $page_links = array(); |
726 | 726 | $disable_first = $disable_last = ''; |
727 | 727 | $total_items = (int) $total_items; |
728 | 728 | $per_page = (int) $per_page; |
729 | 729 | $current = (int) $current; |
730 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
730 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
731 | 731 | |
732 | 732 | //filter items_label |
733 | 733 | $items_label = apply_filters( |
@@ -735,68 +735,68 @@ discard block |
||
735 | 735 | $items_label |
736 | 736 | ); |
737 | 737 | |
738 | - if ( empty( $items_label ) |
|
739 | - || ! is_array( $items_label ) |
|
740 | - || ! isset( $items_label['single'] ) |
|
741 | - || ! isset( $items_label['plural'] ) ) { |
|
738 | + if (empty($items_label) |
|
739 | + || ! is_array($items_label) |
|
740 | + || ! isset($items_label['single']) |
|
741 | + || ! isset($items_label['plural'])) { |
|
742 | 742 | $items_label = array( |
743 | - 'single' => __( '1 item', 'event_espresso' ), |
|
744 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
743 | + 'single' => __('1 item', 'event_espresso'), |
|
744 | + 'plural' => __('%s items', 'event_espresso') |
|
745 | 745 | ); |
746 | 746 | } else { |
747 | 747 | $items_label = array( |
748 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
749 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
748 | + 'single' => '1 '.esc_html($items_label['single']), |
|
749 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
753 | - $total_pages = ceil( $total_items / $per_page ); |
|
753 | + $total_pages = ceil($total_items / $per_page); |
|
754 | 754 | |
755 | - if ( $total_pages <= 1 ) |
|
755 | + if ($total_pages <= 1) |
|
756 | 756 | return ''; |
757 | 757 | |
758 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
758 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
759 | 759 | |
760 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
760 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
761 | 761 | |
762 | - if ( $current === 1 ) { |
|
762 | + if ($current === 1) { |
|
763 | 763 | $disable_first = ' disabled'; |
764 | 764 | } |
765 | - if ( $current == $total_pages ) { |
|
765 | + if ($current == $total_pages) { |
|
766 | 766 | $disable_last = ' disabled'; |
767 | 767 | } |
768 | 768 | |
769 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | - 'first-page' . $disable_first, |
|
771 | - esc_attr__( 'Go to the first page' ), |
|
772 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
769 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | + 'first-page'.$disable_first, |
|
771 | + esc_attr__('Go to the first page'), |
|
772 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
773 | 773 | '«' |
774 | 774 | ); |
775 | 775 | |
776 | 776 | $page_links[] = sprintf( |
777 | 777 | '<a class="%s" title="%s" href="%s">%s</a>', |
778 | - 'prev-page' . $disable_first, |
|
779 | - esc_attr__( 'Go to the previous page' ), |
|
780 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
778 | + 'prev-page'.$disable_first, |
|
779 | + esc_attr__('Go to the previous page'), |
|
780 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
781 | 781 | '‹' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( ! $show_num_field ) { |
|
784 | + if ( ! $show_num_field) { |
|
785 | 785 | $html_current_page = $current; |
786 | 786 | } else { |
787 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | - esc_attr__( 'Current page' ), |
|
787 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | + esc_attr__('Current page'), |
|
789 | 789 | $current, |
790 | - strlen( $total_pages ) |
|
790 | + strlen($total_pages) |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 | |
794 | 794 | $html_total_pages = sprintf( |
795 | 795 | '<span class="total-pages">%s</span>', |
796 | - number_format_i18n( $total_pages ) |
|
796 | + number_format_i18n($total_pages) |
|
797 | 797 | ); |
798 | 798 | $page_links[] = sprintf( |
799 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
799 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
800 | 800 | $html_current_page, |
801 | 801 | $html_total_pages, |
802 | 802 | '<span class="paging-input">', |
@@ -805,29 +805,29 @@ discard block |
||
805 | 805 | |
806 | 806 | $page_links[] = sprintf( |
807 | 807 | '<a class="%s" title="%s" href="%s">%s</a>', |
808 | - 'next-page' . $disable_last, |
|
809 | - esc_attr__( 'Go to the next page' ), |
|
810 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
808 | + 'next-page'.$disable_last, |
|
809 | + esc_attr__('Go to the next page'), |
|
810 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
811 | 811 | '›' |
812 | 812 | ); |
813 | 813 | |
814 | 814 | $page_links[] = sprintf( |
815 | 815 | '<a class="%s" title="%s" href="%s">%s</a>', |
816 | - 'last-page' . $disable_last, |
|
817 | - esc_attr__( 'Go to the last page' ), |
|
818 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
816 | + 'last-page'.$disable_last, |
|
817 | + esc_attr__('Go to the last page'), |
|
818 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
819 | 819 | '»' |
820 | 820 | ); |
821 | 821 | |
822 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
822 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
823 | 823 | // set page class |
824 | - if ( $total_pages ) { |
|
824 | + if ($total_pages) { |
|
825 | 825 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
826 | 826 | } else { |
827 | 827 | $page_class = ' no-pages'; |
828 | 828 | } |
829 | 829 | |
830 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
830 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
844 | 844 | |
845 | 845 | |
846 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
846 | +if ( ! function_exists('espresso_pagination')) { |
|
847 | 847 | /** |
848 | 848 | * espresso_pagination |
849 | 849 | * |
@@ -855,21 +855,21 @@ discard block |
||
855 | 855 | $big = 999999999; // need an unlikely integer |
856 | 856 | $pagination = paginate_links( |
857 | 857 | array( |
858 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
858 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
859 | 859 | 'format' => '?paged=%#%', |
860 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
860 | + 'current' => max(1, get_query_var('paged')), |
|
861 | 861 | 'total' => $wp_query->max_num_pages, |
862 | 862 | 'show_all' => true, |
863 | 863 | 'end_size' => 10, |
864 | 864 | 'mid_size' => 6, |
865 | 865 | 'prev_next' => true, |
866 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
867 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
866 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
867 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
868 | 868 | 'type' => 'plain', |
869 | 869 | 'add_args' => false, |
870 | 870 | 'add_fragment' => '' |
871 | 871 | ) |
872 | 872 | ); |
873 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
873 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
874 | 874 | } |
875 | 875 | } |
876 | 876 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -21,35 +21,35 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param EE_PMT_Paypal_Standard $payment_method_type |
23 | 23 | */ |
24 | - public function __construct( $payment_method_type ){ |
|
24 | + public function __construct($payment_method_type) { |
|
25 | 25 | parent::__construct( |
26 | 26 | array( |
27 | 27 | 'payment_method_type' => $payment_method_type, |
28 | 28 | 'extra_meta_inputs' => array( |
29 | - 'paypal_id' => new EE_Text_Input( array( |
|
30 | - 'html_label_text' => sprintf( __( "Paypal Email %s", 'event_espresso' ), $payment_method_type->get_help_tab_link() ), |
|
31 | - 'html_help_text' => __( "Typically [email protected]", 'event_espresso' ), |
|
29 | + 'paypal_id' => new EE_Text_Input(array( |
|
30 | + 'html_label_text' => sprintf(__("Paypal Email %s", 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
31 | + 'html_help_text' => __("Typically [email protected]", 'event_espresso'), |
|
32 | 32 | 'required' => true |
33 | - ) ), |
|
34 | - 'image_url' => new EE_Admin_File_Uploader_Input( array( |
|
35 | - 'html_help_text' => __( "Used for your business/personal logo on the PayPal page", 'event_espresso' ), |
|
36 | - 'html_label_text' => __( 'Image URL', 'event_espresso' ) |
|
37 | - ) ), |
|
38 | - 'paypal_taxes' => new EE_Yes_No_Input( array( |
|
39 | - 'html_label_text' => sprintf( __( 'Paypal Calculates Taxes %s', 'event_espresso' ), $payment_method_type->get_help_tab_link() ), |
|
40 | - 'html_help_text' => __( 'Whether Paypal should add taxes to the order', 'event_espresso' ), |
|
33 | + )), |
|
34 | + 'image_url' => new EE_Admin_File_Uploader_Input(array( |
|
35 | + 'html_help_text' => __("Used for your business/personal logo on the PayPal page", 'event_espresso'), |
|
36 | + 'html_label_text' => __('Image URL', 'event_espresso') |
|
37 | + )), |
|
38 | + 'paypal_taxes' => new EE_Yes_No_Input(array( |
|
39 | + 'html_label_text' => sprintf(__('Paypal Calculates Taxes %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
40 | + 'html_help_text' => __('Whether Paypal should add taxes to the order', 'event_espresso'), |
|
41 | 41 | 'default' => false |
42 | - ) ), |
|
43 | - 'paypal_shipping' => new EE_Yes_No_Input( array( |
|
44 | - 'html_label_text' => sprintf( __( 'Paypal Calculates Shipping %s', 'event_espresso' ), $payment_method_type->get_help_tab_link() ), |
|
45 | - 'html_help_text' => __( 'Whether Paypal should add shipping surcharges', 'event_espresso' ), |
|
42 | + )), |
|
43 | + 'paypal_shipping' => new EE_Yes_No_Input(array( |
|
44 | + 'html_label_text' => sprintf(__('Paypal Calculates Shipping %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
45 | + 'html_help_text' => __('Whether Paypal should add shipping surcharges', 'event_espresso'), |
|
46 | 46 | 'default' => false |
47 | - ) ), |
|
48 | - 'shipping_details' => new EE_Select_Input( array( |
|
49 | - EE_PMT_Paypal_Standard::shipping_info_none => __( "Do not prompt for an address", 'event_espresso' ), |
|
50 | - EE_PMT_Paypal_Standard::shipping_info_optional => __( "Prompt for an address, but do not require it", 'event_espresso' ), |
|
51 | - EE_PMT_Paypal_Standard::shipping_info_required => __( "Prompt for an address, and require it", 'event_espresso' ) |
|
52 | - ) ) |
|
47 | + )), |
|
48 | + 'shipping_details' => new EE_Select_Input(array( |
|
49 | + EE_PMT_Paypal_Standard::shipping_info_none => __("Do not prompt for an address", 'event_espresso'), |
|
50 | + EE_PMT_Paypal_Standard::shipping_info_optional => __("Prompt for an address, but do not require it", 'event_espresso'), |
|
51 | + EE_PMT_Paypal_Standard::shipping_info_required => __("Prompt for an address, and require it", 'event_espresso') |
|
52 | + )) |
|
53 | 53 | ) |
54 | 54 | ) |
55 | 55 | ); |
@@ -60,28 +60,28 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @param array $req_data |
62 | 62 | */ |
63 | - protected function _normalize( $req_data ) { |
|
64 | - parent::_normalize( $req_data ); |
|
65 | - $paypal_calculates_shipping = $this->get_input_value( 'paypal_shipping' ); |
|
66 | - $paypal_calculates_taxes = $this->get_input_value( 'paypal_taxes' ); |
|
67 | - $paypal_requests_address_info = $this->get_input_value( 'shipping_details' ); |
|
63 | + protected function _normalize($req_data) { |
|
64 | + parent::_normalize($req_data); |
|
65 | + $paypal_calculates_shipping = $this->get_input_value('paypal_shipping'); |
|
66 | + $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
|
67 | + $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
|
68 | 68 | if ( |
69 | - ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
69 | + ($paypal_calculates_shipping || $paypal_calculates_taxes) && |
|
70 | 70 | $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
71 | 71 | ) { |
72 | 72 | //they want paypal to calculate taxes or shipping. They need to ask for |
73 | 73 | //address info, otherwise paypal can't calculate taxes or shipping |
74 | 74 | /** @type EE_Select_Input $shipping_details_input */ |
75 | - $shipping_details_input = $this->get_input( 'shipping_details' ); |
|
76 | - $shipping_details_input->set_default( EE_PMT_Paypal_Standard::shipping_info_optional ); |
|
75 | + $shipping_details_input = $this->get_input('shipping_details'); |
|
76 | + $shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional); |
|
77 | 77 | $shipping_details_input_options = $shipping_details_input->options(); |
78 | 78 | EE_Error::add_attention( |
79 | 79 | sprintf( |
80 | - __( 'Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso' ), |
|
81 | - strip_tags( $shipping_details_input->html_label_text() ), |
|
82 | - isset( $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] ) |
|
83 | - ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
84 | - : __( 'Unknown', 'event_espresso' ) |
|
80 | + __('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
|
81 | + strip_tags($shipping_details_input->html_label_text()), |
|
82 | + isset($shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional]) |
|
83 | + ? $shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional] |
|
84 | + : __('Unknown', 'event_espresso') |
|
85 | 85 | ), |
86 | 86 | __FILE__, __FUNCTION__, __LINE__ |
87 | 87 | ); |