当前位置: 首页>>代码示例>>PHP>>正文


PHP tribe_events_earliest_date函数代码示例

本文整理汇总了PHP中tribe_events_earliest_date函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_events_earliest_date函数的具体用法?PHP tribe_events_earliest_date怎么用?PHP tribe_events_earliest_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了tribe_events_earliest_date函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:26,代码来源:day.php

示例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);
     }
 }
开发者ID:partisan-collective,项目名称:partisan,代码行数:32,代码来源:Known_Range.php

示例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);
     }
 }
开发者ID:kevinaxu,项目名称:99boulders,代码行数:22,代码来源:Main.php

示例4: tribe_events_week_previous_link

 /**
  * Build the previous week link.
  *
  * @param string $text The text to be linked.
  *
  * @return string
  */
 function tribe_events_week_previous_link($text = '')
 {
     try {
         $date = tribe_get_first_week_day();
         if ($date <= tribe_events_earliest_date(Tribe__Events__Date_Utils::DBDATEFORMAT)) {
             return '';
         }
         $url = tribe_get_last_week_permalink();
         if (empty($text)) {
             $text = __('<span>&laquo;</span> Previous Week', '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')));
         if (!empty($url)) {
             return sprintf('<a %s href="%s" rel="prev">%s</a>', $attributes, esc_url($url), $text);
         }
     } catch (OverflowException $e) {
         return '';
     }
 }
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:28,代码来源:week.php

示例5: tribe_events_the_previous_month_link

 /**
  * Display an html link to the previous month. Used in the month navigation.
  *
  * No link will be returned if the link is to a month that precedes any existing
  * events.
  *
  * @return void
  * @uses tribe_get_previous_month_text()
  **/
 function tribe_events_the_previous_month_link()
 {
     $html = '';
     $url = tribe_get_previous_month_link();
     $date = Tribe__Events__Main::instance()->previousMonth(tribe_get_month_view_date());
     if ($date >= tribe_events_earliest_date(Tribe__Events__Date_Utils::DBYEARMONTHTIMEFORMAT)) {
         $text = tribe_get_previous_month_text();
         $html = '<a data-month="' . $date . '" href="' . esc_url($url) . '" rel="prev"><span>&laquo;</span> ' . $text . ' </a>';
     }
     echo apply_filters('tribe_events_the_previous_month_link', $html);
 }
开发者ID:simple-beck,项目名称:project-gc,代码行数:20,代码来源:month.php

示例6: tribe_previous_week_link

 function tribe_previous_week_link($text = '')
 {
     try {
         $date = tribe_get_first_week_day();
         if ($date <= tribe_events_earliest_date(TribeDateUtils::DBDATEFORMAT)) {
             return '';
         }
         $url = tribe_get_last_week_permalink();
         if (empty($text)) {
             $text = __('<span>&laquo;</span> Previous Week', 'tribe-events-calendar-pro');
         }
         if (!empty($url)) {
             return sprintf('<a %s href="%s" rel="prev">%s</a>', tribe_events_the_nav_attributes('prev', false), $url, $text);
         }
     } catch (OverflowException $e) {
         return '';
     }
 }
开发者ID:TMBR,项目名称:johnjohn,代码行数:18,代码来源:week.php

示例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);
     }
 }
开发者ID:estrategasdigitales,项目名称:Golone,代码行数:31,代码来源:the-events-calendar.class.php

示例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);
     }
 }
开发者ID:Vinnica,项目名称:theboxerboston.com,代码行数:28,代码来源:the-events-calendar.class.php

示例9: tribe_events_the_previous_month_link

 /**
  * Display an html link to the previous month. Used in the month navigation.
  *
  * No link will be returned if the link is to a month that precedes any existing
  * events.
  *
  * @uses tribe_get_previous_month_text()
  **/
 function tribe_events_the_previous_month_link()
 {
     $html = '';
     $url = tribe_get_previous_month_link();
     $date = Tribe__Events__Main::instance()->previousMonth(tribe_get_month_view_date());
     $earliest_event_date = tribe_events_earliest_date(Tribe__Date_Utils::DBYEARMONTHTIMEFORMAT);
     // Only form the link if a) we have a known earliest event date and b) the previous month date is the same or later
     if ($earliest_event_date && $date >= $earliest_event_date) {
         $text = tribe_get_previous_month_text();
         $html = '<a data-month="' . $date . '" href="' . esc_url($url) . '" rel="prev"><span>&laquo;</span> ' . $text . ' </a>';
     }
     echo apply_filters('tribe_events_the_previous_month_link', $html);
 }
开发者ID:duongnguyen92,项目名称:tvd12v2,代码行数:21,代码来源:month.php


注:本文中的tribe_events_earliest_date函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。