/** * Singleton constructor for the class. * * @return Tribe__Events__Pro__CSV_Importer__Fields */ public static function instance() { if (empty(self::$instance)) { self::$instance = new self(); } return self::$instance; }
private function __construct() { $this->pluginDir = trailingslashit(basename(EVENTS_CALENDAR_PRO_DIR)); $this->pluginPath = trailingslashit(EVENTS_CALENDAR_PRO_DIR); $this->pluginUrl = plugins_url($this->pluginDir); $this->pluginSlug = 'events-calendar-pro'; $this->loadTextDomain(); $this->weekSlug = sanitize_title(__('week', 'tribe-events-calendar-pro')); $this->photoSlug = sanitize_title(__('photo', 'tribe-events-calendar-pro')); require_once $this->pluginPath . 'src/functions/template-tags/general.php'; require_once $this->pluginPath . 'src/functions/template-tags/week.php'; require_once $this->pluginPath . 'src/functions/template-tags/venue.php'; require_once $this->pluginPath . 'src/functions/template-tags/widgets.php'; require_once $this->pluginPath . 'src/functions/template-tags/ical.php'; // Load Deprecated Template Tags if (!defined('TRIBE_DISABLE_DEPRECATED_TAGS')) { require_once $this->pluginPath . 'src/functions/template-tags/deprecated.php'; } add_action('admin_init', array($this, 'run_updates'), 10, 0); // Tribe common resources add_action('tribe_helper_activation_complete', array($this, 'helpersLoaded')); add_action('init', array($this, 'init'), 10); add_action('admin_print_styles', array($this, 'admin_enqueue_styles')); add_action('tribe_events_enqueue', array($this, 'admin_enqueue_scripts')); add_action('tribe_venues_enqueue', array($this, 'admin_enqueue_scripts')); add_action('wp_enqueue_scripts', array($this, 'enqueue_pro_scripts'), 8); add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); // Rewrite Related Filters add_filter('tribe_events_pre_rewrite', array($this, 'filter_add_routes'), 5); add_filter('tribe_events_rewrite_base_slugs', array($this, 'filter_add_base_slugs'), 11); add_filter('tribe_events_rewrite_i18n_domains', array($this, 'filter_add_i18n_pro_domain'), 11); add_action('tribe_settings_do_tabs', array($this, 'add_settings_tabs')); add_filter('tribe_settings_tab_fields', array($this, 'filter_settings_tab_fields'), 10, 2); add_action('tribe_events_parse_query', array($this, 'parse_query')); add_action('tribe_events_pre_get_posts', array($this, 'pre_get_posts')); add_filter('tribe_enable_recurring_event_queries', '__return_true', 10, 1); add_filter('body_class', array($this, 'body_class')); add_filter('tribe_events_current_view_template', array($this, 'select_page_template')); add_filter('tribe_events_current_template_class', array($this, 'get_current_template_class')); add_filter('tribe_events_template_paths', array($this, 'template_paths')); add_filter('tribe_events_template_class_path', array($this, 'template_class_path')); add_filter('tribe_help_tab_getting_started_text', array($this, 'add_help_tab_getting_started_text')); add_filter('tribe_help_tab_introtext', array($this, 'add_help_tab_intro_text')); add_filter('tribe_help_tab_forumtext', array($this, 'add_help_tab_forumtext')); add_filter('tribe_support_registered_template_systems', array($this, 'register_template_updates')); add_action('widgets_init', array($this, 'pro_widgets_init'), 100); add_action('wp_loaded', array($this, 'allow_cpt_search')); add_action('plugin_row_meta', array($this, 'addMetaLinks'), 10, 2); add_filter('tribe_get_events_title', array($this, 'reset_page_title'), 10, 2); add_filter('tribe_events_title_tag', array($this, 'maybeAddEventTitle'), 10, 3); add_filter('tribe_help_tab_forums_url', array($this, 'helpTabForumsLink')); add_action('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'addLinksToPluginActions')); add_filter('tribe_events_before_html', array($this, 'events_before_html'), 10); // add custom fields to "the_meta" on single event template add_filter('tribe_events_single_event_the_meta_addon', array($this, 'single_event_the_meta_addon'), 10, 2); add_filter('tribe_events_single_event_meta_group_template_keys', array($this, 'single_event_meta_group_template_keys'), 10); add_filter('tribe_events_single_event_meta_template_keys', array($this, 'single_event_meta_template_keys'), 10); add_filter('tribe_event_meta_venue_name', array('Tribe__Events__Pro__Single_Event_Meta', 'venue_name'), 10, 2); add_filter('tribe_event_meta_organizer_name', array('Tribe__Events__Pro__Single_Event_Meta', 'organizer_name'), 10, 2); add_filter('tribe_events_single_event_the_meta_group_venue', array($this, 'single_event_the_meta_group_venue'), 10, 2); $this->enable_recurring_info_tooltip(); add_action('tribe_events_before_the_grid', array($this, 'disable_recurring_info_tooltip'), 10, 0); add_action('tribe_events_after_the_grid', array($this, 'enable_recurring_info_tooltip'), 10, 0); add_action('tribe_events_single_event_after_the_meta', array($this, 'register_related_events_view')); // see function tribe_convert_units( $value, $unit_from, $unit_to ) add_filter('tribe_convert_kms_to_miles_ratio', array($this, 'kms_to_miles_ratio')); add_filter('tribe_convert_miles_to_kms_ratio', array($this, 'miles_to_kms_ratio')); /* Setup Tribe Events Bar */ add_filter('tribe-events-bar-views', array($this, 'setup_weekview_in_bar'), 10, 1); add_filter('tribe-events-bar-views', array($this, 'setup_photoview_in_bar'), 30, 1); add_filter('tribe_events_ugly_link', array($this, 'ugly_link'), 10, 3); add_filter('tribe_events_getLink', array($this, 'get_link'), 10, 4); add_filter('tribe_get_listview_link', array($this, 'get_all_link')); add_filter('tribe_get_listview_dir_link', array($this, 'get_all_dir_link')); add_filter('tribe_bar_datepicker_caption', array($this, 'setup_datepicker_label'), 10, 1); add_action('tribe_events_after_the_title', array($this, 'add_recurring_occurance_setting_to_list')); add_action('tribe_events_list_before_the_content', array('Tribe__Events__Pro__Templates__Mods__List_View', 'print_all_events_link')); add_filter('tribe_is_ajax_view_request', array($this, 'is_pro_ajax_view_request'), 10, 2); add_action('tribe_events_pre_get_posts', array($this, 'setup_hide_recurrence_in_query')); add_filter('wp', array($this, 'detect_recurrence_redirect')); add_filter('template_redirect', array($this, 'filter_canonical_link_on_recurring_events'), 10, 1); $this->permalink_editor = apply_filters('tribe_events_permalink_editor', new Tribe__Events__Pro__Recurrence__Permalinks()); add_filter('post_type_link', array($this->permalink_editor, 'filter_recurring_event_permalinks'), 10, 4); add_filter('get_sample_permalink', array($this->permalink_editor, 'filter_sample_permalink'), 10, 2); add_filter('tribe_events_register_venue_type_args', array($this, 'addSupportsThumbnail'), 10, 1); add_filter('tribe_events_register_organizer_type_args', array($this, 'addSupportsThumbnail'), 10, 1); add_action('post_updated_messages', array($this, 'updatePostMessages'), 20); add_filter('tribe_events_default_value_strategy', array($this, 'set_default_value_strategy')); add_action('plugins_loaded', array($this, 'init_apm_filters')); // Fire up the Customizer Main Class add_action('plugins_loaded', array('Tribe__Events__Pro__Customizer__Main', 'instance')); // override list view ajax get_event args if viewing all instances of a recurring post add_filter('tribe_events_listview_ajax_get_event_args', array($this, 'override_listview_get_event_args'), 10, 2); add_filter('tribe_events_listview_ajax_event_display', array($this, 'override_listview_display_setting'), 10, 2); // Event CSV import additions add_filter('tribe_events_importer_venue_column_names', array(Tribe__Events__Pro__CSV_Importer__Fields::instance(), 'filter_venue_column_names'), 10, 1); add_filter('tribe_events_importer_venue_array', array(Tribe__Events__Pro__CSV_Importer__Fields::instance(), 'filter_venue_array'), 10, 4); add_filter('oembed_discovery_links', array($this, 'oembed_discovery_links_for_recurring_events')); add_filter('oembed_request_post_id', array($this, 'oembed_request_post_id_for_recurring_events'), 10, 2); add_action('plugins_loaded', array('Tribe__Events__Pro__Admin__Settings', 'hook')); // Start the integrations manager Tribe__Events__Pro__Integrations__Manager::instance()->load_integrations(); }