function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) { // From CategoryViewer::addPage global $wgContLang; $this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); // Customization global $wgPeopleCategories; $name = $title->getText(); if( in_array( $this->title->getText(), $wgPeopleCategories ) && strpos( $name, ' ' ) ) { $first = substr( $name, 0, strrpos( $name, ' ' ) ); $last = substr( $name, strrpos( $name, ' ' ) + 1 ); $name = $last . ', ' . $first; } if( $title->getNamespace() !== NS_MAIN ) { $name = $title->getNsText() . ':' . $name; } $linker = new Linker; if( $isRedirect ) { $this->articles[] = '<span class="redirect-in-category">' . $linker->link( $title, $name ) . '</span>'; } else { $this->articles[] = $linker->link( $title, $name ); } }
/** * Callback function to output a restriction * @param $row object Protected title * @return string Formatted <li> element */ public function formatRow($row) { wfProfileIn(__METHOD__); static $infinity = null; if (is_null($infinity)) { $infinity = wfGetDB(DB_SLAVE)->getInfinity(); } $title = Title::makeTitleSafe($row->page_namespace, $row->page_title); $link = Linker::link($title); $description_items = array(); $protType = wfMsgHtml('restriction-level-' . $row->pr_level); $description_items[] = $protType; if ($row->pr_cascade) { $description_items[] = wfMsg('protect-summary-cascade'); } $stxt = ''; $lang = $this->getLanguage(); $expiry = $lang->formatExpiry($row->pr_expiry, TS_MW); if ($expiry != $infinity) { $expiry_description = wfMsg('protect-expiring-local', $lang->timeanddate($expiry, true), $lang->date($expiry, true), $lang->time($expiry, true)); $description_items[] = htmlspecialchars($expiry_description); } if (!is_null($size = $row->page_len)) { $stxt = $lang->getDirMark() . ' ' . Linker::formatRevisionSize($size); } # Show a link to the change protection form for allowed users otherwise a link to the protection log if ($this->getUser()->isAllowed('protect')) { $changeProtection = ' (' . Linker::linkKnown($title, wfMsgHtml('protect_change'), array(), array('action' => 'unprotect')) . ')'; } else { $ltitle = SpecialPage::getTitleFor('Log'); $changeProtection = ' (' . Linker::linkKnown($ltitle, wfMsgHtml('protectlogpage'), array(), array('type' => 'protect', 'page' => $title->getPrefixedText())) . ')'; } wfProfileOut(__METHOD__); return Html::rawElement('li', array(), $lang->specialList($link . $stxt, $lang->commaList($description_items), false) . $changeProtection) . "\n"; }
/** * Add history page link to log line * * @param Title $title * @param string $timestamp * @param array $params * @return string */ public static function stabilityLogLinks($title, $timestamp, $params) { # Add history link showing edits right before the config change $hist = Linker::link($title, wfMessage('hist')->escaped(), array(), array('action' => 'history', 'offset' => $timestamp)); $hist = wfMessage('parentheses')->rawParams($hist)->escaped(); return $hist; }
/** * Callback function to output a restriction * * @param object $row Database row * @return string */ function formatRow($row) { wfProfileIn(__METHOD__); static $infinity = null; if (is_null($infinity)) { $infinity = wfGetDB(DB_SLAVE)->getInfinity(); } $title = Title::makeTitleSafe($row->pt_namespace, $row->pt_title); if (!$title) { wfProfileOut(__METHOD__); return Html::rawElement('li', array(), Html::element('span', array('class' => 'mw-invalidtitle'), Linker::getInvalidTitleDescription($this->getContext(), $row->pt_namespace, $row->pt_title))) . "\n"; } $link = Linker::link($title); $description_items = array(); $protType = $this->msg('restriction-level-' . $row->pt_create_perm)->escaped(); $description_items[] = $protType; $lang = $this->getLanguage(); $expiry = strlen($row->pt_expiry) ? $lang->formatExpiry($row->pt_expiry, TS_MW) : $infinity; if ($expiry != $infinity) { $user = $this->getUser(); $description_items[] = $this->msg('protect-expiring-local', $lang->userTimeAndDate($expiry, $user), $lang->userDate($expiry, $user), $lang->userTime($expiry, $user))->escaped(); } wfProfileOut(__METHOD__); // @todo i18n: This should use a comma separator instead of a hard coded comma, right? return '<li>' . $lang->specialList($link, implode($description_items, ', ')) . "</li>\n"; }
public function formatRow($row) { $title = Title::makeTitle($row->page_namespace, $row->page_title); // Link to page $link = Linker::link($title); // Helpful utility links $utilLinks = array(); $utilLinks[] = Linker::link($title, wfMsgHtml('stablepages-config'), array(), array('action' => 'protect'), 'known'); $utilLinks[] = Linker::link($title, wfMsgHtml('history'), array(), array('action' => 'history'), 'known'); $utilLinks[] = Linker::link(SpecialPage::getTitleFor('Log', 'stable'), wfMsgHtml('stable-logpage'), array(), array('page' => $title->getPrefixedText()), 'known'); // Autoreview/review restriction level $restr = ''; if ($row->fpc_level != '') { $restr = 'autoreview=' . htmlspecialchars($row->fpc_level); $restr = "[{$restr}]"; } // When these configuration settings expire if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) { $expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")"; } else { $expiry_description = ""; } $utilLinks = $this->getLang()->pipeList($utilLinks); return "<li>{$link} ({$utilLinks}) {$restr}<i>{$expiry_description}</i></li>"; }
function doTagRow($tag, $hitcount) { static $doneTags = array(); if (in_array($tag, $doneTags)) { return ''; } $newRow = ''; $newRow .= Xml::tags('td', null, Xml::element('code', null, $tag)); $disp = ChangeTags::tagDescription($tag); $disp .= ' '; $editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped()); $disp .= $this->msg('parentheses')->rawParams($editLink)->escaped(); $newRow .= Xml::tags('td', null, $disp); $msg = $this->msg("tag-{$tag}-description"); $desc = !$msg->exists() ? '' : $msg->parse(); $desc .= ' '; $editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped()); $desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped(); $newRow .= Xml::tags('td', null, $desc); $hitcount = $this->msg('tags-hitcount')->numParams($hitcount)->escaped(); $hitcount = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag)); $newRow .= Xml::tags('td', null, $hitcount); $doneTags[] = $tag; return Xml::tags('tr', null, $newRow) . "\n"; }
function formatValue($name, $value) { global $wgContLang; switch ($name) { case 'article_title': $articleId = $this->mCurrentRow->article_id; $title = Title::newFromID($articleId); return $title ? Linker::link($title) : '(unknown, id: ' . $articleId . ')'; break; case 'page_ns': return ($value != 0 ? $wgContLang->getNsText($value) : $this->mainNamespaceText) . " [{$value}]"; break; case 'average_time': case 'minimum_time': case 'maximum_time': return $value . " s"; break; case 'wikitext_size': case 'html_size': return sprintf("%.1f kb", $value / 1000); break; default: return $value; } }
function formatRow($row) { $time = htmlspecialchars($this->getLanguage()->userDate($row->log_timestamp, $this->getUser())); $paramsSerialized = unserialize($row->log_params); $paramsOldFormat = null; // If the params aren't serialized, it's an older log format if ($paramsSerialized === false) { $paramsOldFormat = explode("\n", $row->log_params); } $targetName = $paramsSerialized === false ? $paramsOldFormat[0] : $paramsSerialized['4::target']; $logPageId = (int) $row->log_page; $currentTitle = $logPageId && $logPageId !== 0 ? Title::newFromID($logPageId) : null; $targetTitleObj = Title::newFromText($targetName); // Make sure the target is NS_MAIN if ($targetTitleObj->getNamespace() !== NS_MAIN) { return false; } $originalNameDisplay = ''; if ($currentTitle && $targetName !== $currentTitle->getFullText()) { $originalNameDisplay = ' ' . $this->msg('newarticles-original-title')->params($targetName); } $pageLink = Linker::link($originalNameDisplay ? $currentTitle : $targetTitleObj); $articleTypeDisplay = ''; if (isset($row->pp_value) && $row->pp_value === 'portal') { $pageLink = Html::rawElement('strong', [], $pageLink); $articleTypeReadable = WRArticleType::getReadableArticleTypeFromCode($row->pp_value); $articleTypeDisplay = $this->msg('newarticles-articletype')->params($articleTypeReadable)->text(); $articleTypeDisplay = ' ' . $articleTypeDisplay; } $formattedRow = Html::rawElement('li', [], "{$time}: {$pageLink}{$articleTypeDisplay}{$originalNameDisplay}") . "\n"; return $formattedRow; }
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); }
/** * add the cite link to the toolbar * * @param $skin Skin * * @return bool */ function wfSpecialCiteToolbox(&$skin) { if (isset($skin->data['nav_urls']['cite'])) { echo Html::rawElement('li', array('id' => 't-cite'), Linker::link(SpecialPage::getTitleFor('Cite'), wfMessage('cite_article_link')->text(), Linker::tooltipAndAccessKeyAttribs('cite-article'), $skin->data['nav_urls']['cite']['args'])); } return true; }
public function getDiv($value) { global $wgOut, $wgPromoterAdPreview; if (array_key_exists('language', $this->mParams)) { $language = $this->mParams['language']; } else { $language = $wgOut->getContext()->getLanguage()->getCode(); } $html = Xml::openElement('div', array('id' => Sanitizer::escapeId("pr-ad-list-element-{$this->mParams['ad']}"), 'class' => "pr-ad-list-element")); // Make the label; this consists of a text link to the ad editor, and a series of status icons if (array_key_exists('withlabel', $this->mParams)) { $adName = $this->mParams['ad']; $html .= Xml::openElement('div', array('class' => 'pr-ad-list-element-label')); $html .= Linker::link(SpecialPage::getTitleFor('PromoterAds', "edit/{$adName}"), htmlspecialchars($adName), array('class' => 'pr-ad-list-element-label-text')); $html .= ' (' . Linker::link(SpecialPage::getTitleFor('Randompage'), $this->msg('promoter-live-preview'), array('class' => 'pr-ad-list-element-label-text'), array('ad' => $adName, 'uselang' => $language, 'force' => '1')) . ')'; // TODO: Output status icons $html .= Xml::tags('div', array('class' => 'pr-ad-list-element-label-icons'), ''); $html .= Xml::closeElement('div'); } // Add the ad preview if ($wgPromoterAdPreview) { $html .= $this->getInputHTML(null); } $html .= Xml::closeElement('div'); return $html; }
protected function getDiffLink() { if ($this->isDeleted() && !$this->canViewContent()) { return $this->list->msg('diff')->escaped(); } return Linker::link(SpecialPage::getTitleFor('Undelete'), $this->list->msg('diff')->escaped(), [], ['target' => $this->list->title->getPrefixedText(), 'diff' => 'prev', 'timestamp' => $this->revision->getTimestamp()]); }
public function link($target, $text = null, $customAttribs = array(), $query = array(), $options = array()) { wfProfileIn(__METHOD__); if (!$target instanceof Title) { return "<!-- ERROR -->{$text}"; } $options = (array) $options; $ret = null; if (!wfRunHooks('LinkBegin', array($this, $target, &$text, &$customAttribs, &$query, &$options, &$ret))) { wfProfileOut(__METHOD__); return $ret; } # Normalize the Title if it's a special page $target = $this->normaliseSpecialPage($target); # If we don't know whether the page exists, let's find out. wfProfileIn(__METHOD__ . '-checkPageExistence'); if (!in_array('known', $options) and !in_array('broken', $options)) { if ($target->isKnown()) { $options[] = 'known'; } else { $options[] = 'broken'; } } if (in_array('broken', $options)) { return $text; } return Linker::link($target, $text, $customAttribs, $query, $options); }
/** * @param Skin $skin * @return bool */ public static function onSkinTemplateToolboxEnd(&$skin) { if (isset($skin->data['nav_urls']['citeThisPage'])) { echo Html::rawElement('li', array('id' => 't-cite'), Linker::link(SpecialPage::getTitleFor('CiteThisPage'), wfMessage('citethispage-link')->escaped(), Linker::tooltipAndAccessKeyAttribs('citethispage'), $skin->data['nav_urls']['citeThisPage']['args'])); } return true; }
/** * @return array */ protected function getMessageParameters() { $entry = $this->entry->getParameters(); $params = parent::getMessageParameters(); $filter_title = SpecialPage::getTitleFor('AbuseFilter', $entry['filter']); $filter_caption = $this->msg('abusefilter-log-detailedentry-local')->params($entry['filter']); $log_title = SpecialPage::getTitleFor('AbuseLog', $entry['log']); $log_caption = $this->msg('abusefilter-log-detailslink'); $params[4] = $entry['action']; if ($this->plaintext) { $params[3] = '[[' . $filter_title->getPrefixedText() . '|' . $filter_caption . ']]'; $params[8] = '[[' . $log_title->getPrefixedText() . '|' . $log_caption . ']]'; } else { $params[3] = Message::rawParam(Linker::link($filter_title, htmlspecialchars($filter_caption))); $params[8] = Message::rawParam(Linker::link($log_title, htmlspecialchars($log_caption))); } $actions_taken = $entry['actions']; if (!strlen(trim($actions_taken))) { $actions_taken = $this->msg('abusefilter-log-noactions'); } else { $actions = explode(',', $actions_taken); $displayActions = array(); foreach ($actions as $action) { $displayActions[] = AbuseFilter::getActionDisplay($action); } $actions_taken = $this->context->getLanguage()->commaList($displayActions); } $params[5] = $actions_taken; // Bad things happen if the numbers are not in correct order ksort($params); return $params; }
public function formatRow($row) { $title = Title::newFromRow($row); # Link to page $link = Linker::link($title); # Link to page configuration $config = Linker::linkKnown(SpecialPage::getTitleFor('Stabilization'), wfMsgHtml('configuredpages-config'), array(), 'page=' . $title->getPrefixedUrl()); # Show which version is the default (stable or draft) if (intval($row->fpc_override)) { $default = wfMsgHtml('configuredpages-def-stable'); } else { $default = wfMsgHtml('configuredpages-def-draft'); } # Autoreview/review restriction level $restr = ''; if ($row->fpc_level != '') { $restr = 'autoreview=' . htmlspecialchars($row->fpc_level); $restr = "[{$restr}]"; } # When these configuration settings expire if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) { $expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")"; } else { $expiry_description = ""; } return "<li>{$link} ({$config}) <b>[{$default}]</b> " . "{$restr}<i>{$expiry_description}</i></li>"; }
function execute($category) { global $wgUser, $wgRequest, $wgOut, $wgPageSchemasHandlerClasses; if (!$wgUser->isAllowed('generatepages')) { $wgOut->permissionRequired('generatepages'); return; } $this->setHeaders(); $param = $wgRequest->getText('param'); if (!empty($param) && !empty($category)) { // Generate the pages! $this->generatePages($param, $wgRequest->getArray('page')); $text = Html::element('p', null, wfMessage('ps-generatepages-success')->parse()); $wgOut->addHTML($text); return true; } if ($category == "") { // No category listed. // TODO - show an error message. return true; } // Standard "generate pages" form, with category name set. // Check for a valid category, with a page schema defined. $pageSchemaObj = new PSSchema($category); if (!$pageSchemaObj->isPSDefined()) { $text = Html::element('p', null, wfMessage('ps-generatepages-noschema')->parse()); $wgOut->addHTML($text); return true; } $text = Html::element('p', null, wfMessage('ps-generatepages-desc')->parse()) . "\n"; $text .= '<form method="post">'; $text .= Html::input('param', $category, 'hidden') . "\n"; $text .= '<div id="ps_check_all_check_none"> <input type="button" id="ps_check_all" value="' . wfMessage('powersearch-toggleall')->parse() . '" /> <input type="button" id="ps_check_none" value="' . wfMessage('powersearch-togglenone')->parse() . '" /> </div><br/>'; $wgOut->addModules('ext.pageschemas.generatepages'); // This hook will set an array of strings, with each value // as a title of a page to be created. $pageList = array(); foreach ($wgPageSchemasHandlerClasses as $psHandlerClass) { $pagesFromHandler = call_user_func(array($psHandlerClass, "getPagesToGenerate"), $pageSchemaObj); foreach ($pagesFromHandler as $page) { $pageList[] = $page; } } foreach ($pageList as $page) { if (!$page instanceof Title) { continue; } $pageName = PageSchemas::titleString($page); $text .= Html::input('page[]', $pageName, 'checkbox', array('checked' => true)); $text .= "\n" . Linker::link($page) . "<br />\n"; } $text .= "<br />\n"; $text .= Html::input(null, wfMessage('generatepages')->parse(), 'submit'); $text .= "\n</form>"; $wgOut->addHTML($text); return true; }
/** * @return string A HTML <li> element representing this revision, showing * change tags and everything */ 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() . $formatter->getComment(); if (LogEventsList::isDeleted($this->row, LogPage::DELETED_COMMENT)) { $comment = '<span class="history-deleted">' . $comment . '</span>'; } $content = "{$loglink} {$date} {$action} {$comment}"; $attribs = array(); $tags = $this->getTags(); if ($tags) { list($tagSummary, $classes) = ChangeTags::formatSummaryRow($tags, 'edittags', $this->list->getContext()); $content .= " {$tagSummary}"; $attribs['class'] = implode(' ', $classes); } return Xml::tags('li', $attribs, $content); }
/** * @param Skin $skin * @param object $result Result row * @return string */ function formatResult($skin, $result) { global $wgContLang; $nt = Title::makeTitle($result->namespace, $result->title); $text = htmlspecialchars($wgContLang->convert($nt->getText())); if (!$this->isCached()) { // We can assume the freshest data $plink = Linker::link($nt, $text, array(), array(), array('broken')); $nlinks = $this->msg('nmembers')->numParams($result->value)->escaped(); } else { $plink = Linker::link($nt, $text); $currentValue = isset($this->currentCategoryCounts[$result->title]) ? $this->currentCategoryCounts[$result->title] : 0; $cachedValue = intval($result->value); // T76910 // If the category has been created or emptied since the list was refreshed, strike it if ($nt->isKnown() || $currentValue === 0) { $plink = "<del>{$plink}</del>"; } // Show the current number of category entries if it changed if ($currentValue !== $cachedValue) { $nlinks = $this->msg('nmemberschanged')->numParams($cachedValue, $currentValue)->escaped(); } else { $nlinks = $this->msg('nmembers')->numParams($cachedValue)->escaped(); } } return $this->getLanguage()->specialList($plink, $nlinks); }
/** * The category list template. Used by article pages on view and edit save. */ public function categories() { wfProfileIn(__METHOD__); $categories = $this->request->getVal('categories', array()); $data = array(); // Because $out->getCategoryLinks doesn't maintain the order of the stored category data, // we have to build this information ourselves manually. This is essentially the same // code from $out->addCategoryLinks() but it results in a different data format. foreach ($categories as $category) { // Support category name or category data object $name = is_array($category) ? $category['name'] : $category; $originalName = $name; $title = Title::makeTitleSafe(NS_CATEGORY, $name); if ($title != null) { $this->wg->ContLang->findVariantLink($name, $title, true); if ($name != $originalName && array_key_exists($name, $data)) { continue; } $text = $this->wg->ContLang->convertHtml($title->getText()); $data[$name] = array('link' => Linker::link($title, $text), 'name' => $text, 'type' => CategoryHelper::getCategoryType($originalName)); } else { \Wikia\Logger\WikiaLogger::instance()->warning("Unsafe category provided", ['name' => $name]); } } $this->response->setVal('categories', $data); wfProfileOut(__METHOD__); }
function execute($par) { $out = $this->getOutput(); $this->setHeaders(); $this->outputHeader(); $opts = new FormOptions(); $opts->add('target', ''); $opts->add('namespace', '', FormOptions::INTNULL); $opts->add('limit', 50); $opts->add('from', 0); $opts->add('back', 0); $opts->add('hideredirs', false); $opts->add('hidetrans', false); $opts->add('hidelinks', false); $opts->add('hideimages', false); $opts->fetchValuesFromRequest($this->getRequest()); $opts->validateIntBounds('limit', 0, 5000); // Give precedence to subpage syntax if (isset($par)) { $opts->setValue('target', $par); } // Bind to member variable $this->opts = $opts; $this->target = Title::newFromURL($opts->getValue('target')); if (!$this->target) { $out->addHTML($this->whatlinkshereForm()); return; } $this->getSkin()->setRelevantTitle($this->target); $this->selfTitle = $this->getTitle($this->target->getPrefixedDBkey()); $out->setPageTitle(wfMsg('whatlinkshere-title', $this->target->getPrefixedText())); $out->setSubtitle(wfMsg('whatlinkshere-backlink', Linker::link($this->target, $this->target->getPrefixedText(), array(), array('redirect' => 'no')))); $this->showIndirectLinks(0, $this->target, $opts->getValue('limit'), $opts->getValue('from'), $opts->getValue('back')); }
static function formatLogEntry($type, $action, $title, $sk, $parameters) { $msg = "lqt-log-action-{$action}"; switch ($action) { case 'merge': if ($parameters[0]) { $msg = 'lqt-log-action-merge-across'; } else { $msg = 'lqt-log-action-merge-down'; } break; case 'move': $smt = new SpecialMoveThread(); $rightsCheck = $smt->checkUserRights($parameters[1] instanceof Title ? $parameters[1] : Title::newFromText($parameters[1]), $parameters[0] instanceof Title ? $parameters[0] : Title::newFromText($parameters[0])); if ($rightsCheck === true) { $parameters[] = Message::rawParam(Linker::link(SpecialPage::getTitleFor('MoveThread', $title), wfMessage('revertmove')->text(), array(), array('dest' => $parameters[0]))); } else { $parameters[] = ''; } break; default: // Give grep a chance to find the usages: // lqt-log-action-move, lqt-log-action-split, lqt-log-action-subjectedit, // lqt-log-action-resort, lqt-log-action-signatureedit $msg = "lqt-log-action-{$action}"; break; } array_unshift($parameters, $title->getPrefixedText()); $html = wfMessage($msg, $parameters); if ($sk === null) { return StringUtils::delimiterReplace('<', '>', '', $html->inContentLanguage()->parse()); } return $html->parse(); }
public function formatRow($row) { $title = Title::newFromRow($row); $link = Linker::link($title); # Link to page $dirmark = $this->getLanguage()->getDirMark(); # Direction mark $stxt = ''; # Size (bytes) if (!is_null($size = $row->page_len)) { if ($size == 0) { $stxt = ' <small>' . $this->msg('historyempty')->escaped() . '</small>'; } else { $stxt = ' <small>' . $this->msg('historysize')->numParams($size)->escaped() . '</small>'; } } # Link to list of reviewed versions for page $list = Linker::linkKnown(SpecialPage::getTitleFor('ReviewedVersions'), $this->msg('reviewedpages-all')->escaped(), array(), 'page=' . $title->getPrefixedUrl()); # Link to highest tier rev $best = ''; if (FlaggedRevs::qualityVersions()) { $best = Linker::linkKnown($title, $this->msg('reviewedpages-best')->escaped(), array(), 'stableid=best'); $best = " [{$best}]"; } return "<li>{$link} {$dirmark} {$stxt} ({$list}){$best}</li>"; }
public function execute($params = false) { $sEditLinkText = wfMessage('bs-widget-edit')->text(); $oTitle = Title::makeTitle(NS_USER, RequestContext::getMain()->getUser()->getName() . '/Widgetbar'); $sEditLink = Linker::link($oTitle, Html::rawElement('span', array(), $sEditLinkText), array('id' => 'bs-widgetbar-edit', 'class' => 'icon-pencil clearfix'), array('action' => 'edit', 'preload' => '')); $aOut = array(); $aOut[] = '<div id="bs-widget-container" >'; $aOut[] = ' <div class="icon-plus" id="bs-widget-tab" title="' . wfMessage('bs-widget-container-tooltip')->text() . '" tabindex="100">[+/-]</div>'; $aOut[] = ' <div id="bs-flyout">'; $aOut[] = ' <h4 id="bs-flyout-heading">' . wfMessage('bs-widget-flyout-heading')->text() . '</h4>'; $aOut[] = ' <div id="bs-flyout-content">'; $aOut[] = ' <div id="bs-flyout-content-widgets">'; $aOut[] = ' <h4 id="bs-flyout-content-widgets-header">' . wfMessage("bs-widget-flyout-heading")->plain() . $sEditLink . '</h4>'; foreach ($this->_mWidgets as $oWidgetView) { if ($oWidgetView instanceof ViewWidget) { $aOut[] = $oWidgetView->execute(); } else { wfDebug(__METHOD__ . ': Invalid widget.'); } } $aOut[] = ' </div>'; $aOut[] = ' </div>'; $aOut[] = ' </div>'; $aOut[] = '</div>'; return implode("\n", $aOut); }
/** * @param $skin Skin * @param $result * @return string */ function formatResult($skin, $result) { $title = Title::makeTitleSafe($result->namespace, $result->title); $count = $this->msg('ncategories')->numParams($result->value)->escaped(); $link = Linker::link($title); return $this->getLanguage()->specialList($link, $count); }
function doTagRow($tag, $hitcount) { $user = $this->getUser(); $newRow = ''; $newRow .= Xml::tags('td', null, Xml::element('code', null, $tag)); $disp = ChangeTags::tagDescription($tag); if ($user->isAllowed('editinterface')) { $disp .= ' '; $editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped()); $disp .= $this->msg('parentheses')->rawParams($editLink)->escaped(); } $newRow .= Xml::tags('td', null, $disp); $msg = $this->msg("tag-{$tag}-description"); $desc = !$msg->exists() ? '' : $msg->parse(); if ($user->isAllowed('editinterface')) { $desc .= ' '; $editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped()); $desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped(); } $newRow .= Xml::tags('td', null, $desc); $active = isset($this->definedTags[$tag]) ? 'tags-active-yes' : 'tags-active-no'; $active = $this->msg($active)->escaped(); $newRow .= Xml::tags('td', null, $active); $hitcountLabel = $this->msg('tags-hitcount')->numParams($hitcount)->escaped(); $hitcountLink = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcountLabel, array(), array('tagfilter' => $tag)); // add raw $hitcount for sorting, because tags-hitcount contains numbers and letters $newRow .= Xml::tags('td', array('data-sort-value' => $hitcount), $hitcountLink); return Xml::tags('tr', null, $newRow) . "\n"; }
/** * Shows link to Special:Renameuser on Special:Contributions/foo * * @param $id * @param $nt Title * @param $tools * * @return bool */ public static function onContributionsToolLinks($id, $nt, &$tools) { global $wgUser; if ($wgUser->isAllowed('renameuser') && $id) { $tools[] = Linker::link(SpecialPage::getTitleFor('Renameuser'), wfMessage('renameuser-linkoncontribs')->escaped(), array('title' => wfMessage('renameuser-linkoncontribs-text')->parse()), array('oldusername' => $nt->getText())); } return true; }
function formatResult($skin, $result) { global $wgContLang, $wgLang; $nt = Title::makeTitle(NS_MAIN, $result->title); $text = $wgContLang->convert($nt->getPrefixedText()); $plink = Linker::link($nt, htmlspecialchars($text), array(), array(), "known"); return wfMsgExt('crossnamespacelinkstext', array('parsemag'), $plink, $wgLang->formatNum($result->namespace), htmlspecialchars($wgLang->getNsText($result->value))); }
/** * Shows link to Special:Nuke on Special:Contributions/username if applicable * * @param $userId Integer * @param $userPageTitle Title * @param $toolLinks Array * * @return true */ public static function nukeContributionsLinks($userId, $userPageTitle, &$toolLinks) { global $wgUser; if ($wgUser->isAllowed('nuke')) { $toolLinks[] = Linker::link(SpecialPage::getTitleFor('Nuke'), wfMessage('nuke-linkoncontribs')->escaped(), array('title' => wfMessage('nuke-linkoncontribs-text')->text()), array('target' => $userPageTitle->getText())); } return true; }
/** * @param string $name * @return array */ protected function getCentralAuthLink($name) { $title = Title::makeTitle(NS_SPECIAL, 'CentralAuth/' . $name); if ($this->plaintext) { return "[[{$title->getPrefixedText()}]]"; } return Message::rawParam(Linker::link($title, htmlspecialchars($name))); }