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


PHP TribeEvents::getRealStartDate方法代码示例

本文整理汇总了PHP中TribeEvents::getRealStartDate方法的典型用法代码示例。如果您正苦于以下问题:PHP TribeEvents::getRealStartDate方法的具体用法?PHP TribeEvents::getRealStartDate怎么用?PHP TribeEvents::getRealStartDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TribeEvents的用法示例。


在下文中一共展示了TribeEvents::getRealStartDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: recurrenceToText

 /**
  * Convert the event recurrence meta into a human readable string
  * @param array $postId The recurring event
  * @return The human readable string
  */
 public static function recurrenceToText($postId = null)
 {
     $text = "";
     $custom_text = "";
     $occurrence_text = "";
     if ($postId == null) {
         global $post;
         $postId = $post->ID;
     }
     extract(TribeEventsRecurrenceMeta::getRecurrenceMeta($postId));
     if ($recType == "Every Day") {
         $text = __("Every day", 'tribe-events-calendar-pro');
         $occurrence_text = sprintf(_n(" for %d day", " for %d days", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
         $custom_text = "";
     } else {
         if ($recType == "Every Week") {
             $text = __("Every week", 'tribe-events-calendar-pro');
             $occurrence_text = sprintf(_n(" for %d week", " for %d weeks", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
         } else {
             if ($recType == "Every Month") {
                 $text = __("Every month", 'tribe-events-calendar-pro');
                 $occurrence_text = sprintf(_n(" for %d month", " for %d months", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
             } else {
                 if ($recType == "Every Year") {
                     $text = __("Every year", 'tribe-events-calendar-pro');
                     $occurrence_text = sprintf(_n(" for %d year", " for %d years", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
                 } else {
                     if ($recType == "Custom") {
                         if ($recCustomType == "Daily") {
                             $text = $recCustomInterval == 1 ? __("Every day", 'tribe-events-calendar-pro') : sprintf(__("Every %d days", 'tribe-events-calendar-pro'), $recCustomInterval);
                             $occurrence_text = sprintf(_n(", recurring %d time", ", recurring %d times", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
                         } else {
                             if ($recCustomType == "Weekly") {
                                 $text = $recCustomInterval == 1 ? __("Every week", 'tribe-events-calendar-pro') : sprintf(__("Every %d weeks", 'tribe-events-calendar-pro'), $recCustomInterval);
                                 $custom_text = sprintf(__(" on %s", 'tribe-events-calendar-pro'), self::daysToText($recCustomWeekDay));
                                 $occurrence_text = sprintf(_n(", recurring %d time", ", recurring %d times", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
                             } else {
                                 if ($recCustomType == "Monthly") {
                                     $text = $recCustomInterval == 1 ? __("Every month", 'tribe-events-calendar-pro') : sprintf(__("Every %d months", 'tribe-events-calendar-pro'), $recCustomInterval);
                                     $number_display = is_numeric($recCustomMonthNumber) ? TribeDateUtils::numberToOrdinal($recCustomMonthNumber) : strtolower($recCustomMonthNumber);
                                     $custom_text = sprintf(__(" on the %s %s", 'tribe-events-calendar-pro'), $number_display, is_numeric($recCustomMonthNumber) ? __("day", 'tribe-events-calendar-pro') : self::daysToText($recCustomMonthDay));
                                     $occurrence_text = sprintf(_n(", recurring %d time", ", recurring %d times", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
                                 } else {
                                     if ($recCustomType == "Yearly") {
                                         $text = $recCustomInterval == 1 ? __("Every year", 'tribe-events-calendar-pro') : sprintf(__("Every %d years", 'tribe-events-calendar-pro'), $recCustomInterval);
                                         $customYearNumber = $recCustomYearMonthNumber != -1 ? TribeDateUtils::numberToOrdinal($recCustomYearMonthNumber) : __("last", 'tribe-events-calendar-pro');
                                         $day = $recCustomYearFilter ? $customYearNumber : TribeDateUtils::numberToOrdinal(date('j', strtotime(TribeEvents::getRealStartDate($postId))));
                                         $of_week = $recCustomYearFilter ? self::daysToText($recCustomYearMonthDay) : "";
                                         $months = self::monthsToText($recCustomYearMonth);
                                         $custom_text = sprintf(__(" on the %s %s of %s", 'tribe-events-calendar-pro'), $day, $of_week, $months);
                                         $occurrence_text = sprintf(_n(", recurring %d time", ", recurring %d times", $recEndCount, 'tribe-events-calendar-pro'), $recEndCount);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // end text
     if ($recEndType == "On") {
         $endText = ' ' . sprintf(__(" until %s", 'tribe-events-calendar-pro'), date_i18n(get_option('date_format'), strtotime($recEnd)));
     } else {
         $endText = $occurrence_text;
     }
     return sprintf(__('%s%s%s', 'tribe-events-calendar-pro'), $text, $custom_text, $endText);
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:73,代码来源:tribe-events-recurrence-meta.class.php

示例2: addDateToRecurringEvents

 public function addDateToRecurringEvents($permalink, $post)
 {
     if (function_exists('tribe_is_recurring_event') && $post->post_type == self::POSTTYPE && tribe_is_recurring_event($post->ID) && !is_search()) {
         if (is_admin() && (!isset($post->EventStartDate) || !$post->EventStartDate)) {
             if (isset($_REQUEST['eventDate'])) {
                 $post->EventStartDate = $_REQUEST['eventDate'];
             } else {
                 $post->EventStartDate = TribeEvents::getRealStartDate($post->ID);
             }
         }
         // prevent any call from outside the tribe from appending bad date on the end of recurring permalinks (looking at Yoast WP SEO)
         if (!isset($post->EventStartDate) || !$post->EventStartDate) {
             return $permalink;
         }
         if ('' == get_option('permalink_structure')) {
             return add_query_arg('eventDate', TribeDateUtils::dateOnly($post->EventStartDate), $permalink);
         } else {
             return trailingslashit($permalink) . TribeDateUtils::dateOnly(isset($post->EventStartDate) ? $post->EventStartDate : null);
         }
     }
     return $permalink;
 }
开发者ID:kevinreilly,项目名称:redwood-city-chamber-wp,代码行数:22,代码来源:the-events-calendar.class.php

示例3: recurrenceToTextByPost

 /**
  * Get the recurrence pattern in text format by post id.
  *
  * @param int $postId The post id.
  * @return sting The human readable string.
  */
 public static function recurrenceToTextByPost($postId = null)
 {
     if ($postId == null) {
         global $post;
         $postId = $post->ID;
     }
     $recurrence_rules = TribeEventsRecurrenceMeta::getRecurrenceMeta($postId);
     $start_date = TribeEvents::getRealStartDate($postId);
     $output_text = empty($recurrence_rules['recCustomRecurrenceDescription']) ? self::recurrenceToText($recurrence_rules, $start_date) : $recurrence_rules['recCustomRecurrenceDescription'];
     return $output_text;
 }
开发者ID:Vinnica,项目名称:theboxerboston.com,代码行数:17,代码来源:tribe-events-recurrence-meta.class.php


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