本文整理汇总了PHP中Gdn_Format::ToTimeStamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::ToTimeStamp方法的具体用法?PHP Gdn_Format::ToTimeStamp怎么用?PHP Gdn_Format::ToTimeStamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::ToTimeStamp方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NewVisit
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;
} elseif (Gdn_Format::ToTimeStamp($this->User->DateLastActive) + $TimeToExpire > $Now) {
$NewVisit = FALSE;
} else {
$NewVisit = TRUE;
}
$this->SetCookie('-Vv', $Now, $Expires);
return $NewVisit;
}
示例2: AddCategoryColumns
/**
* Modifies category data before it is returned.
*
* Adds CountAllDiscussions column to each category representing the sum of
* discussions within this category as well as all subcategories.
*
* @since 2.0.17
* @access public
*
* @param object $Data SQL result.
*/
public static function AddCategoryColumns($Data)
{
$Result =& $Data->Result();
$Result2 = $Result;
foreach ($Result as &$Category) {
if (!property_exists($Category, 'CountAllDiscussions')) {
$Category->CountAllDiscussions = $Category->CountDiscussions;
}
if (!property_exists($Category, 'CountAllComments')) {
$Category->CountAllComments = $Category->CountComments;
}
// Calculate the following field.
$Following = !((bool) GetValue('Archived', $Category) || (bool) GetValue('Unfollow', $Category));
$Category->Following = $Following;
$DateMarkedRead = GetValue('DateMarkedRead', $Category);
$UserDateMarkedRead = GetValue('UserDateMarkedRead', $Category);
if (!$DateMarkedRead) {
$DateMarkedRead = $UserDateMarkedRead;
} elseif ($UserDateMarkedRead && Gdn_Format::ToTimestamp($UserDateMarkedRead) > Gdn_Format::ToTimeStamp($DateMarkedRead)) {
$DateMarkedRead = $UserDateMarkedRead;
}
// Set appropriate Last* columns.
SetValue('LastTitle', $Category, GetValue('LastDiscussionTitle', $Category, NULL));
$LastDateInserted = GetValue('LastDateInserted', $Category, NULL);
if (GetValue('LastCommentUserID', $Category) == NULL) {
SetValue('LastCommentUserID', $Category, GetValue('LastDiscussionUserID', $Category, NULL));
SetValue('DateLastComment', $Category, GetValue('DateLastDiscussion', $Category, NULL));
SetValue('LastUserID', $Category, GetValue('LastDiscussionUserID', $Category, NULL));
$LastDiscussion = ArrayTranslate($Category, array('LastDiscussionID' => 'DiscussionID', 'CategoryID' => 'CategoryID', 'LastTitle' => 'Name'));
SetValue('LastUrl', $Category, DiscussionUrl($LastDiscussion, FALSE, '//') . '#latest');
if (is_null($LastDateInserted)) {
SetValue('LastDateInserted', $Category, GetValue('DateLastDiscussion', $Category, NULL));
}
} else {
$LastDiscussion = ArrayTranslate($Category, array('LastDiscussionID' => 'DiscussionID', 'CategoryID' => 'CategoryID', 'LastTitle' => 'Name'));
SetValue('LastUserID', $Category, GetValue('LastCommentUserID', $Category, NULL));
SetValue('LastUrl', $Category, DiscussionUrl($LastDiscussion, FALSE, '//') . '#latest');
if (is_null($LastDateInserted)) {
SetValue('LastDateInserted', $Category, GetValue('DateLastComment', $Category, NULL));
}
}
$LastDateInserted = GetValue('LastDateInserted', $Category, NULL);
if ($DateMarkedRead) {
if ($LastDateInserted) {
$Category->Read = Gdn_Format::ToTimestamp($DateMarkedRead) >= Gdn_Format::ToTimestamp($LastDateInserted);
} else {
$Category->Read = TRUE;
}
} else {
$Category->Read = FALSE;
}
foreach ($Result2 as $Category2) {
if ($Category2->TreeLeft > $Category->TreeLeft && $Category2->TreeRight < $Category->TreeRight) {
$Category->CountAllDiscussions += $Category2->CountDiscussions;
$Category->CountAllComments += $Category2->CountComments;
}
}
}
}
示例3: array
<?php
$Activities = $this->data('Activities', array());
foreach ($Activities as $Activity) {
$Author = UserBuilder($Activity, 'Activity');
?>
<item>
<title><?php
echo Gdn_Format::text(val('Headline', $Activity));
?>
</title>
<link><?php
echo url(userUrl($Author, '', 'activity'), true);
?>
</link>
<pubDate><?php
echo date('r', Gdn_Format::ToTimeStamp(val('DateUpdated', $Activity)));
?>
</pubDate>
<dc:creator><?php
echo Gdn_Format::text($Author->Name);
?>
</dc:creator>
<guid
isPermaLink="false"><?php
echo val('ActivityID', $Activity) . '@' . Url(userUrl($Author, '', 'activity'));
?>
</guid>
<?php
if ($Story = val('Story', $Activity)) {
?>
<description><![CDATA[<?php
示例4: foreach
?>
" rel="self" type="application/rss+xml" />
<?php
foreach ($this->DiscussionData->Result() as $Discussion) {
?>
<item>
<title><?php
echo Gdn_Format::Text($Discussion->Name);
?>
</title>
<link><?php
echo htmlspecialchars(Url('/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name), TRUE));
?>
</link>
<pubDate><?php
echo date(DATE_RSS, Gdn_Format::ToTimeStamp($Discussion->DateInserted));
?>
</pubDate>
<dc:creator><?php
echo Gdn_Format::Text($Discussion->FirstName);
?>
</dc:creator>
<guid isPermaLink="false"><?php
echo $Discussion->DiscussionID . '@' . Url('/discussions');
?>
</guid>
<description><![CDATA[<?php
echo Gdn_Format::To($Discussion->Body, $Discussion->Format);
?>
]]></description>
</item>
示例5: Url
?>
]]></title>
<link href="<?php
echo $Discussion->Url;
?>
"/>
<id><?php
echo $Discussion->DiscussionID . '@' . Url('/discussions');
?>
</id>
<author>
<name><?php
echo Gdn_Format::text($Discussion->FirstName);
?>
</name>
<uri><?php
echo htmlspecialchars(url('/profile/' . $Discussion->InsertUserID . '/' . $Discussion->FirstName, true));
?>
</uri>
</author>
<updated><?php
echo date('c', Gdn_Format::ToTimeStamp($Discussion->DateLastComment));
?>
</updated>
<summary><![CDATA[<?php
echo Gdn_Format::RssHtml($Discussion->Body, $Discussion->Format);
?>
]]></summary>
</entry>
<?php
}
示例6: foreach
<div class="SubTitleWrapper">
<div class="SubTitle">
<h1>Members who have filled out the Vanilla Forums Contributor Agreement</h1>
</div>
</div>
<table>
<thead>
<tr>
<td>Name</td>
<td>Date</td>
</tr>
</thead>
<tbody>
<?php
foreach ($this->UserData->Result() as $User) {
?>
<tr>
<td><?php
echo $User->Name;
?>
</td>
<td><?php
echo date("m/d/y", Gdn_Format::ToTimeStamp($User->DateContributorAgreement));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
示例7: foreach
?>
" rel="self" type="application/rss+xml" />
<?php
foreach ($this->DiscussionData->Result() as $Discussion) {
?>
<item>
<title><?php
echo Gdn_Format::Text($Discussion->Name);
?>
</title>
<link><?php
echo $Discussion->Url;
?>
</link>
<pubDate><?php
echo date('r', Gdn_Format::ToTimeStamp($Discussion->DateInserted));
?>
</pubDate>
<dc:creator><?php
echo Gdn_Format::Text($Discussion->FirstName);
?>
</dc:creator>
<guid isPermaLink="false"><?php
echo $Discussion->DiscussionID . '@' . Url('/discussions');
?>
</guid>
<description><![CDATA[<?php
echo Gdn_Format::RssHtml($Discussion->Body, $Discussion->Format);
?>
]]></description>
</item>