本文整理汇总了PHP中Linker::userLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::userLink方法的具体用法?PHP Linker::userLink怎么用?PHP Linker::userLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::userLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFeedItem
private function createFeedItem($row)
{
global $wgOut;
$thread = Thread::newFromRow($row);
$linker = new Linker();
$titleStr = $thread->subject();
$completeText = $thread->root()->getContent();
$completeText = $wgOut->parse($completeText);
$threadTitle = clone $thread->topmostThread()->title();
$threadTitle->setFragment('#' . $thread->getAnchorName());
$titleUrl = $threadTitle->getFullURL();
$timestamp = $thread->created();
$user = $thread->author()->getName();
// Grab the title for the superthread, if one exists.
$stTitle = null;
if ($thread->hasSuperThread()) {
$stTitle = clone $thread->topmostThread()->title();
$stTitle->setFragment('#' . $thread->superthread()->getAnchorName());
}
// Prefix content with a quick description
$userLink = $linker->userLink($thread->author()->getId(), $user);
$talkpageLink = $linker->link($thread->getTitle());
$superthreadLink = $linker->link($stTitle);
$description = wfMsgExt($thread->hasSuperThread() ? 'lqt-feed-reply-intro' : 'lqt-feed-new-thread-intro', array('parse', 'replaceafter'), array($talkpageLink, $userLink, $superthreadLink));
$completeText = $description . $completeText;
return new FeedItem($titleStr, $completeText, $titleUrl, $timestamp, $user);
}
示例2: getFormattedValue
/**
* (non-PHPdoc)
* @see EPPager::getFormattedValue()
*/
protected function getFormattedValue($name, $value)
{
switch ($name) {
case 'id':
$value = Linker::linkKnown(SpecialPage::getTitleFor('Student', $value), htmlspecialchars($this->getLanguage()->formatNum($value, true)));
break;
case 'user_id':
$user = User::newFromId($value);
$name = $user->getRealName() === '' ? $user->getName() : $user->getRealName();
$value = Linker::userLink($value, $name) . Linker::userToolLinks($value, $name);
break;
case 'first_enroll':
case 'last_active':
$value = htmlspecialchars($this->getLanguage()->date($value));
break;
case 'active_enroll':
$value = wfMsgHtml($value === '1' ? 'epstudentpager-yes' : 'epstudentpager-no');
break;
case '_courses_current':
$value = $this->getLanguage()->pipeList(array_map(function (EPCourse $course) {
return $course->getLink();
}, $this->currentObject->getCoursesWithState('current', 'name')));
break;
}
return $value;
}
示例3: createFeedItem
private function createFeedItem($row)
{
$thread = Thread::newFromRow($row);
$titleStr = $thread->subject();
$completeText = $thread->root()->getContent();
$completeText = $this->getOutput()->parse($completeText);
$threadTitle = clone $thread->topmostThread()->title();
$threadTitle->setFragment('#' . $thread->getAnchorName());
$titleUrl = $threadTitle->getFullURL();
$timestamp = $thread->created();
$user = $thread->author()->getName();
// Prefix content with a quick description
$userLink = Linker::userLink($thread->author()->getId(), $user);
$talkpageLink = Linker::link($thread->getTitle());
if ($thread->hasSuperThread()) {
$stTitle = clone $thread->topmostThread()->title();
$stTitle->setFragment('#' . $thread->superthread()->getAnchorName());
$superthreadLink = Linker::link($stTitle);
$description = wfMessage('lqt-feed-reply-intro')->rawParams($talkpageLink, $userLink, $superthreadLink)->params($user)->parseAsBlock();
} else {
// Third param is unused
$description = wfMessage('lqt-feed-new-thread-intro')->rawParams($talkpageLink, $userLink, '')->params($user)->parseAsBlock();
}
$completeText = $description . $completeText;
return new FeedItem($titleStr, $completeText, $titleUrl, $timestamp, $user);
}
示例4: genContributionScoreTable
/**
* Function generates Contribution Scores tables in HTML format (not wikiText)
*
* @param $days int Days in the past to run report for
* @param $limit int Maximum number of users to return (default 50)
* @param $title Title (default null)
* @param $options array of options (default none; nosort/notools)
* @return Html Table representing the requested Contribution Scores.
*/
function genContributionScoreTable($days, $limit, $title = null, $options = 'none')
{
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName;
$opts = explode(',', strtolower($options));
$dbr = wfGetDB(DB_SLAVE);
$userTable = $dbr->tableName('user');
$userGroupTable = $dbr->tableName('user_groups');
$revTable = $dbr->tableName('revision');
$ipBlocksTable = $dbr->tableName('ipblocks');
$sqlWhere = "";
$nextPrefix = "WHERE";
if ($days > 0) {
$date = time() - 60 * 60 * 24 * $days;
$dateString = $dbr->timestamp($date);
$sqlWhere .= " {$nextPrefix} rev_timestamp > '{$dateString}'";
$nextPrefix = "AND";
}
if ($wgContribScoreIgnoreBlockedUsers) {
$sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ipb_user FROM {$ipBlocksTable} WHERE ipb_user <> 0)";
$nextPrefix = "AND";
}
if ($wgContribScoreIgnoreBots) {
$sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ug_user FROM {$userGroupTable} WHERE ug_group='bot')";
}
$sqlMostPages = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY page_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
$sqlMostRevs = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY rev_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
$sql = "SELECT user_id, " . "user_name, " . "user_real_name, " . "page_count, " . "rev_count, " . "page_count+SQRT(rev_count-page_count)*2 AS wiki_rank " . "FROM {$userTable} u JOIN (({$sqlMostPages}) UNION ({$sqlMostRevs})) s ON (user_id=rev_user) " . "ORDER BY wiki_rank DESC " . "LIMIT {$limit}";
$res = $dbr->query($sql);
$sortable = in_array('nosort', $opts) ? '' : ' sortable';
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" . "<tr class='header'>\n" . Html::element('th', array(), $this->msg('contributionscores-score')->text()) . Html::element('th', array(), $this->msg('contributionscores-pages')->text()) . Html::element('th', array(), $this->msg('contributionscores-changes')->text()) . Html::element('th', array(), $this->msg('contributionscores-username')->text());
$altrow = '';
$lang = $this->getLanguage();
foreach ($res as $row) {
// Use real name if option used and real name present.
if ($wgContribScoresUseRealName && $row->user_real_name !== '') {
$userLink = Linker::userLink($row->user_id, $row->user_name, $row->user_real_name);
} else {
$userLink = Linker::userLink($row->user_id, $row->user_name);
}
$output .= Html::closeElement('tr');
$output .= "<tr class='{$altrow}'>\n<td class='content'>" . $lang->formatNum(round($row->wiki_rank, 0)) . "\n</td><td class='content'>" . $lang->formatNum($row->page_count) . "\n</td><td class='content'>" . $lang->formatNum($row->rev_count) . "\n</td><td class='content'>" . $userLink;
# Option to not display user tools
if (!in_array('notools', $opts)) {
$output .= Linker::userToolLinks($row->user_id, $row->user_name);
}
$output .= Html::closeElement('td') . "\n";
if ($altrow == '' && empty($sortable)) {
$altrow = 'odd ';
} else {
$altrow = '';
}
}
$output .= Html::closeElement('tr');
$output .= Html::closeElement('table');
$dbr->freeResult($res);
if (!empty($title)) {
$output = Html::rawElement('table', array('style' => 'border-spacing: 0; padding: 0', 'class' => 'contributionscores-wrapper', 'lang' => htmlspecialchars($lang->getCode()), 'dir' => $lang->getDir()), "\n" . "<tr>\n" . "<td style='padding: 0px;'>{$title}</td>\n" . "</tr>\n" . "<tr>\n" . "<td style='padding: 0px;'>{$output}</td>\n" . "</tr>\n");
}
return $output;
}
示例5: getMessageParameters
public function getMessageParameters()
{
$params = parent::getMessageParameters();
$type = $this->entry->getSubtype();
$entry_params = $this->entry->getParameters();
if ($type === 'approve') {
$revid = $entry_params['revid'];
$link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid));
$params[4] = Message::rawParam($link);
} elseif ($type === 'reject') {
$modid = $entry_params['modid'];
$link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid));
$params[4] = Message::rawParam($link);
$userlink = Linker::userLink($entry_params['user'], $entry_params['user_text']);
$params[5] = Message::rawParam($userlink);
} elseif ($type === 'merge') {
$revid = $entry_params['revid'];
$modid = $entry_params['modid'];
$link = Linker::linkKnown(Title::makeTitle(NS_SPECIAL, "Moderation"), wfMessage('moderation-log-change', $modid)->text(), array('title' => wfMessage('tooltip-moderation-rejected-change')), array('modaction' => 'show', 'modid' => $modid));
$params[4] = Message::rawParam($link);
$link = Linker::linkKnown($this->entry->getTarget(), wfMessage('moderation-log-diff', $revid)->text(), array('title' => wfMessage('tooltip-moderation-approved-diff')), array('diff' => $revid));
$params[5] = Message::rawParam($link);
} elseif ($type === 'approveall' || $type === 'rejectall' || $type === 'block' || $type === 'unblock') {
$title = $this->entry->getTarget();
$user_id = User::idFromName($title->getText());
$link = Linker::userLink($user_id, $title->getText());
$params[2] = Message::rawParam($link);
}
return $params;
}
示例6: formatLog
/**
* a StaffLog::formatRow hook
*
* Formats a log entry to be displayed on Special:StaffLog
*/
public static function formatLog($type, $result, $time, $linker, &$out)
{
if ('spamwiki' == $type) {
$l = new Linker();
$out = "{$time} {$type} - user {$l->userLink($result->slog_user, $result->slog_user_name)} {$result->slog_comment}.";
}
return true;
}
示例7: formatResult
function formatResult($skin, $result)
{
global $wgLang, $wgContLang;
$user = User::newFromID($result->rev_user);
$ulinks = Linker::userLink($result->rev_user, $user->getName());
$ulinks .= Linker::userToolLinks($result->rev_user, $user->getName());
$date = date('h:i, d F Y', wfTimestamp(TS_UNIX, $result->rev_timestamp));
return $ulinks . " " . $result->numedits . " edits | {$date}";
}
示例8: 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>';
}
示例9: onView
public function onView()
{
$details = null;
$request = $this->getRequest();
$result = $this->page->doRollback($request->getVal('from'), $request->getText('summary'), $request->getVal('token'), $request->getBool('bot'), $details, $this->getUser());
if (in_array(array('actionthrottledtext'), $result)) {
throw new ThrottledError();
}
if (isset($result[0][0]) && ($result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback')) {
$this->getOutput()->setPageTitle($this->msg('rollbackfailed'));
$errArray = $result[0];
$errMsg = array_shift($errArray);
$this->getOutput()->addWikiMsgArray($errMsg, $errArray);
if (isset($details['current'])) {
$current = $details['current'];
if ($current->getComment() != '') {
$this->getOutput()->addHTML($this->msg('editcomment')->rawParams(Linker::formatComment($current->getComment()))->parse());
}
}
return;
}
# Display permissions errors before read-only message -- there's no
# point in misleading the user into thinking the inability to rollback
# is only temporary.
if (!empty($result) && $result !== array(array('readonlytext'))) {
# array_diff is completely broken for arrays of arrays, sigh.
# Remove any 'readonlytext' error manually.
$out = array();
foreach ($result as $error) {
if ($error != array('readonlytext')) {
$out[] = $error;
}
}
throw new PermissionsError('rollback', $out);
}
if ($result == array(array('readonlytext'))) {
throw new ReadOnlyError();
}
$current = $details['current'];
$target = $details['target'];
$newId = $details['newid'];
$this->getOutput()->setPageTitle($this->msg('actioncomplete'));
$this->getOutput()->setRobotPolicy('noindex,nofollow');
if ($current->getUserText() === '') {
$old = $this->msg('rev-deleted-user')->escaped();
} else {
$old = Linker::userLink($current->getUser(), $current->getUserText()) . Linker::userToolLinks($current->getUser(), $current->getUserText());
}
$new = Linker::userLink($target->getUser(), $target->getUserText()) . Linker::userToolLinks($target->getUser(), $target->getUserText());
$this->getOutput()->addHTML($this->msg('rollback-success')->rawParams($old, $new)->parseAsBlock());
$this->getOutput()->returnToMain(false, $this->getTitle());
if (!$request->getBool('hidediff', false) && !$this->getUser()->getBoolOption('norollbackdiff', false)) {
$de = new DifferenceEngine($this->getContext(), $current->getId(), $newId, false, true);
$de->showDiff('', '');
}
}
示例10: getSummaryData
/**
* Gets the summary data.
*
* @since 0.1
*
* @param EPStudent $student
*
* @return array
*/
protected function getSummaryData(EPDBObject $student)
{
$stats = array();
$id = $student->getUser()->getId();
$stats['user'] = Linker::userLink($id, $student->getName()) . Linker::userToolLinks($id, $student->getName());
$stats['first-enroll'] = htmlspecialchars($this->getLanguage()->timeanddate($student->getField('first_enroll'), true));
$stats['last-active'] = htmlspecialchars($this->getLanguage()->timeanddate($student->getField('last_active'), true));
$stats['active-enroll'] = wfMsgHtml($student->getField('active_enroll') ? 'ep-student-actively-enrolled' : 'ep-student-no-active-enroll');
return $stats;
}
示例11: formatRow
public function formatRow($row)
{
$rdatim = $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->rev_timestamp), true);
$fdatim = $this->getLanguage()->timeanddate(wfTimestamp(TS_MW, $row->fr_timestamp), true);
$fdate = $this->getLanguage()->date(wfTimestamp(TS_MW, $row->fr_timestamp), true);
$ftime = $this->getLanguage()->time(wfTimestamp(TS_MW, $row->fr_timestamp), true);
$review = $this->msg('reviewedversions-review')->rawParams($fdatim, Linker::userLink($row->fr_user, $row->user_name) . ' ' . Linker::userToolLinks($row->fr_user, $row->user_name), $fdate, $ftime, $row->user_name)->text();
$lev = $row->fr_quality >= 1 ? $this->msg('revreview-hist-quality')->escaped() : $this->msg('revreview-hist-basic')->escaped();
$link = Linker::link($this->page, $rdatim, array(), array('stableid' => $row->fr_rev_id));
return '<li>' . $link . ' (' . $review . ') <strong>[' . $lev . ']</strong></li>';
}
示例12: formatRow
public function formatRow($row)
{
$rdatim = $this->getLang()->timeanddate(wfTimestamp(TS_MW, $row->rev_timestamp), true);
$fdatim = $this->getLang()->timeanddate(wfTimestamp(TS_MW, $row->fr_timestamp), true);
$fdate = $this->getLang()->date(wfTimestamp(TS_MW, $row->fr_timestamp), true);
$ftime = $this->getLang()->time(wfTimestamp(TS_MW, $row->fr_timestamp), true);
$review = wfMsgExt('reviewedversions-review', array('parseinline', 'replaceafter'), $fdatim, Linker::userLink($row->fr_user, $row->user_name) . ' ' . Linker::userToolLinks($row->fr_user, $row->user_name), $fdate, $ftime, $row->user_name);
$lev = $row->fr_quality >= 1 ? wfMsgHtml('revreview-hist-quality') : wfMsgHtml('revreview-hist-basic');
$link = Linker::makeKnownLinkObj($this->page, $rdatim, 'stableid=' . $row->fr_rev_id);
return '<li>' . $link . ' (' . $review . ') <strong>[' . $lev . ']</strong></li>';
}
示例13: getFormattedValue
/**
* (non-PHPdoc)
* @see EPPager::getFormattedValue()
*/
protected function getFormattedValue($name, $value)
{
switch ($name) {
case 'user_id':
$user = User::newFromId($value);
$name = $user->getRealName() === '' ? $user->getName() : $user->getRealName();
$value = Linker::userLink($value, $name) . Linker::userToolLinks($value, $name);
break;
}
return $value;
}
示例14: displayRevisionNotice
/**
* Display a revision notice as subtitle.
*
* @since 0.1
*
* @param EPRevision $rev
*/
protected function displayRevisionNotice(EPRevision $rev)
{
$lang = $this->getLanguage();
$current = false;
// TODO
$td = $lang->timeanddate($rev->getField('time'), true);
$tddate = $lang->date($rev->getField('time'), true);
$tdtime = $lang->time($rev->getField('time'), true);
$userToolLinks = Linker::userLink($rev->getUser()->getId(), $rev->getUser()->getName()) . Linker::userToolLinks($rev->getUser()->getId(), $rev->getUser()->getName());
$infomsg = $current && !wfMessage('revision-info-current')->isDisabled() ? 'revision-info-current' : 'revision-info';
$this->getOutput()->setSubtitle("<div id=\"mw-{$infomsg}\">" . wfMessage($infomsg, $td)->rawParams($userToolLinks)->params($rev->getId(), $tddate, $tdtime, $rev->getUser())->parse() . "</div>");
}
示例15: 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>';
}