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


PHP Gdn_Format::Date方法代码示例

本文整理汇总了PHP中Gdn_Format::Date方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Format::Date方法的具体用法?PHP Gdn_Format::Date怎么用?PHP Gdn_Format::Date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdn_Format的用法示例。


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

示例1: WriteModuleDiscussion

function WriteModuleDiscussion($Discussion, $Px = 'Bookmark')
{
    ?>
<li id="<?php 
    echo "{$Px}_{$Discussion->DiscussionID}";
    ?>
" class="<?php 
    echo CssClass($Discussion);
    ?>
">
   <span class="Options">
      <?php 
    //      echo OptionsList($Discussion);
    echo BookmarkButton($Discussion);
    ?>
   </span>
   <div class="Title"><?php 
    echo Anchor(Gdn_Format::Text($Discussion->Name, FALSE), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink');
    ?>
</div>
   <div class="Meta">
      <?php 
    $Last = new stdClass();
    $Last->UserID = $Discussion->LastUserID;
    $Last->Name = $Discussion->LastName;
    echo NewComments($Discussion);
    echo '<span class="MItem">' . Gdn_Format::Date($Discussion->LastDate, 'html') . UserAnchor($Last) . '</span>';
    ?>
   </div>
</li>
<?php 
}
开发者ID:rnovino,项目名称:Garden,代码行数:32,代码来源:helper_functions.php

示例2: ToString

    public function ToString()
    {
        $String = '';
        ob_start();
        ?>
      <div class="Box">
         <h4><?php 
        echo T('In this Discussion');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_UserData->Result() as $User) {
            ?>
            <li>
               <strong><?php 
            echo UserAnchor($User, 'UserLink');
            ?>
</strong>
               <?php 
            echo Gdn_Format::Date($User->DateLastActive);
            ?>
            </li>
            <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
开发者ID:sheldon,项目名称:Garden,代码行数:33,代码来源:class.inthisdiscussionmodule.php

示例3: WriteDiscussion

function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
    $CssClass = 'Item';
    $CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
    $CssClass .= $Alt . ' ';
    $CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
    $CssClass .= $Discussion->Closed == '1' ? ' Closed' : '';
    $CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
    $CssClass .= $Discussion->CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
    $Sender->EventArguments['Discussion'] =& $Discussion;
    $Sender->FireEvent('BeforeDiscussionName');
    $DiscussionName = Gdn_Format::Text($Discussion->Name);
    if ($DiscussionName == '') {
        $DiscussionName = T('Blank Discussion Topic');
    }
    static $FirstDiscussion = TRUE;
    if (!$FirstDiscussion) {
        $Sender->FireEvent('BetweenDiscussion');
    } else {
        $FirstDiscussion = FALSE;
    }
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($Discussion->FirstPhoto != '') {
        if (strtolower(substr($Discussion->FirstPhoto, 0, 7)) == 'http://' || strtolower(substr($Discussion->FirstPhoto, 0, 8)) == 'https://') {
            $PhotoUrl = $Discussion->FirstPhoto;
        } else {
            $PhotoUrl = 'uploads/' . ChangeBasename($Discussion->FirstPhoto, 'n%s');
        }
        echo Img($PhotoUrl, array('alt' => $Discussion->FirstName));
    }
    ?>
   <div class="ItemContent Discussion">
      <?php 
    echo Anchor($DiscussionName, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 && C('Vanilla.Comments.AutoOffset') ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
    ?>
      <?php 
    $Sender->FireEvent('AfterDiscussionTitle');
    ?>
      <div class="Meta">
         <span class="Author"><?php 
    echo $Discussion->FirstName;
    ?>
</span>
         <?php 
    echo '<span class="Counts' . ($Discussion->CountUnreadComments > 0 ? ' NewCounts' : '') . '">' . ($Discussion->CountUnreadComments > 0 ? $Discussion->CountUnreadComments . '/' : '') . $Discussion->CountComments . '</span>';
    if ($Discussion->LastCommentID != '') {
        echo '<span class="LastCommentBy">' . sprintf(T('Latest %1$s'), $Discussion->LastName) . '</span> ';
    }
    echo '<span class="LastCommentDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span> ';
    ?>
      </div>
   </div>
</li>
<?php 
}
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:60,代码来源:helper_functions.php

示例4: ToString

 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(GetValue('Name', $User), 'span', array('class' => 'Username')), 'span'), UserUrl($User));
         ?>
            </li>
         <?php 
     }
     ?>
      </ul>
   </div>
   <?php 
     $String = ob_get_contents();
     @ob_end_clean();
     return $String;
 }
开发者ID:embo-hd,项目名称:vanilla,代码行数:31,代码来源:class.inthisdiscussionmodule.php

示例5: renderOrigin

 public function renderOrigin($Sender)
 {
     $Discussion = $Sender->EventArguments['Discussion'];
     if ($Discussion !== NULL && $Discussion->LastCommentID != '') {
         $Creator = UserBuilder($Discussion, 'First');
         $CreationDate = $Discussion->DateInserted;
         echo ' <span class="MItem LastCommentBy">' . sprintf(T('Started by %1$s'), UserAnchor($Creator)) . '</span>';
         echo ' <span class="MItem LastCommentDate">' . Gdn_Format::Date($CreationDate, 'html') . '</span>';
     }
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:10,代码来源:class.DiscussionOrigin.plugin.php

示例6: DiscussionsController_AfterCountMeta_Handler

 public function DiscussionsController_AfterCountMeta_Handler(&$Sender)
 {
     $Discussion = $Sender->EventArguments['Discussion'];
     if (C('Plugins.AuthorTimeView.Show_AuthorTime')) {
         $First = UserBuilder($Discussion, 'First');
         $Last = UserBuilder($Discussion, 'Last');
         if ($Discussion->LastCommentID != '') {
             echo '<span class="LastCommentBy">' . sprintf(T(' %1$s'), UserAnchor($First)) . '</span>';
             echo '<span class="AuthorDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span>';
             echo '<span class="LastCommentBy">' . sprintf(T('| Recent %1$s'), UserAnchor($Last)) . '</span>';
         } else {
             // leave space preceding Started in ' Started by' or it will be removed by locale definitions
             echo '<span class="LastCommentBy">' . sprintf(T(' Started by %1$s'), UserAnchor($First)) . '</span>';
         }
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:16,代码来源:default.php

示例7: WriteDiscussionEvent

    function WriteDiscussionEvent($Discussion, $Prefix = null)
    {
        ?>
	<li class="<?php 
        echo CssClass($Discussion);
        ?>
">
		<div class="Title">
		<?php 
        echo Anchor(Gdn_Format::Text($Discussion->Name, false), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink');
        ?>
		</div><div class="Meta"><span class="MItem">
		<?php 
        echo Gdn_Format::Date($Discussion->DiscussionEventDate, 'html');
        ?>
		</span></div>
	</li>
	<?php 
    }
开发者ID:pkonecki,项目名称:DiscussionEvent,代码行数:19,代码来源:discussionevent.php

示例8: ToString

    public function ToString()
    {
        $String = '';
        $Session = Gdn::Session();
        ob_start();
        ?>
			<div id="WhosOnline" class="Box">
				<h4><?php 
        echo T("Who's Online");
        ?>
 (<?php 
        echo $this->_OnlineUsers->NumRows();
        ?>
)</h4>
				<ul class="PanelInfo">
				<?php 
        if ($this->_OnlineUsers->NumRows() > 0) {
            foreach ($this->_OnlineUsers->Result() as $User) {
                ?>
					<li>
		 				<strong <?php 
                echo $User->Invisible == 1 ? 'class="Invisible"' : '';
                ?>
>
		    				<?php 
                echo UserAnchor($User);
                ?>
		 				</strong>
		 				<?php 
                echo Gdn_Format::Date($User->Timestamp);
                ?>
					</li>
				<?php 
            }
        }
        ?>
			</ul>
		</div>
		<?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
开发者ID:ru4,项目名称:arabbnota,代码行数:43,代码来源:class.whosonlinemodule.php

示例9: DrawEdited

 protected function DrawEdited($Sender)
 {
     $Record = $Sender->Data('Discussion');
     if (!$Record) {
         $Record = $Sender->Data('Record');
     }
     if (!$Record) {
         return;
     }
     $PermissionCategoryID = GetValue('PermissionCategoryID', $Record);
     $Data = $Record;
     $RecordType = 'discussion';
     $RecordID = GetValue('DiscussionID', $Data);
     // But override if comment
     if (isset($Sender->EventArguments['Comment']) || GetValue('RecordType', $Record) == 'comment') {
         $Data = $Sender->EventArguments['Comment'];
         $RecordType = 'comment';
         $RecordID = GetValue('CommentID', $Data);
     }
     $UserCanEdit = Gdn::Session()->CheckPermission('Vanilla.' . ucfirst($RecordType) . 's.Edit', TRUE, 'Category', $PermissionCategoryID);
     if (is_null($Data->DateUpdated)) {
         return;
     }
     if (Gdn_Format::ToTimestamp($Data->DateUpdated) <= Gdn_Format::ToTimestamp($Data->DateInserted)) {
         return;
     }
     $SourceUserID = $Data->InsertUserID;
     $UpdatedUserID = $Data->UpdateUserID;
     $UserData = Gdn::UserModel()->GetID($UpdatedUserID);
     $Edited = array('EditUser' => GetValue('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>)');
     }
     $Display = '<div class="PostEdited">' . FormatString($Format, $Edited) . '</div>';
     echo $Display;
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:41,代码来源:class.lastedited.plugin.php

示例10: RenderReactionRecord

 /**
  * Renders the reaction record for a specific item
  * 
  * @param int $ID
  * @param string $Type 'discussion', 'activity', or 'comment'
  */
 function RenderReactionRecord($ID, $Type)
 {
     $Reactions = Yaga::ReactionModel()->GetRecord($ID, $Type);
     $Limit = C('Yaga.Reactions.RecordLimit');
     $ReactionCount = count($Reactions);
     $i = 0;
     foreach ($Reactions as $Reaction) {
         $i++;
         // Limit the record if there are a lot of reactions
         if ($i <= $Limit || $Limit <= 0) {
             $User = Gdn::UserModel()->GetID($Reaction->UserID);
             $DateTitle = sprintf(T('Yaga.Reactions.RecordFormat'), $User->Name, $Reaction->Name, Gdn_Format::Date($Reaction->DateInserted, '%B %e, %Y'));
             $String = UserPhoto($User, array('Size' => 'Small', 'title' => $DateTitle));
             $String .= '<span class="ReactSprite Reaction-' . $Reaction->ActionID . ' ' . $Reaction->CssClass . '"></span>';
             $Wrapttributes = array('class' => 'UserReactionWrap', 'data-userid' => $User->UserID, 'title' => $DateTitle);
             echo Wrap($String, 'span', $Wrapttributes);
         }
         if ($Limit > 0 && $i >= $ReactionCount && $ReactionCount > $Limit) {
             echo Plural($ReactionCount - $Limit, 'Yaga.Reactions.RecordLimit.Single', 'Yaga.Reactions.RecordLimit.Plural');
         }
     }
 }
开发者ID:hxii,项目名称:Application-Yaga,代码行数:28,代码来源:functions.render.php

示例11: ProfileController_AfterUserInfo_Handler

 public function ProfileController_AfterUserInfo_Handler($Sender)
 {
     if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage') || $Sender->User->UserID == Gdn::Session()->User->UserID) {
         $Warnings = Gdn::UserModel()->GetMeta($Sender->User->UserID, 'Warnings.%', 'Warnings.', array());
         krsort($Warnings);
         $History = False;
         echo '<div class="Warnings">';
         echo Wrap(T('Warning.Warnings', 'Warnings'), 'h2', array('class' => 'H'));
         foreach ($Warnings as $Date => $Warning) {
             $Warning = Gdn_Format::Unserialize($Warning);
             $Reason = '';
             if (is_array($Warning)) {
                 $Reason = $Warning['Reason'];
                 $Warning = $Warning['Type'];
             }
             if ($History && $Warning != 'None') {
                 $WarningClass = "{$Warning} Historical";
             } else {
                 $WarningClass = $Warning;
             }
             if (!$History && $Warning == 'None') {
                 echo '<div class="NoWarning">' . T('Warning.NoWarnings', 'There are no current warnings for this user. ') . '</div>';
             }
             echo '<div class="Warn ' . $WarningClass . '">' . T('Warning.Level.' . $Warning, $Warning) . '<span class="WarningDate">' . Gdn_Format::Date($Date) . '</span></div>';
             if ($Reason) {
                 echo '<div class="WarningReason ' . $WarningClass . '">' . Gdn_Format::Text($Reason) . '</div>';
             }
             $History = True;
         }
         if (count($Warnings) == 0) {
             echo '<div class="NoWarning">' . T('Warning.NoWarnings', 'There are no current warnings for this user. ') . '</div>';
         }
         if (count($Warnings) > 1) {
             echo '<a class="WarningTogggleHistory" href="#">' . T('Warning.ToggleHistory', 'Toggle History') . '</a>';
         }
         echo '</div>';
     }
 }
开发者ID:Nordic-T,项目名称:Nordic-T,代码行数:38,代码来源:default.php

示例12: WriteReply

    public static function WriteReply(&$Sender, &$Session)
    {
        ?>
         <li class="Reply" id="Comment_<?php 
        echo $Sender->CurrentReply->CommentID;
        ?>
">
            <?php 
        // Delete comment
        if ($Session->CheckPermission('Vanilla.Comments.Delete', $Sender->Discussion->CategoryID)) {
            echo Anchor(T('Delete'), 'vanilla/discussion/deletecomment/' . $Sender->CurrentReply->CommentID . '/' . $Session->TransientKey(), 'DeleteReply');
        }
        ?>
            <ul class="Info<?php 
        echo $Sender->CurrentReply->InsertUserID == $Session->UserID ? ' Author' : '';
        ?>
">
               <li class="Author"><?php 
        $Author = UserBuilder($Sender->CurrentReply, 'Insert');
        echo UserPhoto($Author);
        echo UserAnchor($Author);
        ?>
</li>
               <li class="Created"><?php 
        echo Gdn_Format::Date($Sender->CurrentReply->DateInserted);
        ?>
</li>
               <li class="Permalink"><?php 
        echo Anchor(T('Permalink'), '/discussion/comment/' . (isset($Sender->CurrentComment) ? $Sender->CurrentComment->CommentID : $Sender->ReplyCommentID) . '/#Comment_' . $Sender->CurrentReply->CommentID, T('Permalink'));
        ?>
</li>
            </ul>
            <div class="Body"><?php 
        echo Gdn_Format::To($Sender->CurrentReply->Body, $Sender->CurrentReply->Format);
        ?>
</div>
         </li>
      <?php 
    }
开发者ID:SatiricMan,项目名称:addons,代码行数:39,代码来源:default.php

示例13: UserAnchor

    ?>
>
      <td><strong><?php 
    echo UserAnchor($User);
    ?>
</strong></td>
      <td class="Alt"><?php 
    echo Gdn_Format::Email($User->Email);
    ?>
</td>
      <td><?php 
    echo Gdn_Format::Date($User->DateFirstVisit);
    ?>
</td>
      <td class="Alt"><?php 
    echo Gdn_Format::Date($User->DateLastActive);
    ?>
</td>
      <?php 
    if ($EditUser || $DeleteUser) {
        ?>
         <td><?php 
        if ($EditUser) {
            echo Anchor(T('Edit'), '/user/edit/' . $User->UserID, 'Popup SmallButton');
        }
        if ($DeleteUser && $User->UserID != $Session->User->UserID) {
            echo Anchor(T('Delete'), '/user/delete/' . $User->UserID, 'SmallButton');
        }
        ?>
</td>
      <?php 
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:31,代码来源:users.php

示例14: Anchor

      <div class="ItemContent">
         <b class="Subject"><?php 
        echo Anchor($Subject, "/messages/{$Row['ConversationID']}#latest");
        ?>
</b>
         <?php 
        $Excerpt = SliceString(Gdn_Format::PlainText($Row['LastBody'], $Row['LastFormat']), 80);
        echo Wrap(nl2br($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 {
    ?>
开发者ID:rnovino,项目名称:Garden,代码行数:31,代码来源:popin.php

示例15: _FormatStringCallback

function _FormatStringCallback($Match, $SetArgs = FALSE)
{
    static $Args = array();
    if ($SetArgs) {
        $Args = $Match;
        return;
    }
    $Match = $Match[1];
    if ($Match == '{') {
        return $Match;
    }
    // Parse out the field and format.
    $Parts = explode(',', $Match);
    $Field = trim($Parts[0]);
    $Format = strtolower(trim(GetValue(1, $Parts, '')));
    $SubFormat = strtolower(trim(GetValue(2, $Parts, '')));
    $FomatArgs = GetValue(3, $Parts, '');
    if (in_array($Format, array('currency', 'integer', 'percent'))) {
        $FormatArgs = $SubFormat;
        $SubFormat = $Format;
        $Format = 'number';
    } elseif (is_numeric($SubFormat)) {
        $FormatArgs = $SubFormat;
        $SubFormat = '';
    }
    $Value = GetValueR($Field, $Args, '');
    if ($Value == '' && !in_array($Format, array('url', 'exurl'))) {
        $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);
                        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 'rawurlencode':
                $Result = rawurlencode($Value);
                break;
            case 'time':
                $Result = Gdn_Format::Date($Value, '%l:%M%p');
                break;
            case 'url':
                if (strpos($Field, '/') !== FALSE) {
                    $Value = $Field;
                }
                $Result = Url($Value, $SubFormat == 'domain');
                break;
            case 'exurl':
                if (strpos($Field, '/') !== FALSE) {
                    $Value = $Field;
                }
                $Result = ExternalUrl($Value);
                break;
            case 'urlencode':
                $Result = urlencode($Value);
                break;
            default:
                $Result = $Value;
                break;
        }
    }
    return $Result;
}
开发者ID:ru4,项目名称:arabbnota,代码行数:100,代码来源:functions.general.php


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