/** * Run on applied action init */ public function init() { $rewrite = Tribe__Events__Rewrite::instance(); $venue = Tribe__Events__Venue::instance(); $organizer = Tribe__Events__Organizer::instance(); $this->postVenueTypeArgs = $venue->post_type_args; $this->postOrganizerTypeArgs = $organizer->post_type_args; $this->pluginName = $this->plugin_name = esc_html__('The Events Calendar', 'the-events-calendar'); $this->rewriteSlug = $this->getRewriteSlug(); $this->rewriteSlugSingular = $this->getRewriteSlugSingular(); $this->category_slug = $this->get_category_slug(); $this->tag_slug = $this->get_tag_slug(); $this->taxRewriteSlug = $this->rewriteSlug . '/' . $this->category_slug; $this->tagRewriteSlug = $this->rewriteSlug . '/' . $this->tag_slug; $this->monthSlug = sanitize_title(__('month', 'the-events-calendar')); $this->listSlug = sanitize_title(__('list', 'the-events-calendar')); $this->upcomingSlug = sanitize_title(__('upcoming', 'the-events-calendar')); $this->pastSlug = sanitize_title(__('past', 'the-events-calendar')); $this->daySlug = sanitize_title(__('day', 'the-events-calendar')); $this->todaySlug = sanitize_title(__('today', 'the-events-calendar')); $this->singular_venue_label = $this->get_venue_label_singular(); $this->plural_venue_label = $this->get_venue_label_plural(); $this->singular_organizer_label = $this->get_organizer_label_singular(); $this->plural_organizer_label = $this->get_organizer_label_plural(); $this->singular_event_label = $this->get_event_label_singular(); $this->plural_event_label = $this->get_event_label_plural(); $this->singular_event_label_lowercase = tribe_get_event_label_singular_lowercase(); $this->plural_event_label_lowercase = tribe_get_event_label_plural_lowercase(); $this->postTypeArgs['rewrite']['slug'] = $rewrite->prepare_slug($this->rewriteSlugSingular, self::POSTTYPE, false); $this->currentDay = ''; $this->errors = ''; $this->default_values = apply_filters('tribe_events_default_value_strategy', new Tribe__Events__Default_Values()); Tribe__Events__Query::init(); Tribe__Events__Backcompat::init(); Tribe__Credits::init(); Tribe__Events__Timezones::init(); $this->registerPostType(); Tribe__Debug::debug(sprintf(esc_html__('Initializing Tribe Events on %s', 'the-events-calendar'), date('M, jS \\a\\t h:m:s a'))); $this->maybeSetTECVersion(); // Start the integrations manager Tribe__Events__Integrations__Manager::instance()->load_integrations(); }
public function get_result_messages($queue) { $messages = array(); if (is_wp_error($queue)) { $messages['error'][] = $queue->get_error_message(); tribe_notice('tribe-aggregator-import-failed', array($this, 'render_notice_import_failed'), 'type=error'); return $messages; } $is_queued = $queue->count(); $content_post_type = empty($queue->record->meta['content_type']) ? Tribe__Events__Main::POSTTYPE : $queue->record->meta['content_type']; $content_type = tribe_get_event_label_singular_lowercase(); $content_type_plural = tribe_get_event_label_plural_lowercase(); if ('csv' === $queue->record->meta['origin'] && 'tribe_events' !== $queue->record->meta['content_type']) { $content_type_object = get_post_type_object($queue->record->meta['content_type']); $content_type = empty($content_type_object->labels->singular_name_lowercase) ? $content_type_object->labels->singular_name : $content_type_object->labels->singular_name_lowercase; $content_type_plural = empty($content_type_object->labels->plural_name_lowercase) ? $content_type_object->labels->name : $content_type_object->labels->plural_name_lowercase; $content_post_type = $content_type_object->name; } if (!$is_queued) { $item_created = $queue->activity->get($content_post_type, 'created'); if (!empty($item_created)) { $content_label = 1 === $queue->activity->count($content_post_type, 'created') ? $content_type : $content_type_plural; $messages['success'][] = sprintf(_n('%1$d new %2$s was imported.', '%1$d new %2$s were imported.', $queue->activity->count($content_post_type, 'created'), 'the-events-calendar'), $queue->activity->count($content_post_type, 'created'), $content_label); } $item_updated = $queue->activity->get($content_post_type, 'updated'); if (!empty($item_updated)) { $content_label = 1 === $queue->activity->count($content_post_type, 'updated') ? $content_type : $content_type_plural; // @todo: include a part of sentence like: ", including %1$d %2$signored event%3$s.", <a href="/wp-admin/edit.php?post_status=tribe-ignored&post_type=tribe_events">, </a> $messages['success'][] = sprintf(_n('%1$d existing %2$s was updated.', '%1$d existing %2$s were updated.', $queue->activity->count($content_post_type, 'updated'), 'the-events-calendar'), $queue->activity->count($content_post_type, 'updated'), $content_label); } $item_skipped = $queue->activity->get($content_post_type, 'skipped'); if (!empty($item_skipped)) { $content_label = 1 === $queue->activity->count($content_post_type, 'skipped') ? $content_type : $content_type_plural; $messages['success'][] = sprintf(_n('%1$d already-imported %2$s was skipped.', '%1$d already-imported %2$s were skipped.', $queue->activity->count($content_post_type, 'skipped'), 'the-events-calendar'), $queue->activity->count($content_post_type, 'skipped'), $content_label); } $images_created = $queue->activity->get('images', 'created'); if (!empty($images_created)) { $messages['success'][] = sprintf(_n('%1$d new image was imported.', '%1$d new images were imported.', $queue->activity->count('images', 'created'), 'the-events-calendar'), $queue->activity->count('images', 'created')); } if ($queue && !$messages) { $messages['success'][] = sprintf(__('No %1$s were imported or updated.', 'the-events-calendar'), $content_type_plural); } if (!empty($messages['success']) && !empty($content_type_object->show_ui)) { // append a URL to view all records for the given post type $url = admin_url('edit.php?post_type=' . $content_post_type); $link_text = sprintf(__('View all %s', 'the-events-calendar'), $content_type_plural); $messages['success'][count($messages['success']) - 1] .= ' <a href="' . esc_url($url) . '" >' . esc_html($link_text) . '</a>'; } // if not CSV, pull counts for venues and organizers that were auto-created if ('csv' !== $queue->record->meta['origin']) { $venue_created = $queue->activity->get('venue', 'created'); if (!empty($venue_created)) { $messages['success'][] = '<br/>' . sprintf(_n('%1$d new venue was imported.', '%1$d new venues were imported.', $queue->activity->count('venue', 'created'), 'the-events-calendar'), $queue->activity->count('venue', 'created')) . ' <a href="' . admin_url('edit.php?post_type=tribe_venue') . '">' . __('View your event venues', 'the-events-calendar') . '</a>'; } $organizer_created = $queue->activity->get('organizer', 'created'); if (!empty($organizer_created)) { $messages['success'][] = '<br/>' . sprintf(_n('%1$d new organizer was imported.', '%1$d new organizers were imported.', $queue->activity->count('organizer', 'created'), 'the-events-calendar'), $queue->activity->count('organizer', 'created')) . ' <a href="' . admin_url('edit.php?post_type=tribe_organizer') . '">' . __('View your event organizers', 'the-events-calendar') . '</a>'; } } $category_created = $queue->activity->get('category', 'created'); if (!empty($category_created)) { $messages['success'][] = '<br/>' . sprintf(_n('%1$d new event category was created.', '%1$d new event categories were created.', $queue->activity->count('category', 'created'), 'the-events-calendar'), $queue->activity->count('category', 'created')) . ' <a href="' . admin_url('edit-tags.php?taxonomy=tribe_events_cat&post_type=tribe_events') . '">' . __('View your event categories', 'the-events-calendar') . '</a>'; } } if (!empty($messages['error']) || !empty($messages['success']) || !empty($messages['warning'])) { if ('manual' == $queue->record->type) { array_unshift($messages['success'], __('Import complete!', 'the-events-calendar') . '<br/>'); } else { array_unshift($messages['success'], __('Your scheduled import was saved and the first import is complete!', 'the-events-calendar') . '<br/>'); $scheduled_time = strtotime($queue->record->post->post_modified) + $queue->record->frequency->interval; $scheduled_time_string = date(get_option('date_format'), $scheduled_time) . _x(' at ', 'separator between date and time', 'the-events-calendar') . date(get_option('time_format'), $scheduled_time); $messages['success'][] = '<br/>' . sprintf(__('The next import is scheduled for %1$s.', 'the-events-calendar'), esc_html($scheduled_time_string)) . ' <a href="' . admin_url('edit.php?page=aggregator&post_type=tribe_events&tab=scheduled') . '">' . __('View your scheduled imports.', 'the-events-calendar') . '</a>'; } } return $messages; }
<?php /** * Events post main metabox */ // Don't load directly if (!defined('ABSPATH')) { die('-1'); } $events_label_singular = tribe_get_event_label_singular(); $events_label_plural = tribe_get_event_label_plural(); $events_label_singular_lowercase = tribe_get_event_label_singular_lowercase(); $events_label_plural_lowercase = tribe_get_event_label_plural_lowercase(); if (class_exists('Eventbrite_for_TribeEvents')) { ?> <style type="text/css"> .eventBritePluginPlug { display: none; } </style> <?php } ?> <div id="eventIntro"> <div id="tribe-events-post-error" class="tribe-events-error error"></div> <?php /** * Fires inside the top of "The Events Calendar" meta box * * @param int $event->ID the event currently being edited, will be 0 if creating a new event * @param boolean
protected function nothing_found_notice() { $events_label_plural_lowercase = tribe_get_event_label_plural_lowercase(); list($search_term, $tax_term, $geographic_term) = $this->get_search_terms(); if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No matching %1$s listed under %2$s scheduled for %3$s. Please try another day.', 'the-events-calendar'), $events_label_plural_lowercase, $tax_term, '<strong>' . date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))) . '</strong>')); } elseif (empty($search_term) && empty($geographic_term)) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No %1$s scheduled for %2$s. Please try another day.', 'the-events-calendar'), $events_label_plural_lowercase, '<strong>' . date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))) . '</strong>')); } else { parent::nothing_found_notice(); } }
/** * Sets an appropriate no results found message. * */ protected function nothing_found_notice() { if (!empty($this->args['suppress_nothing_found_notice'])) { return; } $events_label_plural_lowercase = tribe_get_event_label_plural_lowercase(); list($search_term, $tax_term, $geographic_term) = $this->get_search_terms(); if (!empty($search_term)) { Tribe__Notices::set_notice('event-search-no-results', sprintf(esc_html__('There were no results found for %s this month. Try searching next month.', 'the-events-calendar'), '<strong>"' . esc_html($search_term) . '"</strong>')); } elseif (!empty($tax_term)) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No matching %1$s listed under %2$s. Please try viewing the full calendar for a complete list of events.', 'the-events-calendar'), $events_label_plural_lowercase, $tax_term)); } else { Tribe__Notices::set_notice('event-search-no-results', esc_html__('There were no results found.', 'the-events-calendar')); } }
<?php do_action('tribe_events_widget_list_inside_after_loop'); ?> <?php } ?> <p class="tribe-events-widget-link"> <a href="<?php esc_attr_e(esc_url($link_to_all)); ?> " rel="bookmark"> <?php esc_html_e('View More…', 'tribe-events-calendar-pro'); ?> </a> </p> <?php // No Events were found. } else { ?> <p><?php printf(__('There are no upcoming %s at this time.', 'tribe-events-calendar-pro'), tribe_get_event_label_plural_lowercase()); ?> </p> <?php } // Cleanup. Do not remove this. wp_reset_postdata();
/** * The class init function. * * @return void */ public function init() { Tribe__Events__Pro__Mini_Calendar::instance(); Tribe__Events__Pro__This_Week::instance(); Tribe__Events__Pro__Custom_Meta::init(); Tribe__Events__Pro__Recurrence__Meta::init(); Tribe__Events__Pro__Geo_Loc::instance(); Tribe__Events__Pro__Community_Modifications::init(); $this->displayMetaboxCustomFields(); $this->custom_meta_tools = new Tribe__Events__Pro__Admin__Custom_Meta_Tools(); $this->single_event_meta = new Tribe__Events__Pro__Single_Event_Meta(); $this->single_event_overrides = new Tribe__Events__Pro__Recurrence__Single_Event_Overrides(); $this->queue_processor = new Tribe__Events__Pro__Recurrence__Queue_Processor(); $this->queue_realtime = new Tribe__Events__Pro__Recurrence__Queue_Realtime(); $this->aggregator = new Tribe__Events__Pro__Recurrence__Aggregator(); $this->embedded_maps = new Tribe__Events__Pro__Embedded_Maps(); $this->shortcodes = new Tribe__Events__Pro__Shortcodes__Register(); $this->singular_event_label = tribe_get_event_label_singular(); $this->plural_event_label = tribe_get_event_label_plural(); $this->singular_event_label_lowercase = tribe_get_event_label_singular_lowercase(); $this->plural_event_label_lowercase = tribe_get_event_label_plural_lowercase(); }
/** * Sets an appropriate no results found message. This may be overridden in child classes. */ protected function nothing_found_notice() { $events_label_plural = tribe_get_event_label_plural_lowercase(); list($search_term, $tax_term, $geographic_term) = $this->get_search_terms(); $tribe = Tribe__Events__Main::instance(); if (!empty($search_term)) { Tribe__Notices::set_notice('event-search-no-results', sprintf(esc_html__('There were no results found for %s.', 'the-events-calendar'), '<strong>"' . esc_html($search_term) . '"</strong>')); } elseif (!empty($geographic_term)) { Tribe__Notices::set_notice('event-search-no-results', sprintf(esc_html__('No results were found for %1$s in or near %2$s.', 'the-events-calendar'), $events_label_plural, '<strong>"' . esc_html($geographic_term) . '"</strong>')); } elseif (!empty($tax_term) && tribe_is_upcoming() && date('Y-m-d') === date('Y-m-d', strtotime($tribe->date))) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No upcoming %1$s listed under %2$s. Check out upcoming %3$s for this category or view the full calendar.', 'the-events-calendar'), $events_label_plural, $tax_term, $events_label_plural)); } elseif (!empty($tax_term) && tribe_is_upcoming()) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No matching %1$s listed under %2$s. Please try viewing the full calendar for a complete list of %3$s.', 'the-events-calendar'), $events_label_plural, $tax_term, $events_label_plural)); } elseif (!empty($tax_term) && tribe_is_past()) { Tribe__Notices::set_notice('events-past-not-found', sprintf(esc_html__('No previous %s ', 'the-events-calendar'), $events_label_plural)); } elseif (!empty($tax_term)) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No matching %1$s listed under %2$s. Please try viewing the full calendar for a complete list of %3$s.', 'the-events-calendar'), $events_label_plural, $tax_term, $events_label_plural)); } else { Tribe__Notices::set_notice('event-search-no-results', esc_html__('There were no results found.', 'the-events-calendar')); } }
function tribe_recurring_instances_toggle($postId = null) { $hide_recurrence = !empty($_REQUEST['tribeHideRecurrence']) && $_REQUEST['tribeHideRecurrence'] == '1' || empty($_REQUEST['tribeHideRecurrence']) && empty($_REQUEST['action']) && tribe_get_option('hideSubsequentRecurrencesDefault', false) ? '1' : false; if (!tribe_is_week() && !tribe_is_month()) { echo '<span class="tribe-events-user-recurrence-toggle">'; echo '<label for="tribeHideRecurrence">'; echo '<input type="checkbox" name="tribeHideRecurrence" value="1" id="tribeHideRecurrence" ' . checked($hide_recurrence, 1, false) . '>' . sprintf(__('Show only the first upcoming instance of recurring %s', 'tribe-events-calendar-pro'), tribe_get_event_label_plural_lowercase()); echo '</label>'; echo '</span>'; } }