public function handle() { $handle = 'jquery-ui-datepicker'; wp_enqueue_script($handle); wp_enqueue_style($handle); Tribe__Events__Template_Factory::add_vendor_script($handle); }
function enqueue_month_view_scripts() { if (is_front_page()) { Tribe__Events__Template_Factory::asset_package('ajax-calendar'); Tribe__Events__Template_Factory::asset_package('events-css'); } }
/** * Set up the notices for this template * **/ public function set_notices() { parent::set_notices(); $events_label_singular_lowercase = tribe_get_event_label_singular_lowercase(); if (!tribe_is_showing_all() && tribe_is_past_event()) { Tribe__Notices::set_notice('event-past', sprintf(esc_html__('This %s has passed.', 'the-events-calendar'), $events_label_singular_lowercase)); } }
public function load_assets($hook) { if ('widgets.php' !== $hook) { return; } Tribe__Events__Template_Factory::asset_package('select2'); wp_enqueue_script('tribe-admin-widget-countdown', tribe_events_pro_resource_url('admin-widget-countdown.js'), array('jquery'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'month'; $this->set_current_month(); $this->shortcode->prepare_default(); Tribe__Events__Template_Factory::asset_package('ajax-calendar'); $this->shortcode->set_template_object(new Tribe__Events__Template__Month($this->shortcode->get_query_args())); }
public function load_scripts($hook) { if ($hook != 'widgets.php') { return; } Tribe__Events__Template_Factory::asset_package('select2'); wp_enqueue_script('calendar-widget-admin', tribe_events_pro_resource_url('calendar-widget-admin.js'), array(), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); }
public function handle() { $deps = array_merge($this->deps, array('jquery')); $path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'jquery-placeholder/jquery.placeholder.js', true); $placeholder_handle = Tribe__Events__Template_Factory::get_placeholder_handle(); wp_enqueue_script($placeholder_handle, $path, $deps, '2.0.7', false); Tribe__Events__Template_Factory::add_vendor_script($placeholder_handle); }
public function handle() { $ajax_data = array('ajaxurl' => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'post_type' => Tribe__Events__Main::POSTTYPE); $path = Tribe__Events__Template_Factory::getMinFile(tribe_events_resource_url('tribe-events-ajax-day.js'), true); $handle = 'tribe-events-ajax-day'; wp_enqueue_script($handle, $path, array('tribe-events-bar'), $this->filter_js_version(), true); wp_localize_script($handle, 'TribeCalendar', $ajax_data); }
public function handle() { $path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'jquery-resize/jquery.ba-resize.js', true); $deps = array_merge($this->deps, array('jquery')); $handle = $this->prefix . '-jquery-resize'; wp_enqueue_script($handle, $path, $deps, '1.1', false); Tribe__Events__Template_Factory::add_vendor_script($handle); }
public function handle() { $css_path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'select2/select2.css', true); $path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'select2/select2.js', true); wp_enqueue_style($this->prefix . '-select2-css', $css_path); $script_handle = $this->prefix . '-select2'; wp_enqueue_script($script_handle, $path, 'jquery', '3.2'); Tribe__Events__Template_Factory::add_vendor_script($script_handle); }
public function handle() { $deps = array_merge($this->deps, array('jquery'), Tribe__Events__Template_Factory::get_vendor_scripts()); $path = Tribe__Events__Template_Factory::getMinFile(tribe_events_resource_url('tribe-events.js'), true); $handle = $this->prefix . '-calendar-script'; wp_enqueue_script($handle, $path, $deps, $this->filter_js_version()); $js_config_array = array('permalink_settings' => get_option('permalink_structure'), 'events_post_type' => Tribe__Events__Main::POSTTYPE, 'events_base' => tribe_get_events_link()); wp_localize_script($handle, 'tribe_js_config', $js_config_array); }
public function handle() { $ajax_data = array('ajaxurl' => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'post_type' => Tribe__Events__Main::POSTTYPE); $path1 = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'nanoscroller/jquery.nanoscroller.js', true); wp_enqueue_script('tribe-events-pro-slimscroll', $path1, array('tribe-events-pro', 'jquery-ui-draggable'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION), true); $path2 = Tribe__Events__Template_Factory::getMinFile(tribe_events_pro_resource_url('tribe-events-week.js'), true); wp_enqueue_script('tribe-events-pro-week', $path2, array('tribe-events-pro-slimscroll'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION), true); wp_localize_script('tribe-events-pro-week', 'TribeWeek', $ajax_data); }
public function handle() { $deps = array_merge($this->deps, array('jquery', $this->prefix . '-bootstrap-datepicker', $this->prefix . '-calendar-script')); $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); $path = Tribe__Events__Template_Factory::getMinFile(tribe_events_resource_url('tribe-events-ajax-calendar.js'), true); $handle = 'tribe-events-calendar'; wp_enqueue_script($handle, $path, $deps, $this->filter_js_version(), true); wp_localize_script($handle, 'TribeCalendar', $ajax_data); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'list'; $this->shortcode->set_current_page(); $this->shortcode->prepare_default(); Tribe__Events__Template_Factory::asset_package('ajax-list'); $this->template = new Tribe__Events__Template__List($this->shortcode->get_query_args()); $this->shortcode->set_template_object($this->template); }
public function handle() { $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__Events__Template_Factory::getMinFile($this->vendor_url . 'isotope/jquery.isotope.js', true); $path2 = Tribe__Events__Template_Factory::getMinFile(tribe_events_pro_resource_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', Tribe__Events__Pro__Main::VERSION), true); wp_enqueue_script('tribe-events-pro-photo', $path2, array('tribe-events-pro-isotope'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION), true); wp_localize_script('tribe-events-pro-photo', 'TribePhoto', $ajax_data); }
public function handle() { $deps = array_merge($this->deps, array('jquery', $this->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 = Tribe__Events__Template_Factory::getMinFile(tribe_events_resource_url('tribe-events-ajax-list.js'), true); $handle = 'tribe-events-list'; wp_enqueue_script($handle, $path, $deps, $this->filter_js_version(), true); wp_localize_script($handle, 'TribeList', $ajax_data); }
public function handle() { $deps = array_merge($this->deps, array('jquery')); $css_path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'chosen/public/chosen.css', true); $path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'chosen/public/chosen.jquery.js', true); wp_enqueue_style($this->prefix . '-chosen-style', $css_path); $handle = $this->prefix . '-chosen-jquery'; wp_enqueue_script($handle, $path, $deps, '0.9.5', false); Tribe__Events__Template_Factory::add_vendor_script($handle); }
public function handle() { $css_path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'bootstrap-datepicker/css/datepicker.css', true); $path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'bootstrap-datepicker/js/bootstrap-datepicker.min.js', true); wp_enqueue_style($this->prefix . '-bootstrap-datepicker-css', $css_path); $handle = $this->prefix . '-bootstrap-datepicker'; wp_enqueue_script($handle, $path, 'jquery', '3.2'); Tribe__Events__Template_Factory::add_vendor_script($handle); $localized_datepicker_array = array('days' => array_merge($this->tec->daysOfWeek, array($this->tec->daysOfWeek[0])), 'daysShort' => array_merge($this->tec->daysOfWeekShort, array($this->tec->daysOfWeekShort[0])), 'daysMin' => array_merge($this->tec->daysOfWeekMin, array($this->tec->daysOfWeekMin[0])), 'months' => array_values($this->tec->monthsFull), 'monthsShort' => array_values($this->tec->monthsShort), 'clear' => __('Clear', 'the-events-calendar'), 'today' => __('Today', 'the-events-calendar')); wp_localize_script($handle, 'tribe_bootstrap_datepicker_strings', array('dates' => $localized_datepicker_array)); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'map'; $this->shortcode->set_current_page(); $this->shortcode->prepare_default(); Tribe__Events__Pro__Main::instance()->enqueue_pro_scripts(); Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css'); Tribe__Events__Template_Factory::asset_package('jquery-placeholder'); Tribe__Events__Pro__Template_Factory::asset_package('ajax-maps'); $this->shortcode->set_template_object(new Tribe__Events__Pro__Templates__Map($this->shortcode->get_query_args())); }
/** * Set up the notices for this template **/ public function set_notices() { parent::set_notices(); $events_label_singular_lowercase = tribe_get_event_label_singular_lowercase(); global $post; // 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($post, false, 'Y-m-d G:i') . $gmt_offset) <= time()) { Tribe__Notices::set_notice('event-past', sprintf(esc_html__('This %s has passed.', 'the-events-calendar'), $events_label_singular_lowercase)); } }
/** * 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; }
public function handle() { $http = is_ssl() ? 'https' : 'http'; $url = apply_filters('tribe_events_pro_google_maps_api', $http . '://maps.google.com/maps/api/js'); wp_register_script('tribe-gmaps', $url, array('tribe-events-pro')); $path = Tribe__Events__Template_Factory::getMinFile(tribe_events_pro_resource_url('tribe-events-ajax-maps.js'), true); wp_register_script('tribe-events-pro-geoloc', $path, array('tribe-gmaps', Tribe__Events__Template_Factory::get_placeholder_handle()), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); wp_enqueue_script('tribe-events-pro-geoloc'); $geoloc = Tribe__Events__Pro__Geo_Loc::instance(); $data = array('ajaxurl' => admin_url('admin-ajax.php', $http), 'nonce' => wp_create_nonce('tribe_geosearch'), 'map_view' => 'map' == Tribe__Events__Main::instance()->displaying ? true : false); wp_localize_script('tribe-events-pro-geoloc', 'GeoLoc', $data); }
public function handle() { $css_path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'select2/select2.css', true); $path = Tribe__Events__Template_Factory::getMinFile($this->vendor_url . 'select2/select2.js', true); wp_enqueue_style($this->prefix . '-select2-css', $css_path); // we know of other plugins loading a version of select2 compatible with our needs // let's not queue the script twice. if (!$this->has_script_alias('select2')) { $script_handle = $this->prefix . '-select2'; wp_enqueue_script($script_handle, $path, 'jquery', '3.2'); Tribe__Events__Template_Factory::add_vendor_script($script_handle); } }
/** * @param $hook */ public function load_scripts($hook) { if ('widgets.php' != $hook) { return; } //JS for Taxonomy Filter Select Tribe__Events__Template_Factory::asset_package('select2'); wp_enqueue_script('calendar-widget-admin', tribe_events_pro_resource_url('calendar-widget-admin.js'), array(), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); //Need for Customizer and to prevent errors in Widgets Section with Color Picker wp_enqueue_script('underscore'); //Colorpicker wp_enqueue_style('wp-color-picker'); wp_enqueue_script('wp-color-picker'); }
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); }
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 $url = Tribe__Events__Template_Factory::getMinFile(tribe_events_resource_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; }
/** * Get the title for month view * * @param string $original_title * @param string $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_date_option('monthAndYearFormat', 'F Y'), strtotime(get_query_var('eventDate'))); $new_title = apply_filters('tribe_month_grid_view_title', $new_title, $sep, $title_date); } elseif (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; }
/** * Load asset packages. * * @return void */ public function loadStyle() { if (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue()) { // jquery-resize Tribe__Events__Template_Factory::asset_package('jquery-resize'); // smoothness Tribe__Events__Template_Factory::asset_package('smoothness'); // Tribe Calendar JS Tribe__Events__Template_Factory::asset_package('calendar-script'); Tribe__Events__Template_Factory::asset_package('events-css'); } else { if (is_active_widget(false, false, 'tribe-events-list-widget')) { Tribe__Events__Template_Factory::asset_package('events-css'); } } }
protected function nothing_found_notice() { $events_label_plural = tribe_get_event_label_plural(); list($search_term, $tax_term, $geographic_term) = $this->get_search_terms(); if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) { Tribe__Events__Main::setNotice('events-not-found', sprintf(__('No matching %s listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), strtolower($events_label_plural), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } elseif (empty($search_term) && empty($geographic_term)) { Tribe__Events__Main::setNotice('events-not-found', sprintf(__('No %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), strtolower($events_label_plural), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } else { parent::nothing_found_notice(); } }