本文整理汇总了PHP中Gdn_Format::date方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::date方法的具体用法?PHP Gdn_Format::date怎么用?PHP Gdn_Format::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Format
的用法示例。
在下文中一共展示了Gdn_Format::date方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toString
/**
* Build HTML.
*
* @return string HTML.
*/
public function toString()
{
if ($this->_UserData->numRows() == 0) {
return '';
}
$String = '';
ob_start();
?>
<div class="Box">
<?php
echo panelHeading(t('In this Discussion'));
?>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<?php
echo anchor(wrap(wrap(Gdn_Format::date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . wrap(wrap(val('Name', $User), 'span', array('class' => 'Username')), 'span'), userUrl($User));
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
示例2: drawEdited
/**
* Output 'edited' notice.
*
* @param $Sender
*/
protected function drawEdited($Sender)
{
$Record = $Sender->data('Discussion');
if (!$Record) {
$Record = $Sender->data('Record');
}
if (!$Record) {
return;
}
$PermissionCategoryID = val('PermissionCategoryID', $Record);
$Data = $Record;
$RecordType = 'discussion';
$RecordID = val('DiscussionID', $Data);
// But override if comment
if (isset($Sender->EventArguments['Comment']) || val('RecordType', $Record) == 'comment') {
$Data = $Sender->EventArguments['Comment'];
$RecordType = 'comment';
$RecordID = val('CommentID', $Data);
}
$UserCanEdit = Gdn::session()->checkPermission('Vanilla.' . ucfirst($RecordType) . 's.Edit', true, 'Category', $PermissionCategoryID);
if (is_null($Data->DateUpdated)) {
return;
}
// Do not show log link if no log would have been generated.
$elapsed = Gdn_Format::toTimestamp(val('DateUpdated', $Data)) - Gdn_Format::toTimestamp(val('DateInserted', $Data));
$grace = c('Garden.Log.FloodControl', 20) * 60;
if ($elapsed < $grace) {
return;
}
$UpdatedUserID = $Data->UpdateUserID;
$UserData = Gdn::userModel()->getID($UpdatedUserID);
$Edited = array('EditUser' => val('Name', $UserData, t('Unknown User')), 'EditDate' => Gdn_Format::date($Data->DateUpdated, 'html'), 'EditLogUrl' => url("/log/record/{$RecordType}/{$RecordID}"), 'EditWord' => 'at');
$DateUpdateTime = Gdn_Format::toTimestamp($Data->DateUpdated);
if (date('ymd', $DateUpdateTime) != date('ymd')) {
$Edited['EditWord'] = 'on';
}
$Format = t('PostEdited.Plain', 'Post edited by {EditUser} {EditWord} {EditDate}');
if ($UserCanEdit) {
$Format = t('PostEdited.Log', 'Post edited by {EditUser} {EditWord} {EditDate} (<a href="{EditLogUrl}">log</a>)');
}
echo '<div class="PostEdited">' . formatString($Format, $Edited) . '</div>';
}
示例3: writeDiscussionRow
/**
* Writes a discussion in table row format.
*/
function writeDiscussionRow($Discussion, $Sender, $Session)
{
if (!property_exists($Sender, 'CanEditDiscussions')) {
$Sender->CanEditDiscussions = val('PermsDiscussionsEdit', CategoryModel::categories($Discussion->CategoryID)) && c('Vanilla.AdminCheckboxes.Use');
}
$CssClass = CssClass($Discussion);
$DiscussionUrl = $Discussion->Url;
if ($Session->UserID) {
$DiscussionUrl .= '#latest';
}
$Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl;
$Sender->EventArguments['Discussion'] =& $Discussion;
$Sender->EventArguments['CssClass'] =& $CssClass;
$First = UserBuilder($Discussion, 'First');
if ($Discussion->LastUserID) {
$Last = UserBuilder($Discussion, 'Last');
} else {
$Last = $First;
}
$Sender->EventArguments['FirstUser'] =& $First;
$Sender->EventArguments['LastUser'] =& $Last;
$Sender->fireEvent('BeforeDiscussionName');
$DiscussionName = $Discussion->Name;
// If there are no word character detected in the title treat it as if it is blank.
if (!preg_match('/\\w/u', $DiscussionName)) {
$DiscussionName = t('Blank Discussion Topic');
}
$Sender->EventArguments['DiscussionName'] =& $DiscussionName;
static $FirstDiscussion = true;
if (!$FirstDiscussion) {
$Sender->fireEvent('BetweenDiscussion');
} else {
$FirstDiscussion = false;
}
$Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage);
$FirstPageUrl = DiscussionUrl($Discussion, 1);
$LastPageUrl = DiscussionUrl($Discussion, val('CountPages', $Discussion)) . '#latest';
?>
<tr id="Discussion_<?php
echo $Discussion->DiscussionID;
?>
" class="<?php
echo $CssClass;
?>
">
<?php
$Sender->fireEvent('BeforeDiscussionContent');
?>
<?php
echo AdminCheck($Discussion, array('<td class="CheckBoxColumn"><div class="Wrap">', '</div></td>'));
?>
<td class="DiscussionName">
<div class="Wrap">
<span class="Options">
<?php
echo OptionsList($Discussion);
echo BookmarkButton($Discussion);
?>
</span>
<?php
$Sender->fireEvent('BeforeDiscussionTitle');
echo anchor($DiscussionName, $DiscussionUrl, 'Title') . ' ';
$Sender->fireEvent('AfterDiscussionTitle');
WriteMiniPager($Discussion);
echo NewComments($Discussion);
if ($Sender->data('_ShowCategoryLink', true)) {
echo CategoryLink($Discussion, ' ' . t('in') . ' ');
}
// Other stuff that was in the standard view that you may want to display:
echo '<div class="Meta Meta-Discussion">';
WriteTags($Discussion);
echo '</div>';
// if ($Source = val('Source', $Discussion))
// echo ' '.sprintf(t('via %s'), t($Source.' Source', $Source));
//
?>
</div>
</td>
<td class="BlockColumn BlockColumn-User FirstUser">
<div class="Block Wrap">
<?php
echo userPhoto($First, array('Size' => 'Small'));
echo userAnchor($First, 'UserLink BlockTitle');
echo '<div class="Meta">';
echo anchor(Gdn_Format::date($Discussion->FirstDate, 'html'), $FirstPageUrl, 'CommentDate MItem');
echo '</div>';
?>
</div>
</td>
<td class="BigCount CountComments">
<div class="Wrap">
<?php
// Exact Number
// echo number_format($Discussion->CountComments);
// Round Number
echo BigPlural($Discussion->CountComments, '%s comment');
?>
//.........这里部分代码省略.........
示例4: writeTableRow
function writeTableRow($Row, $Depth = 1)
{
$Children = $Row['Children'];
$WriteChildren = FALSE;
if (!empty($Children)) {
if ($Depth + 1 >= c('Vanilla.Categories.MaxDisplayDepth')) {
$WriteChildren = 'list';
} else {
$WriteChildren = 'rows';
}
}
$H = 'h' . ($Depth + 1);
?>
<tr class="<?php
echo CssClass($Row);
?>
">
<td class="CategoryName">
<div class="Wrap">
<?php
echo GetOptions($Row);
echo CategoryPhoto($Row);
echo "<{$H}>";
echo anchor(htmlspecialchars($Row['Name']), $Row['Url']);
Gdn::controller()->EventArguments['Category'] = $Row;
Gdn::controller()->fireEvent('AfterCategoryTitle');
echo "</{$H}>";
?>
<div class="CategoryDescription">
<?php
echo $Row['Description'];
?>
</div>
<?php
if ($WriteChildren === 'list') {
?>
<div class="ChildCategories">
<?php
echo wrap(t('Child Categories') . ': ', 'b');
echo CategoryString($Children, $Depth + 1);
?>
</div>
<?php
}
?>
</div>
</td>
<td class="BigCount CountDiscussions">
<div class="Wrap">
<?php
// echo "({$Row['CountDiscussions']})";
echo BigPlural($Row['CountAllDiscussions'], '%s discussion');
?>
</div>
</td>
<td class="BigCount CountComments">
<div class="Wrap">
<?php
// echo "({$Row['CountComments']})";
echo BigPlural($Row['CountAllComments'], '%s comment');
?>
</div>
</td>
<td class="BlockColumn LatestPost">
<div class="Block Wrap">
<?php
if ($Row['LastTitle']) {
?>
<?php
echo userPhoto($Row, array('Size' => 'Small', 'Px' => 'Last'));
echo anchor(SliceString(Gdn_Format::text($Row['LastTitle']), 100), $Row['LastUrl'], 'BlockTitle LatestPostTitle', array('title' => html_entity_decode($Row['LastTitle'])));
?>
<div class="Meta">
<?php
echo userAnchor($Row, 'UserLink MItem', 'Last');
?>
<span class="Bullet">•</span>
<?php
echo anchor(Gdn_Format::date($Row['LastDateInserted'], 'html'), $Row['LastUrl'], 'CommentDate MItem');
if (isset($Row['LastCategoryID'])) {
$LastCategory = CategoryModel::categories($Row['LastCategoryID']);
echo ' <span>', sprintf('in %s', anchor($LastCategory['Name'], CategoryUrl($LastCategory, '', '//'))), '</span>';
}
?>
</div>
<?php
}
?>
</div>
</td>
</tr>
<?php
if ($WriteChildren === 'rows') {
foreach ($Children as $ChildRow) {
WriteTableRow($ChildRow, $Depth + 1);
}
}
}
示例5: t
?>
</td>
<td class="Alt"><?php
if ($Invitation->AcceptedName == '') {
echo t('Pending');
} else {
echo t('Accepted');
}
?>
</td>
<td>
<?php
if (!$Invitation->DateExpires) {
echo t('Never expires', 'Never');
} else {
echo Gdn_Format::date($Invitation->DateExpires, 'html');
}
?>
</td>
<?php
// <td><?php echo $Invitation->Code; <!--</td>-->
?>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
echo $this->Form->close();
示例6: getInvitationCount
/**
* Get number of available invites a user has.
*
* @param int $UserID
* @return int
*/
public function getInvitationCount($UserID)
{
// If this user is master admin, they should have unlimited invites.
if ($this->SQL->select('UserID')->from('User')->where('UserID', $UserID)->where('Admin', '1')->get()->numRows() > 0) {
return -1;
}
// Get the Registration.InviteRoles settings:
$InviteRoles = Gdn::config('Garden.Registration.InviteRoles', []);
if (!is_array($InviteRoles) || count($InviteRoles) == 0) {
return 0;
}
// Build an array of roles that can send invitations
$CanInviteRoles = [];
foreach ($InviteRoles as $RoleID => $Invites) {
if ($Invites > 0 || $Invites == -1) {
$CanInviteRoles[] = $RoleID;
}
}
if (count($CanInviteRoles) == 0) {
return 0;
}
// See which matching roles the user has
$UserRoleData = $this->SQL->select('RoleID')->from('UserRole')->where('UserID', $UserID)->whereIn('RoleID', $CanInviteRoles)->get();
if ($UserRoleData->numRows() == 0) {
return 0;
}
// Define the maximum number of invites the user is allowed to send
$InviteCount = 0;
foreach ($UserRoleData->result() as $UserRole) {
$Count = $InviteRoles[$UserRole->RoleID];
if ($Count == -1) {
$InviteCount = -1;
} elseif ($InviteCount != -1 && $Count > $InviteCount) {
$InviteCount = $Count;
}
}
// If the user has unlimited invitations, return that value
if ($InviteCount == -1) {
return -1;
}
// Get the user's current invitation settings from their profile
$User = $this->SQL->select('CountInvitations, DateSetInvitations')->from('User')->where('UserID', $UserID)->get()->firstRow();
// If CountInvitations is null (ie. never been set before) or it is a new month since the DateSetInvitations
if ($User->CountInvitations == '' || is_null($User->DateSetInvitations) || Gdn_Format::date($User->DateSetInvitations, '%m %Y') != Gdn_Format::date('', '%m %Y')) {
// Reset CountInvitations and DateSetInvitations
$this->SQL->put($this->Name, ['CountInvitations' => $InviteCount, 'DateSetInvitations' => Gdn_Format::date('', '%Y-%m-01')], ['UserID' => $UserID]);
return $InviteCount;
} else {
// Otherwise return CountInvitations
return $User->CountInvitations;
}
}
示例7: _formatStringCallback
/**
* The callback helper for {@link formatString()}.
*
* @param array $Match Either the array of arguments or the regular expression match.
* @param bool $SetArgs Whether this is a call to initialize the arguments or a matching callback.
* @return mixed Returns the matching string or nothing when setting the arguments.
* @access private
*/
function _formatStringCallback($Match, $SetArgs = false)
{
static $Args = array(), $ContextUserID = null;
if ($SetArgs) {
$Args = $Match;
if (isset($Args['_ContextUserID'])) {
$ContextUserID = $Args['_ContextUserID'];
} else {
$ContextUserID = Gdn::session() && Gdn::session()->isValid() ? Gdn::session()->UserID : null;
}
return '';
}
$Match = $Match[1];
if ($Match == '{') {
return $Match;
}
// Parse out the field and format.
$Parts = explode(',', $Match);
$Field = trim($Parts[0]);
$Format = trim(val(1, $Parts, ''));
$SubFormat = strtolower(trim(val(2, $Parts, '')));
$FormatArgs = val(3, $Parts, '');
if (in_array($Format, array('currency', 'integer', 'percent'))) {
$FormatArgs = $SubFormat;
$SubFormat = $Format;
$Format = 'number';
} elseif (is_numeric($SubFormat)) {
$FormatArgs = $SubFormat;
$SubFormat = '';
}
$Value = valr($Field, $Args, null);
if ($Value === null && !in_array($Format, array('url', 'exurl', 'number', 'plural'))) {
$Result = '';
} else {
switch (strtolower($Format)) {
case 'date':
switch ($SubFormat) {
case 'short':
$Result = Gdn_Format::date($Value, '%d/%m/%Y');
break;
case 'medium':
$Result = Gdn_Format::date($Value, '%e %b %Y');
break;
case 'long':
$Result = Gdn_Format::date($Value, '%e %B %Y');
break;
default:
$Result = Gdn_Format::date($Value);
break;
}
break;
case 'html':
case 'htmlspecialchars':
$Result = htmlspecialchars($Value);
break;
case 'number':
if (!is_numeric($Value)) {
$Result = $Value;
} else {
switch ($SubFormat) {
case 'currency':
$Result = '$' . number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 2);
break;
case 'integer':
$Result = (string) round($Value);
if (is_numeric($FormatArgs) && strlen($Result) < $FormatArgs) {
$Result = str_repeat('0', $FormatArgs - strlen($Result)) . $Result;
}
break;
case 'percent':
$Result = round($Value * 100, is_numeric($FormatArgs) ? $FormatArgs : 0);
break;
default:
$Result = number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 0);
break;
}
}
break;
case 'plural':
if (is_array($Value)) {
$Value = count($Value);
} elseif (StringEndsWith($Field, 'UserID', true)) {
$Value = 1;
}
if (!is_numeric($Value)) {
$Result = $Value;
} else {
if (!$SubFormat) {
$SubFormat = rtrim("%s {$Field}", 's');
}
if (!$FormatArgs) {
$FormatArgs = $SubFormat . 's';
//.........这里部分代码省略.........
示例8: comment
/**
* Create or update a comment.
*
* @since 2.0.0
* @access public
*
* @param int $DiscussionID Unique ID to add the comment to. If blank, this method will throw an error.
*/
public function comment($DiscussionID = '')
{
// Get $DiscussionID from RequestArgs if valid
if ($DiscussionID == '' && count($this->RequestArgs)) {
if (is_numeric($this->RequestArgs[0])) {
$DiscussionID = $this->RequestArgs[0];
}
}
// If invalid $DiscussionID, get from form.
$this->Form->setModel($this->CommentModel);
$DiscussionID = is_numeric($DiscussionID) ? $DiscussionID : $this->Form->getFormValue('DiscussionID', 0);
// Set discussion data
$this->DiscussionID = $DiscussionID;
$this->Discussion = $Discussion = $this->DiscussionModel->getID($DiscussionID);
// Is this an embedded comment being posted to a discussion that doesn't exist yet?
$vanilla_type = $this->Form->getFormValue('vanilla_type', '');
$vanilla_url = $this->Form->getFormValue('vanilla_url', '');
$vanilla_category_id = $this->Form->getFormValue('vanilla_category_id', '');
$Attributes = array('ForeignUrl' => $vanilla_url);
$vanilla_identifier = $this->Form->getFormValue('vanilla_identifier', '');
$isEmbeddedComments = $vanilla_url != '' && $vanilla_identifier != '';
// Only allow vanilla identifiers of 32 chars or less - md5 if larger
if (strlen($vanilla_identifier) > 32) {
$Attributes['vanilla_identifier'] = $vanilla_identifier;
$vanilla_identifier = md5($vanilla_identifier);
}
if (!$Discussion && $isEmbeddedComments) {
$Discussion = $Discussion = $this->DiscussionModel->getForeignID($vanilla_identifier, $vanilla_type);
if ($Discussion) {
$this->DiscussionID = $DiscussionID = $Discussion->DiscussionID;
$this->Form->setValue('DiscussionID', $DiscussionID);
}
}
// If so, create it!
if (!$Discussion && $isEmbeddedComments) {
// Add these values back to the form if they exist!
$this->Form->addHidden('vanilla_identifier', $vanilla_identifier);
$this->Form->addHidden('vanilla_type', $vanilla_type);
$this->Form->addHidden('vanilla_url', $vanilla_url);
$this->Form->addHidden('vanilla_category_id', $vanilla_category_id);
$PageInfo = fetchPageInfo($vanilla_url);
if (!($Title = $this->Form->getFormValue('Name'))) {
$Title = val('Title', $PageInfo, '');
if ($Title == '') {
$Title = t('Undefined discussion subject.');
if (!empty($PageInfo['Exception']) && $PageInfo['Exception'] === "Couldn't connect to host.") {
$Title .= ' ' . t('Page timed out.');
}
}
}
$Description = val('Description', $PageInfo, '');
$Images = val('Images', $PageInfo, array());
$LinkText = t('EmbededDiscussionLinkText', 'Read the full story here');
if (!$Description && count($Images) == 0) {
$Body = formatString('<p><a href="{Url}">{LinkText}</a></p>', array('Url' => $vanilla_url, 'LinkText' => $LinkText));
} else {
$Body = formatString('
<div class="EmbeddedContent">{Image}<strong>{Title}</strong>
<p>{Excerpt}</p>
<p><a href="{Url}">{LinkText}</a></p>
<div class="ClearFix"></div>
</div>', array('Title' => $Title, 'Excerpt' => $Description, 'Image' => count($Images) > 0 ? img(val(0, $Images), array('class' => 'LeftAlign')) : '', 'Url' => $vanilla_url, 'LinkText' => $LinkText));
}
if ($Body == '') {
$Body = $vanilla_url;
}
if ($Body == '') {
$Body = t('Undefined discussion body.');
}
// Validate the CategoryID for inserting.
$Category = CategoryModel::categories($vanilla_category_id);
if (!$Category) {
$vanilla_category_id = c('Vanilla.Embed.DefaultCategoryID', 0);
if ($vanilla_category_id <= 0) {
// No default category defined, so grab the first non-root category and use that.
$vanilla_category_id = $this->DiscussionModel->SQL->select('CategoryID')->from('Category')->where('CategoryID >', 0)->get()->firstRow()->CategoryID;
// No categories in the db? default to 0
if (!$vanilla_category_id) {
$vanilla_category_id = 0;
}
}
} else {
$vanilla_category_id = $Category['CategoryID'];
}
$EmbedUserID = c('Garden.Embed.UserID');
if ($EmbedUserID) {
$EmbedUser = Gdn::userModel()->getID($EmbedUserID);
}
if (!$EmbedUserID || !$EmbedUser) {
$EmbedUserID = Gdn::userModel()->getSystemUserID();
}
$EmbeddedDiscussionData = array('InsertUserID' => $EmbedUserID, 'DateInserted' => Gdn_Format::toDateTime(), 'DateUpdated' => Gdn_Format::toDateTime(), 'CategoryID' => $vanilla_category_id, 'ForeignID' => $vanilla_identifier, 'Type' => $vanilla_type, 'Name' => $Title, 'Body' => $Body, 'Format' => 'Html', 'Attributes' => dbencode($Attributes));
//.........这里部分代码省略.........
示例9: SliceString
?>
" class="Item">
<?php
$this->fireEvent('BeforeItemContent');
?>
<div class="ItemContent">
<div class="Message"><?php
echo SliceString(Gdn_Format::text(Gdn_Format::to($Comment->Body, $Comment->Format), false), 250);
?>
</div>
<div class="Meta">
<span class="MItem"><?php
echo t('Comment in', 'in') . ' ';
?>
<b><?php
echo anchor(Gdn_Format::text($Comment->DiscussionName), $Permalink);
?>
</b></span>
<span class="MItem"><?php
printf(t('Comment by %s'), userAnchor($User));
?>
</span>
<span class="MItem"><?php
echo anchor(Gdn_Format::date($Comment->DateInserted), $Permalink);
?>
</span>
</div>
</div>
</li>
<?php
}
示例10: userPhoto
echo $Class == '' ? '' : ' class="' . $Class . '"';
?>
>
<div id="Item_<?php
echo $CurrentOffset;
?>
" class="ConversationMessage">
<div class="Meta">
<span class="Author">
<?php
echo userPhoto($Author, 'Photo');
echo userAnchor($Author, 'Name');
?>
</span>
<span class="MItem DateCreated"><?php
echo Gdn_Format::date($Message->DateInserted, 'html');
?>
</span>
<?php
$this->fireEvent('AfterConversationMessageDate');
?>
</div>
<div class="Message">
<?php
$this->fireEvent('BeforeConversationMessageBody');
echo Gdn_Format::to($Message->Body, $Format);
$this->EventArguments['Message'] =& $Message;
$this->fireEvent('AfterConversationMessageBody');
?>
</div>
</div>
示例11: anchor
if ($LastPhoto) {
echo '<div class="Author Photo">' . $LastPhoto . '</div>';
}
echo anchor(htmlspecialchars($Names), $Url);
}
if ($Subject = val('Subject', $Conversation)) {
if ($Names) {
echo Bullet(' ');
}
echo '<span class="Subject">' . anchor(htmlspecialchars($Subject), $Url) . '</span>';
}
echo '</h3>';
?>
<div class="Excerpt"><?php
echo anchor(htmlspecialchars($Message), $Url, 'Message');
?>
</div>
<div class="Meta">
<?php
$this->fireEvent('BeforeConversationMeta');
echo ' <span class="MItem CountMessages">' . sprintf(Plural($Conversation->CountMessages, '%s message', '%s messages'), $Conversation->CountMessages) . '</span> ';
if ($Conversation->CountNewMessages > 0) {
echo ' <strong class="HasNew"> ' . plural($Conversation->CountNewMessages, '%s new', '%s new') . '</strong> ';
}
echo ' <span class="MItem LastDateInserted">' . Gdn_Format::date($Conversation->LastDateInserted) . '</span> ';
?>
</div>
</div>
</li>
<?php
}
示例12: writeActivityComment
function writeActivityComment($Comment, $Activity)
{
$Session = Gdn::session();
$Author = UserBuilder($Comment, 'Insert');
$PhotoAnchor = userPhoto($Author, 'Photo');
$CssClass = 'Item ActivityComment ActivityComment';
if ($PhotoAnchor != '') {
$CssClass .= ' HasPhoto';
}
?>
<li id="ActivityComment_<?php
echo $Comment['ActivityCommentID'];
?>
" class="<?php
echo $CssClass;
?>
">
<?php
if ($PhotoAnchor != '') {
?>
<div class="Author Photo"><?php
echo $PhotoAnchor;
?>
</div>
<?php
}
?>
<div class="ItemContent ActivityComment">
<?php
echo userAnchor($Author, 'Title Name');
?>
<div class="Excerpt"><?php
echo Gdn_Format::to($Comment['Body'], $Comment['Format']);
?>
</div>
<div class="Meta">
<span class="DateCreated"><?php
echo Gdn_Format::date($Comment['DateInserted'], 'html');
?>
</span>
<?php
if (ActivityModel::canDelete($Activity)) {
echo anchor(t('Delete'), "dashboard/activity/deletecomment?id={$Comment['ActivityCommentID']}&tk=" . $Session->TransientKey() . '&target=' . urlencode(Gdn_Url::Request()), 'DeleteComment');
}
?>
</div>
</div>
</li>
<?php
}
示例13: anchor
$PhotoAnchor = anchor(img($Activity['Photo'], array('class' => 'ProfilePhoto PhotoWrapMedium')), $Activity['PhotoUrl'], 'PhotoWrap PhotoWrapMedium');
} else {
$PhotoAnchor = '';
}
?>
<div class="Author Photo"><?php
echo $PhotoAnchor;
?>
</div>
<div class="ItemContent Activity">
<?php
echo $Activity['Headline'];
?>
<div class="Meta">
<span class="MItem DateCreated"><?php
echo Gdn_Format::date($Activity['DateUpdated']);
?>
</span>
</div>
</div>
</li>
<?php
}
?>
<li class="Item Center">
<?php
echo anchor(sprintf(t('All %s'), t('Notifications')), '/profile/notifications');
?>
</li>
<?php
} else {
示例14: foreach
<?php
if (!defined('APPLICATION')) {
exit;
}
$Loop = 1;
echo '<div class="Feed">';
foreach ($this->Feed->channel->item as $Item) {
if ($Loop > $this->MaxLength) {
break;
}
$Title = val('title', $Item);
$Link = val('link', $Item);
$PubDate = strtotime(val('pubDate', $Item));
if ($this->FeedFormat == 'extended') {
$Description = val('description', $Item);
// Cut off after the first subheading.
$Description = array_shift(explode('<h', $Description));
echo wrap(wrap(anchor($Title, $Link), 'h2') . wrap(Gdn_Format::date($PubDate), 'div', ['class' => 'Date']) . wrap($Description, 'div', ['class' => 'FeedDescription']), 'div', ['class' => 'FeedItem ExtendedFormat']);
} else {
echo wrap('<span class="Sprite SpriteRarr SpriteRarrDown">→</span>' . anchor($Title, $Link) . wrap(Gdn_Format::date($PubDate), 'div', ['class' => 'Date']), 'div', ['class' => 'FeedItem NormalFormat']);
}
$Loop++;
}
echo '</div>';
示例15: anchor
<div class="ItemContent">
<b class="Subject"><?php
echo anchor($Subject, "/messages/{$Row['ConversationID']}#Message_{$Row['LastMessageID']}");
?>
</b>
<?php
$Excerpt = sliceString(Gdn_Format::plainText($Row['LastBody'], $Row['LastFormat']), 80);
echo wrap(nl2br(htmlspecialchars($Excerpt)), 'div', array('class' => 'Excerpt'));
?>
<div class="Meta">
<?php
echo ' <span class="MItem">' . plural($Row['CountMessages'], '%s message', '%s messages') . '</span> ';
if ($Row['CountNewMessages'] > 0) {
echo ' <strong class="HasNew"> ' . plural($Row['CountNewMessages'], '%s new', '%s new') . '</strong> ';
}
echo ' <span class="MItem">' . Gdn_Format::date($Row['LastDateInserted']) . '</span> ';
?>
</div>
</div>
</li>
<?php
}
?>
<li class="Item Center">
<?php
echo anchor(sprintf(t('All %s'), t('Messages')), '/messages/inbox');
?>
</li>
<?php
} else {
?>