本文整理汇总了PHP中tribe_get_end_date函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_end_date函数的具体用法?PHP tribe_get_end_date怎么用?PHP tribe_get_end_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_end_date函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:nikolaror,项目名称:Bodega,代码行数:30,代码来源:functions-bkp.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;
}
开发者ID:chicosilva,项目名称:olharambiental,代码行数:36,代码来源:Google_Data_Markup.php
示例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);
}
开发者ID:jvcanote,项目名称:wp-the-events-calendar,代码行数:36,代码来源:meta.php
示例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'));
}
}
开发者ID:TyRichards,项目名称:river_of_life,代码行数:16,代码来源:single-event.php
示例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();
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:55,代码来源:upcoming-events.php
示例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);
}
开发者ID:michael-pratt,项目名称:event-rocket,代码行数:11,代码来源:event-duplicator-filters.php
示例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);
}
开发者ID:TyRichards,项目名称:river_of_life,代码行数:18,代码来源:meta.php
示例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));
}
}
开发者ID:nullify005,项目名称:shcc-website,代码行数:15,代码来源:Embed.php
示例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;
}
开发者ID:bostondv,项目名称:the-events-calendar,代码行数:19,代码来源:Event.php
示例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';
}
开发者ID:TakenCdosG,项目名称:chefs,代码行数:20,代码来源:Countdown_Widget.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);
}
}
开发者ID:partisan-collective,项目名称:partisan,代码行数:32,代码来源:Known_Range.php
示例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;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:46,代码来源:Event.php
示例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;
}
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:33,代码来源:Single_Event_Overrides.php
示例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/>";
开发者ID:donwea,项目名称:nhap.org,代码行数:31,代码来源:attendees.php
示例15: end_time
public function end_time()
{
return tribe_get_end_date(null, false, get_option('time_format', 'H:i'));
}
开发者ID:michael-pratt,项目名称:event-rocket,代码行数:4,代码来源:inline-templates-organizers.php
示例16: process
/**
* Updates the next batch of non-timezone ready events.
*
* @param int $batch_size (defaults to -1 meaning "update all")
*/
public function process($batch_size = -1)
{
$site_timezone = Tribe__Timezones::wp_timezone_string();
foreach ($this->get_ids($batch_size) as $event_id) {
$local_start_time = tribe_get_start_date($event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT);
$utc_start_time = Tribe__Timezones::to_utc($local_start_time, $site_timezone);
$local_end_time = tribe_get_end_date($event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT);
$utc_end_time = Tribe__Timezones::to_utc($local_end_time, $site_timezone);
// The abbreviation needs to be calculated per event as it can vary according to the actual date
$site_timezone_abbr = Tribe__Timezones::wp_timezone_abbr($local_start_time);
update_post_meta($event_id, '_EventTimezone', $site_timezone);
update_post_meta($event_id, '_EventTimezoneAbbr', $site_timezone_abbr);
update_post_meta($event_id, '_EventStartDateUTC', $utc_start_time);
update_post_meta($event_id, '_EventEndDateUTC', $utc_end_time);
}
}
开发者ID:reubenbrown13,项目名称:the-events-calendar,代码行数:21,代码来源:Timezone_Updater.php
示例17: the_post_thumbnail
<div class="thumbnail">
<?php
the_post_thumbnail('thumbnail');
?>
</div>
<?php
}
?>
<h3 class="tribe-events-month-event-title entry-title summary">
<a href="<?php
tribe_event_link($post);
?>
" class="url">
<?php
the_title();
?>
</a>
</h3>
<div class="date">
<i class="fa fa-clock-o"></i><?php
echo tribe_get_start_date(get_the_id(), false, 'H:i m/d/Y');
?>
<span> - </span>
<?php
echo tribe_get_end_date(get_the_id(), false, 'H:i m/d/Y');
?>
</div>
<div class="clearfix"></div>
</div><!-- #tribe-events-event-# -->
开发者ID:morganloehr,项目名称:chris-verna,代码行数:29,代码来源:single-event.php
示例18: get_option
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe-events/modules/meta/details.php
*
* @package TribeEventsCalendar
*/
$time_format = get_option('time_format', Tribe__Events__Date_Utils::TIMEFORMAT);
$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');
$start_datetime = tribe_get_start_date();
$start_date = tribe_get_start_date(null, false);
$start_time = tribe_get_start_date(null, false, $time_format);
$start_ts = tribe_get_start_date(null, false, Tribe__Events__Date_Utils::DBDATEFORMAT);
$end_datetime = tribe_get_end_date();
$end_date = tribe_get_end_date(null, false);
$end_time = tribe_get_end_date(null, false, $time_format);
$end_ts = tribe_get_end_date(null, false, Tribe__Events__Date_Utils::DBDATEFORMAT);
$instructor = get_post_meta(get_the_ID(), 'Instructor', true);
$cost = tribe_get_formatted_cost();
$website = tribe_get_event_website_link();
?>
<div class="tribe-events-meta-group tribe-events-meta-group-details">
<h3 class="tribe-events-single-section-title"> <?php
esc_html_e('Details', 'the-events-calendar');
?>
</h3>
<dl>
<?php
do_action('tribe_events_single_meta_details_section_start');
// All day (multiday) events
开发者ID:mattholsen,项目名称:caseylab,代码行数:31,代码来源:details.php
示例19: get_event_ids_by_day
/**
* Breaks the possible collection of events down by grid date
*
* @param string $date Y-m-d formatted date to retrieve events for
*
* @return array
*/
private function get_event_ids_by_day($date)
{
if (!$this->event_ids_by_day) {
$this->event_ids_by_day = array();
// Let's loop over all of the events in the month and assign them to days
foreach ($this->events_in_month as $event) {
// if we're querying by category and the event doesn't have it, skip the event
if (!empty($this->queried_event_cats)) {
if (!has_term($this->queried_event_cats, Tribe__Events__Main::TAXONOMY, $event)) {
continue;
}
}
$event_start = strtotime(tribe_get_start_date($event->ID, true, Tribe__Date_Utils::DBDATETIMEFORMAT));
$event_end = strtotime(tribe_get_end_date($event->ID, true, Tribe__Date_Utils::DBDATETIMEFORMAT));
$start = date('Y-m-d', $event_start);
$end = date('Y-m-d', $event_end);
$beginning_of_start = $this->get_cutoff_details($start, 'beginning');
$beginning_of_start_timestamp = $this->get_cutoff_details($start, 'beginning_timestamp');
$end_of_start = $this->get_cutoff_details($start, 'end');
$end_of_start_timestamp = $this->get_cutoff_details($start, 'end_timestamp');
$beginning_of_end = $this->get_cutoff_details($end, 'beginning');
$beginning_of_end_timestamp = $this->get_cutoff_details($end, 'beginning_timestamp');
// if the start of the event is earlier than the beginning of the day, consider the event
// as starting on the day before
//
// Example 1:
// Assuming a cut-off of 6:00am and an event start date/time of August 2nd @ 5:00am. The
// "start" DATE would be August 2nd and the beginning of the "start" DATE would be August
// 2nd @ 6:00am. Therefore, the event start DATE shoud be altered to be a day earlier
// (August 1st) (Note: the following if statement conditional would be true)
if ($event_start < $beginning_of_start_timestamp) {
$start = date('Y-m-d', strtotime('-1 day', strtotime($start)));
}
// Subtract a day from the $end if it is:
// * earlier than the beginning of the start DATE OR
// * earlier than the beginning of the end DATE OR
// * earlier than the end of the start DATE (as long as the beginning of the end DATE is greater than that of the start DATE)
//
// Example 1:
// Assuming a cut-off of 6:00am and an event end date/time of August 2nd @ 7:00am. The
// "end" DATE would be August 2nd and the beginning of the "end" DATE would be August
// 2nd @ 6:00am. Therefore, the event end DATE shoud remain as August 2nd. (Note: the
// following if statement conditional would be false)
//
// Example 2:
// Assuming a cut-off of 6:00am and an event end date/time of August 2nd @ 5:00am. The
// "end" DATE would be August 2nd and the beginning of the "end" DATE would be August
// 2nd @ 6:00am. Therefore, the event end DATE shoud be altered to be a day earlier
// (August 1st) (Note: this following if statement conditional would be true)
if ($event_end < $beginning_of_start_timestamp || $event_end < $beginning_of_end_timestamp || $event_end < $end_of_start_timestamp && $beginning_of_end_timestamp > $end_of_start_timestamp) {
$end = date('Y-m-d', strtotime('-1 day', strtotime($end)));
}
// determine if there's a difference in days between start and end
$diff = strtotime($end) - strtotime($start);
if ($diff > 0) {
// There IS a difference. How many days?
$diff_in_days = $diff / DAY_IN_SECONDS;
// add the event to each day until the event end
$new_start = $start;
for ($i = 0; $i <= $diff_in_days; $i++) {
if (!isset($this->event_ids_by_day[$new_start])) {
$this->event_ids_by_day[$new_start] = array();
}
$this->event_ids_by_day[$new_start][] = $event->ID;
$new_start = date('Y-m-d', strtotime('+1 day', strtotime($new_start)));
}
} else {
// nope. The event is a single day event. Add it to the array
if (!isset($this->event_ids_by_day[$start])) {
$this->event_ids_by_day[$start] = array();
}
$this->event_ids_by_day[$start][] = $event->ID;
}
}
// Now that we've built our event_ids_by_day, let's array_unique and sort
foreach ($this->event_ids_by_day as &$day) {
$day = array_unique($day);
sort($day);
}
}
if (empty($this->event_ids_by_day[$date])) {
return array();
}
return $this->event_ids_by_day[$date];
}
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:92,代码来源:Month.php
示例20: tribe_events_template_data
/**
* Returns json for javascript templating functions throughout the plugin.
*
* @category Events
*
* @param $event
* @param $additional
*
* @return string
*/
function tribe_events_template_data($event, array $additional = null)
{
$has_image = false;
$image_src = '';
$image_tool_src = '';
$date_display = '';
//Disable recurring event info in tooltip
if (class_exists('Tribe__Events__Pro__Main')) {
$ecp = Tribe__Events__Pro__Main::instance();
$ecp->disable_recurring_info_tooltip();
$date_display = strip_tags(tribe_events_event_schedule_details($event));
// Re-enable recurring event info
$ecp->enable_recurring_info_tooltip();
} else {
$date_display = strip_tags(tribe_events_event_schedule_details($event));
}
if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) {
$has_image = true;
$image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium');
$image_src = $image_arr[0];
}
if ($has_image) {
$image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75));
$image_tool_src = $image_tool_arr[0];
}
if (has_excerpt($event->ID)) {
$excerpt = $event->post_excerpt;
} else {
$excerpt = $event->post_content;
}
$excerpt = Tribe__Events__Main::instance()->truncate($excerpt, 30);
$category_classes = tribe_events_event_classes($event->ID, false);
$json = array('eventId' => $event->ID, 'title' => $event->post_title, 'permalink' => tribe_get_event_link($event->ID), 'imageSrc' => $image_src, 'dateDisplay' => $date_display, 'imageTooltipSrc' => $image_tool_src, 'excerpt' => $excerpt, 'categoryClasses' => $category_classes);
/**
* Template overrides (of month/tooltip.php) set up in 3.9.3 or earlier may still expect
* these vars and will break without them, so they are being kept temporarily for
* backwards compatibility purposes.
*
* @todo consider removing in 4.0
*/
$json['startTime'] = tribe_get_start_date($event);
$json['endTime'] = tribe_get_end_date($event);
if ($additional) {
$json = array_merge((array) $json, (array) $additional);
}
$json = apply_filters('tribe_events_template_data_array', $json, $event, $additional);
$json = tribe_prepare_for_json_deep($json);
return json_encode($json);
}
开发者ID:TMBR,项目名称:johnjohn,代码行数:59,代码来源:general.php
注:本文中的tribe_get_end_date函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论