本文整理汇总了PHP中tribe_format_date函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_format_date函数的具体用法?PHP tribe_format_date怎么用?PHP tribe_format_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_format_date函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$aggregator = Tribe__Events__Aggregator::instance();
$event_id = get_the_ID();
$record = Tribe__Events__Aggregator__Records::instance()->get_by_event_id($event_id);
$last_import = null;
$source = null;
$origin = null;
if (is_wp_error($record)) {
$last_import = get_post_meta($event_id, Tribe__Events__Aggregator__Event::$updated_key, true);
$source = get_post_meta($event_id, Tribe__Events__Aggregator__Event::$source_key, true);
$origin = get_post_meta($event_id, Tribe__Events__Aggregator__Event::$origin_key, true);
} else {
$last_import = $record->post->post_modified;
$source_info = $record->get_source_info();
$source = $source_info['title'];
$origin = $record->origin;
}
$origin = $aggregator->api('origins')->get_name($origin);
$datepicker_format = Tribe__Date_Utils::datepicker_formats(tribe_get_option('datepickerFormat'));
$last_import = $last_import ? tribe_format_date($last_import, true, $datepicker_format . ' h:i a') : null;
$settings_link = Tribe__Settings::instance()->get_url(array('tab' => 'imports'));
$import_setting = tribe_get_option('tribe_aggregator_default_update_authority', Tribe__Events__Aggregator__Settings::$default_update_authority);
include Tribe__Events__Main::instance()->plugin_path . 'src/admin-views/aggregator/meta-box.php';
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:25,代码来源:Meta_Box.php
示例2: tribe_events_the_mini_calendar_title
/**
* Output a link for the mini calendar month previous nav, includes data attributes needed to update the month with ajax
*
* @return void
**/
function tribe_events_the_mini_calendar_title()
{
$args = tribe_events_get_mini_calendar_args();
$date = strtotime($args['eventDate']);
$date_format = tribe_get_option('monthAndYearFormat', 'M Y');
$title = tribe_format_date($date, false, $date_format);
echo apply_filters('tribe_events_the_mini_calendar_title', $title);
}
开发者ID:jamestrevorlees,项目名称:odd-web-v1.00,代码行数:13,代码来源:widgets.php
示例3: tribe_get_display_end_date
/**
* End Date formatted for display
*
* Returns the event end date that observes the end of day cutoff
*
* @category Events
* @param int $event (optional)
* @param bool $display_time If true shows date and time, if false only shows date
* @param string $date_format 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 Date
*/
function tribe_get_display_end_date($event = null, $display_time = true, $date_format = '', $timezone = null)
{
$end_date = tribe_get_end_date($event, true, 'U', $timezone);
$beginning_of_day = tribe_beginning_of_day(date(Tribe__Date_Utils::DBDATETIMEFORMAT, $end_date));
if (tribe_event_is_multiday($event) && $end_date < strtotime($beginning_of_day)) {
$end_date -= DAY_IN_SECONDS;
}
return tribe_format_date($end_date, $display_time, $date_format);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:22,代码来源:date.php
示例4: getLink
/**
* Returns various internal events-related URLs
*
* @param string $type type of link. See switch statement for types.
* @param string $secondary for $type = month, pass a YYYY-MM string for a specific month's URL
* for $type = week, pass a Week # string for a specific week's URL
* @param int|bool|null $term
*
* @return string The link.
*/
public function getLink($type = 'home', $secondary = false, $term = null)
{
// if permalinks are off or user doesn't want them: ugly.
if ('' === get_option('permalink_structure')) {
return esc_url_raw($this->uglyLink($type, $secondary));
}
// account for semi-pretty permalinks
if (false !== strpos(get_option('permalink_structure'), 'index.php')) {
$event_url = home_url('/index.php/');
} else {
$event_url = home_url('/');
}
// URL Arguments on home_url() pre-check
$url_query = @parse_url($event_url, PHP_URL_QUERY);
$url_args = wp_parse_args($url_query, array());
// Remove the "args"
if (!empty($url_query)) {
$event_url = str_replace('?' . $url_query, '', $event_url);
}
// Append Events structure
$event_url .= trailingslashit(sanitize_title(Tribe__Settings_Manager::get_option('eventsSlug', 'events')));
// if we're on an Event Cat, show the cat link, except for home and days.
if ($type !== 'home' && is_tax(self::TAXONOMY) && $term !== false && !is_numeric($term)) {
$term_link = get_term_link(get_query_var('term'), self::TAXONOMY);
if (!is_wp_error($term_link)) {
$event_url = trailingslashit($term_link);
}
} else {
if ($term) {
$term_link = get_term_link((int) $term, self::TAXONOMY);
if (!is_wp_error($term_link)) {
$event_url = trailingslashit($term_link);
}
}
}
switch ($type) {
case 'home':
$event_url = trailingslashit(esc_url_raw($event_url));
break;
case 'month':
if ($secondary) {
$event_url = trailingslashit(esc_url_raw($event_url . $secondary));
} else {
$event_url = trailingslashit(esc_url_raw($event_url . $this->monthSlug));
}
break;
case 'list':
$event_url = trailingslashit(esc_url_raw($event_url . $this->listSlug));
break;
case 'upcoming':
$event_url = trailingslashit(esc_url_raw($event_url . $this->listSlug));
break;
case 'past':
$event_url = esc_url_raw(add_query_arg('tribe_event_display', 'past', trailingslashit($event_url . $this->listSlug)));
break;
case 'dropdown':
$event_url = esc_url_raw($event_url);
break;
case 'single':
global $post;
$p = $secondary ? $secondary : $post;
$link = trailingslashit(get_permalink($p));
$event_url = trailingslashit(esc_url_raw($link));
break;
case 'day':
if (empty($secondary)) {
$secondary = $this->todaySlug;
} else {
$secondary = tribe_format_date($secondary, false, Tribe__Date_Utils::DBDATEFORMAT);
}
$event_url = trailingslashit(esc_url_raw($event_url . $secondary));
break;
default:
$event_url = esc_url_raw($event_url);
break;
}
// Filter get link
$event_url = apply_filters('tribe_events_get_link', $event_url, $type, $secondary, $term, $url_args);
// @todo deprecate on 4.2
$event_url = apply_filters('tribe_events_getLink', $event_url, $type, $secondary, $term, $url_args);
// Add the Arguments back
$event_url = add_query_arg($url_args, $event_url);
return $event_url;
}
开发者ID:rmacdon465,项目名称:the-events-calendar,代码行数:94,代码来源:Main.php
示例5: 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">';
$end_date_full = tribe_get_end_date($event, true, Tribe__Date_Utils::DBDATETIMEFORMAT);
$end_date_full_timestamp = strtotime($end_date_full);
// if the end date is <= the beginning of the day, consider it the previous day
if ($end_date_full_timestamp <= strtotime(tribe_beginning_of_day($end_date_full))) {
$end_date = tribe_format_date($end_date_full_timestamp - DAY_IN_SECONDS, false, $format2ndday);
} else {
$end_date = tribe_get_end_date($event, false, $format2ndday);
}
$inner .= $end_date;
} 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>';
/**
//.........这里部分代码省略.........
开发者ID:rmacdon465,项目名称:the-events-calendar,代码行数:101,代码来源:general.php
示例6: pre_get_posts
//.........这里部分代码省略.........
// make sure start and end date are set
if ($query->get('start_date') == '') {
$event_date = $query->get('eventDate') != '' ? $query->get('eventDate') : date_i18n(Tribe__Date_Utils::DBDATETIMEFORMAT);
$query->set('start_date', tribe_beginning_of_day($event_date));
}
if ($query->get('end_date' == '')) {
$query->set('end_date', tribe_end_of_day($query->get('start_date')));
}
$query->set('hide_upcoming', true);
break;
case 'day':
$event_date = $query->get('eventDate') != '' ? $query->get('eventDate') : date('Y-m-d', current_time('timestamp'));
$query->set('eventDate', $event_date);
$beginning_of_day = strtotime(tribe_beginning_of_day($event_date)) + 1;
$query->set('start_date', date_i18n(Tribe__Date_Utils::DBDATETIMEFORMAT, $beginning_of_day));
$query->set('end_date', tribe_end_of_day($event_date));
$query->set('posts_per_page', -1);
// show ALL day posts
$query->set('hide_upcoming', true);
$query->set('order', self::set_order('ASC', $query));
break;
case 'single-event':
if ($query->get('eventDate') != '') {
$query->set('start_date', $query->get('eventDate'));
$query->set('eventDate', $query->get('eventDate'));
}
break;
case 'all':
case 'list':
default:
// default display query
$event_date = $query->get('eventDate') != '' ? $query->get('eventDate') : date_i18n(Tribe__Date_Utils::DBDATETIMEFORMAT);
if (!$query->tribe_is_past) {
$query->set('start_date', '' != $query->get('eventDate') ? tribe_beginning_of_day($event_date) : tribe_format_date(current_time('timestamp'), true, 'Y-m-d H:i:s'));
$query->set('end_date', '');
$query->set('order', self::set_order('ASC', $query));
} else {
// on past view, set the passed date as the end date
$query->set('start_date', '');
$query->set('end_date', tribe_end_of_day($event_date));
$query->set('order', self::set_order('DESC', $query));
}
$query->set('orderby', self::set_orderby(null, $query));
$query->set('hide_upcoming', true);
break;
}
} else {
$query->set('hide_upcoming', true);
$query->set('start_date', date_i18n(Tribe__Date_Utils::DBDATETIMEFORMAT));
$query->set('orderby', self::set_orderby(null, $query));
$query->set('order', self::set_order(null, $query));
}
// eventCat becomes a standard taxonomy query - will need to deprecate and update views eventually
if (!in_array($query->get(Tribe__Events__Main::TAXONOMY), array('', '-1'))) {
$tax_query[] = array('taxonomy' => Tribe__Events__Main::TAXONOMY, 'field' => 'slug', 'terms' => $query->get(Tribe__Events__Main::TAXONOMY), 'include_children' => apply_filters('tribe_events_query_include_children', true));
}
// Only add the postmeta hack if it's not the main admin events list
// Because this method filters out drafts without EventStartDate.
// For this screen we're doing the JOIN manually in Tribe__Events__Admin_List
if (!Tribe__Admin__Helpers::instance()->is_screen('edit-tribe_events')) {
$event_start_key = Tribe__Events__Timezones::is_mode('site') ? '_EventStartDateUTC' : '_EventStartDate';
$meta_query[] = array('key' => $event_start_key, 'type' => 'DATETIME');
}
}
// filter by Venue ID
if ($query->tribe_is_event_query && $query->get('venue') != '') {
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:67,代码来源:Query.php
示例7: tribe_event_format_date
/**
* Formatted Date
*
* Returns formatted date
*
* @category Events
* @param string $date String representing the datetime, assumed to be UTC (relevant if timezone conversion is used)
* @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
*/
function tribe_event_format_date($date, $displayTime = true, $dateFormat = '')
{
_deprecated_function(__FUNCTION__, '4.0', 'tribe_format_date');
return tribe_format_date($date, $displayTime, $dateFormat);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:17,代码来源:deprecated.php
示例8: tribe_events_get_current_month_day
<?php
// Get data for this day within the loop.
$daydata = tribe_events_get_current_month_day();
?>
<td class="<?php
tribe_events_the_month_day_classes();
?>
"
data-day="<?php
echo esc_attr(isset($daydata['daynum']) ? $daydata['date'] : '');
?>
"
data-tribejson='<?php
echo tribe_events_template_data(null, array('date_name' => tribe_format_date($daydata['date'], false)));
?>
'
>
<?php
tribe_get_template_part('month/single', 'day');
?>
</td>
<?php
}
?>
</tr>
</tbody>
</table><!-- .tribe-events-calendar -->
<?php
do_action('tribe_events_after_the_grid');
开发者ID:partisan-collective,项目名称:partisan,代码行数:30,代码来源:loop-grid.php
示例9: fitclub_tribe_alter_event_archive_titles
function fitclub_tribe_alter_event_archive_titles($depth)
{
// Modify the titles here
// Some of these include %1$s and %2$s, these will be replaced with relevant dates
$title_upcoming = esc_html__('Upcoming Events', 'fitclub');
// List View: Upcoming events
$title_past = esc_html__('Past Events', 'fitclub');
// List view: Past events
$title_range = esc_html__('Events for %1$s - %2$s', 'fitclub');
// List view: range of dates being viewed
$title_month = esc_html__('Events for %1$s', 'fitclub');
// Month View, %1$s = the name of the month
$title_day = esc_html__('Events for %1$s', 'fitclub');
// Day View, %1$s = the day
$title_all = esc_html__('All events for %s', 'fitclub');
// showing all recurrences of an event, %s = event title
$title_week = esc_html__('Events for week of %s', 'fitclub');
// Week view
// Don't modify anything below this unless you know what it does
global $wp_query;
$tribe_ecp = Tribe__Events__Main::instance();
$date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true));
// Default Title
$title = $title_upcoming;
// If there's a date selected in the tribe bar, show the date range of the currently showing events
if (isset($_REQUEST['tribe-bar-date']) && $wp_query->have_posts()) {
if ($wp_query->get('paged') > 1) {
// if we're on page 1, show the selected tribe-bar-date as the first date in the range
$first_event_date = tribe_get_start_date($wp_query->posts[0], false);
} else {
//otherwise show the start date of the first event in the results
$first_event_date = tribe_format_date($_REQUEST['tribe-bar-date'], false);
}
$last_event_date = tribe_get_end_date($wp_query->posts[count($wp_query->posts) - 1], false);
$title = sprintf($title_range, $first_event_date, $last_event_date);
} elseif (tribe_is_past()) {
$title = $title_past;
}
// Month view title
if (tribe_is_month()) {
$title = sprintf($title_month, date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date())));
}
// Single view title
if (tribe_is_event() && is_single()) {
$title = get_the_title();
}
// Day view title
if (tribe_is_day()) {
$title = sprintf($title_day, date_i18n(tribe_get_date_format(true), strtotime($wp_query->get('start_date'))));
}
// All recurrences of an event
if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) {
$title = sprintf($title_all, get_the_title());
}
// Week view title
if (function_exists('tribe_is_week') && tribe_is_week()) {
$title = sprintf($title_week, date_i18n($date_format, strtotime(tribe_get_first_week_day($wp_query->get('start_date')))));
}
if (is_tax($tribe_ecp->get_event_taxonomy()) && $depth) {
$cat = get_queried_object();
$title = $cat->name;
}
return $title;
}
开发者ID:themegrill,项目名称:fitclub,代码行数:64,代码来源:fitclub.php
示例10: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @category Events
* @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)
* @param string $timezone Timezone in which to present the date/time (or default behaviour if not set)
*
* @return string|null Date
*/
function tribe_get_end_date($event = null, $displayTime = true, $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)) {
$displayTime = false;
}
$end_date = Tribe__Events__Timezones::event_end_timestamp($event->ID, $timezone);
return tribe_format_date($end_date, $displayTime, $dateFormat);
}
开发者ID:reubenbrown13,项目名称:the-events-calendar,代码行数:31,代码来源:date.php
示例11: tribe_get_events_title
/**
* Event Title
*
* Return an event's title with pseudo-breadcrumb if on a category
*
* @param bool $depth include linked title
*
* @return string title
* @todo move logic to template classes
*/
function tribe_get_events_title($depth = true)
{
$events_label_plural = tribe_get_event_label_plural();
global $wp_query;
$tribe_ecp = Tribe__Events__Main::instance();
$title = sprintf(esc_html__('Upcoming %s', 'the-events-calendar'), $events_label_plural);
// If there's a date selected in the tribe bar, show the date range of the currently showing events
if (isset($_REQUEST['tribe-bar-date']) && $wp_query->have_posts()) {
$first_returned_date = tribe_get_start_date($wp_query->posts[0], false, Tribe__Date_Utils::DBDATEFORMAT);
$first_event_date = tribe_get_start_date($wp_query->posts[0], false);
$last_event_date = tribe_get_end_date($wp_query->posts[count($wp_query->posts) - 1], false);
// If we are on page 1 then we may wish to use the *selected* start date in place of the
// first returned event date
if (1 == $wp_query->get('paged') && $_REQUEST['tribe-bar-date'] < $first_returned_date) {
$first_event_date = tribe_format_date($_REQUEST['tribe-bar-date'], false);
}
$title = sprintf(__('%1$s for %2$s - %3$s', 'the-events-calendar'), $events_label_plural, $first_event_date, $last_event_date);
} elseif (tribe_is_past()) {
$title = sprintf(esc_html__('Past %s', 'the-events-calendar'), $events_label_plural);
}
if (tribe_is_month()) {
$title = sprintf(esc_html__('%1$s for %2$s', 'the-events-calendar'), $events_label_plural, date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date())));
}
// day view title
if (tribe_is_day()) {
$title = sprintf(esc_html__('%1$s for %2$s', 'the-events-calendar'), $events_label_plural, date_i18n(tribe_get_date_format(true), strtotime($wp_query->get('start_date'))));
}
if (is_tax($tribe_ecp->get_event_taxonomy()) && $depth) {
$cat = get_queried_object();
$title = '<a href="' . esc_url(tribe_get_events_link()) . '">' . $title . '</a>';
$title .= ' › ' . $cat->name;
}
return apply_filters('tribe_get_events_title', $title, $depth);
}
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:44,代码来源:loop.php
示例12: tribe_get_end_date
/**
* End Date
*
* Returns the event end date
*
* @category Events
* @param int $event (optional)
* @param bool $display_time If true shows date and time, if false only shows date
* @param string $date_format 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 Date
*/
function tribe_get_end_date($event = null, $display_time = true, $date_format = '', $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__Date_Utils::is_all_day(get_post_meta($event->ID, '_EventAllDay', true))) {
$display_time = false;
}
// @todo move timezones to Common
if (class_exists('Tribe__Events__Timezones')) {
$end_date = Tribe__Events__Timezones::event_end_timestamp($event->ID, $timezone);
}
return tribe_format_date($end_date, $display_time, $date_format);
}
开发者ID:partisan-collective,项目名称:partisan,代码行数:34,代码来源:date.php
注:本文中的tribe_format_date函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论