當前位置: 首頁>>代碼示例>>PHP>>正文


PHP nnText::fixDate方法代碼示例

本文整理匯總了PHP中nnText::fixDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP nnText::fixDate方法的具體用法?PHP nnText::fixDate怎麽用?PHP nnText::fixDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nnText的用法示例。


在下文中一共展示了nnText::fixDate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: passDate

 function passDate()
 {
     if (!$this->params->publish_up && !$this->params->publish_down) {
         // no date range set
         return $this->assignment == 'include';
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
     nnText::fixDate($this->params->publish_up);
     nnText::fixDate($this->params->publish_down);
     $now = strtotime($this->date->format('Y-m-d H:i:s', true));
     $tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
     $up = JFactory::getDate($this->params->publish_up)->setTimeZone($tz);
     $down = JFactory::getDate($this->params->publish_down)->setTimeZone($tz);
     if (isset($this->params->recurring) && $this->params->recurring) {
         if (!(int) $this->params->publish_up || !(int) $this->params->publish_down) {
             // no date range set
             return $this->assignment == 'include';
         }
         $up = strtotime(date('Y') . $up->format('-m-d H:i:s'));
         $down = strtotime(date('Y') . $down->format('-m-d H:i:s'));
         // pass:
         // 1) now is between up and down
         // 2) up is later in year than down and:
         // 2a) now is after up
         // 2b) now is before down
         if ($up < $now && $down > $now || $up > $down && ($up < $now || $down > $now)) {
             return $this->assignment == 'include';
         }
         // outside date range
         return $this->pass(false);
     }
     if ((int) $this->params->publish_up && strtotime($up->format('Y-m-d H:i:s')) > $now || (int) $this->params->publish_down && strtotime($down->format('Y-m-d H:i:s')) < $now) {
         // outside date range
         return $this->pass(false);
     }
     // pass
     return $this->assignment == 'include';
 }
開發者ID:kleinhelmi,項目名稱:tus03_j3_2015_01,代碼行數:38,代碼來源:datetime.php


注:本文中的nnText::fixDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。