/** * Enqueue the appropriate CSS for the calendar/advanced list widgets, which share * the same basic appearance. */ public static function enqueue_calendar_widget_styles() { // CSS file $event_file = 'widget-calendar.css'; $event_file_option = 'widget-calendar-theme.css'; $stylesheet_option = tribe_get_option('stylesheetOption', 'tribe'); // Choose the appropriate stylesheet in light of the current styling options switch ($stylesheet_option) { case 'skeleton': case 'full': $event_file_option = "widget-calendar-{$stylesheet_option}.css"; break; } $style_url = TribeEventsPro::instance()->pluginUrl . 'resources/' . $event_file_option; $style_url = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $style_url); $style_override_url = TribeEventsTemplates::locate_stylesheet('tribe-events/pro/' . $event_file, $style_url); // Load up stylesheet from theme or plugin if ($style_url && 'tribe' === $stylesheet_option) { wp_enqueue_style('widget-calendar-pro-style', TribeEventsPro::instance()->pluginUrl . 'resources/widget-calendar-full.css', array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); wp_enqueue_style(TribeEvents::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); } else { wp_enqueue_style(TribeEvents::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); } if ($style_override_url) { wp_enqueue_style(TribeEvents::POSTTYPE . '--widget-calendar-pro-override-style', $style_override_url, array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); } }
/** * Asset calls for vendor packages * * @param string $name * @param array $deps Dependents */ public static function asset_package($name, $deps = array()) { $tec = TribeEvents::instance(); $prefix = 'tribe-events'; // TribeEvents::POSTTYPE; // setup plugin resources & 3rd party vendor urls $resources_url = trailingslashit($tec->pluginUrl) . 'resources/'; $vendor_url = trailingslashit($tec->pluginUrl) . 'vendor/'; switch ($name) { case 'jquery-resize': $path = self::getMinFile($vendor_url . 'jquery-resize/jquery.ba-resize.js', true); $deps = array_merge($deps, array('jquery')); wp_enqueue_script($prefix . '-jquery-resize', $path, $deps, '1.1', false); self::$vendor_scripts[] = $prefix . '-jquery-resize'; break; case 'chosen': // Vendor: jQuery Chosen $deps = array_merge($deps, array('jquery')); $css_path = self::getMinFile($vendor_url . 'chosen/public/chosen.css', true); $path = self::getMinFile($vendor_url . 'chosen/public/chosen.jquery.js', true); wp_enqueue_style($prefix . '-chosen-style', $css_path); wp_enqueue_script($prefix . '-chosen-jquery', $path, $deps, '0.9.5', false); self::$vendor_scripts[] = $prefix . '-chosen-jquery'; break; case 'smoothness': // Vendor: jQuery Custom Styles $path = self::getMinFile($vendor_url . 'jquery/smoothness/jquery-ui-1.8.23.custom.css', true); wp_enqueue_style($prefix . '-custom-jquery-styles', $path); break; case 'select2': // Vendor: Select2 $css_path = self::getMinFile($vendor_url . 'select2/select2.css', true); $path = self::getMinFile($vendor_url . 'select2/select2.js', true); wp_enqueue_style($prefix . '-select2-css', $css_path); wp_enqueue_script($prefix . '-select2', $path, 'jquery', '3.2'); self::$vendor_scripts[] = $prefix . '-select2'; break; case 'calendar-script': // Tribe Events JS $deps = array_merge($deps, array('jquery'), self::$vendor_scripts); $path = self::getMinFile($resources_url . 'tribe-events.js', true); wp_enqueue_script($prefix . '-calendar-script', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'datepicker': // Vendor: jQuery Datepicker wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_style('jquery-ui-datepicker'); self::$vendor_scripts[] = 'jquery-ui-datepicker'; break; case 'bootstrap-datepicker': // Vendor: Bootstrap Datepicker $css_path = self::getMinFile($vendor_url . 'bootstrap-datepicker/css/datepicker.css', true); $path = self::getMinFile($vendor_url . 'bootstrap-datepicker/js/bootstrap-datepicker.js', true); wp_enqueue_style($prefix . '-bootstrap-datepicker-css', $css_path); wp_enqueue_script($prefix . '-bootstrap-datepicker', $path, 'jquery', '3.2'); self::$vendor_scripts[] = $prefix . '-bootstrap-datepicker'; $localized_datepicker_array = array('days' => array_merge($tec->daysOfWeek, array($tec->daysOfWeek[0])), 'daysShort' => array_merge($tec->daysOfWeekShort, array($tec->daysOfWeekShort[0])), 'daysMin' => array_merge($tec->daysOfWeekMin, array($tec->daysOfWeekMin[0])), 'months' => array_values($tec->monthsFull), 'monthsShort' => array_values($tec->monthsShort)); wp_localize_script($prefix . '-bootstrap-datepicker', 'tribe_bootstrap_datepicker_strings', array('dates' => $localized_datepicker_array)); break; case 'dialog': // Vendor: jQuery Dialog wp_enqueue_script('jquery-ui-dialog'); self::$vendor_scripts[] = 'jquery-ui-dialog'; break; case 'admin-ui': // Tribe Events $path = self::getMinFile($resources_url . 'events-admin.css', true); wp_enqueue_style($prefix . '-admin-ui', $path); break; case 'admin': $deps = array_merge($deps, array('jquery', 'jquery-ui-datepicker')); $path = self::getMinFile($resources_url . 'events-admin.js', true); wp_enqueue_script($prefix . '-admin', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); break; case 'settings': $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($resources_url . 'tribe-settings.js', true); wp_enqueue_script($prefix . '-settings', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); break; case 'ecp-plugins': $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($resources_url . 'jquery-ecp-plugins.js', true); wp_enqueue_script($prefix . '-ecp-plugins', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'tribe-events-bar': $deps = array_merge($deps, array('jquery', $prefix . '-calendar-script', $prefix . '-bootstrap-datepicker', $prefix . '-jquery-resize', $prefix . '-select2', 'tribe-placeholder')); $path = self::getMinFile($resources_url . 'tribe-events-bar.js', true); wp_enqueue_script($prefix . '-bar', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'jquery-placeholder': // Vendor: jQuery Placeholder $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($vendor_url . 'jquery-placeholder/jquery.placeholder.js', true); wp_enqueue_script('tribe-placeholder', $path, $deps, '2.0.7', false); self::$vendor_scripts[] = 'tribe-placeholder'; break; case 'ajax-calendar': $deps = array_merge($deps, array('jquery', $prefix . '-calendar-script')); $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); $path = self::getMinFile($resources_url . 'tribe-events-ajax-calendar.js', true); wp_enqueue_script('tribe-events-calendar', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); wp_localize_script('tribe-events-calendar', 'TribeCalendar', $ajax_data); break; case 'ajax-list': $deps = array_merge($deps, array('jquery', $prefix . '-calendar-script')); $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); $path = self::getMinFile($resources_url . 'tribe-events-ajax-list.js', true); wp_enqueue_script('tribe-events-list', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); wp_localize_script('tribe-events-list', 'TribeList', $ajax_data); break; case 'events-css': // Tribe Events CSS filename $event_file = 'tribe-events.css'; $stylesheet_option = tribe_get_option('stylesheetOption', 'tribe'); // What Option was selected switch ($stylesheet_option) { case 'skeleton': case 'full': $event_file_option = 'tribe-events-' . $stylesheet_option . '.css'; break; default: $event_file_option = 'tribe-events-theme.css'; break; } $styleUrl = trailingslashit($tec->pluginUrl) . 'resources/' . $event_file_option; $styleUrl = self::getMinFile($styleUrl, true); $styleUrl = apply_filters('tribe_events_stylesheet_url', $styleUrl); // Is there a core override file in the theme? $styleOverrideUrl = TribeEventsTemplates::locate_stylesheet('tribe-events/' . $event_file, $styleUrl); // Load up stylesheet from theme or plugin if ($styleUrl && $stylesheet_option == 'tribe') { $full_path = self::getMinFile(trailingslashit($tec->pluginUrl) . 'resources/tribe-events-full.css', true); wp_enqueue_style('full-calendar-style', $full_path); wp_enqueue_style(TribeEvents::POSTTYPE . '-calendar-style', $styleUrl); } else { wp_enqueue_style(TribeEvents::POSTTYPE . '-calendar-style', $styleUrl); } if ($styleOverrideUrl) { wp_enqueue_style(TribeEvents::POSTTYPE . '-calendar-override-style', $styleOverrideUrl); } break; default: do_action($prefix . '-' . $name); break; } }
private function styles_and_scripts() { wp_enqueue_script('tribe-mini-calendar', TribeEventsPro::instance()->pluginUrl . 'resources/widget-calendar.js', array('jquery'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION)); // Tribe Events CSS filename $event_file = 'widget-calendar.css'; $stylesheet_option = tribe_get_option('stylesheetOption', 'tribe'); // What Option was selected switch ($stylesheet_option) { case 'skeleton': $event_file_option = 'widget-calendar-' . $stylesheet_option . '.css'; break; case 'full': $event_file_option = 'widget-calendar-' . $stylesheet_option . '.css'; break; default: $event_file_option = 'widget-calendar-theme.css'; break; } $styleUrl = TribeEventsPro::instance()->pluginUrl . 'resources/' . $event_file_option; $styleUrl = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $styleUrl); $styleOverrideUrl = TribeEventsTemplates::locate_stylesheet('tribe-events/pro/' . $event_file, $styleUrl); // Load up stylesheet from theme or plugin if ($styleUrl && $stylesheet_option == 'tribe') { wp_enqueue_style('widget-calendar-pro-style', TribeEventsPro::instance()->pluginUrl . 'resources/widget-calendar-full.css', array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); wp_enqueue_style(TribeEvents::POSTTYPE . '-widget-calendar-pro-style', $styleUrl, array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); } else { wp_enqueue_style(TribeEvents::POSTTYPE . '-widget-calendar-pro-style', $styleUrl, array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); } if ($styleOverrideUrl) { wp_enqueue_style(TribeEvents::POSTTYPE . '--widget-calendar-pro-override-style', $styleOverrideUrl, array(), apply_filters('tribe_events_pro_css_version', TribeEventsPro::VERSION)); } $widget_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); wp_localize_script('tribe-mini-calendar', 'TribeMiniCalendar', $widget_data); }
/** * Enqueue the proper styles depending on what is requred by a given page load. * * @return void * @author Jessica Yazbek * @since 3.0 */ public function enqueue_styles() { if (tribe_is_event_query() || is_active_widget(false, false, 'tribe-events-adv-list-widget') || is_active_widget(false, false, 'tribe-mini-calendar') || is_active_widget(false, false, 'tribe-events-countdown-widget') || is_active_widget(false, false, 'next_event') || is_active_widget(false, false, 'tribe-events-venue-widget')) { // Tribe Events CSS filename $event_file = 'tribe-events-pro.css'; $stylesheet_option = tribe_get_option('stylesheetOption', 'tribe'); // What Option was selected switch ($stylesheet_option) { case 'skeleton': case 'full': $event_file_option = 'tribe-events-pro-' . $stylesheet_option . '.css'; break; default: $event_file_option = 'tribe-events-pro-theme.css'; break; } $styleUrl = trailingslashit($this->pluginUrl) . 'resources/' . $event_file_option; $styleUrl = apply_filters('tribe_events_pro_stylesheet_url', $styleUrl); // Is there a pro override file in the theme? $styleOverrideUrl = TribeEventsTemplates::locate_stylesheet('tribe-events/pro/' . $event_file, $styleUrl); // Load up stylesheet from theme or plugin if ($styleUrl && $stylesheet_option == 'tribe') { wp_enqueue_style('full-calendar-pro-style', trailingslashit($this->pluginUrl) . 'resources/tribe-events-pro-full.css'); wp_enqueue_style(TribeEvents::POSTTYPE . '-calendar-pro-style', $styleUrl); } else { wp_enqueue_style(TribeEvents::POSTTYPE . '-calendar-pro-style', $styleUrl); } if ($styleOverrideUrl) { wp_enqueue_style(TribeEvents::POSTTYPE . '-calendar-pro-override-style', $styleOverrideUrl); } } }
/** * Asset calls for vendor packages * * @param string $name * @param array $deps Dependents */ public static function asset_package($name, $deps = array()) { $tec = TribeEvents::instance(); $prefix = 'tribe-events'; // TribeEvents::POSTTYPE; // setup plugin resources & 3rd party vendor urls $resources_url = trailingslashit($tec->pluginUrl) . 'resources/'; $vendor_url = trailingslashit($tec->pluginUrl) . 'vendor/'; switch ($name) { case 'jquery-resize': $path = self::getMinFile($vendor_url . 'jquery-resize/jquery.ba-resize.js', true); $deps = array_merge($deps, array('jquery')); wp_enqueue_script($prefix . '-jquery-resize', $path, $deps, '1.1', false); self::$vendor_scripts[] = $prefix . '-jquery-resize'; break; case 'chosen': // Vendor: jQuery Chosen $deps = array_merge($deps, array('jquery')); $css_path = self::getMinFile($vendor_url . 'chosen/public/chosen.css', true); $path = self::getMinFile($vendor_url . 'chosen/public/chosen.jquery.js', true); wp_enqueue_style($prefix . '-chosen-style', $css_path); wp_enqueue_script($prefix . '-chosen-jquery', $path, $deps, '0.9.5', false); self::$vendor_scripts[] = $prefix . '-chosen-jquery'; break; case 'smoothness': // Vendor: jQuery Custom Styles $path = self::getMinFile($vendor_url . 'jquery/smoothness/jquery-ui-1.8.23.custom.css', true); wp_enqueue_style($prefix . '-custom-jquery-styles', $path); break; case 'select2': // Vendor: Select2 $css_path = self::getMinFile($vendor_url . 'select2/select2.css', true); $path = self::getMinFile($vendor_url . 'select2/select2.js', true); wp_enqueue_style($prefix . '-select2-css', $css_path); wp_enqueue_script($prefix . '-select2', $path, 'jquery', '3.2'); self::$vendor_scripts[] = $prefix . '-select2'; break; case 'calendar-script': // Tribe Events JS $deps = array_merge($deps, array('jquery'), self::$vendor_scripts); $path = self::getMinFile($resources_url . 'tribe-events.js', true); wp_enqueue_script($prefix . '-calendar-script', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'datepicker': // Vendor: jQuery Datepicker wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_style('jquery-ui-datepicker'); self::$vendor_scripts[] = 'jquery-ui-datepicker'; break; case 'bootstrap-datepicker': // Vendor: Bootstrap Datepicker $css_path = self::getMinFile($vendor_url . 'bootstrap-datepicker/css/datepicker.css', true); $path = self::getMinFile($vendor_url . 'bootstrap-datepicker/js/bootstrap-datepicker.js', true); wp_enqueue_style($prefix . '-bootstrap-datepicker-css', $css_path); wp_enqueue_script($prefix . '-bootstrap-datepicker', $path, 'jquery', '3.2'); self::$vendor_scripts[] = $prefix . '-bootstrap-datepicker'; $localized_datepicker_array = array('days' => array_merge($tec->daysOfWeek, array($tec->daysOfWeek[0])), 'daysShort' => array_merge($tec->daysOfWeekShort, array($tec->daysOfWeekShort[0])), 'daysMin' => array_merge($tec->daysOfWeekMin, array($tec->daysOfWeekMin[0])), 'months' => array_values($tec->monthsFull), 'monthsShort' => array_values($tec->monthsShort), 'clear' => 'Clear', 'today' => 'Today'); wp_localize_script($prefix . '-bootstrap-datepicker', 'tribe_bootstrap_datepicker_strings', array('dates' => $localized_datepicker_array)); break; case 'dialog': // Vendor: jQuery Dialog wp_enqueue_script('jquery-ui-dialog'); self::$vendor_scripts[] = 'jquery-ui-dialog'; break; case 'admin-ui': // Tribe Events $path = self::getMinFile($resources_url . 'events-admin.css', true); wp_enqueue_style($prefix . '-admin-ui', $path, array(), TribeEvents::VERSION); break; case 'admin': $deps = array_merge($deps, array('jquery', 'jquery-ui-datepicker')); $path = self::getMinFile($resources_url . 'events-admin.js', true); wp_enqueue_script($prefix . '-admin', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); break; case 'settings': $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($resources_url . 'tribe-settings.js', true); wp_enqueue_script($prefix . '-settings', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); break; case 'ecp-plugins': $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($resources_url . 'jquery-ecp-plugins.js', true); wp_enqueue_script($prefix . '-ecp-plugins', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'tribe-events-bar': $deps = array_merge($deps, array('jquery', $prefix . '-calendar-script', $prefix . '-bootstrap-datepicker', $prefix . '-jquery-resize', self::get_placeholder_handle())); $path = self::getMinFile($resources_url . 'tribe-events-bar.js', true); wp_enqueue_script($prefix . '-bar', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'jquery-placeholder': // Vendor: jQuery Placeholder $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($vendor_url . 'jquery-placeholder/jquery.placeholder.js', true); $placeholder_handle = self::get_placeholder_handle(); wp_enqueue_script($placeholder_handle, $path, $deps, '2.0.7', false); self::$vendor_scripts[] = $placeholder_handle; break; case 'ajax-calendar': $deps = array_merge($deps, array('jquery', $prefix . '-bootstrap-datepicker', $prefix . '-calendar-script')); $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); $path = self::getMinFile($resources_url . 'tribe-events-ajax-calendar.js', true); wp_enqueue_script('tribe-events-calendar', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); wp_localize_script('tribe-events-calendar', 'TribeCalendar', $ajax_data); break; case 'ajax-list': $deps = array_merge($deps, array('jquery', $prefix . '-calendar-script')); $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); $path = self::getMinFile($resources_url . 'tribe-events-ajax-list.js', true); wp_enqueue_script('tribe-events-list', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); wp_localize_script('tribe-events-list', 'TribeList', $ajax_data); break; case 'events-css': // check if responsive should be killed if (apply_filters('tribe_events_kill_responsive', false)) { add_filter('tribe_events_mobile_breakpoint', '__return_zero'); } $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-style'] = 'tribe-events-skeleton.css'; break; case 'full': $stylesheets['tribe-events-calendar-style'] = 'tribe-events-full.css'; if ($mobile_break > 0) { $stylesheets['tribe-events-calendar-mobile-style'] = 'tribe-events-full-mobile.css'; } break; default: // tribe styles $stylesheets['tribe-events-full-calendar-style'] = 'tribe-events-full.css'; $stylesheets['tribe-events-calendar-style'] = 'tribe-events-theme.css'; if ($mobile_break > 0) { $stylesheets['tribe-events-calendar-full-mobile-style'] = 'tribe-events-full-mobile.css'; $stylesheets['tribe-events-calendar-mobile-style'] = 'tribe-events-theme-mobile.css'; } break; } // put override css at the end of the array $stylesheets['tribe-events-calendar-override-style'] = 'tribe-events/tribe-events.css'; // do the enqueues foreach ($stylesheets as $name => $css_file) { if ($name == 'tribe-events-calendar-override-style') { $user_stylesheet_url = TribeEventsTemplates::locate_stylesheet('tribe-events/tribe-events.css'); if ($user_stylesheet_url) { wp_enqueue_style($name, $user_stylesheet_url); } } else { // get full URL $url = tribe_events_resource_url($css_file); // get the minified file $url = self::getMinFile($url, true); // apply filters $url = apply_filters('tribe_events_stylesheet_url', $url, $name); // set the $media attribute if ($name == 'tribe-events-calendar-mobile-style' || $name == 'tribe-events-calendar-full-mobile-style') { $media = "(max-width: {$mobile_break}px)"; wp_enqueue_style($name, $url, array('tribe-events-calendar-style'), TribeEvents::VERSION, $media); } else { wp_register_style($name, $url, array(), TribeEvents::VERSION); wp_enqueue_style($name); } } } break; default: do_action($prefix . '-' . $name); break; } }
/** * 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 scripts & styles. * * @return void * @author Nick Ciske * @since 1.0 */ public function addScriptsAndStyles() { $stylesheet_url = $this->pluginUrl . '/resources/tribe-events-community.css'; $stylesheet_url = TribeEventsTemplates::locate_stylesheet('tribe-events/community/tribe-events-community.css', $stylesheet_url); $stylesheet_url = apply_filters('tribe_events_community_stylesheet_url', $stylesheet_url); wp_enqueue_style(TribeEvents::POSTTYPE . '-community', $stylesheet_url, array(), apply_filters('tribe_events_community_css_version', TribeCommunityEvents::VERSION)); wp_enqueue_script(TribeEvents::POSTTYPE . '-community', $this->pluginUrl . '/resources/tribe-events-community.js', array('jquery'), apply_filters('tribe_events_community_js_version', TribeCommunityEvents::VERSION)); }