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


PHP WikiPage::getRedirectTarget方法代码示例

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


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

示例1: efSharedHelpArticleCreation

/**
 * @param WikiPage $article
 * @param $user
 * @param $text
 * @param $summary
 * @param $minoredit
 * @param $watchthis
 * @param $sectionanchor
 * @param $flags
 * @param $revision
 * @param Status $status
 * @param $baseRevId
 * @return bool
 */
function efSharedHelpArticleCreation(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
{
    global $wgCityId, $wgHelpWikiId;
    // only run on help wikis
    if ($wgCityId !== $wgHelpWikiId) {
        return true;
    }
    // not likely if we got here, but... healthy paranoia ;)
    if (wfReadOnly()) {
        return true;
    }
    if ($article->mTitle->getNamespace() !== NS_HELP) {
        return true;
    }
    if (!$status->isOK()) {
        return true;
    }
    if (!($flags & EDIT_NEW)) {
        return true;
    }
    $talkTitle = Title::newFromText($article->mTitle->getText(), NS_HELP_TALK);
    if ($talkTitle->exists()) {
        return true;
    }
    $talkArticle = new Article($talkTitle);
    $redir = $article->getRedirectTarget();
    if ($redir) {
        $target = $redir->getTalkNsText() . ':' . $redir->getText();
        $talkArticle->doEdit("#REDIRECT [[{$target}]]", wfMsgForContent('sharedhelp-autotalkcreate-summary'));
    } else {
        $talkArticle->doEdit('{{talkheader}}', wfMsgForContent('sharedhelp-autotalkcreate-summary'));
    }
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:48,代码来源:SharedHelpArticleCreation.php

示例2: findTitle

 /**
  * Assuming the user's interface language is fi. Given input Page, it
  * returns Page/fi if it exists, otherwise Page. Given input Page/de,
  * it returns Page/fi if it exists, otherwise Page/de if it exists,
  * otherwise Page.
  *
  * @param string $par
  * @return Title|null
  */
 public function findTitle($par)
 {
     // base = title without language code suffix
     // provided = the title as it was given
     $base = $provided = Title::newFromText($par);
     if ($base && strpos($par, '/') !== false) {
         $pos = strrpos($par, '/');
         $basepage = substr($par, 0, $pos);
         $code = substr($par, $pos + 1);
         if (strlen($code) && Language::isKnownLanguageTag($code)) {
             $base = Title::newFromText($basepage);
         }
     }
     if (!$base) {
         return null;
     }
     if ($base->isRedirect()) {
         $page = new WikiPage($base);
         $base = $page->getRedirectTarget();
     }
     $uiCode = $this->getLanguage()->getCode();
     $proposed = $base->getSubpage($uiCode);
     if ($uiCode !== $this->getConfig()->get('LanguageCode') && $proposed && $proposed->exists()) {
         return $proposed;
     } elseif ($provided && $provided->exists()) {
         return $provided;
     } else {
         return $base;
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:39,代码来源:SpecialMyLanguage.php

示例3: getRedirectTarget

	/**
	 * @return mixed|null|Title
	 */
	public function getRedirectTarget() {
		$this->loadFile();
		if ( $this->mFile->isLocal() ) {
			return parent::getRedirectTarget();
		}
		// Foreign image page
		$from = $this->mFile->getRedirected();
		$to = $this->mFile->getName();
		if ( $from == $to ) {
			return null;
		}
		return $this->mRedirectTarget = Title::makeTitle( NS_FILE, $to );
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:16,代码来源:WikiFilePage.php

示例4: resolveRedirect

 /**
  * Get target title if the current title is a redirect.
  * It doesn't handle
  *
  * @param $title Title|GlobalTitle
  * @return Title|GlobalTitle
  */
 protected function resolveRedirect($title)
 {
     $origTitle = $title;
     if ($title instanceof GlobalTitle) {
         if ($title->isRedirect()) {
             $target = $title->getRedirectTarget();
             if ($target) {
                 $title = $target;
             }
         }
     } else {
         if ($title instanceof Title) {
             if ($title->isRedirect()) {
                 $page = new WikiPage($title);
                 $target = $page->getRedirectTarget();
                 if ($target->exists()) {
                     $title = $target;
                 }
             }
         }
     }
     return $title;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:30,代码来源:ResourceLoaderGlobalWikiModule.class.php

示例5: resolveRedirect

 /**
  * Get target title if the current title is a redirect.
  * It doesn't handle
  *
  * @param $title Title|GlobalTitle
  * @return Title|GlobalTitle
  */
 protected function resolveRedirect($title)
 {
     wfProfileIn(__METHOD__);
     if ($title instanceof GlobalTitle) {
         if ($title->isRedirect()) {
             $target = $title->getRedirectTarget();
             if ($target) {
                 $title = $target;
             }
         }
     } else {
         if ($title instanceof Title) {
             if ($title->isRedirect()) {
                 $page = new WikiPage($title);
                 $target = $page->getRedirectTarget();
                 if ($target->exists()) {
                     $title = $target;
                 }
             }
         }
     }
     wfProfileOut(__METHOD__);
     return $title;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:ResourceLoaderGlobalWikiModule.class.php

示例6: getNextArticleToPatrolInner


//.........这里部分代码省略.........
     // has the user skipped any articles?
     $cookiename = $wgCookiePrefix . "Rcskip";
     $skipids = "";
     if (isset($_COOKIE[$cookiename])) {
         $cookie_ids = array_unique(split(",", $_COOKIE[$cookiename]));
         $ids = array();
         //safety first
         foreach ($cookie_ids as $id) {
             $id = intval($id);
             if ($id > 0) {
                 $ids[] = $id;
             }
         }
         if ($ids) {
             $skipids = " AND rc_cur_id NOT IN (" . implode(",", $ids) . ") ";
         }
     }
     $sql .= "{$skipids} ORDER BY rc_timestamp " . ($reverse == 1 ? "" : "DESC ") . "LIMIT 1";
     $res = $dbr->query($sql, __METHOD__);
     $row = $res->fetchObject();
     /*$show=true;
     if ($show){
     var_dump($_GET);
     var_dump($_POST);
     echo $sql;
     var_dump($row);
     exit;
     }*/
     if ($row) {
         $result = array();
         $t = Title::makeTitle($row->rc_namespace, $row->rc_title);
         if ($t->isRedirect()) {
             $wp = new WikiPage($t);
             $t = $wp->getRedirectTarget();
         }
         // if title has been deleted set $t to null so we will skip it
         if (!$t->exists()) {
             MWDebug::log("{$t} does not exist");
             $t = null;
         }
         $result['rc_cur_id'] = $row->rc_cur_id;
         if ($rc_user_filter) {
             $result['rchi'] = $result['rclo'] = $row->rc_id;
             $result['new'] = $dbr->selectField('recentchanges', array('rc_this_oldid'), array('rc_id' => $row->rc_id));
         } else {
             // always compare to current version
             $result['new'] = $dbr->selectField('revision', array('max(rev_id)'), array('rev_page' => $row->rc_cur_id));
             $result['rchi'] = $dbr->selectField('recentchanges', array('rc_id'), array('rc_this_oldid' => $result['new']));
             $result['rclo'] = $dbr->selectField('recentchanges', array('min(rc_id)'), array('rc_patrolled' => 0, "rc_cur_id" => $row->rc_cur_id));
             // do we have a reverted edit caught between these 2?
             // if so, only show the reversion, because otherwise you get the reversion trapped in the middle
             // and it shows a weird diff page.
             $hi = isset($result['rchi']) ? $result['rchi'] : $row->rc_id;
             if ($hi) {
                 $reverted_id = $dbr->selectField('recentchanges', array('min(rc_id)'), array('rc_comment like ' . $dbr->addQuotes($rollbackCommentPrefix . '%'), "rc_id < {$hi}", "rc_id >= {$result['rclo']}", "rc_cur_id" => $row->rc_cur_id));
                 if ($reverted_id) {
                     $result['rchi'] = $reverted_id;
                     $result['new'] = $dbr->selectField('recentchanges', array('rc_this_oldid'), array('rc_id' => $reverted_id));
                     $row->rc_id = $result['rchi'];
                 }
                 //} else {
                 //	$email = new MailAddress("alerts@wikihow.com");
                 //	$subject = "Could not find hi variable " . date("r");
                 //	$body = print_r($_SERVER, true) . "\n\n" . $sql . "\n\n" . print_r($result, true) . "\n\n\$hi: " . $hi;
                 //	UserMailer::send($email, $email, $subject, $body);
             }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:67,代码来源:RCPatrol.body.php


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