本文整理汇总了PHP中Linker::commentBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::commentBlock方法的具体用法?PHP Linker::commentBlock怎么用?PHP Linker::commentBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::commentBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: customizeOldChangesList
/**
* @param $changeslist ChangesList
* @param $s string
* @param $rc RecentChange
* @return bool
*/
static function customizeOldChangesList(&$changeslist, &$s, $rc, &$classes)
{
if ($rc->getTitle()->getNamespace() != NS_LQT_THREAD) {
return true;
}
$thread = Threads::withRoot(new Article($rc->getTitle(), 0));
if (!$thread) {
return true;
}
global $wgLang, $wgOut;
$wgOut->addModules('ext.liquidThreads');
// Custom display for new posts.
if ($rc->mAttribs['rc_new']) {
// Article link, timestamp, user
$s = '';
$s .= Linker::link($thread->getTitle());
$changeslist->insertTimestamp($s, $rc);
$changeslist->insertUserRelatedLinks($s, $rc);
// Action text
$msg = $thread->isTopmostThread() ? 'lqt_rc_new_discussion' : 'lqt_rc_new_reply';
$link = LqtView::linkInContext($thread);
$s .= ' ' . wfMessage($msg)->rawParams($link)->parse();
$s .= $wgLang->getDirMark();
// add the truncated post content
$quote = $thread->root()->getContent();
$quote = $wgLang->truncate($quote, 200);
$s .= ' ' . Linker::commentBlock($quote);
$classes = array();
$changeslist->insertTags($s, $rc, $classes);
$changeslist->insertExtra($s, $rc, $classes);
}
return true;
}
示例2: formatRow
function formatRow($row)
{
$comment = Linker::commentBlock($row->cw_comment);
$user = Linker::userLink($row->cw_user, $row->user_name) . Linker::userToolLinks($row->cw_user, $row->user_name);
$sitename = $row->cw_sitename;
$status = $row->cw_status;
$idlink = Linker::link(Title::newFromText('Special:RequestWikiQueue/' . $row->cw_id), "#{$row->cw_id}");
return '<li>' . $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->cw_timestamp), true) . ' ' . $this->msg('requestwikiqueue-logpagerentry', $user, htmlspecialchars($sitename), $idlink, $this->msg('requestwikiqueue-pager-status-' . $status))->text() . $comment . '</li>';
}
示例3: getComment
public function getComment()
{
$legacy = $this->entry->getParameters();
if (isset($legacy['reason'])) {
$comment = Linker::commentBlock($legacy['reason']);
// No hard coded spaces thanx
return ltrim($comment);
}
return parent::getComment();
}
示例4: formatRow
function formatRow($row)
{
if ($row->cul_reason === '') {
$comment = '';
} else {
$comment = Linker::commentBlock($row->cul_reason);
}
$user = Linker::userLink($row->cul_user, $row->user_name);
if ($row->cul_type == 'userips' || $row->cul_type == 'useredits') {
$target = Linker::userLink($row->cul_target_id, $row->cul_target_text) . Linker::userToolLinks($row->cul_target_id, $row->cul_target_text);
} else {
$target = $row->cul_target_text;
}
// Give grep a chance to find the usages:
// checkuser-log-userips, checkuser-log-ipedits, checkuser-log-ipusers,
// checkuser-log-ipedits-xff, checkuser-log-ipusers-xff, checkuser-log-useredits
return '<li>' . $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->cul_timestamp), true) . $this->msg('comma-separator')->text() . $this->msg('checkuser-log-' . $row->cul_type, $user, $target)->text() . $comment . '</li>';
}
示例5: getHTML
public function getHTML()
{
$date = htmlspecialchars($this->list->getLanguage()->userTimeAndDate($this->row->log_timestamp, $this->list->getUser()));
$title = Title::makeTitle($this->row->log_namespace, $this->row->log_title);
$formatter = LogFormatter::newFromRow($this->row);
$formatter->setContext($this->list->getContext());
$formatter->setAudience(LogFormatter::FOR_THIS_USER);
// Log link for this page
$loglink = Linker::link(SpecialPage::getTitleFor('Log'), $this->list->msg('log')->escaped(), array(), array('page' => $title->getPrefixedText()));
$loglink = $this->list->msg('parentheses')->rawParams($loglink)->escaped();
// User links and action text
$action = $formatter->getActionText();
// Comment
$comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock($this->row->log_comment);
if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) {
$comment = '<span class="history-deleted">' . $comment . '</span>';
}
return "<li>{$loglink} {$date} {$action} {$comment}</li>";
}
示例6: formatValue
function formatValue($name, $value)
{
global $wgLang, $wgTitle;
$row = $this->mCurrentRow;
switch ($name) {
case 'th_timestamp':
$formatted = $wgLang->timeanddate($value, true);
return Linker::link($wgTitle, $formatted, array(), array('lqt_oldid' => $row->th_id));
case 'th_user_text':
return Linker::userLink($row->th_user, $row->th_user_text) . ' ' . Linker::userToolLinks($row->th_user, $row->th_user_text);
case 'th_change_type':
return $this->getActionDescription($value);
case 'th_change_comment':
return Linker::commentBlock($value);
default:
return "Unable to format {$name}";
break;
}
}
示例7: getComment
/**
* Wrap and format the file's comment block, if the current
* user is allowed to view it.
*
* @return string HTML
*/
protected function getComment()
{
if ($this->file->userCan(File::DELETED_COMMENT, $this->list->getUser())) {
$block = Linker::commentBlock($this->file->getDescription());
} else {
$block = ' ' . $this->list->msg('rev-deleted-comment')->escaped();
}
if ($this->file->isDeleted(File::DELETED_COMMENT)) {
return "<span class=\"history-deleted\">{$block}</span>";
}
return $block;
}
示例8: formatValue
function formatValue($name, $value)
{
static $msg = null;
if ($msg === null) {
$msg = array('anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock', 'blocklist-nousertalk', 'unblocklink', 'change-blocklink', 'infiniteblock');
$msg = array_combine($msg, array_map(array($this, 'msg'), $msg));
}
/** @var $row object */
$row = $this->mCurrentRow;
$formatted = '';
switch ($name) {
case 'ipb_timestamp':
$formatted = $this->getLanguage()->userTimeAndDate($value, $this->getUser());
break;
case 'ipb_target':
if ($row->ipb_auto) {
$formatted = $this->msg('autoblockid', $row->ipb_id)->parse();
} else {
list($target, $type) = Block::parseTarget($row->ipb_address);
switch ($type) {
case Block::TYPE_USER:
case Block::TYPE_IP:
$formatted = Linker::userLink($target->getId(), $target);
$formatted .= Linker::userToolLinks($target->getId(), $target, false, Linker::TOOL_LINKS_NOBLOCK);
break;
case Block::TYPE_RANGE:
$formatted = htmlspecialchars($target);
}
}
break;
case 'ipb_expiry':
$formatted = $this->getLanguage()->formatExpiry($value, true);
if ($this->getUser()->isAllowed('block')) {
if ($row->ipb_auto) {
$links[] = Linker::linkKnown(SpecialPage::getTitleFor('Unblock'), $msg['unblocklink'], array(), array('wpTarget' => "#{$row->ipb_id}"));
} else {
$links[] = Linker::linkKnown(SpecialPage::getTitleFor('Unblock', $row->ipb_address), $msg['unblocklink']);
$links[] = Linker::linkKnown(SpecialPage::getTitleFor('Block', $row->ipb_address), $msg['change-blocklink']);
}
$formatted .= ' ' . Html::rawElement('span', array('class' => 'mw-blocklist-actions'), $this->msg('parentheses')->rawParams($this->getLanguage()->pipeList($links))->escaped());
}
break;
case 'ipb_by':
if (isset($row->by_user_name)) {
$formatted = Linker::userLink($value, $row->by_user_name);
$formatted .= Linker::userToolLinks($value, $row->by_user_name);
} else {
$formatted = htmlspecialchars($row->ipb_by_text);
// foreign user?
}
break;
case 'ipb_reason':
$formatted = Linker::commentBlock($value);
break;
case 'ipb_params':
$properties = array();
if ($row->ipb_anon_only) {
$properties[] = $msg['anononlyblock'];
}
if ($row->ipb_create_account) {
$properties[] = $msg['createaccountblock'];
}
if ($row->ipb_user && !$row->ipb_enable_autoblock) {
$properties[] = $msg['noautoblockblock'];
}
if ($row->ipb_block_email) {
$properties[] = $msg['emailblock'];
}
if (!$row->ipb_allow_usertalk) {
$properties[] = $msg['blocklist-nousertalk'];
}
$formatted = $this->getLanguage()->commaList($properties);
break;
default:
$formatted = "Unable to format {$name}";
break;
}
return $formatted;
}
示例9: contributionsLineEndingProcess
public static function contributionsLineEndingProcess(ContribsPager &$contribsPager, &$ret, $row)
{
wfProfileIn(__METHOD__);
$rev = new Revision($row);
$page = $rev->getTitle();
$page->resetArticleId($row->rev_page);
$wfMsgOptsBase = self::getMessageOptions(null, $row);
$isThread = $wfMsgOptsBase['isThread'];
$isNew = $wfMsgOptsBase['isNew'];
// Don't show useless link to people who cannot hide revisions
$del = Linker::getRevDeleteLink($contribsPager->getUser(), $rev, $page);
if ($del !== '') {
$del .= ' ';
} else {
$del = '';
}
// VOLDEV-40: remove html messages
$ret = $del;
$ret .= Linker::linkKnown($page, $contribsPager->getLanguage()->userTimeAndDate($row->rev_timestamp, $contribsPager->getUser()), [], ['oldid' => $row->rev_id]) . ' (';
if ($isNew) {
$ret .= $contribsPager->msg('diff')->escaped();
} else {
$ret .= Linker::linkKnown($page, $contribsPager->msg('diff')->escaped(), [], ['diff' => 'prev', 'oldid' => $row->rev_id]);
}
$wallMessage = new WallMessage($page);
$threadId = $wallMessage->getMessagePageId();
$threadTitle = Title::newFromText($threadId, NS_USER_WALL_MESSAGE);
$ret .= ' | ' . Linker::linkKnown($threadTitle, $contribsPager->msg('hist')->escaped(), [], ['action' => 'history']) . ') ';
if ($isThread && $isNew) {
$ret .= ChangesList::flag('newpage') . ' ';
}
if (MWNamespace::getSubject($row->page_namespace) === NS_WIKIA_FORUM_BOARD && empty($wfMsgOptsBase['articleTitleVal'])) {
$wfMsgOptsBase['articleTitleTxt'] = $contribsPager->msg('forum-recentchanges-deleted-reply-title')->text();
}
$prefix = MWNamespace::getSubject($row->page_namespace) === NS_WIKIA_FORUM_BOARD ? 'forum' : 'wall';
$ret .= $contribsPager->msg($prefix . '-contributions-line')->params($wfMsgOptsBase['articleTitle'])->rawParams(htmlspecialchars($wfMsgOptsBase['articleTitleTxt']))->params($wfMsgOptsBase['wallTitleTxt'], $wfMsgOptsBase['wallPageName'])->parse();
if (!$isNew) {
$summary = $rev->getComment();
if (empty($summary)) {
$msg = Linker::commentBlock($contribsPager->msg(static::getMessagePrefix($row->page_namespace) . '-edit')->inContentLanguage()->text());
} else {
$msg = Linker::revComment($rev, false, true);
}
$ret .= ' ' . $contribsPager->getLanguage()->getDirMark() . $msg;
}
wfProfileOut(__METHOD__);
return true;
}
示例10: buildOldVersionSelect
/**
* Build links to old version of the configuration
*/
protected function buildOldVersionSelect()
{
global $wgConf;
$count = 0;
$links = array();
$versions = $wgConf->getArchiveVersions(array('wiki' => $this->mWiki, 'limit' => 11));
$title = $this->getTitle();
$lang = $this->getLang();
$prev = null;
ksort($versions);
## Put in ascending order for now.
foreach ($versions as $data) {
$ts = $data['timestamp'];
$count++;
$datetime = $this->msg('configure-old-summary-datetime', $lang->timeanddate($ts), $lang->date($ts), $lang->time($ts))->escaped();
$link = Linker::linkKnown($title, $datetime, array(), array('version' => $ts));
$diffLink = '';
if ($prev) {
$diffLink = '(' . Linker::linkKnown(SpecialPage::getTitleFor('ViewConfig'), $this->msg('configure-old-changes')->escaped(), array(), array('version' => $ts, 'diff' => $prev)) . ')';
}
## Make user link...
$userLink = '';
if (!$data['userwiki'] || !$data['username']) {
$userLink = '';
$username = '';
} elseif ($data['userwiki'] == wfWikiId()) {
$userLink = Linker::link(Title::makeTitle(NS_USER, $data['username']), htmlspecialchars($data['username']));
$username = $data['username'];
} elseif ($wiki = WikiMap::getWiki($data['userwiki'])) {
$userLink = Linker::makeExternalLink($wiki->getUrl('User:' . $data['username']), htmlspecialchars($data['username'] . '@' . $data['userwiki']));
$username = '';
} else {
## Last-ditch
$userLink = htmlspecialchars($data['username'] . '@' . $data['userwiki']);
$username = '';
}
$comment = $data['reason'] ? Linker::commentBlock($data['reason']) : '';
$text = $this->msg('configure-old-summary')->rawParams($link, $userLink, $diffLink, $comment)->params($username)->parse();
$prev = $ts;
$links[] = $text;
}
## Reset into descending order
$links = array_reverse($links);
## Take out the first ten...
$links = array_slice($links, 0, 10);
$text = Html::element('legend', null, $this->msg('configure-old')->text());
if (!count($links)) {
$text .= $this->msg('configure-no-old')->parseAsBlock();
} else {
$text .= $this->msg('configure-old-versions')->parseAsBlock();
$text .= "<ul>\n<li>";
$text .= implode("</li>\n<li>", $links);
$text .= "</li>\n</ul>\n";
}
$link = SpecialPage::getTitleFor('ViewConfig');
$text .= Html::rawElement('p', null, Linker::linkKnown($link, $this->msg('configure-view-all-versions')->escaped()));
$text .= Html::rawElement('p', null, Linker::linkKnown($link, $this->msg('configure-view-default')->escaped(), array(), array('version' => 'default')));
return Html::rawElement('fieldset', null, $text);
}
示例11: getComment
/**
* Gets the user provided comment
* @return string HTML
*/
public function getComment()
{
if ($this->canView(LogPage::DELETED_COMMENT)) {
$comment = Linker::commentBlock($this->entry->getComment());
// No hard coded spaces thanx
$element = ltrim($comment);
if ($this->entry->isDeleted(LogPage::DELETED_COMMENT)) {
$element = $this->styleRestricedElement($element);
}
} else {
$element = $this->getRestrictedElement('rev-deleted-comment');
}
return $element;
}
示例12: testLogComment
/**
* @covers LogFormatter::newFromEntry
* @covers LogFormatter::getComment
*/
public function testLogComment()
{
$entry = $this->newLogEntry('test', array());
$formatter = LogFormatter::newFromEntry($entry);
$formatter->setContext($this->context);
$comment = ltrim(Linker::commentBlock($entry->getComment()));
$this->assertEquals($comment, $formatter->getComment());
}
示例13: getSummaryPreview
/**
* @param $isSubjectPreview Boolean: true if this is the section subject/title
* up top, or false if this is the comment summary
* down below the textarea
* @param $summary String: the text of the summary to display
* @return String
*/
protected function getSummaryPreview($isSubjectPreview, $summary = "")
{
if (!$summary || !$this->preview && !$this->diff) {
return "";
}
global $wgParser;
if ($isSubjectPreview) {
$summary = wfMsgForContent('newsectionsummary', $wgParser->stripSectionName($summary));
}
$message = $isSubjectPreview ? 'subject-preview' : 'summary-preview';
$summary = wfMsgExt($message, 'parseinline') . Linker::commentBlock($summary, $this->mTitle, $isSubjectPreview);
return Xml::tags('div', array('class' => 'mw-summary-preview'), $summary);
}
示例14: insertComment
/**
* Insert a formatted comment
* @param RecentChange $rc
* @return string
*/
public function insertComment($rc)
{
if ($this->isDeleted($rc, Revision::DELETED_COMMENT)) {
return ' <span class="history-deleted">' . $this->msg('rev-deleted-comment')->escaped() . '</span>';
} else {
return Linker::commentBlock($rc->mAttribs['rc_comment'], $rc->getTitle());
}
}
示例15: getSummaryPreview
/**
* @param bool $isSubjectPreview True if this is the section subject/title
* up top, or false if this is the comment summary
* down below the textarea
* @param string $summary The text of the summary to display
* @return string
*/
protected function getSummaryPreview($isSubjectPreview, $summary = "")
{
// avoid spaces in preview, gets always trimmed on save
$summary = trim($summary);
if (!$summary || !$this->preview && !$this->diff) {
return "";
}
global $wgParser;
if ($isSubjectPreview) {
$summary = wfMessage('newsectionsummary')->rawParams($wgParser->stripSectionName($summary))->inContentLanguage()->text();
}
$message = $isSubjectPreview ? 'subject-preview' : 'summary-preview';
$summary = wfMessage($message)->parse() . Linker::commentBlock($summary, $this->mTitle, $isSubjectPreview);
return Xml::tags('div', array('class' => 'mw-summary-preview'), $summary);
}