本文整理汇总了PHP中tribe_get_end_date函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_end_date函数的具体用法?PHP tribe_get_end_date怎么用?PHP tribe_get_end_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_end_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tribe_rss_feed_add_eventdate
function tribe_rss_feed_add_eventdate()
{
?>
<ev:tribe_event_meta xmlns:ev="Event">
<?php
if (tribe_get_start_date() !== tribe_get_end_date()) {
?>
<ev:startdate><?php
echo tribe_get_start_date();
?>
</ev:startdate>
<ev:enddate><?php
echo tribe_get_end_date();
?>
</ev:enddate>
<?php
} else {
?>
<ev:startdate><?php
echo tribe_get_start_date();
?>
</ev:startdate>
<?php
}
?>
</ev:tribe_event_meta>
<?php
}
示例2: build_data
/**
* Compile the schema.org event data into an array
*/
private function build_data()
{
global $post;
$id = $post->ID;
$events_data = array();
// Index by ID: this will allow filter code to identify the actual event being referred to
// without injecting an additional property
$events_data[$id] = new stdClass();
$events_data[$id]->{'@context'} = 'http://schema.org';
$events_data[$id]->{'@type'} = 'Event';
$events_data[$id]->name = get_the_title();
if (has_post_thumbnail()) {
$events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
}
$events_data[$id]->url = get_the_permalink($post->ID);
$events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
$events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c');
if (tribe_has_venue($id)) {
$events_data[$id]->location = new stdClass();
$events_data[$id]->location->{'@type'} = 'Place';
$events_data[$id]->location->name = tribe_get_venue($post->ID);
$events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
}
/**
* Allows the event data to be modifed by themes and other plugins.
*
* @param array $events_data objects representing the Google Markup for each event.
*/
$events_data = apply_filters('tribe_google_event_data', $events_data);
// Strip the post ID indexing before returning
$events_data = array_values($events_data);
return $events_data;
}
示例3: event_date
/**
* Get the event date
*
* @param int $meta_id
* @return string
*/
public static function event_date($meta_id)
{
$time_format = get_option('time_format', TribeDateUtils::TIMEFORMAT);
$start_time = tribe_get_start_date(null, false, $time_format);
$end_time = tribe_get_end_date(null, false, $time_format);
if (tribe_event_is_all_day()) {
if (tribe_event_is_multiday()) {
$html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
$html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id);
} else {
// If all day event, show only start date
$html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
}
} elseif (tribe_event_is_multiday()) {
// If multiday, show start date+time and end date+time
$html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
$html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id);
} else {
// show start date
$html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date(null, false)), $meta_id);
if ($start_time == $end_time) {
// if start and end time are the same, just show the start time
$html .= Tribe_Meta_Factory::template(__('Time:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), $start_time), $meta_id);
} else {
// show start and end time
$html .= Tribe_Meta_Factory::template(__('Time:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), $start_time . ' - ' . $end_time), $meta_id);
}
}
return apply_filters('tribe_event_meta_event_date', $html);
}
示例4: set_notices
/**
* Set up the notices for this template
*
* @return void
* @since 3.0
**/
public function set_notices()
{
parent::set_notices();
// 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(get_the_ID(), false, 'Y-m-d G:i') . $gmt_offset) <= time()) {
TribeEvents::setNotice('event-past', __('This event has passed.', 'tribe-events-calendar'));
}
}
示例5: front_end
function front_end($args, $instance)
{
extract($args);
$limit = intval($instance['load']);
$title = $instance['title'];
$events = tribe_get_events(array('eventDisplay' => 'upcoming', 'posts_per_page' => $event_count));
if (!empty($events)) {
echo $title ? $before_title . $title . $after_title : '';
foreach ($events as $event) {
$start_date = strtotime(tribe_get_start_date($event->ID));
$start_date_day = date('Y-m-d', $start_date);
$end_date = strtotime(tribe_get_end_date($event->ID));
$end_date_day = date('Y-m-d', $end_date);
$all_day = tribe_event_is_all_day($event->ID);
$time_format = get_option('time_format');
if ($all_day) {
$date_format = date('F jS', $start_date) . '<span>•</span> <em>' . __('All day', 'espresso') . '</em>';
} else {
if ($end_date_day) {
if ($start_date_day == $end_date_day) {
$date_format = date('F jS', $start_date) . '<span>•</span> <em>' . date($time_format, $start_date) . ' – ' . date($time_format, $end_date) . '</em>';
} else {
$date_format = date('F jS', $start_date) . ' <em>@ ' . date($time_format, $start_date) . '<br />' . __('to', 'espresso') . '</em> ' . date('F jS', $end_date) . ' <em>@' . date($time_format, $end_date) . '</em>';
}
}
}
?>
<article class="upcoming-event-block clearfix">
<h3><a href="<?php
echo get_permalink($event->ID);
?>
"><?php
echo apply_filters('the_title', $event->post_title);
?>
</a></h3>
<small><?php
echo $date_format;
?>
</small>
<p><?php
echo $event->post_excerpt ? $event->post_excerpt : espressoTruncate($event->post_content, 155) . ' ...';
?>
</p>
<a class="es-button" href="<?php
echo get_permalink($event->ID);
?>
"><?php
_e('Event Information', 'espresso');
?>
</a>
</article><?php
}
}
wp_reset_query();
}
示例6: maintain_gap
protected function maintain_gap(array &$meta, $original)
{
// Original event start/end times and difference between them
$start = tribe_get_start_date($original->ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
$end = tribe_get_end_date($original->ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
$diff = strtotime($end) - strtotime($start);
// Adjust new event end time to maintain the same difference
$start = strtotime($meta['_EventStartDate']);
$end = $start + $diff;
$meta['_EventEndDate'] = date(Tribe__Events__Date_Utils::DBDATETIMEFORMAT, $end);
}
示例7: event_date
/**
* Get the event date
*
* @param int $meta_id
* @return string
*/
function event_date($meta_id)
{
if (tribe_get_start_date() !== tribe_get_end_date()) {
// Start & end date
$html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
$html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id);
} else {
// If all day event, show only start date
$html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id);
}
return apply_filters('tribe_event_meta_event_date', $html);
}
示例8: set_notices
/**
* 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));
}
}
示例9: build_data
/**
* Compile the schema.org event data into an array
*/
protected function build_data()
{
global $post;
$id = $post->ID;
$event_data = parent::build_data();
$event_data[$id]->{'@type'} = 'Event';
$event_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT), 'c');
$event_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT), 'c');
if (tribe_has_venue($id)) {
$event_data[$id]->location = new stdClass();
$event_data[$id]->location->{'@type'} = 'Place';
$event_data[$id]->location->name = tribe_get_venue($post->ID);
$event_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID)));
}
return $event_data;
}
示例10: form
public function form($instance)
{
$defaults = array('title' => '', 'type' => 'single-event', 'event' => null, 'show_seconds' => true, 'complete' => esc_attr__('Hooray!', 'tribe-events-calendar-pro'), 'event_ID' => null, 'event_date' => null);
$instance = wp_parse_args((array) $instance, $defaults);
if (empty($instance['event'])) {
$instance['event'] = $instance['event_ID'];
}
$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));
if (is_numeric($instance['event'])) {
$event = get_post($instance['event']);
if ($event instanceof WP_Post && !in_array($event->ID, wp_list_pluck($events, 'ID'))) {
$event->EventStartDate = tribe_get_start_date($event->ID, false, Tribe__Date_Utils::DBDATETIMEFORMAT);
$event->EventEndDate = tribe_get_end_date($event->ID, false, Tribe__Date_Utils::DBDATETIMEFORMAT);
$events = array_merge(array($event), $events);
}
}
include Tribe__Events__Pro__Main::instance()->pluginPath . 'src/admin-views/widget-admin-countdown.php';
}
示例11: update_known_range
/**
* Intelligently updates our record of the earliest start date/latest event date in
* the system. If the existing earliest/latest values have not been superseded by the new post's
* start/end date then no update takes place.
*
* This is deliberately hooked into save_post, rather than save_post_tribe_events, to avoid issues
* where the removal/restoration of hooks within addEventMeta() etc might stop this method from
* actually being called (relates to a core WP bug).
*
* @param int $event_id
*/
public function update_known_range($event_id)
{
$is_earliest_date_marker = in_array($event_id, tribe_get_option('earliest_date_markers', array()));
$is_latest_date_marker = in_array($event_id, tribe_get_option('latest_date_markers', array()));
if ($is_earliest_date_marker || $is_latest_date_marker) {
$this->rebuild_known_range();
return;
}
$current_min = tribe_events_earliest_date();
$current_max = tribe_events_latest_date();
$event_start = tribe_get_start_date($event_id, false, Tribe__Date_Utils::DBDATETIMEFORMAT);
$event_end = tribe_get_end_date($event_id, false, Tribe__Date_Utils::DBDATETIMEFORMAT);
if ($current_min > $event_start) {
$this->rebuild_known_range();
tribe_update_option('earliest_date', $event_start);
}
if ($current_max < $event_end) {
$this->rebuild_known_range();
tribe_update_option('latest_date', $event_end);
}
}
示例12: get_data
/**
* Fetches the JSON-LD data for this type of object
*
* @param int|WP_Post|null $post The post/event
* @param array $args
* @return array
*/
public function get_data($posts = null, $args = array())
{
$posts = $posts instanceof WP_Post ? array($posts) : (array) $posts;
$return = array();
foreach ($posts as $i => $post) {
$data = parent::get_data($post, $args);
// If we have an Empty data we just skip
if (empty($data)) {
continue;
}
// Fetch first key
$post_id = key($data);
// Fetch first Value
$data = reset($data);
$event_tz_string = get_post_meta($post_id, '_EventTimezone', true);
$tz_mode = tribe_get_option('tribe_events_timezone_mode', 'event');
$tz_string = $event_tz_string && $tz_mode === 'event' ? $event_tz_string : Tribe__Events__Timezones::wp_timezone_string();
$data->startDate = Tribe__Events__Timezones::to_utc(tribe_get_start_date($post_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT), $tz_string, 'c');
$data->endDate = Tribe__Events__Timezones::to_utc(tribe_get_end_date($post_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT), $tz_string, 'c');
if (tribe_has_venue($post_id)) {
$venue_id = tribe_get_venue_id($post_id);
$venue_data = Tribe__Events__JSON_LD__Venue::instance()->get_data($venue_id);
$data->location = reset($venue_data);
}
if (tribe_has_organizer($post_id)) {
$organizer_id = tribe_get_organizer_id($post_id);
$organizer_data = Tribe__Events__JSON_LD__Organizer::instance()->get_data($organizer_id);
$data->organizer = reset($organizer_data);
}
$price = tribe_get_cost($post_id);
$price = $this->normalize_price($price);
if ('' !== $price) {
// Manually Include the Price for non Event Tickets
$data->offers = (object) array('@type' => 'Offer', 'price' => $price, 'url' => $data->url);
}
$return[$post_id] = $data;
}
return $return;
}
示例13: maybe_render_multiple_formatted_times
/**
* Alters the provided formatted time to include all recurrence times for the day
*
* @since 4.0.3
*
* @param string $formatted_time Formatted time range for the given event
* @param int $event_id Event ID
*
* @return string
*/
public function maybe_render_multiple_formatted_times($formatted_time, $event_id)
{
if (!tribe_is_recurring_event($event_id)) {
return $formatted_time;
}
$date = tribe_get_start_date($event_id, false, Tribe__Date_Utils::DBDATEFORMAT);
$time_format = get_option('time_format', Tribe__Date_Utils::TIMEFORMAT);
$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');
$events = $this->get_recurring_events_for_date($event_id, $date);
$formatted_time = null;
foreach ($events as $child) {
$start_time = tribe_get_start_date($child->ID, false, $time_format);
$end_time = tribe_get_end_date($child->ID, false, $time_format);
$formatted_time .= '<div class="tribe-recurring-event-time">';
if ($start_time === $end_time) {
$formatted_time .= esc_html($start_time);
} else {
$formatted_time .= esc_html($start_time . $time_range_separator . $end_time);
}
$formatted_time .= '</div>';
}
return $formatted_time;
}
示例14: _e
<div id="filters-wrap" class="postbox">
<h3 title="Click to toggle"><?php
_e('Event Summary', 'tribe-events-calendar');
?>
</h3>
<table class="eventtable ticket_list">
<tr>
<td width="33%" valign="top">
<?php
echo sprintf('<h4>%s</h4>', esc_html(__('Event Details', 'tribe-events-calendar')));
echo sprintf('<strong>%s </strong> %s', esc_html(__('Start Date / Time:', 'tribe-events-calendar')), tribe_get_start_date($event_id, false, get_option('date_format') . ' ' . get_option('time_format')));
echo "<br/>";
echo sprintf('<strong>%s </strong> %s', esc_html(__('End Date / Time:', 'tribe-events-calendar')), tribe_get_end_date($event_id, false, get_option('date_format') . ' ' . get_option('time_format')));
$venue_id = tribe_get_venue_id($event_id);
if (!empty($venue_id)) {
$venue = get_post($venue_id);
}
if (!empty($venue)) {
echo "<br/>";
echo sprintf('<strong>%s </strong> %s', esc_html(__('Venue:', 'tribe-events-calendar')), esc_html($venue->post_title));
$phone = get_post_meta($venue_id, '_VenuePhone', true);
if (!empty($phone)) {
echo "<br/>";
echo sprintf('<strong>%s </strong> %s', esc_html(__('Phone:', 'tribe-events-calendar')), esc_html($phone));
}
$website = get_post_meta($venue_id, '_VenueURL', true);
if (!empty($website)) {
echo "<br/>";
示例15: end_time
public function end_time()
{
return tribe_get_end_date(null, false, get_option('time_format', 'H:i'));
}