Exemplo n.º 1
0
 /**
  * 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));
     }
 }
Exemplo n.º 2
0
 /**
  * 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));
     }
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 /**
  * 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();
 }
Exemplo n.º 5
0
 /**
  * Returns a tickets unavailable message based on the availability slug of a collection of tickets
  *
  * @since 4.2
  *
  * @param array $tickets Collection of tickets
  *
  * @return string
  */
 public function get_tickets_unavailable_message($tickets)
 {
     $availability_slug = $this->get_availability_slug_by_collection($tickets);
     $message = null;
     $post_type = get_post_type();
     if ('tribe_events' == $post_type && function_exists('tribe_is_past_event') && tribe_is_past_event()) {
         $events_label_singular_lowercase = tribe_get_event_label_singular_lowercase();
         $message = sprintf(esc_html__('Tickets are not available as this %s has passed.', 'event-tickets'), $events_label_singular_lowercase);
     } elseif ('availability-future' === $availability_slug) {
         $message = __('Tickets are not yet available.', 'event-tickets');
     } elseif ('availability-past' === $availability_slug) {
         $message = __('Tickets are no longer available.', 'event-tickets');
     } elseif ('availability-mixed' === $availability_slug) {
         $message = __('There are no tickets available at this time.', 'event-tickets');
     }
     /**
      * Filters the unavailability message for a ticket collection
      *
      * @var string Unavailability message
      * @var array Collection of tickets
      */
     $message = apply_filters('event_tickets_unvailable_message', $message, $tickets);
     return $message;
 }
<?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
Exemplo n.º 7
0
 /**
  * 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();
 }