本文整理汇总了PHP中tribe_events_latest_date函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_events_latest_date函数的具体用法?PHP tribe_events_latest_date怎么用?PHP tribe_events_latest_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_events_latest_date函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tribe_the_day_link
/**
* Output an html link to a day
*
* @category Events
* @param string $date 'previous day', 'next day', 'yesterday', 'tomorrow', or any date string that strtotime() can parse
* @param string $text text for the link
*
**/
function tribe_the_day_link($date = null, $text = null)
{
$html = '';
try {
if (is_null($text)) {
$text = tribe_get_the_day_link_label($date);
}
$date = tribe_get_the_day_link_date($date);
$link = tribe_get_day_link($date);
$earliest = tribe_events_earliest_date(Tribe__Date_Utils::DBDATEFORMAT);
$latest = tribe_events_latest_date(Tribe__Date_Utils::DBDATEFORMAT);
if ($date >= $earliest && $date <= $latest) {
$html = '<a href="' . esc_url($link) . '" data-day="' . $date . '" rel="prev">' . $text . '</a>';
}
} catch (OverflowException $e) {
}
echo apply_filters('tribe_the_day_link', $html);
}
示例2: 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);
}
}
示例3: 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).
*/
public function update_known_range($object_id)
{
$current_min = tribe_events_earliest_date();
$current_max = tribe_events_latest_date();
$event_start = tribe_get_start_date($object_id, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
$event_end = tribe_get_end_date($object_id, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
if ($current_min > $event_start) {
tribe_update_option('earliest_date', $event_start);
}
if ($current_max < $event_end) {
tribe_update_option('latest_date', $event_end);
}
}
示例4: tribe_events_week_next_link
/**
* Build the next week link
*
* @param string $text the text to be linked
*
* @return string
*/
function tribe_events_week_next_link($text = '')
{
try {
$date = date(Tribe__Events__Date_Utils::DBDATEFORMAT, strtotime(tribe_get_first_week_day() . ' +1 week'));
if ($date >= tribe_events_latest_date(Tribe__Events__Date_Utils::DBDATEFORMAT)) {
return '';
}
$url = tribe_get_next_week_permalink();
if (empty($text)) {
$text = __('Next Week <span>»</span>', 'tribe-events-calendar-pro');
}
global $wp_query;
$current_week = tribe_get_first_week_day($wp_query->get('start_date'));
$attributes = sprintf(' data-week="%s" ', date('Y-m-d', strtotime($current_week . ' +7 days')));
return sprintf('<a %s href="%s" rel="next">%s</a>', $attributes, esc_url($url), $text);
} catch (OverflowException $e) {
return '';
}
}
示例5: tribe_events_the_next_month_link
/**
* Display an html link to the next month. Used in the month navigation.
*
* @return void
* @uses tribe_get_next_month_text()
**/
function tribe_events_the_next_month_link()
{
$html = '';
$url = tribe_get_next_month_link();
$text = tribe_get_next_month_text();
// Check if $url is populated (an empty string may indicate the date was out-of-bounds, ie on 32bit servers)
if (!empty($url)) {
$date = Tribe__Events__Main::instance()->nextMonth(tribe_get_month_view_date());
if ($date <= tribe_events_latest_date(Tribe__Events__Date_Utils::DBYEARMONTHTIMEFORMAT)) {
$html = '<a data-month="' . $date . '" href="' . esc_url($url) . '" rel="next">' . $text . ' <span>»</span></a>';
}
}
echo apply_filters('tribe_events_the_next_month_link', $html);
}
示例6: tribe_next_week_link
function tribe_next_week_link($text = '')
{
try {
$date = date(TribeDateUtils::DBDATEFORMAT, strtotime(tribe_get_first_week_day() . ' +1 week'));
if ($date >= tribe_events_latest_date(TribeDateUtils::DBDATEFORMAT)) {
return '';
}
$url = tribe_get_next_week_permalink();
if (empty($text)) {
$text = __('Next Week <span>»</span>', 'tribe-events-calendar-pro');
}
return sprintf('<a %s href="%s" rel="next">%s</a>', tribe_events_the_nav_attributes('next', false), $url, $text);
} catch (OverflowException $e) {
return '';
}
}
示例7: update_earliest_latest
/**
* 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).
*/
public function update_earliest_latest($post_id)
{
// Bail if this isn't an event
if (TribeEvents::POSTTYPE !== get_post_type($post_id)) {
return;
}
// If the event isn't going to be visible (perhaps it's been trashed) rebuild dates and bail
if (!in_array(get_post_status($post_id), array('publish', 'private', 'protected'))) {
$this->rebuild_earliest_latest();
return;
}
$current_min = tribe_events_earliest_date();
$current_max = tribe_events_latest_date();
$event_start = tribe_get_start_date($post_id, false, TribeDateUtils::DBDATETIMEFORMAT);
$event_end = tribe_get_end_date($post_id, false, TribeDateUtils::DBDATETIMEFORMAT);
if ($current_min > $event_start) {
tribe_update_option('earliest_date', $event_start);
}
if ($current_max < $event_end) {
tribe_update_option('latest_date', $event_end);
}
}
示例8: 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).
*/
public function update_known_range($meta_id, $object_id, $meta_key)
{
if (TribeEvents::POSTTYPE !== get_post_type($object_id)) {
return;
}
if ('_EventDuration' !== $meta_key) {
return;
}
$current_min = tribe_events_earliest_date();
$current_max = tribe_events_latest_date();
$event_start = tribe_get_start_date($object_id, false, TribeDateUtils::DBDATETIMEFORMAT);
$event_end = tribe_get_end_date($object_id, false, TribeDateUtils::DBDATETIMEFORMAT);
if ($current_min > $event_start) {
tribe_update_option('earliest_date', $event_start);
}
if ($current_max < $event_end) {
tribe_update_option('latest_date', $event_end);
}
}