/** * 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 = tribe_events_pro_resource_url($event_file_option); $style_url = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $style_url); $style_override_url = Tribe__Events__Templates::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', tribe_events_pro_resource_url('widget-calendar-full.css'), array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } else { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } if ($style_override_url) { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '--widget-calendar-pro-override-style', $style_override_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } }
public function handle() { // 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'); // from `some-style-option` // to `Tribe__Events__Asset__Events_Css_Some_Style_Option` $child_class_name = $this->get_child_class_name($style_option); /** * @var Tribe__Events__Asset__Abstract_Events_Css */ $child_class_instance = new $child_class_name(); // `$stylesheets` passed by reference $child_class_instance->handle($stylesheets, $mobile_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 = Tribe__Events__Templates::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 = Tribe__Events__Template_Factory::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 = "only screen and (max-width: {$mobile_break}px)"; wp_enqueue_style($name, $url, array('tribe-events-calendar-style'), Tribe__Events__Main::VERSION, $media); } else { wp_register_style($name, $url, array(), Tribe__Events__Main::VERSION); wp_enqueue_style($name); } } } }
/** * This Week Widget - Style and Scripts * */ public static function styles_and_scripts() { wp_enqueue_script('tribe-this-week', tribe_events_pro_resource_url('widget-this-week.min.js'), array('jquery'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); // Tribe Events CSS filename $event_file = 'widget-this-week.css'; $stylesheet_option = tribe_get_option('stylesheetOption', 'tribe'); // What Option was selected switch ($stylesheet_option) { case 'skeleton': $event_file_option = 'widget-this-week-' . $stylesheet_option . '.css'; break; case 'full': $event_file_option = 'widget-this-week-' . $stylesheet_option . '.css'; break; default: $event_file_option = 'widget-this-week-theme.css'; break; } $style_url = tribe_events_pro_resource_url($event_file_option); // get the minified file $style_url = Tribe__Events__Template_Factory::getMinFile($style_url, true); //filter stylesheet $style_url = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $style_url); //Check for Override $style_override_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/pro/' . $event_file, $style_url); // Load up stylesheet from theme or plugin if ($style_url && $stylesheet_option == 'tribe') { wp_enqueue_style('widget-this-week-pro-style', tribe_events_pro_resource_url('widget-this-week-full.css'), array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-this-week-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } else { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-this-week-pro-style', $style_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } if ($style_override_url && $style_override_url != $style_url) { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '--widget-this-week-pro-override-style', $style_override_url, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } $widget_data = array('ajaxurl' => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); wp_localize_script('tribe-this-week', 'tribe_this_week', $widget_data); }
/** * @todo revise so that our stylesheet is enqueued in time for the link to be included within the head element */ protected function styles_and_scripts() { wp_enqueue_script('tribe-mini-calendar', tribe_events_pro_resource_url('widget-calendar.js'), array('jquery'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); Tribe__Events__Pro__Widgets::enqueue_calendar_widget_styles(); // 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 = tribe_events_pro_resource_url($event_file_option); $styleUrl = apply_filters('tribe_events_pro_widget_calendar_stylesheet_url', $styleUrl); $styleOverrideUrl = Tribe__Events__Templates::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', tribe_events_pro_resource_url('widget-calendar-full.css'), array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $styleUrl, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } else { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '-widget-calendar-pro-style', $styleUrl, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::VERSION)); } if ($styleOverrideUrl) { wp_enqueue_style(Tribe__Events__Main::POSTTYPE . '--widget-calendar-pro-override-style', $styleOverrideUrl, array(), apply_filters('tribe_events_pro_css_version', Tribe__Events__Pro__Main::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 plugin stylesheet(s). * * @author caseypicker * @since 3.9 * @return void */ public function enqueue_styles() { //Only enqueue wootickets styles on singular event page if (is_singular(Tribe__Events__Main::POSTTYPE)) { $stylesheet_url = $this->pluginUrl . 'src/resources/css/wootickets.css'; // Get minified CSS if it exists $stylesheet_url = Tribe__Events__Template_Factory::getMinFile($stylesheet_url, true); // apply filters $stylesheet_url = apply_filters('tribe_wootickets_stylesheet_url', $stylesheet_url); wp_enqueue_style('TribeEventsWooTickets', $stylesheet_url, array(), apply_filters('tribe_events_wootickets_css_version', self::VERSION)); //Check for override stylesheet $user_stylesheet_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/wootickets/wootickets.css'); $user_stylesheet_url = apply_filters('tribe_events_wootickets_stylesheet_url', $user_stylesheet_url); //If override stylesheet exists, then enqueue it if ($user_stylesheet_url) { wp_enqueue_style('tribe-events-wootickets-override-style', $user_stylesheet_url); } } }
/** * Enqueue the plugin stylesheet(s). * * @author PaulHughes01 * @since 3.4 * @return void */ public 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(Tribe__Events__Main::VENUE_POST_TYPE, Tribe__Events__Main::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__Events__Template_Factory::asset_package('chosen'); Tribe__Events__Template_Factory::asset_package('calendar-script', array('jquery-ui-slider')); wp_enqueue_style('custom-jquery-styles'); wp_enqueue_style('Tribe__Events__Filterbar__View-css', Tribe__Events__Template_Factory::getMinFile($this->pluginUrl . 'src/resources/css/filter-view.css', true), array(), apply_filters('tribe_events_filters_css_version', self::VERSION)); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('Tribe__Events__Filterbar__View-scripts', Tribe__Events__Template_Factory::getMinFile($this->pluginUrl . 'src/resources/js/filter-scripts.js', true), array(), apply_filters('tribe_events_filters_js_version', self::VERSION)); //Check for override stylesheet $user_stylesheet_url = Tribe__Events__Templates::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); } } }