function form($instance) { $defaults = array('title' => '', 'event_ID' => null, 'event_date' => null, 'show_seconds' => true, 'complete' => 'Hooray!'); $instance = wp_parse_args((array) $instance, $defaults); $events = tribe_get_events(array('eventDisplay' => 'upcoming', 'posts_per_page' => '-1')); include TribeEventsPro::instance()->pluginPath . 'admin-views/widget-admin-countdown.php'; }
function load_premium_view($file) { if (!file_exists($file)) { $file = TribeEventsPro::instance()->pluginPath . 'views/widget-featured-display.php'; } return $file; }
function form($instance) { /* Set up default widget settings. */ $defaults = array('title' => __('Upcoming Events', 'tribe-events-calendar-pro'), 'limit' => '5', 'no_upcoming_events' => false, 'venue' => false, 'country' => true, 'address' => false, 'city' => true, 'region' => true, 'zip' => false, 'phone' => false, 'cost' => false, 'category' => false, 'organizer' => false); $instance = wp_parse_args((array) $instance, $defaults); include TribeEventsPro::instance()->pluginPath . 'admin-views/widget-admin-advanced-list.php'; }
function form($instance) { $defaults = array('title' => '', 'venue_ID' => null, 'count' => 3, 'hide_if_empty' => true); $venues = get_posts(array('post_type' => TribeEvents::VENUE_POST_TYPE, 'orderby' => 'title', 'nopaging' => true)); $instance = wp_parse_args((array) $instance, $defaults); include TribeEventsPro::instance()->pluginPath . 'admin-views/widget-admin-venue.php'; }
/** * 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)); } }
/** * Generate a support form. * * @return string * @author Peter Chester */ public static function supportForm() { ob_start(); include TribeEventsPro::instance()->pluginPath . 'admin-views/support-form.php'; $form = ob_get_contents(); ob_get_clean(); return $form; }
/** * single_event_meta * * loads the custom field meta box on the event editor screen * * @return void */ public static function single_event_meta() { $tribe_ecp = TribeEvents::instance(); $customFields = tribe_get_option('custom-fields'); $events_event_meta_template = TribeEventsPro::instance()->pluginPath . 'admin-views/event-meta.php'; $events_event_meta_template = apply_filters('tribe_events_event_meta_template', $events_event_meta_template); include $events_event_meta_template; }
public function form($instance) { $defaults = array('title' => '', 'event_ID' => null, 'event_date' => null, 'show_seconds' => true, 'complete' => 'Hooray!'); $instance = wp_parse_args((array) $instance, $defaults); $limit = apply_filters('tribe_events_pro_countdown_widget_limit', 250); $paged = apply_filters('tribe_events_pro_countdown_widget_paged', 1); $events = tribe_get_events(array('eventDisplay' => 'list', 'posts_per_page' => $limit, 'paged' => $paged)); include TribeEventsPro::instance()->pluginPath . 'admin-views/widget-admin-countdown.php'; }
function form($instance) { $defaults = array('title' => __('Events Calendar', 'tribe-events-calendar-pro'), 'layout' => "tall", 'count' => 5, 'operand' => 'OR', 'filters' => null); $instance = wp_parse_args((array) $instance, $defaults); $taxonomies = get_object_taxonomies(TribeEvents::POSTTYPE, 'objects'); $taxonomies = array_reverse($taxonomies); $ts = TribeEventsPro::instance(); include $ts->pluginPath . 'admin-views/widget-calendar.php'; }
public function form($instance) { $this->instance_defaults($instance); $this->include_cat_id($this->instance['filters'], $this->instance['category']); // @todo remove after 3.7 $taxonomies = get_object_taxonomies(TribeEvents::POSTTYPE, 'objects'); $taxonomies = array_reverse($taxonomies); $instance = $this->instance; include TribeEventsPro::instance()->pluginPath . 'admin-views/widget-admin-advanced-list.php'; }
/** * 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); }
function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '')); $tribe_ecp = TribeEvents::instance(); require_once TribeEventsPro::instance()->pluginPath . 'admin-views/widget-admin-calendar.php'; }
/** * Google Calendar Link * * Returns an add to Google Calendar link. Must be used in the loop * * @param int $postId (optional) * @return string URL for google calendar. * @since 2.0 */ function tribe_get_gcal_link($postId = null) { $postId = TribeEvents::postIdHelper($postId); $tribe_ecp = TribeEventsPro::instance(); $output = esc_url($tribe_ecp->googleCalendarLink($postId)); return apply_filters('tribe_get_gcal_link', $output); }
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); }
* @author Modern Tribe Inc. * */ if (!defined('ABSPATH')) { die('-1'); } //Maximum Number of related posts to display $num_posts = 3; $posts = tribe_get_related_posts($num_posts); ?> <?php if (is_array($posts) && !empty($posts)) { echo '<h3 class="tribe-events-related-events-title">' . __('Related Events', 'tribe-events-calendar-pro') . '</h3>'; echo '<ul class="tribe-related-events tribe-clearfix hfeed vcalendar">'; foreach ($posts as $post) { echo '<li>'; $thumb = has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'large') : '<img src="' . trailingslashit(TribeEventsPro::instance()->pluginUrl) . 'resources/images/tribe-related-events-placeholder.png" alt="' . get_the_title($post->ID) . '" />'; echo '<div class="tribe-related-events-thumbnail">'; echo '<a href="' . tribe_get_event_link($post) . '" class="url" rel="bookmark">' . $thumb . '</a>'; echo '</div>'; echo '<div class="tribe-related-event-info">'; echo '<h3 class="tribe-related-events-title summary"><a href="' . tribe_get_event_link($post) . '" class="url" rel="bookmark">' . get_the_title($post->ID) . '</a></h3>'; if ($post->post_type == TribeEvents::POSTTYPE) { echo tribe_events_event_schedule_details($post); } echo '</div>'; echo '</li>'; } echo '</ul>'; }
/** * The singleton function. * * @return TribeEventsPro The instance. */ public static function instance() { if (!isset(self::$instance)) { $className = __CLASS__; self::$instance = new $className(); } return self::$instance; }
/** * Event editing form. * * @param int $id the event's ID. * @return string The editing view markup. * @author Nick Ciske * @since 1.0 */ public function doEventForm($id = null) { if (class_exists('TribeEventsPro')) { // venue and organizer defaults- override ECP defaults add_filter('tribe_get_single_option', array($this, 'filter_default_venue_id'), 10, 3); add_filter('tribe_get_single_option', array($this, 'filter_default_organizer_id'), 10, 3); } add_filter('tribe-post-origin', array($this, 'filterPostOrigin')); $output = ''; $show_form = true; $event = null; if ($id) { $edit = true; $tribe_event_id = $id; } else { $edit = false; $tribe_event_id = null; } if ($tribe_event_id && class_exists('TribeEventsPro') && tribe_is_recurring_event($tribe_event_id)) { $this->enqueueOutputMessage(sprintf(__('%sWarning:%s You are editing a recurring event. All changes will be applied to the entire series.', 'tribe-events-community'), '<b>', '</b>'), 'error'); } // Delete the featured image, if there was a request to do so. if (isset($_GET['action']) && $_GET['action'] == 'deleteFeaturedImage' && wp_verify_nonce($_GET['_wpnonce'], 'tribe_community_events_featured_image_delete') && current_user_can('edit_post', $tribe_event_id)) { $featured_image_id = get_post_thumbnail_id($tribe_event_id); delete_post_meta($tribe_event_id, '_thumbnail_id'); wp_delete_attachment($featured_image_id, true); } if ($edit && $tribe_event_id) { $event = get_post(intval($tribe_event_id)); global $post; $old_post = $post; $post = $event; } if ($edit && (!$tribe_event_id || !isset($event->ID))) { $this->enqueueOutputMessage(__('Event not found.', 'tribe-events-community'), 'error'); $output = $this->outputMessage(null, false); $show_form = false; } // login check if (!$this->allowAnonymousSubmissions && !is_user_logged_in() || $edit && $tribe_event_id && !is_user_logged_in()) { do_action('tribe_ce_event_submission_login_form'); $output .= $this->login_form(__('Please log in first.', 'tribe-events-community')); return $output; } // security check if ($edit && $tribe_event_id && !current_user_can('edit_post', $tribe_event_id)) { $output .= '<p>' . __('You do not have permission to edit this event.', 'tribe-events-community') . '</p>'; return $output; } $this->loadScripts = true; do_action('tribe_ce_before_event_submission_page'); $output .= '<div id="tribe-community-events" class="form">'; if ($this->allowAnonymousSubmissions || is_user_logged_in()) { $current_user = wp_get_current_user(); if (class_exists('TribeEventsPro')) { $tribe_ecp = TribeEventsPro::instance(); } $submission = $this->get_submitted_event(); if (!empty($submission)) { // show no sympathy for spammers if (!is_user_logged_in()) { $this->spam_check($submission); } $submission['ID'] = $tribe_event_id; require_once 'tribe-community-events-submission-scrubber.php'; $scrubber = new TribeCommunityEvents_SubmissionScrubber($submission); $_POST = $scrubber->scrub(); // update the event if ($tribe_event_id && $this->validate_submission_has_required_fields($_POST)) { if ($this->saveEvent($tribe_event_id)) { $this->enqueueOutputMessage(__('Event updated.', 'tribe-events-community') . $this->get_view_edit_links($tribe_event_id)); $this->enqueueOutputMessage('<a href="' . $this->getUrl('add') . '">' . __('Submit another event', 'tribe-events-community') . '</a>'); delete_transient('tribe_community_events_today_page'); //clear cache } else { $this->enqueueOutputMessage($this->get_error_message($_POST, $tribe_event_id), 'error'); } } else { // or create a new one $_POST['post_status'] = $this->defaultStatus; if ($this->validate_submission_has_required_fields($_POST)) { $tribe_event_id = $this->createEvent(); } if ($tribe_event_id) { $this->enqueueOutputMessage(__('Event submitted.', 'tribe-events-community') . $this->get_view_edit_links($tribe_event_id)); $this->enqueueOutputMessage('<a href="' . $this->getUrl('add') . '">' . __('Submit another event', 'tribe-events-community') . '</a>'); // email alerts if ($this->emailAlertsEnabled) { $this->sendEmailAlerts($tribe_event_id); } } else { $this->enqueueOutputMessage($this->get_error_message($_POST, $tribe_event_id), 'error'); //get event info from POST $event = $this->getInfoFromPost(); } } } // are we editing an event? if (isset($tribe_event_id) && $edit) { // global $post; // $event = get_post(intval($tribe_event_id)); } else { if (empty($event)) { $event = new stdClass(); } if (isset($_POST['post_title'])) { $event->post_title = $_POST['post_title']; } if (isset($_POST['post_content'])) { $event->post_content = $_POST['post_content']; } } $show_form = apply_filters('tribe_community_events_show_form', $show_form); if ($show_form) { remove_filter('the_content', 'do_shortcode', 11); //get data from $_POST and override core function add_filter('tribe_get_hour_options', array($this, 'getHours'), 10, 3); add_filter('tribe_get_minute_options', array($this, 'getMinutes'), 10, 3); add_filter('tribe_get_meridian_options', array($this, 'getMeridians'), 10, 3); //turn off upsell -- this is public after all remove_action('tribe_events_cost_table', array(TribeEvents::instance(), 'maybeShowMetaUpsell')); if (class_exists('Event_Tickets_PRO')) { // Remove the eventbrite method hooked into the event form, if it exists. remove_action('tribe_events_cost_table', array(Event_Tickets_PRO::instance(), 'eventBriteMetaBox'), 1); } if (class_exists('TribeEventsPro')) { remove_action('tribe_events_date_display', array('TribeEventsRecurrenceMeta', 'loadRecurrenceData')); add_action('tribe_events_date_display', array($this, 'loadRecurrenceData')); } do_action('tribe_ce_before_event_submission_page_template'); $edit_template = TribeEventsTemplates::getTemplateHierarchy('community/edit-event', array('disable_view_check' => true)); ob_start(); if (empty($_POST) || $this->messageType == 'error') { do_action('tribe_events_community_form', $tribe_event_id, $event, $edit_template); } else { include TribeEventsTemplates::getTemplateHierarchy('community/modules/header-links'); } $output .= ob_get_clean(); } $output .= '</div>'; } wp_reset_query(); remove_filter('tribe-post-origin', array($this, 'filterPostOrigin')); return $output; }
/** * Inject the GeoLoc settings into the general TEC settings screen * * @param $args * @param $id * * @return array */ public function inject_settings($args, $id) { if ($id == 'general') { $venues = $this->get_venues_without_geoloc_info(); // we want to inject the map default distance and unit into the map section directly after "enable Google Maps" $args = TribeEventsPro::array_insert_after_key('embedGoogleMaps', $args, array('geoloc_default_geofence' => array('type' => 'text', 'label' => __('Map view search distance limit', 'tribe-events-calendar-pro'), 'size' => 'small', 'tooltip' => __('Set the distance that the location search covers (find events within X distance units of location search input).', 'tribe-events-calendar-pro'), 'default' => '25', 'class' => '', 'validation_type' => 'number_or_percent'), 'geoloc_default_unit' => array('type' => 'dropdown', 'label' => __('Map view distance unit', 'tribe-events-calendar-pro'), 'validation_type' => 'options', 'size' => 'small', 'default' => 'miles', 'options' => apply_filters('tribe_distance_units', array('miles' => __('Miles', 'tribe-events-calendar-pro'), 'kms' => __('Kilometers', 'tribe-events-calendar-pro')))), 'geoloc_fix_venues' => array('type' => 'html', 'html' => '<a name="geoloc_fix"></a><fieldset class="tribe-field tribe-field-html"><legend>' . __('Fix geolocation data', 'tribe-events-calendar-pro') . '</legend><div class="tribe-field-wrap">' . $this->fix_geoloc_data_button() . '<p class="tribe-field-indent description">' . sprintf(__("You have %d venues for which we don't have geolocation data. We need to use the Google Maps API to get that information. Doing this may take a while (aprox. 1 minute for every 200 venues).", 'tribe-events-calendar-pro'), $venues->found_posts) . '</p></div></fieldset>', 'conditional' => $venues->found_posts > 0))); } elseif ($id == 'display') { $args = TribeEventsPro::array_insert_after_key('tribeDisableTribeBar', $args, array('hideLocationSearch' => array('type' => 'checkbox_bool', 'label' => __('Hide location search', 'tribe-events-calendar-pro'), 'tooltip' => __('Removes location search field from the events bar on all views except for map view.', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean'))); } return $args; }
function dt_sc_widgets($attrs, $content = null) { extract(shortcode_atts(array('widget_name' => '', 'widget_wpname' => '', 'widget_wpid' => ''), $attrs)); if ($widget_name != '') { foreach ($attrs as $key => $value) { $instance[$key] = $value; } $instance = array_filter($instance); //Event Widgets if ($widget_name == 'TribeCountdownWidget') { $eventid = $instance['event_id']; $eventid = explode('|', $eventid); $instance['event_ID'] = $eventid[0]; } if ($widget_name == 'TribeVenueWidget') { $venueid = $instance['venue_id']; $instance['venue_ID'] = $venueid; } if (($widget_name == 'TribeEventsAdvancedListWidget' || $widget_name == 'TribeEventsMiniCalendarWidget') && isset($instance['selector'])) { $instance['filters'] = '{"tribe_events_cat":["' . $instance['selector'] . '"]}'; } if (class_exists('TribeEventsPro')) { 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)); } //Event Widgets End //Woocommerce Start if (substr($widget_name, 0, 2) == 'WC') { $add_cls = 'woocommerce'; } else { $add_cls = ''; } //Woocommerce End ob_start(); the_widget($widget_name, $instance, 'before_widget=<aside id="' . $widget_wpid . '" class="widget ' . $add_cls . ' ' . $widget_wpname . '">&after_widget=</aside>&before_title=<h3 class="widgettitle">&after_title=<span></span></h3>'); $output = ob_get_contents(); ob_end_clean(); return $output; } }
/** * @todo revise so that our stylesheet is enqueued in time for the link to be included within the head element */ 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)); TribeEventsPro_Widgets::enqueue_calendar_widget_styles(); $widget_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); wp_localize_script('tribe-mini-calendar', 'TribeMiniCalendar', $widget_data); }
/** * Echos the single events page related events boxes. * * @param mixed $tag The specific tags you want it relating to. * @param mixed $category The specific categories you want it relating to. * @param int $count The number of related events to find. * @param mixed $blog What blog/site should they come from? * @param bool $only_display_related Should we show only related events if we don't find $count number of related ones? * @param string $post_type What post type are we finding related things in? * @return void. */ function tribe_single_related_events($tag = false, $category = false, $count = 3, $blog = false, $only_display_related = true, $post_type = TribeEvents::POSTTYPE) { $posts = tribe_get_related_posts($tag, $category, $count, $blog, $only_display_related, $post_type); if (is_array($posts) && !empty($posts)) { echo '<h3 class="tribe-events-related-events-title">' . __('Related Events', 'tribe-events-calendar-pro') . '</h3>'; echo '<ul class="tribe-related-events tribe-clearfix hfeed vcalendar">'; foreach ($posts as $post) { echo '<li>'; $thumb = has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'large') : '<img src="' . trailingslashit(TribeEventsPro::instance()->pluginUrl) . 'resources/images/tribe-related-events-placeholder.png" alt="' . get_the_title($post->ID) . '" />'; echo '<div class="tribe-related-events-thumbnail">'; echo '<a href="' . get_permalink($post->ID) . '" class="url" rel="bookmark">' . $thumb . '</a>'; echo '</div>'; echo '<div class="tribe-related-event-info">'; echo '<h3 class="tribe-related-events-title summary"><a href="' . get_permalink($post->ID) . '" class="url" rel="bookmark">' . get_the_title($post->ID) . '</a></h3>'; if (class_exists('TribeEvents') && $post->post_type == TribeEvents::POSTTYPE && function_exists('tribe_events_event_schedule_details')) { echo tribe_events_event_schedule_details($post); } if (class_exists('TribeEvents') && $post->post_type == TribeEvents::POSTTYPE && function_exists('tribe_events_event_recurring_info_tooltip')) { echo tribe_events_event_recurring_info_tooltip($post->ID); } echo '</div>'; echo '</li>'; } echo '</ul>'; } }
/** * Adds setting for hiding subsequent occurrences by default. * * @since 3.0 * @author PaulHughes * * @return void */ public function inject_settings($args, $id) { if ($id == 'general') { // we want to inject the hiding subsequent occurrences into the general section directly after "Live update AJAX" $args = TribeEventsPro::array_insert_after_key('liveFiltersUpdate', $args, array('hideSubsequentRecurrencesDefault' => array('type' => 'checkbox_bool', 'label' => __('Recurring event instances', 'tribe-events-calendar-pro'), 'tooltip' => __('Show only the first instance of each recurring event.', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean'), 'userToggleSubsequentRecurrences' => array('type' => 'checkbox_bool', 'label' => __('Front-end recurring event instances toggle', 'tribe-events-calendar-pro'), 'tooltip' => __('Allow users to decide whether to show all instances of a recurring event.', 'tribe-events-calendar-pro'), 'default' => false, 'validation_type' => 'boolean'))); } return $args; }
/** * Displays the events recurrence form on the event editor screen * * @param integer $postId ID of the current event * * @return void */ public static function loadRecurrenceData($postId) { $post = get_post($postId); if (!empty($post->post_parent)) { return; // don't show recurrence fields for instances of a recurring event } // convert array to variables that can be used in the view extract(TribeEventsRecurrenceMeta::getRecurrenceMeta($postId)); $premium = TribeEventsPro::instance(); include TribeEventsPro::instance()->pluginPath . 'admin-views/event-recurrence.php'; }
/** * 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); }
/** * Get the date for the day navigation link. * * @param string $date_description * * @return string * @throws OverflowException */ function tribe_get_the_day_link_date($date_description) { if (is_null($date_description)) { return TribeEventsPro::instance()->todaySlug; } if ($date_description == 'previous day') { return tribe_get_previous_day_date(get_query_var('start_date')); } if ($date_description == 'next day') { return tribe_get_next_day_date(get_query_var('start_date')); } return date('Y-m-d', strtotime($date_description)); }
add_action('tribe_events_after_the_event_title', 'avia_events_open_outer_wrap', 10); function avia_events_open_outer_wrap() { echo "<div class='av-tribe-events-outer-content-wrap'>"; } } if (!function_exists('avia_events_open_inner_wrap')) { add_action('tribe_events_after_the_meta', 'avia_events_open_inner_wrap', 10); function avia_events_open_inner_wrap() { echo "<div class='av-tribe-events-inner-content-wrap'>"; } } if (!function_exists('avia_events_close_div')) { /*call 3 times, once for wrappper, outer and inner wrap*/ add_action('tribe_events_after_the_content', 'avia_events_close_div', 1000); add_action('tribe_events_after_the_content', 'avia_events_close_div', 1001); add_action('tribe_events_after_the_content', 'avia_events_close_div', 1003); function avia_events_close_div() { echo "</div>"; } } /*PRO PLUGIN*/ if (!class_exists('TribeEventsPro')) { return false; } /*move related events*/ $tec = TribeEventsPro::instance(); remove_action('tribe_events_single_event_after_the_meta', array($tec, 'register_related_events_view')); add_action('tribe_events_single_event_after_the_content', array($tec, 'register_related_events_view'));
/** * Displays the events recurrence form on the event editor screen * @param integer $postId ID of the current event * @return void */ public static function loadRecurrenceData($postId) { // convert array to variables that can be used in the view extract(TribeEventsRecurrenceMeta::getRecurrenceMeta($postId)); $premium = TribeEventsPro::instance(); include TribeEventsPro::instance()->pluginPath . 'admin-views/event-recurrence.php'; }
function tribe_events_pro_resource_url($resource, $echo = false) { $url = apply_filters('tribe_events_pro_resource_url', trailingslashit(TribeEventsPro::instance()->pluginUrl) . 'resources/' . $resource, $resource); if ($echo) { echo $url; } return $url; }