protected function hooks() { parent::hooks(); if (tribe_is_showing_all()) { add_filter('tribe_get_template_part_path_modules/bar.php', '__return_false'); } }
public function load_scripts($hook) { if ($hook != 'widgets.php') { return; } Tribe_Template_Factory::asset_package('select2'); wp_enqueue_script('calendar-widget-admin', TribeEventsPro::instance()->pluginUrl . 'resources/calendar-widget-admin.js'); }
public function load_scripts($hook) { if ($hook != 'widgets.php') { return; } Tribe_Template_Factory::asset_package('select2'); wp_enqueue_script('calendar-widget-admin', TribeEventsPro::instance()->pluginUrl . 'resources/calendar-widget-admin.js', array(), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION)); }
/** * Set up the notices for this template * * @return void * @since 3.0 **/ public function set_notices() { parent::set_notices(); // Check if event has passed $gmt_offset = get_option('gmt_offset') >= '0' ? ' +' . get_option('gmt_offset') : " " . get_option('gmt_offset'); $gmt_offset = str_replace(array('.25', '.5', '.75'), array(':15', ':30', ':45'), $gmt_offset); if (!tribe_is_showing_all() && strtotime(tribe_get_end_date(get_the_ID(), false, 'Y-m-d G:i') . $gmt_offset) <= time()) { TribeEvents::setNotice('event-past', __('This event has passed.', 'tribe-events-calendar')); } }
/** * Get the title for list view * @param $title * @param null $sep * * @return string */ protected function get_title($original_title, $sep = null) { $new_title = parent::get_title($original_title, $sep); if (tribe_is_upcoming() && has_filter('tribe_upcoming_events_title')) { _deprecated_function("The 'tribe_upcoming_events_title' filter", '3.8', " the 'tribe_get_events_title' filter"); $new_title = apply_filters('tribe_upcoming_events_title', $new_title, $sep); } elseif (has_filter('tribe_past_events_title')) { _deprecated_function("The 'tribe_past_events_title' filter", '3.8', " the 'tribe_get_events_title' filter"); $new_title = apply_filters('tribe_past_events_title', $new_title, $sep); } return $new_title; }
/** * Set the notices used on month view * * @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query * @since 3.0 */ public function __construct($args = null) { if ($args === null) { global $wp_query; $args = $wp_query->query; } self::$args = $args; self::$posts_per_page_limit = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3')); if (!tribe_is_month()) { $this->asset_packages = array(); } parent::__construct(); }
/** * The asset loading function. * * @param string $name The name of the package reqested. * @param array $deps An array of dependencies (this should be the registered name that is registered to the wp_enqueue functions). * @return void * @author Timothy Wood * @since 3.0 */ public static function asset_package($name, $deps = array()) { $tec_pro = TribeEventsPro::instance(); $prefix = 'tribe-events-pro'; // setup plugin resources & 3rd party vendor urls $resources_url = trailingslashit($tec_pro->pluginUrl) . 'resources/'; $vendor_url = trailingslashit($tec_pro->pluginUrl) . 'vendor/'; switch ($name) { case 'ajax-weekview': $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'post_type' => TribeEvents::POSTTYPE); $path1 = Tribe_Template_Factory::getMinFile($vendor_url . 'jquery-slimscroll/jquery.slimscroll.js', true); $path2 = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-week.js', true); wp_enqueue_script('tribe-events-pro-slimscroll', $path1, array('tribe-events-pro', 'jquery-ui-draggable'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_enqueue_script('tribe-events-pro-week', $path2, array('tribe-events-pro-slimscroll'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_localize_script('tribe-events-pro-week', 'TribeWeek', $ajax_data); break; case 'ajax-photoview': $tribe_paged = !empty($_REQUEST['tribe_paged']) ? $_REQUEST['tribe_paged'] : 0; $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'tribe_paged' => $tribe_paged); $path1 = Tribe_Template_Factory::getMinFile($vendor_url . 'isotope/jquery.isotope.js', true); $path2 = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-photo-view.js', true); wp_enqueue_script('tribe-events-pro-isotope', $path1, array('tribe-events-pro'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_enqueue_script('tribe-events-pro-photo', $path2, array('tribe-events-pro-isotope'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_localize_script('tribe-events-pro-photo', 'TribePhoto', $ajax_data); break; case 'ajax-dayview': $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'post_type' => TribeEvents::POSTTYPE); $path = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-ajax-day.js', true); wp_enqueue_script('tribe-events-pro-ajax-day', $path, array('tribe-events-pro'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_localize_script('tribe-events-pro-ajax-day', 'TribeCalendar', $ajax_data); break; case 'ajax-maps': $http = is_ssl() ? 'https' : 'http'; wp_register_script('gmaps', $http . '://maps.google.com/maps/api/js?sensor=false', array('tribe-events-pro')); $path = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-ajax-maps.js', true); wp_register_script('tribe-events-pro-geoloc', $path, array('gmaps', parent::get_placeholder_handle()), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION)); wp_enqueue_script('tribe-events-pro-geoloc'); $geoloc = TribeEventsGeoLoc::instance(); $data = array('ajaxurl' => admin_url('admin-ajax.php', $http), 'nonce' => wp_create_nonce('tribe_geosearch'), 'map_view' => TribeEvents::instance()->displaying == 'map' ? true : false); wp_localize_script('tribe-events-pro-geoloc', 'GeoLoc', $data); break; } parent::asset_package($name, $deps); }
/** * Unhook all the hooks set up on this view * * @return void **/ protected function unhook() { parent::unhook(); remove_filter('post_type_archive_title', '__return_false', 10); }
protected function nothing_found_notice() { list($search_term, $tax_term, $geographic_term) = $this->get_search_terms(); if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } elseif (empty($search_term) && empty($geographic_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } else { parent::nothing_found_notice(); } }
/** * Enqueue the proper PRO scripts as necessary. * * @return void * @author Paul Hughes * @since 3.0 */ public function enqueue_pro_scripts() { if (tribe_is_event_query()) { $resources_url = trailingslashit($this->pluginUrl) . 'resources/'; $path = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-pro.js', true); wp_enqueue_script('tribe-events-pro', $path, array('jquery', 'tribe-events-calendar-script'), false, false); $geoloc = TribeEventsGeoLoc::instance(); $data = array('geocenter' => $geoloc->estimate_center_point()); wp_localize_script('tribe-events-pro', 'TribeEventsPro', $data); } }
/** * Load asset packages. * * @return void */ public function loadStyle() { if (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue()) { // jquery-resize Tribe_Template_Factory::asset_package('jquery-resize'); // smoothness Tribe_Template_Factory::asset_package('smoothness'); // Tribe Calendar JS Tribe_Template_Factory::asset_package('calendar-script'); Tribe_Template_Factory::asset_package('events-css'); } else { if (is_active_widget(false, false, 'tribe-events-list-widget')) { Tribe_Template_Factory::asset_package('events-css'); } } }
/** * Set up the notices for this template * * @return void **/ public function set_notices() { global $wp_query; $tribe = TribeEvents::instance(); $geographic_term = ''; $search_term = ''; $tax_term = ''; // No need to set notices unless we didn't find anything if (have_posts()) { return; } // Do we have a keyword or place name search? if (!empty($wp_query->query_vars['s'])) { $search_term = $wp_query->query_vars['s']; } elseif (!empty($_REQUEST['tribe-bar-search'])) { $search_term = $_REQUEST['tribe-bar-search']; } elseif (!empty($_REQUEST['tribe-bar-geoloc'])) { $geographic_term = $_REQUEST['tribe-bar-geoloc']; } if (is_tax($tribe->get_event_taxonomy())) { $tax_term = get_term_by('slug', get_query_var('term'), $tribe->get_event_taxonomy()); $tax_term = $tax_term->name; } // No events found on this day if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } elseif (empty($search_term) && empty($geographic_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } else { parent::set_notices(); } }
/** * Set up hooks for this template * * @return void * @since 1.0 **/ public function hooks() { parent::hooks(); add_filter('tribe_get_events_title', array($this, 'the_title')); }
/** * Get the title for month view * @param $title * @param null $sep * * @return string */ protected function get_title($original_title, $sep = null) { $new_title = parent::get_title($original_title, $sep); if (get_query_var('eventDate') && has_filter('tribe_month_grid_view_title')) { _deprecated_function("The 'tribe_month_grid_view_title' filter", '3.8', " the 'tribe_get_events_title' filter"); $title_date = date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(get_query_var('eventDate'))); $new_title = apply_filters('tribe_month_grid_view_title', $new_title, $sep, $title_date); } else { if (has_filter('tribe_events_this_month_title')) { _deprecated_function("The 'tribe_events_this_month_title' filter", '3.8', " the 'tribe_get_events_title' filter"); $new_title = apply_filters('tribe_events_this_month_title', $new_title, $sep); } } return $new_title; }
/** * Used to ensure that CE views function when the Default Events Template is in use. * * We could consider using a template class at some future point, right now this provides * a light functional means of letting users choose the Default Events Template for CE * views. */ protected function default_template_compatibility() { add_filter('tribe_events_current_view_template', array($this, 'default_template_placeholder')); Tribe_Template_Factory::asset_package('events-css'); }
/** * Load the CSSs and JSs only if the Bar will be shown */ public function load_script() { if ($this->should_show()) { Tribe_Template_Factory::asset_package('jquery-placeholder'); Tribe_Template_Factory::asset_package('bootstrap-datepicker'); Tribe_Template_Factory::asset_package('tribe-events-bar'); do_action('tribe-events-bar-enqueue-scripts'); } }
/** * Enqueue the panels admin scripts * * @action admin_print_scripts-post-new.php * @action admin_print_scripts-post.php * @action admin_print_scripts-appearance_page_so_panels_home_page */ function siteorigin_panels_admin_enqueue_scripts($prefix) { $screen = get_current_screen(); if ($screen->base == 'post' && in_array($screen->id, siteorigin_panels_setting('post-types')) || $screen->base == 'appearance_page_so_panels_home_page') { wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_script('jquery-ui-dialog'); wp_enqueue_script('jquery-ui-button'); wp_enqueue_script('so-undomanager', plugin_dir_url(__FILE__) . 'js/undomanager.min.js', array(), 'fb30d7f'); // check if "chosen" is already used, e.g. by WooCommerce if (!wp_script_is('chosen')) { wp_enqueue_script('so-panels-chosen', plugin_dir_url(__FILE__) . 'js/chosen/chosen.jquery.min.min.js', array('jquery'), POOTLEPAGE_VERSION); } wp_enqueue_script('so-panels-admin', plugin_dir_url(__FILE__) . 'js/panels.admin.js', array('jquery'), POOTLEPAGE_VERSION); wp_enqueue_script('so-panels-admin-panels', plugin_dir_url(__FILE__) . 'js/panels.admin.panels.js', array('jquery'), POOTLEPAGE_VERSION); wp_enqueue_script('so-panels-admin-grid', plugin_dir_url(__FILE__) . 'js/panels.admin.grid.js', array('jquery'), POOTLEPAGE_VERSION); wp_enqueue_script('so-panels-admin-prebuilt', plugin_dir_url(__FILE__) . 'js/panels.admin.prebuilt.js', array('jquery'), POOTLEPAGE_VERSION); wp_enqueue_script('so-panels-admin-tooltip', plugin_dir_url(__FILE__) . 'js/panels.admin.tooltip.min.js', array('jquery'), POOTLEPAGE_VERSION); wp_enqueue_script('so-panels-admin-media', plugin_dir_url(__FILE__) . 'js/panels.admin.media.min.js', array('jquery'), POOTLEPAGE_VERSION); wp_enqueue_script('so-panels-admin-styles', plugin_dir_url(__FILE__) . 'js/panels.admin.styles.js', array('jquery'), POOTLEPAGE_VERSION); wp_enqueue_script('row-options', plugin_dir_url(__FILE__) . 'js/row.options.admin.js', array('jquery')); wp_localize_script('so-panels-admin', 'panels', array('previewUrl' => wp_nonce_url(add_query_arg('siteorigin_panels_preview', 'true', get_home_url()), 'siteorigin-panels-preview'), 'i10n' => array('buttons' => array('insert' => __('Insert', 'siteorigin-panels'), 'cancel' => __('cancel', 'siteorigin-panels'), 'delete' => __('Delete', 'siteorigin-panels'), 'duplicate' => __('Duplicate', 'siteorigin-panels'), 'style' => __('Style', 'siteorigin-panels'), 'edit' => __('Edit', 'siteorigin-panels'), 'done' => __('Done', 'siteorigin-panels'), 'undo' => __('Undo', 'siteorigin-panels'), 'add' => __('Add', 'siteorigin-panels')), 'messages' => array('deleteColumns' => __('Columns deleted', 'siteorigin-panels'), 'deleteWidget' => __('Widget deleted', 'siteorigin-panels'), 'confirmLayout' => __('Are you sure you want to load this layout? It will overwrite your current page.', 'siteorigin-panels'), 'editWidget' => __('Edit %s Widget', 'siteorigin-panels'), 'styleWidget' => __('Style Widget', 'siteorigin-panels'))))); // this is the data of the widget and row that have been setup $panels_data = siteorigin_panels_get_current_admin_panels_data(); // Remove any widgets with classes that don't exist if (!empty($panels_data['panels'])) { foreach ($panels_data['panels'] as $i => $panel) { if (!class_exists($panel['info']['class'])) { unset($panels_data['panels'][$i]); } } } // Add in the forms if (count($panels_data) > 0) { foreach ($panels_data['widgets'] as $i => $widget) { if (!class_exists($widget['info']['class'])) { unset($panels_data['widgets'][$i]); } // bring over the hide title check box from old Pootle Visual Editor if ($widget['info']['class'] == 'Pootle_Text_Widget') { if (isset($widget['hide-title']) && $widget['hide-title'] == '1') { $widgetStyle = isset($widget['info']['style']) ? json_decode($widget['info']['style'], true) : pp_get_default_widget_style(); $widgetStyle['hide-title'] = 'none'; $panels_data['widgets'][$i]['info']['style'] = json_encode($widgetStyle); } } } // load all data even if no widget inside, so row styling will be loaded wp_localize_script('so-panels-admin', 'panelsData', $panels_data); } // Set up the row styles wp_localize_script('so-panels-admin', 'panelsStyleFields', siteorigin_panels_style_get_fields()); // we definitely need to use color picker //if ( siteorigin_panels_style_is_using_color( ) ) { wp_dequeue_script("iris"); wp_enqueue_script("pp-pb-iris", plugin_dir_url(__FILE__) . '/js/iris.js', array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch')); wp_enqueue_script('pp-pb-color-picker', plugin_dir_url(__FILE__) . '/js/color-picker-custom.js', array('pp-pb-iris')); wp_localize_script('pp-pb-color-picker', 'wpColorPickerL10n', array('clear' => __('Clear'), 'defaultString' => __('Default'), 'pick' => __('Select Color'), 'current' => __('Current Color'))); wp_enqueue_style('wp-color-picker'); //} // Render all the widget forms. A lot of widgets use this as a chance to enqueue their scripts $original_post = isset($GLOBALS['post']) ? $GLOBALS['post'] : null; // Make sure widgets don't change the global post. foreach ($GLOBALS['wp_widget_factory']->widgets as $class => $widget_obj) { ob_start(); $widget_obj->form(array()); ob_clean(); } $GLOBALS['post'] = $original_post; // handle a special case for Event Calendar Pro, // since it doesn't enqueue script if not in Widgets page if (class_exists('TribeEventsMiniCalendarWidget')) { Tribe_Template_Factory::asset_package('select2'); //wp_enqueue_script( 'calendar-widget-admin', plugin_dir_url( __FILE__ ) . '/js/calendar-widget-admin.js' ); } // This gives panels a chance to enqueue scripts too, without having to check the screen ID. do_action('siteorigin_panel_enqueue_admin_scripts'); do_action('sidebar_admin_setup'); } }
/** * Enqueue the plugin stylesheet(s). * * @author PaulHughes01 * @since 3.4 * @return void */ function enqueueStylesAndScripts() { if (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue()) { $show_filter = apply_filters('tribe_events_filters_should_show', in_array(get_post_type(), array(TribeEvents::VENUE_POST_TYPE, TribeEvents::ORGANIZER_POST_TYPE)) ? false : true); if ($show_filter) { //Only display filters before template if the layout is horizontal if (tribe_get_option('events_filters_layout', 'vertical') == 'vertical') { add_action('tribe_events_bar_after_template', array($this, 'displaySidebar'), 25); } else { if (tribe_get_option('tribeDisableTribeBar', false) == true) { add_action('tribe_events_before_template', array($this, 'displaySidebar'), 25); } else { add_action('tribe_events_bar_after_template', array($this, 'displaySidebar'), 25); } } } // enqueue chosen for tag multi-select Tribe_Template_Factory::asset_package('chosen'); Tribe_Template_Factory::asset_package('calendar-script', array('jquery-ui-slider')); wp_enqueue_style('custom-jquery-styles'); wp_enqueue_style('TribeEventsFilterView-css', $this->pluginUrl . 'resources/filter-view.css', array(), apply_filters('tribe_events_filters_css_version', TribeEventsFilterView::VERSION)); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('TribeEventsFilterView-scripts', $this->pluginUrl . 'resources/filter-scripts.js', array(), apply_filters('tribe_events_filters_js_version', TribeEventsFilterView::VERSION)); //Check for override stylesheet $user_stylesheet_url = TribeEventsTemplates::locate_stylesheet('tribe-events/filterbar/filter-view.css'); $user_stylesheet_url = apply_filters('tribe_events_filterbar_stylesheet_url', $user_stylesheet_url); //If override stylesheet exists, then enqueue it if ($user_stylesheet_url) { wp_enqueue_style('tribe-events-filterbar-override-style', $user_stylesheet_url); } } }
/** * The asset loading function. * * @param string $name The name of the package reqested. * @param array $deps An array of dependencies (this should be the registered name that is registered to the wp_enqueue functions). * * @return void */ public static function asset_package($name, $deps = array()) { $tec_pro = TribeEventsPro::instance(); $prefix = 'tribe-events-pro'; // setup plugin resources & 3rd party vendor urls $resources_url = trailingslashit($tec_pro->pluginUrl) . 'resources/'; $vendor_url = trailingslashit($tec_pro->pluginUrl) . 'vendor/'; switch ($name) { case 'ajax-weekview': $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'post_type' => TribeEvents::POSTTYPE); $path1 = Tribe_Template_Factory::getMinFile($vendor_url . 'jquery-slimscroll/jquery.slimscroll.js', true); $path2 = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-week.js', true); wp_enqueue_script('tribe-events-pro-slimscroll', $path1, array('tribe-events-pro', 'jquery-ui-draggable'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_enqueue_script('tribe-events-pro-week', $path2, array('tribe-events-pro-slimscroll'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_localize_script('tribe-events-pro-week', 'TribeWeek', $ajax_data); break; case 'ajax-photoview': $tribe_paged = !empty($_REQUEST['tribe_paged']) ? $_REQUEST['tribe_paged'] : 0; $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'tribe_paged' => $tribe_paged); $path1 = Tribe_Template_Factory::getMinFile($vendor_url . 'isotope/jquery.isotope.js', true); $path2 = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-photo-view.js', true); wp_enqueue_script('tribe-events-pro-isotope', $path1, array('tribe-events-pro'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_enqueue_script('tribe-events-pro-photo', $path2, array('tribe-events-pro-isotope'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), true); wp_localize_script('tribe-events-pro-photo', 'TribePhoto', $ajax_data); break; case 'ajax-maps': $http = is_ssl() ? 'https' : 'http'; $url = apply_filters('tribe_events_pro_google_maps_api', $http . '://maps.google.com/maps/api/js?sensor=false'); wp_register_script('tribe-gmaps', $url, array('tribe-events-pro')); $path = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-ajax-maps.js', true); wp_register_script('tribe-events-pro-geoloc', $path, array('tribe-gmaps', parent::get_placeholder_handle()), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION)); wp_enqueue_script('tribe-events-pro-geoloc'); $geoloc = TribeEventsGeoLoc::instance(); $data = array('ajaxurl' => admin_url('admin-ajax.php', $http), 'nonce' => wp_create_nonce('tribe_geosearch'), 'map_view' => TribeEvents::instance()->displaying == 'map' ? true : false); wp_localize_script('tribe-events-pro-geoloc', 'GeoLoc', $data); break; case 'events-pro-css': $stylesheets = array(); $mobile_break = tribe_get_mobile_breakpoint(); // Get the selected style option $style_option = tribe_get_option('stylesheetOption', 'tribe'); // Determine the stylesheet files for the selected option switch ($style_option) { case 'skeleton': $stylesheets['tribe-events-calendar-pro-style'] = 'tribe-events-pro-skeleton.css'; break; case 'full': $stylesheets['tribe-events-calendar-pro-style'] = 'tribe-events-pro-full.css'; if ($mobile_break > 0) { $stylesheets['tribe-events-calendar-pro-mobile-style'] = 'tribe-events-pro-full-mobile.css'; } break; default: // tribe styles $stylesheets['tribe-events-full-pro-calendar-style'] = 'tribe-events-pro-full.css'; $stylesheets['tribe-events-calendar-pro-style'] = 'tribe-events-pro-theme.css'; if ($mobile_break > 0) { $stylesheets['tribe-events-calendar-full-pro-mobile-style'] = 'tribe-events-pro-full-mobile.css'; $stylesheets['tribe-events-calendar-pro-mobile-style'] = 'tribe-events-pro-theme-mobile.css'; } break; } // put override css at the end of the array $stylesheets['tribe-events-calendar-pro-override-style'] = 'tribe-events/pro/tribe-events-pro.css'; // do the enqueues foreach ($stylesheets as $name => $css_file) { if ($name == 'tribe-events-calendar-pro-override-style') { $user_stylesheet_url = TribeEventsTemplates::locate_stylesheet($css_file); if ($user_stylesheet_url) { wp_enqueue_style($name, $user_stylesheet_url); } } else { // get full URL $url = tribe_events_pro_resource_url($css_file); // get the minified file $url = self::getMinFile($url, true); // apply filters $url = apply_filters('tribe_events_pro_stylesheet_url', $url, $name); // set the $media attribute if ($name == 'tribe-events-calendar-pro-mobile-style' || $name == 'tribe-events-calendar-full-pro-mobile-style') { $media = "only screen and (max-width: {$mobile_break}px)"; wp_enqueue_style($name, $url, array('tribe-events-calendar-pro-style'), TribeEventsPro::VERSION, $media); } else { wp_register_style($name, $url, array(), TribeEventsPro::VERSION); wp_enqueue_style($name); } } } break; } parent::asset_package($name, $deps); }
/** * Enqueue the proper PRO scripts as necessary. * * @return void */ public function enqueue_pro_scripts() { if (tribe_is_event_query()) { // @TODO filter the tribe_events_resource_url() function $resources_url = trailingslashit($this->pluginUrl) . 'resources/'; $path = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-pro.js', true); wp_enqueue_script('tribe-events-pro', $path, array('jquery', 'tribe-events-calendar-script'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), false); $geoloc = TribeEventsGeoLoc::instance(); $data = array('geocenter' => $geoloc->estimate_center_point(), 'map_tooltip_event' => __('Event: ', 'tribe-events-calendar-pro'), 'map_tooltip_address' => __('Address: ', 'tribe-events-calendar-pro')); $data = apply_filters('tribe_events_pro_localize_script', $data, 'TribeEventsPro', 'tribe-events-pro'); wp_localize_script('tribe-events-pro', 'TribeEventsPro', $data); } }
protected function enqueue_map_scripts() { // Setup Google Maps API $url = apply_filters('tribe_events_google_maps_api', '//maps.googleapis.com/maps/api/js'); wp_enqueue_script('tribe_events_google_maps_api', $url, array(), false, true); // Setup our own script used to initialize each map $resources_url = trailingslashit(TribeEvents::instance()->pluginUrl) . 'resources/'; $url = Tribe_Template_Factory::getMinFile($resources_url . 'embedded-map.js', true); wp_enqueue_script(self::MAP_HANDLE, $url, array('tribe_events_google_maps_api'), false, true); $this->map_script_enqueued = true; }