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


PHP Title::isRedirect方法代码示例

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


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

示例1: getRedirectTarget

	/**
	 * If this page is a redirect, get its target
	 *
	 * The target will be fetched from the redirect table if possible.
	 * If this page doesn't have an entry there, call insertRedirect()
	 * @return Title|mixed object, or null if this page is not a redirect
	 */
	public function getRedirectTarget() {
		if ( !$this->mTitle->isRedirect() ) {
			return null;
		}

		if ( $this->mRedirectTarget !== null ) {
			return $this->mRedirectTarget;
		}

		// Query the redirect table
		$dbr = wfGetDB( DB_SLAVE );
		$row = $dbr->selectRow( 'redirect',
			array( 'rd_namespace', 'rd_title', 'rd_fragment', 'rd_interwiki' ),
			array( 'rd_from' => $this->getId() ),
			__METHOD__
		);

		// rd_fragment and rd_interwiki were added later, populate them if empty
		if ( $row && !is_null( $row->rd_fragment ) && !is_null( $row->rd_interwiki ) ) {
			return $this->mRedirectTarget = Title::makeTitle(
				$row->rd_namespace, $row->rd_title,
				$row->rd_fragment, $row->rd_interwiki );
		}

		// This page doesn't have an entry in the redirect table
		return $this->mRedirectTarget = $this->insertRedirect();
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:34,代码来源:WikiPage.php

示例2: followRedirect

 /**
  * Function to follow redirects
  *
  * @param $title Title
  * @return Title|null null if the page is an interwiki redirect
  */
 public static function followRedirect(Title $title)
 {
     if (!$title->isRedirect()) {
         return $title;
     }
     $wikipage = WikiPage::factory($title);
     $target = $wikipage->followRedirect();
     if ($target instanceof Title) {
         return $target;
     } else {
         return null;
         // Interwiki redirect
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:20,代码来源:MassMessage.body.php

示例3: buildBacklinkSubtitle

 /**
  * Build message object for a subtitle containing a backlink to a page
  *
  * @param Title $title Title to link to
  * @param array $query Array of additional parameters to include in the link
  * @return Message
  * @since 1.25
  */
 public static function buildBacklinkSubtitle(Title $title, $query = array())
 {
     if ($title->isRedirect()) {
         $query['redirect'] = 'no';
     }
     return wfMessage('backlinksubtitle')->rawParams(Linker::link($title, null, array(), $query));
 }
开发者ID:GoProjectOwner,项目名称:mediawiki,代码行数:15,代码来源:OutputPage.php

示例4: addBacklinkSubtitle

 /**
  * Add a subtitle containing a backlink to a page
  *
  * @param Title $title Title to link to
  */
 public function addBacklinkSubtitle(Title $title)
 {
     $query = array();
     if ($title->isRedirect()) {
         $query['redirect'] = 'no';
     }
     $this->addSubtitle($this->msg('backlinksubtitle')->rawParams(Linker::link($title, null, array(), $query)));
 }
开发者ID:spring,项目名称:spring-website,代码行数:13,代码来源:OutputPage.php

示例5: getLinkColour

 /**
  * Return the CSS colour of a known link
  *
  * @param Title $t
  * @param int $threshold User defined threshold
  * @return string CSS class
  */
 public static function getLinkColour($t, $threshold)
 {
     $colour = '';
     if ($t->isRedirect()) {
         # Page is a redirect
         $colour = 'mw-redirect';
     } elseif ($threshold > 0 && $t->isContentPage() && $t->exists() && $t->getLength() < $threshold) {
         # Page is a stub
         $colour = 'stub';
     }
     return $colour;
 }
开发者ID:paladox,项目名称:2,代码行数:19,代码来源:Linker.php

示例6: isMainPage

 /**
  * Check if page is the main page after follow redirect when followRedirects is true.
  *
  * @param Title $title Title object to check
  * @return boolean
  */
 protected function isMainPage($title)
 {
     if ($title->isRedirect() && $this->followRedirects) {
         $wp = $this->makeWikiPage($title);
         $target = $wp->getRedirectTarget();
         if ($target) {
             return $target->isMainPage();
         }
     }
     return $title->isMainPage();
 }
开发者ID:negati-ve,项目名称:openshift-mediawiki,代码行数:17,代码来源:ApiMobileView.php

示例7: getLinkColour

 /**
  * Return the CSS colour of a known link
  *
  * @param Title $t
  * @param integer $threshold user defined threshold
  * @return string CSS class
  */
 function getLinkColour($t, $threshold)
 {
     $colour = '';
     if ($t->isRedirect()) {
         # Page is a redirect
         $colour = 'mw-redirect';
     } elseif ($threshold > 0 && $t->exists() && $t->getLength() < $threshold && MWNamespace::isContent($t->getNamespace())) {
         # Page is a stub
         $colour = 'stub';
     }
     return $colour;
 }
开发者ID:akoehn,项目名称:wikireader,代码行数:19,代码来源:Linker.php


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