本文整理汇总了PHP中Format::To方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::To方法的具体用法?PHP Format::To怎么用?PHP Format::To使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::To方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WriteComment
function WriteComment($Comment, &$Sender, &$Session, $CurrentOffset)
{
$Author = UserBuilder($Comment, 'Insert');
$Sender->EventArguments['Comment'] =& $Comment;
$Sender->Options = '';
$CssClass = 'Item Comment';
$CssClass .= $Comment->InsertUserID == $Session->UserID ? ' Mine' : '';
?>
<li class="<?php
echo $CssClass;
?>
" id="Comment_<?php
echo $Comment->CommentID;
?>
">
<?php
WriteOptions($Comment, $Sender, $Session);
?>
<div class="Comment">
<div class="Meta">
<span class="Author">
<?php
echo UserPhoto($Author);
echo UserAnchor($Author);
?>
</span>
<span class="DateCreated">
<?php
echo Format::Date($Comment->DateInserted);
?>
</span>
<span class="Permalink">
<?php
echo Anchor(T('Permalink'), '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID, 'Permalink', array('name' => 'Item_' . $CurrentOffset));
?>
</span>
<?php
$Sender->FireEvent('AfterCommentMeta');
?>
</div>
<div class="Message"><?php
echo Format::To($Comment->Body, $Comment->Format);
?>
</div>
<?php
$Sender->FireEvent('AfterCommentBody');
?>
</div>
</li>
<?php
}
示例2: UserPhoto
if (!defined('APPLICATION')) {
exit;
}
if (property_exists($this, 'Discussion')) {
?>
<h2><?php
echo Format::Text($this->Discussion->Name);
?>
</h2>
<?php
}
?>
<ul class="Discussion Preview">
<li class="Comment">
<ul class="Info">
<li class="Author"><?php
echo UserPhoto($this->Comment->InsertName, $this->Comment->InsertPhoto);
echo UserAnchor($this->Comment->InsertName);
?>
</li>
<li class="Created"><?php
echo Format::Date($this->Comment->DateInserted);
?>
</li>
</ul>
<div class="Body"><?php
echo Format::To($this->Comment->Body, Gdn::Config('Garden.InputFormatter'));
?>
</div>
</li>
</ul>
示例3: UserPhoto
echo $Message->MessageID;
?>
"<?php
echo $Class == '' ? '' : ' class="' . $Class . '"';
?>
>
<div class="ConversationMessage">
<div class="Meta">
<span class="Author">
<?php
echo UserPhoto($Author, 'Photo');
echo UserAnchor($Author, 'Name');
?>
</span>
<span class="DateCreated"><?php
echo Format::Date($Message->DateInserted);
?>
</span>
<span class="ItemLink"><a name="Item_<?php
echo $CurrentOffset;
?>
" class="Item"></a></span>
</div>
<div class="Message"><?php
echo Format::To($Message->Body, $Format);
?>
</div>
</div>
</li>
<?php
}
示例4: 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(Gdn::Translate('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 Format::Date($Sender->CurrentReply->DateInserted);
?>
</li>
<li class="Permalink"><?php
echo Anchor(Gdn::Translate('Permalink'), '/discussion/comment/' . (isset($Sender->CurrentComment) ? $Sender->CurrentComment->CommentID : $Sender->ReplyCommentID) . '/#Comment_' . $Sender->CurrentReply->CommentID, Gdn::Translate('Permalink'));
?>
</li>
</ul>
<div class="Body"><?php
echo Format::To($Sender->CurrentReply->Body, $Sender->CurrentReply->Format);
?>
</div>
</li>
<?php
}
示例5: Anchor
<?php
if (!defined('APPLICATION')) {
exit;
}
if (is_object($this->_Message)) {
// todo: Wrap this string in a div with a "dismiss" link if necessary
echo '<div class="DismissMessage' . ($this->_Message->CssClass == '' ? '' : ' ' . $this->_Message->CssClass) . '">';
if ($this->_Message->AllowDismiss == '1') {
$Session = Gdn::Session();
echo Anchor('x', '/garden/messages/dismiss/' . $this->_Message->MessageID . '/' . $Session->TransientKey() . '?Target=' . $this->_Sender->SelfUrl, 'Close');
}
echo Format::To($this->_Message->Content, 'Html');
echo '</div>';
}
示例6: Row
/**
* Returns the requested row index as the requested row type.
*
* @param int $RowIndex The row to return from the result set. It is zero-based.
* @param string $FormatType The type of formatting to use on each of the result fields. Defaults to none.
* @param string $RowType The format in which the result should be returned: object or array.
*/
public function Row($RowIndex, $FormatType = '', $RowType = FALSE)
{
if ($RowType === FALSE) {
$RowType = $this->DefaultDatasetType;
}
$Result = $this->Result('', $RowType);
if (count($Result) == 0) {
return $Result;
}
if (isset($Result[$RowIndex])) {
return Format::To($Result[$RowIndex], $FormatType);
}
return FALSE;
}
示例7: WriteComment
function WriteComment($Comment, &$Sender, &$Session, $CurrentOffset)
{
?>
<li class="Comment<?php
echo $Comment->InsertUserID == $Session->UserID ? ' Mine' : '';
?>
" id="Comment_<?php
echo $Comment->CommentID;
?>
">
<?php
$Sender->EventArguments['Comment'] =& $Comment;
$Sender->Options = '';
$IsFirstComment = $Comment->CommentID == $Sender->Discussion->FirstCommentID;
if ($IsFirstComment && ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Vanilla.Discussions.Edit', $Sender->Discussion->CategoryID))) {
// User can edit the discussion topic/first comment
$Sender->Options .= '<li>' . Anchor('Edit', '/vanilla/post/editdiscussion/' . $Comment->DiscussionID, 'EditDiscussion') . '</li>';
} else {
if ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Vanilla.Comments.Edit', $Sender->Discussion->CategoryID)) {
// User can edit the comment
$Sender->Options .= '<li>' . Anchor('Edit', '/vanilla/post/editcomment/' . $Comment->CommentID, 'EditComment') . '</li>';
}
}
if ($IsFirstComment) {
// Announce discussion
if ($Session->CheckPermission('Vanilla.Discussions.Announce', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor($Sender->Discussion->Announce == '1' ? 'Unannounce' : 'Announce', 'vanilla/discussion/announce/' . $Comment->DiscussionID . '/' . $Session->TransientKey(), 'AnnounceDiscussion') . '</li>';
}
// Sink discussion
if ($Session->CheckPermission('Vanilla.Discussions.Sink', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor($Sender->Discussion->Sink == '1' ? 'Unsink' : 'Sink', 'vanilla/discussion/sink/' . $Comment->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'SinkDiscussion') . '</li>';
}
// Close discussion
if ($Session->CheckPermission('Vanilla.Discussions.Close', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor($Sender->Discussion->Closed == '1' ? 'Reopen' : 'Close', 'vanilla/discussion/close/' . $Comment->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'CloseDiscussion') . '</li>';
}
// Delete discussion
if ($Session->CheckPermission('Vanilla.Discussions.Delete', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor('Delete Discussion', 'vanilla/discussion/delete/' . $Comment->DiscussionID . '/' . $Session->TransientKey(), 'DeleteDiscussion') . '</li>';
}
} else {
// Delete comment
if ($Session->CheckPermission('Vanilla.Comments.Delete', $Sender->Discussion->CategoryID)) {
$Sender->Options .= '<li>' . Anchor('Delete', 'vanilla/discussion/deletecomment/' . $Comment->CommentID . '/' . $Session->TransientKey() . '/?Target=' . urlencode($Sender->SelfUrl), 'DeleteComment') . '</li>';
}
}
// Allow plugins to add options
$Sender->FireEvent('CommentOptions');
if ($Sender->Options != '') {
?>
<ul class="Options">
<li><strong><?php
echo Gdn::Translate('Options');
?>
</strong>
<ul>
<?php
echo $Sender->Options;
?>
</ul>
</li>
</ul>
<?php
}
?>
<ul class="Info">
<li class="Author">
<?php
$Author = UserBuilder($Comment, 'Insert');
echo UserPhoto($Author);
echo UserAnchor($Author);
?>
</li>
<li class="Created">
<?php
echo Format::Date($Comment->DateInserted);
?>
</li>
<li class="Permalink">
<?php
echo Anchor(Gdn::Translate('Permalink'), '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID, 'Permalink', array('name' => 'Item_' . $CurrentOffset));
?>
</li>
<?php
$Sender->FireEvent('AfterCommentMeta');
?>
</ul>
<div class="Body"><?php
echo Format::To($Comment->Body, $Comment->Format);
?>
</div>
<?php
$Sender->FireEvent('AfterCommentBody');
?>
</li>
<?php
}