本文整理汇总了PHP中userAnchor函数的典型用法代码示例。如果您正苦于以下问题:PHP userAnchor函数的具体用法?PHP userAnchor怎么用?PHP userAnchor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了userAnchor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: categoriesController_afterDiscussionLabels_handler
/**
*
*
* @param $Sender
* @param $Args
*/
public function categoriesController_afterDiscussionLabels_handler($Sender, $Args)
{
if (c('Vanilla.Discussions.Layout') != 'table') {
if (val('FirstUser', $Args)) {
echo '<span class="MItem DiscussionAuthor">' . userAnchor(val('FirstUser', $Args)) . '</span>';
}
}
}
开发者ID:vanilla,项目名称:vanilla,代码行数:14,代码来源:class.indexphotos.plugin.php
示例2: categoriesController_afterDiscussionLabels_handler
/**
*
*
* @param $Sender
* @param $Args
*/
public function categoriesController_afterDiscussionLabels_handler($Sender, $Args)
{
if (!$this->hasLayoutTables() || isMobile()) {
if (val('FirstUser', $Args)) {
echo '<span class="MItem DiscussionAuthor">' . userAnchor(val('FirstUser', $Args)) . '</span>';
}
}
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:14,代码来源:class.indexphotos.plugin.php
示例3: discussionModel_afterSaveDiscussion_handler
/**
* Post every new discussion to HipChat.
*
* @param PostController $sender
* @param array $args
*/
public function discussionModel_afterSaveDiscussion_handler($sender, $args)
{
// Make sure we have a valid discussion.
if (!$args['Discussion'] || !val('DiscussionID', $args['Discussion'])) {
return;
}
// Only trigger for new discussions.
if (!$args['Insert']) {
return;
}
// Prep HipChat message.
$author = Gdn::userModel()->getID(val('InsertUserID', $args['Discussion']));
$message = sprintf('%1$s: %2$s', userAnchor($author), anchor(val('Name', $args['Discussion']), discussionUrl($args['Discussion'])));
// Say it.
self::sayInHipChat($message);
}
开发者ID:ravilrrr,项目名称:addons,代码行数:22,代码来源:class.hipchat.plugin.php
示例4: anchor
<h3><?php
echo anchor(htmlspecialchars($Row['Title']), $Row['Url']);
?>
</h3>
<div class="Item-Body Media">
<?php
$Photo = userPhoto($Row, array('LinkClass' => 'Img'));
if ($Photo) {
echo $Photo;
}
?>
<div class="Media-Body">
<div class="Meta">
<?php
echo ' <span class="MItem-Author">' . sprintf(t('by %s'), userAnchor($Row)) . '</span>';
echo Bullet(' ');
echo ' <span clsss="MItem-DateInserted">' . Gdn_Format::date($Row['DateInserted'], 'html') . '</span> ';
if (isset($Row['Breadcrumbs'])) {
echo Bullet(' ');
echo ' <span class="MItem-Location">' . Gdn_Theme::Breadcrumbs($Row['Breadcrumbs'], false) . '</span> ';
}
if (isset($Row['Notes'])) {
echo ' <span class="Aside Debug">debug(' . $Row['Notes'] . ')</span>';
}
?>
</div>
<div class="Summary">
<?php
echo $Row['Summary'];
?>
开发者ID:caidongyun,项目名称:vanilla,代码行数:31,代码来源:results.php
示例5: printf
<?php
if (!defined('APPLICATION')) {
exit;
}
?>
<h1><?php
printf(t('Delete User: %s'), userAnchor($this->User));
?>
</h1>
<?php
echo $this->Form->open(array('class' => 'User'));
echo $this->Form->errors();
?>
<div class="Messages Errors" style="margin-bottom: 20px;">
<ul>
<li><?php
printf(t("By clicking the button below, you will be deleting the user account for %s forever."), wrap(htmlspecialchars($this->User->Name), 'strong'));
?>
</li>
<li><?php
if ($this->Method == 'keep') {
echo t("The user content will remain untouched.");
} else {
if ($this->Method == 'wipe') {
echo t("All of the user content will be replaced with a message stating the user has been deleted.");
} else {
echo t("The user content will be completely deleted.");
}
}
?>
开发者ID:caidongyun,项目名称:vanilla,代码行数:31,代码来源:deleteconfirm.php
示例6: t
">
<h2 class="H"><?php
echo t("Add a Message");
?>
</h2>
<div class="MessageFormWrap">
<div class="Form-HeaderWrap">
<div class="Form-Header">
<span class="Author">
<?php
if (c('Vanilla.Comment.UserPhotoFirst', true)) {
echo userPhoto($Session->User);
echo userAnchor($Session->User, 'Username');
} else {
echo userAnchor($Session->User, 'Username');
echo userPhoto($Session->User);
}
?>
</span>
</div>
</div>
<div class="Form-BodyWrap">
<div class="Form-Body">
<div class="FormWrapper FormWrapper-Condensed">
<?php
echo $this->Form->open(array('id' => 'Form_ConversationMessage', 'action' => url('/messages/addmessage/')));
echo $this->Form->errors();
// echo wrap($this->Form->textBox('Body', array('MultiLine' => true, 'class' => 'TextBox')), 'div', array('class' => 'TextBoxWrapper'));
echo $this->Form->bodyBox('Body', array('Table' => 'ConversationMessage', 'FileUpload' => true, 'tabindex' => 1));
echo '<div class="Buttons">', $this->Form->button('Send Message', array('class' => 'Button Primary', 'tabindex' => 1)), '</div>';
开发者ID:vanilla,项目名称:vanilla,代码行数:31,代码来源:addmessage.php
示例7: 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');
?>
//.........这里部分代码省略.........
开发者ID:vanilla,项目名称:vanilla,代码行数:101,代码来源:table_functions.php
示例8: 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);
}
}
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:98,代码来源:helper_functions.php
示例9: foreach
$Session = Gdn::session();
$Alt = FALSE;
foreach ($this->InvitationData->Format('Text')->result() as $Invitation) {
$Alt = $Alt == TRUE ? FALSE : TRUE;
?>
<tr class="js-invitation" data-id="<?php
echo $Invitation->InvitationID;
?>
">
<td class="Alt"><?php
if ($Invitation->AcceptedName == '') {
echo $Invitation->Email;
echo wrap(anchor(t('Uninvite'), "/profile/uninvite/{$Invitation->InvitationID}", 'Uninvite Hijack') . ' | ' . anchor(t('Send Again'), "/profile/sendinvite/{$Invitation->InvitationID}", 'SendAgain Hijack'), 'div');
} else {
$User = Gdn::userModel()->getID($Invitation->AcceptedUserID);
echo userAnchor($User);
echo wrap(anchor(t('Remove'), "/profile/deleteinvitation/{$Invitation->InvitationID}", 'Delete Hijack'), 'div');
}
if ($Invitation->AcceptedName == '') {
}
?>
</td>
<td><?php
echo Gdn_Format::date($Invitation->DateInserted, 'html');
?>
</td>
<td class="Alt"><?php
if ($Invitation->AcceptedName == '') {
echo t('Pending');
} else {
echo t('Accepted');
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:invitations.php
示例10: writeDiscussion
function writeDiscussion($Discussion, &$Sender, &$Session)
{
$CssClass = CssClass($Discussion);
$DiscussionUrl = $Discussion->Url;
$Category = CategoryModel::categories($Discussion->CategoryID);
if ($Session->UserID) {
$DiscussionUrl .= '#latest';
}
$Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl;
$Sender->EventArguments['Discussion'] =& $Discussion;
$Sender->EventArguments['CssClass'] =& $CssClass;
$First = UserBuilder($Discussion, 'First');
$Last = UserBuilder($Discussion, 'Last');
$Sender->EventArguments['FirstUser'] =& $First;
$Sender->EventArguments['LastUser'] =& $Last;
$Sender->fireEvent('BeforeDiscussionName');
$DiscussionName = $Discussion->Name;
if ($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);
?>
<li id="Discussion_<?php
echo $Discussion->DiscussionID;
?>
" class="<?php
echo $CssClass;
?>
">
<?php
if (!property_exists($Sender, 'CanEditDiscussions')) {
$Sender->CanEditDiscussions = val('PermsDiscussionsEdit', CategoryModel::categories($Discussion->CategoryID)) && c('Vanilla.AdminCheckboxes.Use');
}
$Sender->fireEvent('BeforeDiscussionContent');
// WriteOptions($Discussion, $Sender, $Session);
?>
<span class="Options">
<?php
echo OptionsList($Discussion);
echo BookmarkButton($Discussion);
?>
</span>
<div class="ItemContent Discussion">
<div class="Title">
<?php
echo AdminCheck($Discussion, array('', ' ')) . anchor($DiscussionName, $DiscussionUrl);
$Sender->fireEvent('AfterDiscussionTitle');
?>
</div>
<div class="Meta Meta-Discussion">
<?php
WriteTags($Discussion);
?>
<span class="MItem MCount ViewCount"><?php
printf(PluralTranslate($Discussion->CountViews, '%s view html', '%s views html', t('%s view'), t('%s views')), BigPlural($Discussion->CountViews, '%s view'));
?>
</span>
<span class="MItem MCount CommentCount"><?php
printf(PluralTranslate($Discussion->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), BigPlural($Discussion->CountComments, '%s comment'));
?>
</span>
<span class="MItem MCount DiscussionScore Hidden"><?php
$Score = $Discussion->Score;
if ($Score == '') {
$Score = 0;
}
printf(Plural($Score, '%s point', '%s points', BigPlural($Score, '%s point')));
?>
</span>
<?php
echo NewComments($Discussion);
$Sender->fireEvent('AfterCountMeta');
if ($Discussion->LastCommentID != '') {
echo ' <span class="MItem LastCommentBy">' . sprintf(t('Most recent by %1$s'), userAnchor($Last)) . '</span> ';
echo ' <span class="MItem LastCommentDate">' . Gdn_Format::date($Discussion->LastDate, 'html') . '</span>';
} else {
echo ' <span class="MItem LastCommentBy">' . sprintf(t('Started by %1$s'), userAnchor($First)) . '</span> ';
echo ' <span class="MItem LastCommentDate">' . Gdn_Format::date($Discussion->FirstDate, 'html');
if ($Source = val('Source', $Discussion)) {
echo ' ' . sprintf(t('via %s'), t($Source . ' Source', $Source));
}
echo '</span> ';
}
if ($Sender->data('_ShowCategoryLink', true) && c('Vanilla.Categories.Use') && $Category) {
echo wrap(Anchor(htmlspecialchars($Discussion->Category), CategoryUrl($Discussion->CategoryUrlCode)), 'span', array('class' => 'MItem Category ' . $Category['CssClass']));
}
$Sender->fireEvent('DiscussionMeta');
?>
</div>
</div>
<?php
$Sender->fireEvent('AfterDiscussionContent');
//.........这里部分代码省略.........
开发者ID:caidongyun,项目名称:vanilla,代码行数:101,代码来源:helper_functions.php
示例11: 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
}
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:profilecomments.php
示例12: userPhoto
<li id="Message_<?php
echo $Message->MessageID;
?>
"<?php
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;
开发者ID:caidongyun,项目名称:vanilla,代码行数:31,代码来源:messages.php
示例13: 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
}
开发者ID:R-J,项目名称:vanilla,代码行数:50,代码来源:helper_functions.php
示例14: OtherRecordsMeta
echo OtherRecordsMeta($Row['Data']);
echo '<div class="Meta-Container">';
echo '<span class="Tags">';
echo '<span class="Tag Tag-' . $Row['Operation'] . '">' . t($Row['Operation']) . '</span> ';
echo '<span class="Tag Tag-' . $RecordLabel . '">' . anchor(t($RecordLabel), $Url) . '</span> ';
echo '</span>';
if (checkPermission('Garden.PersonalInfo.View') && $Row['RecordIPAddress']) {
echo ' <span class="Meta">', '<span class="Meta-Label">IP</span> ', IPAnchor($Row['RecordIPAddress'], 'Meta-Value'), '</span> ';
}
if ($Row['CountGroup'] > 1) {
echo ' <span class="Meta">', '<span class="Meta-Label">' . t('Reported') . '</span> ', wrap(Plural($Row['CountGroup'], '%s time', '%s times'), 'span', 'Meta-Value'), '</span> ';
// echo ' ', sprintf(t('%s times'), $Row['CountGroup']);
}
$RecordUser = Gdn::userModel()->getID($Row['RecordUserID'], DATASET_TYPE_ARRAY);
if ($Row['RecordName']) {
echo ' <span class="Meta">', '<span class="Meta-Label">' . sprintf(t('%s by'), t($RecordLabel)) . '</span> ', userAnchor($Row, 'Meta-Value', 'Record');
if ($RecordUser['Banned']) {
echo ' <span class="Tag Tag-Ban">' . t('Banned') . '</span>';
}
echo ' <span class="Count">' . plural($RecordUser['CountDiscussions'] + $RecordUser['CountComments'], '%s post', '%s posts') . '</span>';
echo '</span> ';
}
// Write custom meta information.
$CustomMeta = valr('Data._Meta', $Row, false);
if (is_array($CustomMeta)) {
foreach ($CustomMeta as $Key => $Value) {
echo ' <span class="Meta">', '<span class="Meta-Label">' . t($Key) . '</span> ', wrap(Gdn_Format::Html($Value), 'span', array('class' => 'Meta-Value')), '</span>';
}
}
echo '</div>';
?>
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:table.php
示例15: userAnchor
<tr id="<?php
echo "UserID_{$User->UserID}";
?>
"<?php
echo $Alt ? ' class="Alt"' : '';
?>
data-userid="<?php
echo $User->UserID;
?>
">
<!-- <td class="CheckboxCell"><input type="checkbox" name="LogID[]" value="<?php
echo $User->UserID;
?>
" /></td>-->
<td><strong><?php
echo userAnchor($User, 'Username');
?>
</strong></td>
<?php
if ($ViewPersonalInfo) {
?>
<td class="Alt"><?php
echo Gdn_Format::Email($User->Email);
?>
</td>
<?php
}
?>
<td style="max-width: 200px;">
<?php
$Roles = val('Roles', $User, array());
开发者ID:caidongyun,项目名称:vanilla,代码行数:31,代码来源:users.php
示例16: doQuote
/**
* Perform formatting against a string for the quote tag.
*
* @param Nbbc $bbcode Instance of Nbbc doing the parsing.
* @param int $action Value of one of NBBC's defined constants. Typically, this will be BBCODE_CHECK.
* @param string $name Name of the tag.
* @param string $default Value of the _default parameter, from the $params array.
* @param array $params A standard set parameters related to the tag.
* @param string $content Value between the open and close tags, if any.
* @return bool|string Formatted value.
*/
function doQuote($bbcode, $action, $name, $default, $params, $content)
{
if ($action == Nbbc::BBCODE_CHECK) {
return true;
}
if (is_string($default)) {
$defaultParts = explode(';', $default);
// support vbulletin style quoting.
$Url = array_pop($defaultParts);
if (count($defaultParts) == 0) {
$params['name'] = $Url;
} else {
$params['name'] = implode(';', $defaultParts);
$params['url'] = $Url;
}
}
$title = '';
if (isset($params['name'])) {
$username = trim($params['name']);
$username = html_entity_decode($username, ENT_QUOTES, 'UTF-8');
$User = Gdn::userModel()->getByUsername($username);
if ($User) {
$userAnchor = userAnchor($User);
} else {
$userAnchor = anchor(htmlspecialchars($username, null, 'UTF-8'), '/profile/' . rawurlencode($username));
}
$title = concatSep(' ', $title, $userAnchor, t('Quote wrote', 'wrote'));
}
if (isset($params['date'])) {
$title = concatSep(' ', $title, t('Quote on', 'on'), htmlspecialchars(trim($params['date'])));
}
if ($title) {
$title = $title . ':';
}
if (isset($params['url'])) {
$url = trim($params['url']);
if (preg_match('/(c|d)-(\\d+)/', strtolower($url), $matches)) {
if ($matches[1] === 'd') {
$url = "/discussion/{$matches[2]}";
} else {
$url = "/discussion/comment/{$matches[2]}#Comment_{$matches[2]}";
}
} elseif (is_numeric($url)) {
$url = "/discussion/comment/{$url}#Comment_{$url}";
} elseif (!$bbcode->isValidURL($url)) {
$url = '';
}
if ($url) {
$title = concatSep(' ', $title, anchor('<span class="ArrowLink">»</span>', $url, ['class' => 'QuoteLink']));
}
}
if ($title) {
$title = "<div class=\"QuoteAuthor\">{$title}</div>";
}
return "\n<blockquote class=\"Quote UserQuote\">\n{$title}\n<div class=\"QuoteText\">{$content}</div>\n</blockquote>\n";
}
开发者ID:vanilla,项目名称:vanilla,代码行数:67,代码来源:class.bbcode.php
示例17: getOptions
<div class="ItemContent Category"><div class="Options">' . getOptions($Category, $this) . '</div>' . Gdn_Format::text($Category->Name) . '</div>
</li>';
$Alt = FALSE;
} else {
$LastComment = UserBuilder($Category, 'Last');
$AltCss = $Alt ? ' Alt' : '';
$Alt = !$Alt;
$CatList .= '<li id="Category_' . $CategoryID . '" class="' . $CssClass . '">
<div class="ItemContent Category">' . '<div class="Options">' . getOptions($Category, $this) . '</div>' . CategoryPhoto($Category) . '<div class="TitleWrap">' . anchor(Gdn_Format::text($Category->Name), CategoryUrl($Category), 'Title') . '</div>
<div class="CategoryDescription">' . $Category->Description . '</div>
<div class="Meta">
<span class="MItem RSS">' . anchor(img('applications/dashboard/design/images/rss.gif', array('alt' => T('RSS Feed'))), '/categories/' . $Category->UrlCode . '/feed.rss', '', array('title' => T('RSS Feed'))) . '</span>
<span class="MItem DiscussionCount">' . sprintf(PluralTranslate($Category->CountDiscussions, '%s discussion html', '%s discussions html', t('%s discussion'), t('%s discussions')), BigPlural($Category->CountDiscussions, '%s discussion')) . '</span>
<span class="MItem CommentCount">' . sprintf(PluralTranslate($Category->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), BigPlural($Category->CountComments, '%s comment')) . '</span>';
if ($Category->LastTitle != '') {
$CatList .= '<span class="MItem LastDiscussionTitle">' . sprintf(t('Most recent: %1$s by %2$s'), anchor(Gdn_Format::text(sliceString($Category->LastTitle, 40)), $Category->LastUrl), userAnchor($LastComment)) . '</span>' . '<span class="MItem LastCommentDate">' . Gdn_Format::date($Category->LastDateInserted) . '</span>';
}
// If this category is one level above the max display depth, and it
// has children, add a replacement string for them.
if ($MaxDisplayDepth > 0 && $Category->Depth == $MaxDisplayDepth - 1 && $Category->TreeRight - $Category->TreeLeft > 1) {
$CatList .= '{ChildCategories}';
}
$CatList .= '</div>
</div>
</li>';
}
}
}
}
// If there are any remaining child categories that have been collected, do
// the replacement one last time.
开发者ID:R-J,项目名称:vanilla,代码行数:31,代码来源:all.php
示例18: writeCommentFormHeader
function writeCommentFormHeader()
{
$Session = Gdn::session();
if (c('Vanilla.Comment.UserPhotoFirst', true)) {
echo userPhoto($Session->User);
echo userAnchor($Session->User, 'Username');
} else {
echo userAnchor($Session->User, 'Username');
echo userPhoto($Session->User);
}
}
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:11,代码来源:helper_functions.php
示例19: _formatStringCallback
//.........这里部分代码省略.........
case 'urlencode':
$Result = urlencode($Value);
break;
case 'gender':
// Format in the form of FieldName,gender,male,female,unknown[,plural]
if (is_array($Value) && count($Value) == 1) {
$Value = array_shift($Value);
}
$Gender = 'u';
if (!is_array($Value)) {
$User = Gdn::userModel()->getID($Value);
if ($User) {
$Gender = $User->Gender;
}
} else {
$Gender = 'p';
}
switch ($Gender) {
case 'm':
$Result = $SubFormat;
break;
case 'f':
$Result = $FormatArgs;
break;
case 'p':
$Result = val(5, $Parts, val(4, $Parts));
break;
case 'u':
default:
$Result = val(4, $Parts);
}
break;
case 'user':
case 'you':
case 'his':
case 'her':
case 'your':
// $Result = print_r($Value, true);
$ArgsBak = $Args;
if (is_array($Value) && count($Value) == 1) {
$Value = array_shift($Value);
}
if (is_array($Value)) {
if (isset($Value['UserID'])) {
$User = $Value;
$User['Name'] = formatUsername($User, $Format, $ContextUserID);
$Result = userAnchor($User);
} else {
$Max = c('Garden.FormatUsername.Max', 5);
// See if there is another count.
$ExtraCount = valr($Field . '_Count', $Args, 0);
$Count = count($Value);
$Result = '';
for ($i = 0; $i < $Count; $i++) {
if ($i >= $Max && $Count > $Max + 1) {
$Others = $Count - $i + $ExtraCount;
$Result .= ' ' . t('sep and', 'and') . ' ' . plural($Others, '%s other', '%s others');
break;
}
$ID = $Value[$i];
if (is_array($ID)) {
continue;
}
if ($i == $Count - 1) {
$Result .= ' ' . T('sep and', 'and') . ' ';
} elseif ($i > 0) {
$Result .= ', ';
}
$Special = array(-1 => T('everyone'), -2 => T('moderators'), -3 => T('administrators'));
if (isset($Special[$ID])) {
$Result .= $Special[$ID];
} else {
$User = Gdn::userModel()->getID($ID);
if ($User) {
$User->Name = formatUsername($User, $Format, $ContextUserID);
$Result .= userAnchor($User);
}
}
}
}
} else {
$User = Gdn::userModel()->getID($Value);
if ($User) {
// Store this name separately because of special 'You' case.
$Name = formatUsername($User, $Format, $ContextUserID);
// Manually build instead of using userAnchor() because of special 'You' case.
$Result = anchor(htmlspecialchars($Name), userUrl($User));
} else {
$Result = '';
}
}
$Args = $ArgsBak;
break;
default:
$Result = $Value;
break;
}
}
return $Result;
}
开发者ID:sitexa,项目名称:vanilla,代码行数:101,代码来源:functions.general.php
|
请发表评论