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


PHP Linker::link方法代码示例

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


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

示例1: addPage

	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 );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:PeopleCategories.body.php

示例2: formatRow

 /**
  * 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";
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:SpecialProtectedpages.php

示例3: stabilityLogLinks

 /**
  * 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;
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:15,代码来源:FlaggedRevsLogView.php

示例4: formatRow

 /**
  * 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";
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:32,代码来源:SpecialProtectedtitles.php

示例5: formatRow

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

示例6: doTagRow

 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";
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:25,代码来源:SpecialTags.php

示例7: formatValue

 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;
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:25,代码来源:ParserSpeedTablePager.class.php

示例8: formatRow

 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;
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-WRNewArticles,代码行数:32,代码来源:SpecialNewArticles.php

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

示例10: wfSpecialCiteToolbox

/**
 * 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;
}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:14,代码来源:SpecialCite.php

示例11: getDiv

 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;
 }
开发者ID:kolzchut,项目名称:mediawiki-extensions-Promoter,代码行数:26,代码来源:HTMLPromoterAd.php

示例12: getDiffLink

 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()]);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:7,代码来源:RevDelArchiveItem.php

示例13: link

 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);
 }
开发者ID:kiwix,项目名称:tools,代码行数:28,代码来源:KiwixBaseSkin.php

示例14: onSkinTemplateToolboxEnd

 /**
  * @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;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:11,代码来源:CiteThisPage.hooks.php

示例15: getMessageParameters

 /**
  * @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;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:35,代码来源:AbuseLogHitFormatter.php


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