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


PHP NNText::fixDate方法代码示例

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


在下文中一共展示了NNText::fixDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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', true));
         $down = strtotime(date('Y') . $down->format('-m-d H:i:s', true));
         // 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', true)) > $now || (int) $this->params->publish_down && strtotime($down->format('Y-m-d H:i:s', true)) < $now) {
         // outside date range
         return $this->pass(false);
     }
     // pass
     return $this->assignment == 'include';
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:38,代码来源:datetime.php

示例2: passDate

 function passDate()
 {
     if (!$this->params->publish_up && !$this->params->publish_down) {
         // no date range set
         return $this->assignment == 'include';
     }
     require_once dirname(__DIR__) . '/text.php';
     NNText::fixDate($this->params->publish_up);
     NNText::fixDate($this->params->publish_down);
     $now = $this->getNow();
     $up = $this->getDate($this->params->publish_up);
     $down = $this->getDate($this->params->publish_down);
     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', true));
         $down = strtotime(date('Y') . $down->format('-m-d H:i:s', true));
         // 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', true)) > $now || (int) $this->params->publish_down && strtotime($down->format('Y-m-d H:i:s', true)) < $now) {
         // outside date range
         return $this->pass(false);
     }
     // pass
     return $this->assignment == 'include';
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:37,代码来源:datetime.php


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