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


PHP FLEXIUtilities::isSqlValidDate方法代码示例

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


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

示例1: getItems


//.........这里部分代码省略.........
     }
     // **********
     // tags scope
     // **********
     if ($method_tags > 1) {
         // Check for empty statically selected records, and abort with error message
         if (empty($tag_ids)) {
             echo "<b>WARNING:</b> Misconfigured tags scope, select at least one tag or set tags scope to ALL<br/>";
             return;
         }
         // Make sure tag_ids is an array
         $tag_ids = !is_array($tag_ids) ? array($tag_ids) : $tag_ids;
         // Create query to match item ids using the selected tags
         $query2 = 'SELECT ' . ($tag_combine ? 'itemid' : 'DISTINCT itemid') . ' FROM #__flexicontent_tags_item_relations' . ' WHERE tid IN (' . implode(',', $tag_ids) . ')' . ($tag_combine ? ' GROUP by itemid HAVING COUNT(*) >= ' . count($tag_ids) : '');
         if ($method_tags == 2) {
             // exclude method
             $where .= ' AND i.id NOT IN (' . $query2 . ')';
         } else {
             if ($method_tags == 3) {
                 // include method
                 $where .= ' AND i.id IN (' . $query2 . ')';
             }
         }
     }
     // **********
     // date scope
     // **********
     // ZERO 'behaviour' means statically selected records, but METHOD 1 is ALL records ... so NOTHING to do
     // NOTE: currently we only have ALL, INCLUDE methods
     if (!$behaviour_dates && $method_dates == 1) {
     } else {
         if (!$behaviour_dates) {
             $negate_op = $method_dates == 2 ? 'NOT' : '';
             if (!$raw_edate && $edate && !FLEXIUtilities::isSqlValidDate($edate)) {
                 echo "<b>WARNING:</b> Misconfigured date scope, you have entered invalid -END- date:<br>(a) Enter a valid date via callendar OR <br>(b) leave blank OR <br>(c) choose (non-static behavior 'custom offset') and enter custom offset e.g. five days ago (be careful with space character): -5 d<br/>";
                 return;
             } else {
                 if ($edate) {
                     $where .= ' AND ( ' . $negate_op . ' ( ' . $comp . ' <= ' . (!$raw_edate ? $db->Quote($edate) : $edate) . ' )' . ($nulldates ? ' OR ' . $comp . ' IS NULL OR ' . $comp . '="" ' : '') . ' )';
                 }
             }
             if (!$raw_bdate && $bdate && !FLEXIUtilities::isSqlValidDate($bdate)) {
                 echo "<b>WARNING:</b> Misconfigured date scope, you have entered invalid -BEGIN- date:<br>(a) Enter a valid date via callendar OR <br>(b) leave blank OR <br>(c) choose (non-static behavior 'custom offset') and enter custom offset e.g. five days ago (be careful with space character): -5 d<br/>";
                 return;
             } else {
                 if ($bdate) {
                     $where .= ' AND ( ' . $negate_op . ' ( ' . $comp . ' >= ' . (!$raw_bdate ? $db->Quote($bdate) : $bdate) . ' )' . ($nulldates ? ' OR ' . $comp . ' IS NULL OR ' . $comp . '="" ' : '') . ' )';
                 }
             }
         } else {
             if (!$isflexi_itemview && $date_compare == 1) {
                 return;
                 // date_compare == 1 means compare to current item, but current view is not an item view so we terminate
             }
             // FOR date_compare==0, $cdate is SERVER DATE
             // FOR date_compare==1, $cdate is CURRENT ITEM DATE of type created or modified or publish_up or CUSTOM date field
             switch ($behaviour_dates) {
                 case '1':
                     // custom offset
                     if ($edate) {
                         $edate = array(0 => preg_replace("/[^-+0-9\\s]/", "", $edate), 1 => preg_replace("/[0-9-+\\s]/", "", $edate));
                         if (empty($edate[1])) {
                             echo "<b>WARNING:</b> Misconfigured date scope, you have entered invalid -END- date:Custom offset is invalid e.g. in order to enter five days ago (be careful with space character) use: -5 d (DO NOT FORGET the space between e.g. '-5 d')<br/>";
                             return;
                         } else {
                             $where .= ' AND ( ' . $comp . ' < ' . $db->Quote(date_time::shift_dates($cdate, $edate[0], $edate[1])) . ($nulldates ? ' OR ' . $comp . ' IS NULL OR ' . $comp . '="" ' : '') . ' )';
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:67,代码来源:helper.php


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