本文整理匯總了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>