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


PHP Title::newFromLinkTarget方法代码示例

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


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

示例1: getTitle

 /**
  * @return Title
  * @deprecated Internal class use only
  */
 public function getTitle()
 {
     if (!$this->title) {
         $this->title = Title::newFromLinkTarget($this->linkTarget);
     }
     return $this->title;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:11,代码来源:WatchedItem.php

示例2: renderHtmlLink

 /**
  * Returns an HTML link to the given page, using the given surface text.
  *
  * @param LinkTarget $linkTarget The link's target
  * @param string $text The link's surface text (will be derived from $page if not given).
  *
  * @return string
  */
 public function renderHtmlLink(LinkTarget $linkTarget, $text = null)
 {
     if ($text === null) {
         $text = $this->formatter->getFullText($linkTarget);
     }
     // TODO: move the logic implemented by Linker here,
     // using $this->formatter and $this->baseUrl, and
     // re-implement Linker to use a HtmlPageLinkRenderer.
     if ($linkTarget instanceof Title) {
         $title = $linkTarget;
     } else {
         $title = Title::newFromLinkTarget($linkTarget);
     }
     $link = Linker::link($title, htmlspecialchars($text));
     return $link;
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:24,代码来源:MediaWikiPageLinkRenderer.php

示例3: testCategorizeTypeParameter

 public function testCategorizeTypeParameter()
 {
     $user = $this->getLoggedInTestUser();
     $subjectTarget = new TitleValue(0, 'ApiQueryWatchlistIntegrationTestPage');
     $categoryTarget = new TitleValue(NS_CATEGORY, 'ApiQueryWatchlistIntegrationTestCategory');
     $this->doPageEdits($user, [['target' => $categoryTarget, 'content' => 'Some Content', 'summary' => 'Create the category'], ['target' => $subjectTarget, 'content' => 'Some Content [[Category:ApiQueryWatchlistIntegrationTestCategory]]t', 'summary' => 'Create the page and add it to the category']]);
     $title = Title::newFromLinkTarget($subjectTarget);
     $revision = Revision::newFromTitle($title);
     $rc = RecentChange::newForCategorization($revision->getTimestamp(), Title::newFromLinkTarget($categoryTarget), $user, $revision->getComment(), $title, 0, $revision->getId(), null, false);
     $rc->save();
     $this->watchPages($user, [$subjectTarget, $categoryTarget]);
     $result = $this->doListWatchlistRequest(['wlprop' => 'title', 'wltype' => 'categorize']);
     $this->assertEquals([['type' => 'categorize', 'ns' => $categoryTarget->getNamespace(), 'title' => $this->getPrefixedText($categoryTarget)]], $this->getItemsFromApiResponse($result));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:ApiQueryWatchlistIntegrationTest.php

示例4: formatTemplate

 /**
  * Builds an <li> item for an individual template
  *
  * @param LinkTarget $target
  * @return string
  */
 private function formatTemplate(LinkTarget $target)
 {
     // TODO Would be nice if we didn't have to use Title here
     $titleObj = Title::newFromLinkTarget($target);
     $protected = $this->getRestrictionsText($titleObj->getRestrictions('edit'));
     $editLink = $this->buildEditLink($titleObj);
     return '<li>' . $this->linkRenderer->makeLink($target) . $this->context->msg('word-separator')->escaped() . $this->context->msg('parentheses')->rawParams($editLink)->escaped() . $this->context->msg('word-separator')->escaped() . $protected . '</li>';
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:TemplatesOnThisPageFormatter.php

示例5: duplicateAllAssociatedEntries

 /**
  * Check if the given title already is watched by the user, and if so
  * add a watch for the new title.
  *
  * To be used for page renames and such.
  *
  * @param LinkTarget $oldTarget
  * @param LinkTarget $newTarget
  */
 public function duplicateAllAssociatedEntries(LinkTarget $oldTarget, LinkTarget $newTarget)
 {
     $oldTarget = Title::newFromLinkTarget($oldTarget);
     $newTarget = Title::newFromLinkTarget($newTarget);
     $this->duplicateEntry($oldTarget->getSubjectPage(), $newTarget->getSubjectPage());
     $this->duplicateEntry($oldTarget->getTalkPage(), $newTarget->getTalkPage());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:16,代码来源:WatchedItemStore.php

示例6: getImageLinkMTOParams

 /**
  * Get the link parameters for MediaTransformOutput::toHtml() from given
  * frame parameters supplied by the Parser.
  * @param array $frameParams The frame parameters
  * @param string $query An optional query string to add to description page links
  * @param Parser|null $parser
  * @return array
  */
 private static function getImageLinkMTOParams($frameParams, $query = '', $parser = null)
 {
     $mtoParams = [];
     if (isset($frameParams['link-url']) && $frameParams['link-url'] !== '') {
         $mtoParams['custom-url-link'] = $frameParams['link-url'];
         if (isset($frameParams['link-target'])) {
             $mtoParams['custom-target-link'] = $frameParams['link-target'];
         }
         if ($parser) {
             $extLinkAttrs = $parser->getExternalLinkAttribs($frameParams['link-url']);
             foreach ($extLinkAttrs as $name => $val) {
                 // Currently could include 'rel' and 'target'
                 $mtoParams['parser-extlink-' . $name] = $val;
             }
         }
     } elseif (isset($frameParams['link-title']) && $frameParams['link-title'] !== '') {
         $mtoParams['custom-title-link'] = Title::newFromLinkTarget(self::normaliseSpecialPage($frameParams['link-title']));
     } elseif (!empty($frameParams['no-link'])) {
         // No link
     } else {
         $mtoParams['desc-link'] = true;
         $mtoParams['desc-query'] = $query;
     }
     return $mtoParams;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:33,代码来源:Linker.php


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