本文整理汇总了PHP中Gdn_Format::toTimeStamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::toTimeStamp方法的具体用法?PHP Gdn_Format::toTimeStamp怎么用?PHP Gdn_Format::toTimeStamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::toTimeStamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newVisit
/**
*
*
* @return bool
*/
public function newVisit()
{
static $NewVisit = null;
if ($NewVisit !== null) {
return $NewVisit;
}
if (!$this->User) {
return false;
}
$Current = $this->getCookie('-Vv');
$Now = time();
$TimeToExpire = 1200;
// 20 minutes
$Expires = $Now + $TimeToExpire;
// Figure out if this is a new visit.
if ($Current) {
$NewVisit = false;
// user has cookie, not a new visit.
} elseif (Gdn_Format::toTimeStamp($this->User->DateLastActive) + $TimeToExpire > $Now) {
$NewVisit = false;
} else {
$NewVisit = true;
}
$this->setCookie('-Vv', $Now, $Expires);
return $NewVisit;
}
示例2: foreach
<?php
$SlugBase = AddonModel::slug($this->Data, FALSE);
foreach ($this->data('Versions') as $Version) {
$VersionSlug = urlencode($SlugBase . '-' . $Version['Version']);
?>
<item>
<title><?php
echo Gdn_Format::text($this->data('Name') . ' ' . $Version['Version']);
?>
</title>
<link><?php
echo url('/addon/' . $VersionSlug, TRUE);
?>
</link>
<pubDate><?php
echo date(DATE_RSS, Gdn_Format::toTimeStamp($Version['DateInserted']));
?>
</pubDate>
<dc:creator><?php
echo Gdn_Format::text($this->data('InsertName'));
?>
</dc:creator>
<guid isPermaLink="true"><?php
echo Url('/addons/addon/' . $VersionSlug, TRUE);
?>
</guid>
<description><![CDATA[<?php
echo Gdn_Format::html($this->data('Description'));
?>
]]></description>
</item>