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


PHP Linker::userToolLinks方法代码示例

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


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

示例1: 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;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:69,代码来源:ContributionScores_body.php

示例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;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:EPStudentPager.php

示例3: 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}";
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:9,代码来源:Newcontributors.body.php

示例4: 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>';
 }
开发者ID:reviforks,项目名称:miraheze-cw,代码行数:9,代码来源:RequestWikiQueuePager.php

示例5: 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('', '');
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:56,代码来源:RollbackAction.php

示例6: getUserToolLinks

function getUserToolLinks($u)
{
    global $wgUser;
    if (!$u) {
        return "";
    }
    $ret = Linker::userToolLinks($u->getID(), $u->getName());
    $ret = str_replace('href="/', 'href="http://www.wikihow.com/', $ret);
    return $ret;
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:10,代码来源:update_dashboard.php

示例7: 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;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:19,代码来源:SpecialStudent.php

示例8: 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;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:15,代码来源:EPArticleTable.php

示例9: 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>';
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:11,代码来源:ReviewedVersions_body.php

示例10: 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>';
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:11,代码来源:ReviewedVersions_body.php

示例11: 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>");
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:19,代码来源:EPViewAction.php

示例12: 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>';
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:18,代码来源:CheckUserLogPager.php

示例13: 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;
     }
 }
开发者ID:Rikuforever,项目名称:wiki,代码行数:19,代码来源:ThreadHistoryPager.php

示例14: getFormattedValue

 /**
  * (non-PHPdoc)
  * @see EPPager::getFormattedValue()
  */
 protected function getFormattedValue($name, $value)
 {
     switch ($name) {
         case 'photo':
             $title = Title::newFromText($value, NS_FILE);
             $value = '';
             if (is_object($title)) {
                 $api = new ApiMain(new FauxRequest(array('action' => 'query', 'format' => 'json', 'prop' => 'imageinfo', 'iiprop' => 'url', 'titles' => $title->getFullText(), 'iiurlwidth' => 200), true), true);
                 $api->execute();
                 $result = $api->getResultData();
                 if (array_key_exists('query', $result) && array_key_exists('pages', $result['query'])) {
                     foreach ($result['query']['pages'] as $page) {
                         foreach ($page['imageinfo'] as $imageInfo) {
                             $value = Html::element('img', array('src' => $imageInfo['thumburl'], 'width' => '200px'));
                             break;
                         }
                     }
                 }
             }
             break;
         case 'user_id':
             $oa = $this->currentObject;
             $value = Linker::userLink($value, $oa->getName()) . Linker::userToolLinks($value, $oa->getName());
             break;
         case 'bio':
             $value = $this->getOutput()->parseInline($value);
             break;
         case '_courses':
             $oa = $this->currentObject;
             $value = $this->getLanguage()->listToText(array_map(function (EPCourse $course) {
                 return $course->getLink();
             }, $oa->getCoursesWithState('current', 'name')));
             break;
     }
     return $value;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:40,代码来源:EPOAPager.php

示例15: newFromRecentChange

 /**
  * @param RecentChange $baseRC
  * @param bool $watched
  *
  * @return RCCacheEntry
  */
 public function newFromRecentChange(RecentChange $baseRC, $watched)
 {
     $user = $this->context->getUser();
     $counter = $baseRC->counter;
     $cacheEntry = RCCacheEntry::newFromParent($baseRC);
     // Should patrol-related stuff be shown?
     $cacheEntry->unpatrolled = ChangesList::isUnpatrolled($baseRC, $user);
     $cacheEntry->watched = $cacheEntry->mAttribs['rc_type'] == RC_LOG ? false : $watched;
     $cacheEntry->numberofWatchingusers = $baseRC->numberofWatchingusers;
     $cacheEntry->link = $this->buildCLink($cacheEntry);
     $cacheEntry->timestamp = $this->buildTimestamp($cacheEntry);
     // Make "cur" and "diff" links.  Do not use link(), it is too slow if
     // called too many times (50% of CPU time on RecentChanges!).
     $showDiffLinks = $this->showDiffLinks($cacheEntry, $user);
     $cacheEntry->difflink = $this->buildDiffLink($cacheEntry, $showDiffLinks, $counter);
     $cacheEntry->curlink = $this->buildCurLink($cacheEntry, $showDiffLinks, $counter);
     $cacheEntry->lastlink = $this->buildLastLink($cacheEntry, $showDiffLinks);
     // Make user links
     $cacheEntry->userlink = $this->getUserLink($cacheEntry);
     if (!ChangesList::isDeleted($cacheEntry, Revision::DELETED_USER)) {
         $cacheEntry->usertalklink = Linker::userToolLinks($cacheEntry->mAttribs['rc_user'], $cacheEntry->mAttribs['rc_user_text']);
     }
     return $cacheEntry;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:30,代码来源:RCCacheEntryFactory.php


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