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


PHP Title::getInterwiki方法代码示例

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


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

示例1: deleteSubject

 /**
  * @see SMWStore::deleteSubject
  *
  * @since 1.8
  * @param Title $title
  */
 public function deleteSubject(Title $title)
 {
     // @deprecated since 2.1, use 'SMW::SQLStore::BeforeDeleteSubjectComplete'
     wfRunHooks('SMWSQLStore3::deleteSubjectBefore', array($this->store, $title));
     wfRunHooks('SMW::SQLStore::BeforeDeleteSubjectComplete', array($this->store, $title));
     $id = $this->store->getObjectIds()->getSMWPageID($title->getDBkey(), $title->getNamespace(), $title->getInterwiki(), '', false);
     $emptySemanticData = new SemanticData(DIWikiPage::newFromTitle($title));
     $subobjects = $this->getSubobjects($emptySemanticData->getSubject());
     $this->doDataUpdate($emptySemanticData);
     if ($title->getNamespace() === SMW_NS_CONCEPT) {
         // make sure to clear caches
         $db = $this->store->getConnection();
         $db->delete('smw_fpt_conc', array('s_id' => $id), 'SMW::deleteSubject::Conc');
         $db->delete(SMWSQLStore3::CONCEPT_CACHE_TABLE, array('o_id' => $id), 'SMW::deleteSubject::Conccache');
     }
     // Mark subject/subobjects with a special IW, the final removal is being
     // triggered by the `ByIdDataRebuildDispatcher`
     $this->store->getObjectIds()->updateInterwikiField($id, $emptySemanticData->getSubject(), SMW_SQL3_SMWDELETEIW);
     foreach ($subobjects as $smw_id => $subobject) {
         $this->store->getObjectIds()->updateInterwikiField($smw_id, $subobject, SMW_SQL3_SMWDELETEIW);
     }
     // 1.9.0.1
     // The update of possible associative entities is handled by DeleteSubjectJob which is invoked during
     // the ArticleDelete hook
     // @deprecated since 2.1, use 'SMW::SQLStore::AfterDeleteSubjectComplete'
     wfRunHooks('SMWSQLStore3::deleteSubjectAfter', array($this->store, $title));
     wfRunHooks('SMW::SQLStore::AfterDeleteSubjectComplete', array($this->store, $title));
 }
开发者ID:ReachingOut,项目名称:SemanticMediaWiki,代码行数:34,代码来源:SMW_SQLStore3_Writers.php

示例2: getInexpensiveTitleData

 /**
  * Extract inexpensive information from a Title object for return to Lua
  *
  * @param $title Title Title to return
  * @return array Lua data
  */
 private function getInexpensiveTitleData(Title $title)
 {
     $ns = $title->getNamespace();
     $ret = array('isLocal' => (bool) $title->isLocal(), 'interwiki' => $title->getInterwiki(), 'namespace' => $ns, 'nsText' => $title->getNsText(), 'text' => $title->getText(), 'fragment' => $title->getFragment(), 'thePartialUrl' => $title->getPartialURL());
     if ($ns === NS_SPECIAL) {
         // Core doesn't currently record special page links, but it may in the future.
         if ($this->getParser() && !$title->equals($this->getTitle())) {
             $this->getParser()->getOutput()->addLink($title);
         }
         $ret['exists'] = (bool) SpecialPageFactory::exists($title->getDBkey());
     }
     if ($ns !== NS_FILE && $ns !== NS_MEDIA) {
         $ret['file'] = false;
     }
     return $ret;
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:22,代码来源:TitleLibrary.php

示例3: makeRedirectContent

 /**
  * Returns a WikitextContent object representing a redirect to the given destination page.
  *
  * @param Title $destination The page to redirect to.
  * @param string $text Text to include in the redirect, if possible.
  *
  * @return Content
  *
  * @see ContentHandler::makeRedirectContent
  */
 public function makeRedirectContent(Title $destination, $text = '')
 {
     $optionalColon = '';
     if ($destination->getNamespace() == NS_CATEGORY) {
         $optionalColon = ':';
     } else {
         $iw = $destination->getInterwiki();
         if ($iw && Language::fetchLanguageName($iw, null, 'mw')) {
             $optionalColon = ':';
         }
     }
     $mwRedir = MagicWord::get('redirect');
     $redirectText = $mwRedir->getSynonym(0) . ' [[' . $optionalColon . $destination->getFullText() . ']]';
     if ($text != '') {
         $redirectText .= "\n" . $text;
     }
     return new WikitextContent($redirectText);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:28,代码来源:WikitextContentHandler.php

示例4: deleteSubject

 /**
  * @see SMWStore::deleteSubject
  *
  * @since 1.8
  * @param Title $title
  */
 public function deleteSubject(Title $title)
 {
     // @deprecated since 2.1, use 'SMW::SQLStore::BeforeDeleteSubjectComplete'
     \Hooks::run('SMWSQLStore3::deleteSubjectBefore', array($this->store, $title));
     \Hooks::run('SMW::SQLStore::BeforeDeleteSubjectComplete', array($this->store, $title));
     // Fetch all possible matches (including any duplicates created by
     // incomplete rollback or DB deadlock)
     $ids = $this->store->getObjectIds()->getListOfIdMatchesFor($title->getDBkey(), $title->getNamespace(), $title->getInterwiki());
     $subject = DIWikiPage::newFromTitle($title);
     $emptySemanticData = new SemanticData($subject);
     $this->entitySubobjectListIterator->setSubject($emptySemanticData->getSubject());
     $subobjects = $this->entitySubobjectListIterator->getIterator();
     $this->doDataUpdate($emptySemanticData);
     foreach ($ids as $id) {
         $this->doDelete($id, $subject, $subobjects);
     }
     // @deprecated since 2.1, use 'SMW::SQLStore::AfterDeleteSubjectComplete'
     \Hooks::run('SMWSQLStore3::deleteSubjectAfter', array($this->store, $title));
     \Hooks::run('SMW::SQLStore::AfterDeleteSubjectComplete', array($this->store, $title));
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:26,代码来源:SMW_SQLStore3_Writers.php

示例5: deleteSubject

 /**
  * @see SMWStore::deleteSubject
  *
  * @since 1.8
  * @param Title $title
  */
 public function deleteSubject(Title $title)
 {
     // @deprecated since 2.1, use 'SMW::SQLStore::BeforeDeleteSubjectComplete'
     \Hooks::run('SMWSQLStore3::deleteSubjectBefore', array($this->store, $title));
     \Hooks::run('SMW::SQLStore::BeforeDeleteSubjectComplete', array($this->store, $title));
     // Fetch all possible matches (including any duplicates created by
     // incomplete rollback or DB deadlock)
     $ids = $this->store->getObjectIds()->getListOfIdMatchesFor($title->getDBkey(), $title->getNamespace(), $title->getInterwiki());
     $subject = DIWikiPage::newFromTitle($title);
     $emptySemanticData = new SemanticData($subject);
     $subobjects = $this->getSubobjects($emptySemanticData->getSubject());
     $this->doDataUpdate($emptySemanticData);
     foreach ($ids as $id) {
         $this->doDeleteReferencesFor($id, $subject, $subobjects);
     }
     // 1.9.0.1
     // The update of possible associative entities is handled by DeleteSubjectJob which is invoked during
     // the ArticleDelete hook
     // @deprecated since 2.1, use 'SMW::SQLStore::AfterDeleteSubjectComplete'
     \Hooks::run('SMWSQLStore3::deleteSubjectAfter', array($this->store, $title));
     \Hooks::run('SMW::SQLStore::AfterDeleteSubjectComplete', array($this->store, $title));
 }
开发者ID:jaideraf,项目名称:SemanticMediaWiki,代码行数:28,代码来源:SMW_SQLStore3_Writers.php

示例6: isSubpageOf

 /**
  * Check if this title is a subpage of another title
  *
  * @param Title $title
  * @return bool
  */
 public function isSubpageOf(Title $title)
 {
     return $this->getInterwiki() === $title->getInterwiki() && $this->getNamespace() == $title->getNamespace() && strpos($this->getDBkey(), $title->getDBkey() . '/') === 0;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:Title.php

示例7: insertRedirectEntry

 /**
  * Insert or update the redirect table entry for this page to indicate it redirects to $rt
  * @param Title $rt Redirect target
  * @param int|null $oldLatest Prior page_latest for check and set
  */
 public function insertRedirectEntry(Title $rt, $oldLatest = null)
 {
     $dbw = wfGetDB(DB_MASTER);
     $dbw->startAtomic(__METHOD__);
     if (!$oldLatest || $oldLatest == $this->lockAndGetLatest()) {
         $dbw->replace('redirect', ['rd_from'], ['rd_from' => $this->getId(), 'rd_namespace' => $rt->getNamespace(), 'rd_title' => $rt->getDBkey(), 'rd_fragment' => $rt->getFragment(), 'rd_interwiki' => $rt->getInterwiki()], __METHOD__);
     }
     $dbw->endAtomic(__METHOD__);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:WikiPage.php

示例8: moveInconsistentPage

 /**
  * @param object $row
  * @param Title $title
  */
 protected function moveInconsistentPage($row, $title)
 {
     if ($title->exists() || $title->getInterwiki() || !$title->canExist()) {
         if ($title->getInterwiki() || !$title->canExist()) {
             $prior = $title->getPrefixedDBkey();
         } else {
             $prior = $title->getDBkey();
         }
         # Old cleanupTitles could move articles there. See bug 23147.
         $ns = $row->page_namespace;
         if ($ns < 0) {
             $ns = 0;
         }
         # Namespace which no longer exists. Put the page in the main namespace
         # since we don't have any idea of the old namespace name. See bug 68501.
         if (!MWNamespace::exists($ns)) {
             $ns = 0;
         }
         $clean = 'Broken/' . $prior;
         $verified = Title::makeTitleSafe($ns, $clean);
         if (!$verified || $verified->exists()) {
             $blah = "Broken/id:" . $row->page_id;
             $this->output("Couldn't legalize; form '{$clean}' exists; using '{$blah}'\n");
             $verified = Title::makeTitleSafe($ns, $blah);
         }
         $title = $verified;
     }
     if (is_null($title)) {
         $this->error("Something awry; empty title.", true);
     }
     $ns = $title->getNamespace();
     $dest = $title->getDBkey();
     if ($this->dryrun) {
         $this->output("DRY RUN: would rename {$row->page_id} ({$row->page_namespace}," . "'{$row->page_title}') to ({$ns},'{$dest}')\n");
     } else {
         $this->output("renaming {$row->page_id} ({$row->page_namespace}," . "'{$row->page_title}') to ({$ns},'{$dest}')\n");
         $dbw = wfGetDB(DB_MASTER);
         $dbw->update('page', array('page_namespace' => $ns, 'page_title' => $dest), array('page_id' => $row->page_id), __METHOD__);
         LinkCache::singleton()->clear();
     }
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:45,代码来源:cleanupTitles.php

示例9: equals

 /**
  * Compare with another title.
  *
  * @param Title $title
  * @return bool
  */
 public function equals($title)
 {
     // Note: === is necessary for proper matching of number-like titles.
     return $this->getInterwiki() === $title->getInterwiki() && $this->getNamespace() == $title->getNamespace() && $this->getDbkey() === $title->getDbkey();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:11,代码来源:Title.php

示例10: insertRedirectEntry

 /**
  * Insert or update the redirect table entry for this page to indicate
  * it redirects to $rt .
  * @param Title $rt Redirect target
  */
 public function insertRedirectEntry($rt)
 {
     $dbw = wfGetDB(DB_MASTER);
     $dbw->replace('redirect', array('rd_from'), array('rd_from' => $this->getId(), 'rd_namespace' => $rt->getNamespace(), 'rd_title' => $rt->getDBkey(), 'rd_fragment' => $rt->getFragment(), 'rd_interwiki' => $rt->getInterwiki()), __METHOD__);
 }
开发者ID:Tanych,项目名称:mediawiki,代码行数:10,代码来源:WikiPage.php

示例11: addInterwikiLink

 /**
  * @param Title $title Title object, must be an interwiki link
  * @throws MWException If given invalid input
  */
 public function addInterwikiLink($title)
 {
     if (!$title->isExternal()) {
         throw new MWException('Non-interwiki link passed, internal parser error.');
     }
     $prefix = $title->getInterwiki();
     if (!isset($this->mInterwikiLinks[$prefix])) {
         $this->mInterwikiLinks[$prefix] = array();
     }
     $this->mInterwikiLinks[$prefix][$title->getDBkey()] = 1;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:15,代码来源:ParserOutput.php

示例12: canonicalTitle

 /**
  * Return prefixed text form of title, but using the content language's
  * canonical namespace. This skips any special-casing such as gendered
  * user namespaces -- which while useful, are not yet listed in the
  * XML "<siteinfo>" data so are unsafe in export.
  *
  * @param Title $title
  * @return string
  * @since 1.18
  */
 public static function canonicalTitle(Title $title)
 {
     if ($title->getInterwiki()) {
         return $title->getPrefixedText();
     }
     global $wgContLang;
     $prefix = str_replace('_', ' ', $wgContLang->getNsText($title->getNamespace()));
     if ($prefix !== '') {
         $prefix .= ':';
     }
     return $prefix . $title->getText();
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:22,代码来源:Export.php

示例13: newFromTitle

 /**
  * Create a data item from a MediaWiki Title.
  *
  * @param $title Title
  * @return SMWDIWikiPage
  */
 public static function newFromTitle(Title $title)
 {
     return new SMWDIWikiPage($title->getDBkey(), $title->getNamespace(), $title->getInterwiki(), str_replace(' ', '_', $title->getFragment()));
 }
开发者ID:yusufchang,项目名称:app,代码行数:10,代码来源:SMW_DI_WikiPage.php

示例14: testCreateFragmentTitle

 /**
  * @covers Title::createFragmentTarget
  * @dataProvider provideCreateFragmentTitle
  */
 public function testCreateFragmentTitle(Title $title, $fragment)
 {
     $this->mergeMwGlobalArrayValue('wgHooks', ['InterwikiLoadPrefix' => [function ($prefix, &$iwdata) {
         if ($prefix === 'interwiki') {
             $iwdata = ['iw_url' => 'http://example.com/', 'iw_local' => 0, 'iw_trans' => 0];
             return false;
         }
     }]]);
     $fragmentTitle = $title->createFragmentTarget($fragment);
     $this->assertEquals($title->getNamespace(), $fragmentTitle->getNamespace());
     $this->assertEquals($title->getText(), $fragmentTitle->getText());
     $this->assertEquals($title->getInterwiki(), $fragmentTitle->getInterwiki());
     $this->assertEquals($fragment, $fragmentTitle->getFragment());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:18,代码来源:TitleTest.php

示例15: ArticleFromTitle

 /**
  * ArticleFromTitle
  *
  * hook handler for redirecting pages from old central to new community wiki
  *
  * @author Marooned
  */
 static function ArticleFromTitle(Title &$title, &$article)
 {
     global $wgRequest, $wgCorporatePageRedirectWiki;
     //do not redirect for action different than view (allow creating, deleting, etc)
     if ($wgRequest->getVal('action', 'view') != 'view') {
         return true;
     }
     wfProfileIn(__METHOD__);
     switch ($title->getNamespace()) {
         case NS_USER:
         case NS_USER_TALK:
         case NS_FILE_TALK:
         case NS_HELP:
         case NS_HELP_TALK:
         case NS_CATEGORY_TALK:
         case NS_FORUM:
         case NS_FORUM_TALK:
         case 150:
             //NS_HUB
         //NS_HUB
         case 151:
             //NS_HUB_TALK
         //NS_HUB_TALK
         case 400:
             //NS_VIDEO
         //NS_VIDEO
         case 401:
             //NS_VIDEO_TALK
         //NS_VIDEO_TALK
         case 500:
             //NS_BLOG_ARTICLE
         //NS_BLOG_ARTICLE
         case 501:
             //NS_BLOG_ARTICLE_TALK
         //NS_BLOG_ARTICLE_TALK
         case 502:
             //NS_BLOG_LISTING
         //NS_BLOG_LISTING
         case 503:
             //NS_BLOG_LISTING_TALK
         //NS_BLOG_LISTING_TALK
         case 1200:
             // NS_WALL
             if (!$title->exists() && !empty($wgCorporatePageRedirectWiki)) {
                 $redirect = $wgCorporatePageRedirectWiki . self::getPrefixedText($title->getPartialURL(), array($title->getInterwiki(), $title->getNsText()));
             }
             break;
         case NS_FILE:
             $file = wfFindFile($title);
             if (empty($file) && !empty($wgCorporatePageRedirectWiki)) {
                 $redirect = $wgCorporatePageRedirectWiki . self::getPrefixedText($title->getPartialURL(), array($title->getInterwiki(), $title->getNsText()));
             }
             break;
         case NS_PROJECT:
         case NS_PROJECT_TALK:
             if (!$title->exists()) {
                 //"Project" namespace hardcoded because MW will rename it to name of redirecting page - not the destination wiki
                 $redirect = 'http://community.wikia.com/wiki/Project:' . $title->getPartialURL();
             }
             break;
         case NS_TALK:
             $t = $title->getSubjectPage();
             if ($t->exists()) {
                 $redirect = 'http://www.wikia.com/' . $t->getPartialURL();
             }
             break;
     }
     if (!wfRunHooks('CorporateBeforeRedirect', array(&$title))) {
         wfProfileOut(__METHOD__);
         return true;
     }
     if (!empty($redirect)) {
         header("Location: {$redirect}");
         wfProfileOut(__METHOD__);
         exit;
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:86,代码来源:CorporatePageHelper.class.php


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