本文整理汇总了PHP中tribe_event_is_all_day函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_event_is_all_day函数的具体用法?PHP tribe_event_is_all_day怎么用?PHP tribe_event_is_all_day使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_event_is_all_day函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @param int $event (optional)
* @param bool $displayTime If true shows date and time, if false only shows date
* @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @return string Date
* @since 2.0
*/
function tribe_get_end_date($event = null, $displayTime = true, $dateFormat = '')
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
if (tribe_event_is_all_day($event)) {
$displayTime = false;
}
if (empty($event->EventEndDate) && is_object($event)) {
$event->EventEndDate = tribe_get_event_meta($event->ID, '_EventEndDate', true);
}
if (isset($event->EventEndDate)) {
if (tribe_event_is_all_day($event) && empty($event->_end_date_fixed) && TribeDateUtils::timeOnly($event->EventEndDate) != '23:59:59' && TribeDateUtils::timeOnly(tribe_event_end_of_day()) != '23:59') {
// set the event end date to be one day earlier, if it's an all day event and the cutoff is past midnight
// @todo remove this once we can have all day events without a start / end time
$event->EventEndDate = date_create($event->EventEndDate);
$event->EventEndDate->modify('-1 day');
$event->EventEndDate = $event->EventEndDate->format(TribeDateUtils::DBDATEFORMAT);
$event->_end_date_fixed = true;
}
$date = strtotime($event->EventEndDate);
} else {
return;
// '—';
}
return tribe_event_format_date($date, $displayTime, $dateFormat);
}
开发者ID:robertark,项目名称:the-events-calendar,代码行数:42,代码来源:date.php
示例2: 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
示例3: setup_view
/**
* Organize and reorder the events posts according to time slot
*
* @return void
* @since 1.0
**/
public function setup_view()
{
global $wp_query;
if ($wp_query->have_posts()) {
foreach ($wp_query->posts as &$post) {
$post->timeslot = tribe_event_is_all_day($post->ID) ? __('All Day', 'tribe-events-calendar-pro') : ($post->timeslot = tribe_get_start_date($post, false, 'l, F jS Y g:i A'));
}
$wp_query->rewind_posts();
}
}
开发者ID:rlaloux,项目名称:tribe-events-agenda-view,代码行数:16,代码来源:tribe-events-agenda-template-class.php
示例4: 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
示例5: append_timezone
/**
* Adds the timezone to the event schedule information.
*
* @param string $schedule_text
* @param int|null $event_id
*
* @return string
*/
public static function append_timezone($schedule_text, $event_id = null)
{
static $hide_for_all_day;
if (!isset($hide_for_all_day)) {
$hide_for_all_day = apply_filters('tribe_events_hide_timezone_for_all_day_events', true);
}
if (tribe_event_is_all_day($event_id) && $hide_for_all_day) {
return $schedule_text;
}
$timezone = self::is_mode('site') ? self::wp_timezone_abbr(tribe_get_start_date($event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT)) : self::get_event_timezone_abbr($event_id);
if (!empty($timezone)) {
$timezone_text = " <span class='timezone'> {$timezone} </span>";
$schedule_text = $schedule_text . $timezone_text;
}
return $schedule_text;
}
开发者ID:reubenbrown13,项目名称:the-events-calendar,代码行数:24,代码来源:Timezones.php
示例6: tribe_get_end_time
/**
* End Time
*
* Returns the event end time
*
* @category Events
* @param int $event (optional)
* @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @param string $timezone Timezone in which to present the date/time (or default behaviour if not set)
*
* @return string|null Time
*/
function tribe_get_end_time($event = null, $dateFormat = '', $timezone = null)
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
if (!is_object($event)) {
return;
}
if (tribe_event_is_all_day($event)) {
return;
}
$end_date = Tribe__Events__Timezones::event_end_timestamp($event->ID, $timezone);
if ('' == $dateFormat) {
$dateFormat = tribe_get_time_format();
}
return tribe_format_date($end_date, false, $dateFormat);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:33,代码来源:date.php
示例7: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @param int $event (optional) this only works for non recurring events
* @param bool $displayTime If true shows date and time, if false only shows date
* @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
* @return string Date
* @todo support $postId for recurring events.
* @since 2.0
*/
function tribe_get_end_date($event = null, $displayTime = true, $dateFormat = '')
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
if (tribe_event_is_all_day($event)) {
$displayTime = false;
}
if (empty($event->EventEndDate) && is_object($event)) {
$event->EventEndDate = tribe_get_event_meta($event->ID, '_EventEndDate', true);
}
if (isset($event->EventEndDate)) {
$date = strtotime($event->EventEndDate);
} else {
return;
// '—';
}
return tribe_event_format_date($date, $displayTime, $dateFormat);
}
开发者ID:scttrgd,项目名称:scottish-piping,代码行数:35,代码来源:date.php
示例8: setup_view
/**
* Organize and reorder the events posts according to time slot
*
* @return void
**/
public function setup_view()
{
global $wp_query;
$time_format = apply_filters('tribe_events_day_timeslot_format', get_option('time_format', TribeDateUtils::TIMEFORMAT));
if ($wp_query->have_posts()) {
$unsorted_posts = $wp_query->posts;
foreach ($unsorted_posts as &$post) {
if (tribe_event_is_all_day($post->ID)) {
$post->timeslot = __('All Day', 'tribe-events-calendar');
} else {
if (strtotime(tribe_get_start_date($post->ID, true, TribeDateUtils::DBDATETIMEFORMAT)) < strtotime($wp_query->get('start_date'))) {
$post->timeslot = __('Ongoing', 'tribe-events-calendar');
} else {
$post->timeslot = tribe_get_start_date($post, false, $time_format);
}
}
}
unset($post);
// Make sure All Day events come first
$all_day = array();
$ongoing = array();
$hourly = array();
foreach ($unsorted_posts as $i => $post) {
if ($post->timeslot == __('All Day', 'tribe-events-calendar')) {
$all_day[$i] = $post;
} else {
if ($post->timeslot == __('Ongoing', 'tribe-events-calendar')) {
$ongoing[$i] = $post;
} else {
$hourly[$i] = $post;
}
}
}
$wp_query->posts = array_values($all_day + $ongoing + $hourly);
$wp_query->rewind_posts();
}
}
开发者ID:chicosilva,项目名称:olharambiental,代码行数:42,代码来源:day.php
示例9: setup_view
/**
* Organize and reorder the events posts according to time slot
*
* @return void
* @since 3.0
**/
public function setup_view()
{
global $wp_query;
$time_format = apply_filters('tribe_events_pro_day_timeslot_format', 'ga ');
if ($wp_query->have_posts()) {
$unsorted_posts = $wp_query->posts;
foreach ($unsorted_posts as &$post) {
$post->timeslot = tribe_event_is_all_day($post->ID) ? __('All Day', 'tribe-events-calendar-pro') : ($post->timeslot = tribe_get_start_date($post, false, $time_format));
}
unset($post);
// Make sure All Day events come first
$all_day = array();
$hourly = array();
foreach ($unsorted_posts as $i => $post) {
if ($post->timeslot == __('All Day', 'tribe-events-calendar-pro')) {
$all_day[$i] = $post;
} else {
$hourly[$i] = $post;
}
}
$wp_query->posts = array_values($all_day + $hourly);
$wp_query->rewind_posts();
}
}
开发者ID:donwea,项目名称:nhap.org,代码行数:30,代码来源:day.php
示例10: tribe_community_events_form_end_time_selector
/**
* Return form select fields for event end time.
*
* @param null|int $event_id
* @return string time select HTML
* @author Peter Chester
* @since 3.1
*/
function tribe_community_events_form_end_time_selector($event_id = null)
{
$event_id = TribeEvents::postIdHelper($event_id);
$is_all_day = tribe_event_is_all_day($event_id);
$end_date = tribe_get_end_date($event_id);
$end_minutes = TribeEventsViewHelpers::getMinuteOptions($end_date);
$end_hours = TribeEventsViewHelpers::getHourOptions($is_all_day == 'yes' ? null : $end_date);
$end_meridian = TribeEventsViewHelpers::getMeridianOptions($end_date);
$output = '';
$output .= sprintf('<select name="EventEndHour">%s</select>', $end_hours);
$output .= sprintf('<select name="EventEndMinute">%s</select>', $end_minutes);
if (!strstr(get_option('time_format', TribeDateUtils::TIMEFORMAT), 'H')) {
$output .= sprintf('<select name="EventEndMeridian">%s</select>', $end_meridian);
}
return apply_filters('tribe_community_events_form_end_time_selector', $output, $event_id);
}
开发者ID:donwea,项目名称:nhap.org,代码行数:24,代码来源:tribe-community-events-template-tags.php
示例11: _e
_e('All Day', 'church-event');
?>
</div>
<?php
}
?>
<?php
}
?>
</div>
<div class="wpv-single-event-schedule-block address">
<?php
if ($image === false) {
?>
<?php
if (!tribe_event_is_all_day($post->ID)) {
?>
<div class="time"><?php
echo $stime;
?>
<?php
if ($stime !== $etime) {
echo '— ' . $etime;
}
?>
</div>
<?php
} else {
?>
<div class="time"><?php
_e('All Day', 'church-event');
开发者ID:petrfaitl,项目名称:wordpress-event-theme,代码行数:31,代码来源:single-event-media.php
示例12: tribe_events_event_schedule_details
/**
* Return the details of the start/end date/time.
*
* The highest level means of customizing this function's output is simply to adjust the date format settings under
* Events > Settings > Display, and WordPress time formats (via the General Settings admin screen).
* Beyond that, however, there are two filters which can be used to exercise further control here.
*
* The first is 'tribe_events_event_schedule_details_formatting' which allows an array of format settings to be
* altered - it's basic make-up is as a simple set of key:value pairs as follows.
*
* "show_end_time": for single day events only (not including all day events) it may not always be desirable to
* include the end time. In that situation, this setting can be set to false and the end time will not be
* displayed.
*
* "time": if it is undesirable to show times and only dates should be displayed then this setting can be set to
* false. If it is false it will by extension cause 'show_end_time' to be false.
*
* The resulting string can also be caught and manipulated, or completely overridden, using the
* 'tribe_events_event_schedule_details' filter, should none of the above settings be sufficient.
*
* @category Events
* @TODO use tribe_get_datetime_format() and related functions if possible
*
* @param int|null $event
* @param string $before
* @param string $after
*
* @return mixed|void
*/
function tribe_events_event_schedule_details($event = null, $before = '', $after = '')
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
$schedule = '<span class="date-start dtstart">';
$format = '';
$date_without_year_format = tribe_get_date_format();
$date_with_year_format = tribe_get_date_format(true);
$time_format = get_option('time_format');
$datetime_separator = tribe_get_option('dateTimeSeparator', ' @ ');
$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');
$microformatStartFormat = tribe_get_start_date($event, false, 'Y-m-dTh:i');
$microformatEndFormat = tribe_get_end_date($event, false, 'Y-m-dTh:i');
$settings = array('show_end_time' => true, 'time' => true);
$settings = wp_parse_args(apply_filters('tribe_events_event_schedule_details_formatting', $settings), $settings);
if (!$settings['time']) {
$settings['show_end_time'] = false;
}
extract($settings);
$format = $date_with_year_format;
// if it starts and ends in the current year then there is no need to display the year
if (tribe_get_start_date($event, false, 'Y') === date('Y') && tribe_get_end_date($event, false, 'Y') === date('Y')) {
$format = $date_without_year_format;
}
if (tribe_event_is_multiday($event)) {
// multi-date event
$format2ndday = apply_filters('tribe_format_second_date_in_range', $format, $event);
if (tribe_event_is_all_day($event)) {
$schedule .= tribe_get_start_date($event, true, $format);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span>' . $time_range_separator;
$schedule .= '<span class="date-end dtend">';
$schedule .= tribe_get_end_date($event, true, $format2ndday);
$schedule .= '<span class="value-title" title="' . $microformatEndFormat . '"></span>';
} else {
$schedule .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : '');
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span>' . $time_range_separator;
$schedule .= '<span class="date-end dtend">';
$schedule .= tribe_get_end_date($event, false, $format2ndday) . ($time ? $datetime_separator . tribe_get_end_date($event, false, $time_format) : '');
$schedule .= '<span class="value-title" title="' . $microformatEndFormat . '"></span>';
}
} elseif (tribe_event_is_all_day($event)) {
// all day event
$schedule .= tribe_get_start_date($event, true, $format);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
} else {
// single day event
if (tribe_get_start_date($event, false, 'g:i A') === tribe_get_end_date($event, false, 'g:i A')) {
// Same start/end time
$schedule .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : '');
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
} else {
// defined start/end time
$schedule .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : '');
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span>' . ($show_end_time ? $time_range_separator : '');
$schedule .= '<span class="end-time dtend">';
$schedule .= ($show_end_time ? tribe_get_end_date($event, false, $time_format) : '') . '<span class="value-title" title="' . $microformatEndFormat . '"></span>';
}
}
$schedule .= '</span>';
$schedule = $before . $schedule . $after;
return apply_filters('tribe_events_event_schedule_details', $schedule, $event->ID);
}
开发者ID:TMBR,项目名称:johnjohn,代码行数:99,代码来源:general.php
示例13: event_classes
/**
* Determine and return the CSS classes needed for each event on week view
*
* @param $classes array
*
* @return string
* @see 'tribe_events_event_classes'
*/
public function event_classes($classes)
{
global $post;
$event = $post;
// we need to adjust on behalf of weekly span scripts
$day_span_length = $event->days_between + 1;
if ($day_span_length > 0) {
$classes[] = 'tribe-dayspan' . $day_span_length . ' ';
}
if (isset(self::$previous_event) && !tribe_event_is_all_day($event) && strtotime(self::$previous_event->EventStartDate) < strtotime($event->EventStartDate)) {
$classes[] = 'tribe-event-overlap ';
}
if (!tribe_event_is_all_day($event)) {
$classes[] = 'tribe-events-week-hourly-single';
} else {
$classes[] = 'tribe-events-week-allday-single';
}
return $classes;
}
开发者ID:TakenCdosG,项目名称:chefs,代码行数:27,代码来源:Week.php
示例14: tribe_get_start_date
<img class="bg-image" src="<?php echo $src[0]; ?>" alt="">
<span class="bg-image-mask"></span>
<div class="item-content">
<div class="date">
<span class="num"><?php echo tribe_get_start_date( $event, false, 'd' ); ?></span>
<?php echo tribe_get_start_date( $event, false, 'F' ); ?>
</div>
<?php
$term_color = get_term_meta( array_pop( tribe_get_event_cat_ids( $event ) ) , '_events_category_color', true );
$term_color = implode(',', sscanf($term_color, "#%02x%02x%02x")) ;
?>
<div class="title-wrap" style="background-color: rgba(<?php echo $term_color; ?>, .7);" >
<strong>
<?php if( tribe_event_is_all_day($event) ): ?>
All Day
<?php else: ?>
<?php printf('%s - %s', tribe_get_start_time( $event, 'ga' ), tribe_get_end_time( $event, 'ga' ) ); ?>
<?php endif; ?>
</strong>
<h3 class="item-title"><?php echo get_the_title( $event ); ?></h3>
</div>
</div>
</a>
</li>
<?php endforeach; ?>
</ul>
开发者ID:simple-beck,项目名称:project-gc,代码行数:30,代码来源:_partial-latest-events.php
示例15: foreach
if (!empty($events)) {
?>
<section id="homepage-events" class="homepage-block">
<div class="shell clearfix">
<h2 class="centered"><span><?php
echo $event_items_title;
?>
</span></h2>
<div class="widget"><?php
foreach ($events as $event) {
$temp_count++;
$start_date = strtotime(tribe_get_start_date($event->ID, false, 'Y-m-d H:i:s'));
$start_date_day = date('Y-m-d', $start_date);
$end_date = strtotime(tribe_get_end_date($event->ID, false, 'Y-m-d H:i:s'));
$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 = strftime('%B %e', $start_date) . '<span>•</span> <em>' . __('All day', 'espresso') . '</em>';
} else {
if ($end_date_day) {
if ($start_date_day == $end_date_day) {
$date_format = strftime('%B %e', $start_date) . '<span>•</span> <em>' . date($time_format, $start_date) . ' – ' . date($time_format, $end_date) . '</em>';
} else {
$date_format = strftime('%B %e', $start_date) . ' <em>@ ' . date($time_format, $start_date) . '<br />' . __('to', 'espresso') . '</em> ' . strftime('%B %e', $end_date) . ' <em>@' . date($time_format, $end_date) . '</em>';
}
}
}
?>
<article class="upcoming-event-block clearfix">
<h3><a href="<?php
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:31,代码来源:pagepart-events.php
示例16: tribe_events_event_schedule_details
/**
* Return the details of the start/end date/time.
*
* The highest level means of customizing this function's output is simply to adjust the date format settings under
* Events > Settings > Display, and WordPress time formats (via the General Settings admin screen).
* Beyond that, however, there are two filters which can be used to exercise further control here.
*
* The first is 'tribe_events_event_schedule_details_formatting' which allows an array of format settings to be
* altered - it's basic make-up is as a simple set of key:value pairs as follows.
*
* "show_end_time": for single day events only (not including all day events) it may not always be desirable to
* include the end time. In that situation, this setting can be set to false and the end time will not be
* displayed.
*
* "time": if it is undesirable to show times and only dates should be displayed then this setting can be set to
* false. If it is false it will by extension cause 'show_end_time' to be false.
*
* The resulting string can also be caught and manipulated, or completely overridden, using the
* 'tribe_events_event_schedule_details' filter, should none of the above settings be sufficient.
*
* @category Events
* @TODO use tribe_get_datetime_format() and related functions if possible
*
* @param int|null $event
* @param string $before
* @param string $after
*
* @return mixed|void
*/
function tribe_events_event_schedule_details($event = null, $before = '', $after = '')
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
$inner = '<span class="tribe-event-date-start">';
$format = '';
$date_without_year_format = tribe_get_date_format();
$date_with_year_format = tribe_get_date_format(true);
$time_format = get_option('time_format');
$datetime_separator = tribe_get_option('dateTimeSeparator', ' @ ');
$time_range_separator = tribe_get_option('timeRangeSeparator', ' - ');
$settings = array('show_end_time' => true, 'time' => true);
$settings = wp_parse_args(apply_filters('tribe_events_event_schedule_details_formatting', $settings), $settings);
if (!$settings['time']) {
$settings['show_end_time'] = false;
}
/**
* @var $show_end_time
* @var $time
*/
extract($settings);
$format = $date_with_year_format;
// if it starts and ends in the current year then there is no need to display the year
if (tribe_get_start_date($event, false, 'Y') === date('Y') && tribe_get_end_date($event, false, 'Y') === date('Y')) {
$format = $date_without_year_format;
}
if (tribe_event_is_multiday($event)) {
// multi-date event
$format2ndday = apply_filters('tribe_format_second_date_in_range', $format, $event);
if (tribe_event_is_all_day($event)) {
$inner .= tribe_get_start_date($event, true, $format);
$inner .= '</span>' . $time_range_separator;
$inner .= '<span class="tribe-event-date-end">';
$inner .= tribe_get_end_date($event, true, $format2ndday);
} else {
$inner .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : '');
$inner .= '</span>' . $time_range_separator;
$inner .= '<span class="tribe-event-date-end">';
$inner .= tribe_get_end_date($event, false, $format2ndday) . ($time ? $datetime_separator . tribe_get_end_date($event, false, $time_format) : '');
}
} elseif (tribe_event_is_all_day($event)) {
// all day event
$inner .= tribe_get_start_date($event, true, $format);
} else {
// single day event
if (tribe_get_start_date($event, false, 'g:i A') === tribe_get_end_date($event, false, 'g:i A')) {
// Same start/end time
$inner .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : '');
} else {
// defined start/end time
$inner .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : '');
$inner .= '</span>' . ($show_end_time ? $time_range_separator : '');
$inner .= '<span class="tribe-event-time">';
$inner .= $show_end_time ? tribe_get_end_date($event, false, $time_format) : '';
}
}
$inner .= '</span>';
/**
* Provides an opportunity to modify the *inner* schedule details HTML (ie before it is
* wrapped).
*
* @param string $inner_html the output HTML
* @param int $event_id post ID of the event we are interested in
*/
$inner = apply_filters('tribe_events_event_schedule_details_inner', $inner, $event->ID);
// Wrap the schedule text
//.........这里部分代码省略.........
开发者ID:reubenbrown13,项目名称:the-events-calendar,代码行数:101,代码来源:general.php
示例17: tribe_get_start_date
<div>
<?php
$shortdater = tribe_get_start_date($post->ID, true, 'M');
$shortdaterend = tribe_get_end_date($post->ID, true, 'M');
$shortdaterz = substr($shortdater, 0, 3);
$shortdaterendz = substr($shortdaterend, 0, 3);
$shortdate = tribe_get_start_date($post->ID, true, 'j');
$shortdateend = tribe_get_end_date($post->ID, true, 'j');
$shortdatez = substr($shortdate, 0, 2);
$shortdateendz = substr($shortdateend, 0, 2);
?>
<?php
if (tribe_event_is_all_day() == true) {
?>
<div class="post-date post-date-start" style="right: 20px;">
<span class="date-month"><?php
echo $shortdaterz;
?>
</span>
<span class="date-number"><?php
echo $shortdatez;
?>
</span>
</div>
<?php
} else {
开发者ID:Vinnica,项目名称:theboxerboston.com,代码行数:31,代码来源:index.php
示例18: tribe_events_event_schedule_details
/**
* Return the details of the start/end date/time
*
* @since 3.0
* @param int|null $event
* @return string
*/
function tribe_events_event_schedule_details($event = null)
{
if (is_null($event)) {
global $post;
$event = $post;
}
if (is_numeric($event)) {
$event = get_post($event);
}
$format = '';
$timeFormat = get_option('time_format');
$microformatStartFormat = tribe_get_start_date($event, false, 'Y-m-dTh:i');
$microformatEndFormat = tribe_get_end_date($event, false, 'Y-m-dTh:i');
// If the WordPress date setting matches DATEONLYFORMAT, make the string more readable
if (get_option('date_format') == TribeDateUtils::DATEONLYFORMAT) {
/* If the event happens this year, no need to show the year, unless it ends on another year (multi-day) */
if (tribe_get_start_date($event, false, 'Y') === date('Y') && tribe_get_end_date($event, false, 'Y') === date('Y')) {
$format = 'F j';
}
}
$schedule = '';
if (tribe_event_is_multiday($event)) {
// multi-date event
$format2ndday = $format;
// If the WordPress date setting matches DATEONLYFORMAT, make the string more readable
if (get_option('date_format') == TribeDateUtils::DATEONLYFORMAT) {
//If it's all day and the end date is in the same month and year, just show the day.
if (tribe_event_is_all_day($event) && tribe_get_end_date($event, false, 'm') === tribe_get_start_date($event, false, 'm') && tribe_get_end_date($event, false, 'Y') === date('Y')) {
$format2ndday = 'j';
}
}
if (tribe_event_is_all_day($event)) {
// If the multi-day event begins and ends in the same month, just show the month once.
if (tribe_get_end_date($event, false, 'm') === tribe_get_start_date($event, false, 'm') && tribe_get_end_date($event, false, 'Y') === date('Y')) {
$schedule .= '<span class="date-start dtstart">';
$schedule .= tribe_get_start_date($event, true, $format);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span> - ';
$schedule .= '<span class="date-end dtend">';
$schedule .= tribe_get_end_date($event, true, $format2ndday);
$schedule .= '<span class="value-title" title="' . $microformatEndFormat . '"></span>';
$schedule .= '</span>';
} else {
$schedule .= '<span class="date-start dtstart">';
$schedule .= tribe_get_start_date($event, true, $format);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span> - ';
$schedule .= '<span class="date-end dtend">';
$schedule .= tribe_get_end_date($event, true, $format2ndday);
$schedule .= '<span class="value-title" title="' . $microformatEndFormat . '"></span>';
$schedule .= '</span>';
}
} else {
$schedule .= '<span class="date-start dtstart">';
$schedule .= tribe_get_start_date($event, false, $format) . ' @ ' . tribe_get_start_date($event, false, $timeFormat);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span> - ';
$schedule .= '<span class="date-end dtend">';
$schedule .= tribe_get_end_date($event, false, $format2ndday) . ' @ ' . tribe_get_end_date($event, false, $timeFormat);
$schedule .= '<span class="value-title" title="' . $microformatEndFormat . '"></span>';
$schedule .= '</span>';
}
} elseif (tribe_event_is_all_day($event)) {
// all day event
$schedule .= '<span class="date-start dtstart">';
$schedule .= tribe_get_start_date($event, true, $format);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span>';
} else {
// single day event
if (tribe_get_start_date($event, false, 'g:i A') === tribe_get_end_date($event, false, 'g:i A')) {
// Same start/end time
$schedule .= '<span class="date-start dtstart">';
$schedule .= tribe_get_start_date($event, false, $format) . ' @ ' . tribe_get_start_date($event, false, $timeFormat);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span>';
} else {
// defined start/end time
$schedule .= '<span class="date-start dtstart">';
$schedule .= tribe_get_start_date($event, false, $format) . ' @ ' . tribe_get_start_date($event, false, $timeFormat);
$schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>';
$schedule .= '</span> - ';
$schedule .= '<span class="end-time dtend">';
$schedule .= tribe_get_end_date($event, false, $timeFormat) . '<span class="value-title" title="' . $microformatEndFormat . '"></span>';
$schedule .= '</span>';
}
}
return apply_filters('tribe_events_event_schedule_details', $schedule);
}
开发者ID:paarthd,项目名称:gslvpa,代码行数:96,代码来源:general.php
|
请发表评论