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


PHP is_new_day函数代码示例

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


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

示例1: checkday

function checkday(bool $force = true) : bool
{
    global $session, $revertsession, $REQUEST_URI;
    output_notl('<!--checkday()-->', true);
    if (is_new_day()) {
        if ($force && $session['user']['loggedin']) {
            $session = $revertsession;
            $session['user']['restorepage'] = $REQUEST_URI;
            $session['allowednavs'] = [];
            addnav('', 'newday.php');
            redirect('newday.php');
        }
        return true;
    } else {
        return false;
    }
}
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:17,代码来源:datetime.php

示例2: the_date

/**
 * Display or Retrieve the date the current post was written (once per date)
 *
 * Will only output the date if the current post's date is different from the
 * previous one output.
 *
 * i.e. Only one date listing will show per day worth of posts shown in the loop, even if the
 * function is called several times for each post.
 *
 * HTML output can be filtered with 'the_date'.
 * Date string output can be filtered with 'get_the_date'.
 *
 * @since 0.71
 *
 * @global string|int|bool $currentday
 * @global string|int|bool $previousday
 *
 * @param string $d      Optional. PHP date format defaults to the date_format option if not specified.
 * @param string $before Optional. Output before the date.
 * @param string $after  Optional. Output after the date.
 * @param bool   $echo   Optional, default is display. Whether to echo the date or return it.
 * @return string|void String if retrieving.
 */
function the_date($d = '', $before = '', $after = '', $echo = true)
{
    global $currentday, $previousday;
    if (is_new_day()) {
        $the_date = $before . get_the_date($d) . $after;
        $previousday = $currentday;
        /**
         * Filter the date a post was published for display.
         *
         * @since 0.71
         *
         * @param string $the_date The formatted date string.
         * @param string $d        PHP date format. Defaults to 'date_format' option
         *                         if not specified.
         * @param string $before   HTML output before the date.
         * @param string $after    HTML output after the date.
         */
        $the_date = apply_filters('the_date', $the_date, $d, $before, $after);
        if ($echo) {
            echo $the_date;
        } else {
            return $the_date;
        }
    }
}
开发者ID:blogfor,项目名称:king,代码行数:48,代码来源:general-template.php

示例3: checkday

function checkday()
{
    global $session, $revertsession, $REQUEST_URI;
    //output("`#`iChecking to see if you're due for a new day: ".$session['user']['laston'].", ".date("Y-m-d H:i:s")."`i`n`0");
    if ($session['user']['loggedin']) {
        output("<!--CheckNewDay()-->", true);
        if (is_new_day()) {
            $session = $revertsession;
            $session['user']['restorepage'] = $REQUEST_URI;
            $session['allowednavs'] = array();
            addnav("", "newday.php");
            redirect("newday.php");
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:dragonsaga-svn,代码行数:15,代码来源:common.php

示例4:

<?php

/**
 * Template part for displaying the post meta inside The Loop.
 *
 * @package Rock
 * @since   1.0.0
 */
?>

<div class="entry-meta">

	<?php 
if (is_new_day()) {
    ?>

		<span class="posted-date"><?php 
    the_date();
    ?>
</span>

	<?php 
}
?>

	<span class="posted-author"><?php 
the_author_posts_link();
?>
</span>

	<?php 
开发者ID:faithmade,项目名称:rock,代码行数:31,代码来源:post-meta.php

示例5: checkday

function checkday()
{
    global $session, $revertsession, $REQUEST_URI;
    if ($session['user']['loggedin']) {
        output_notl("<!--CheckNewDay()-->", true);
        if (is_new_day()) {
            $session = $revertsession;
            $session['user']['restorepage'] = $REQUEST_URI;
            $session['allowednavs'] = array();
            addnav("", "newday.php");
            $trace = debug_backtrace();
            redirect("newday.php", "New Day, checkday called from " . $trace[0]['file'] . ", line " . $trace[0]['line']);
        }
    }
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:15,代码来源:datetime.php

示例6: Parse


//.........这里部分代码省略.........
                 $te_data[$s]['Battery'] = $stat;
             }
         }
         if (trim($data[$f + 1]) != 'i') {
             $te_data[$s]['Hum'] = (int) $data[$f + 1];
         }
         //todo
         $te_data[$s]['Typ'] = 'T/F';
         if ($s == 0) {
             $te_data[$s]['Typ'] = 'Indoor';
         } else {
             if (!isset($te_data[$s]['Hum'])) {
                 $te_data[$s]['Typ'] = 'T';
             }
         }
     }
     //indoor specioa
     if (trim($data[13]) != 'i') {
         $te_data[0]['Press'] = (int) $data[13];
     }
     if (trim($data[15]) != 'i') {
         $te_data[0]['Forecast'] = (int) $data[15];
     }
     //uv
     if (trim($data[14]) != 'i') {
         $te_data['UV']['UV'] = $data[14];
         $te_data['UV']['Bat'] = $status[6];
     }
     //wind
     if (trim($data[18]) != 'i') {
         $te_data['Wind']['Wind'] = $data[18] * self::ms_to_kmh;
         $te_data['Wind']['Storm'] = $data[16] != 0 ? 'YES' : 'No';
         $te_data['Wind']['WindDir'] = $data[17] * 22.5;
         $te_data['Wind']['WindGust'] = $data[19] * self::ms_to_kmh;
         $te_data['Wind']['WindChill'] = (double) $data[20];
         $te_data['Wind']['Bat'] = $status[7];
     }
     //rain
     if (trim($data[21]) != 'i') {
         $new = (int) $data[21];
         $factor = $this->GetRainPerCount() / 1000;
         $rcid = @$this->GetIDForIdent('LastRainCounter');
         $dailyid = @$this->GetIDForIdent('NewDayRainCounter');
         $old = GetValueInteger($rcid);
         $daily = GetValueInteger($dailyid);
         $diff = $new - $old;
         $dailydiff = $new - $daily;
         $rain = $diff * $factor;
         $raindaily = $dailydiff * $factor;
         $te_data['Rain']['RainLastDay'] = '';
         $dailyvar = IPS_GetVariable($dailyid);
         $dailyupdated = $dailyvar['VariableUpdated'];
         if (is_new_day($dailyupdated)) {
             //set last day sum
             SetValueInteger($dailyid, $old);
             //calculate rain last day
             $lastday = ($old - $daily) * $factor;
             if ($lastday < 0 or $lastday > 500) {
                 $lastday = 0;
             }
             $te_data['Rain']['RainLastDay'] = $lastday;
             $this->debug(__FUNCTION__, "::NewDay, Store old Counter({$old}) and Daily({$lastday})");
         }
         if ($new > $old) {
             SetValueInteger($rcid, $new);
         }
         if ($rain < 0 or $rain > 100) {
             $rain = 0;
         }
         $te_data['Rain']['Rain'] = $rain;
         if ($raindaily < 0 or $raindaily > 500) {
             $raindaily = 0;
         }
         $te_data['Rain']['RainDaily'] = $raindaily;
         $te_data['Rain']['Bat'] = $status[5];
     }
     //fill standard fields
     foreach (array('Wind', 'Rain', 'UV', 'Indoor') as $dev) {
         if (isset($te_data[$dev])) {
             $te_data[$dev]['Typ'] = $dev . "Sensor";
             $te_data[$dev]['Id'] = $dev;
             if (isset($te_data[$dev]['Bat'])) {
                 $stat = trim($te_data[$dev]['Bat']) == '0' ? 'LOW' : 'OK';
                 $te_data[$dev]['Battery'] = $stat;
                 unset($te_data[$dev]['Bat']);
             }
         }
     }
     $this->debug(__FUNCTION__, 'OK');
     /*
     } else {
         $this->debug(__FUNCTION__, "Field Error (22 data and 14 status fields expected");
     }
     */
     $this->debug(__FUNCTION__, " Parsed Data:" . print_r($te_data, true));
     if (count($te_data) == 0) {
         IPS_LogMessage(__CLASS__, __FUNCTION__ . " Error: Parsing returned no data");
     }
     return $te_data;
 }
开发者ID:Tommi2Day,项目名称:ipsymcon-phpmodule-by-Tommi,代码行数:101,代码来源:module.php


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