當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MWNamespace::isSubject方法代碼示例

本文整理匯總了PHP中MWNamespace::isSubject方法的典型用法代碼示例。如果您正苦於以下問題:PHP MWNamespace::isSubject方法的具體用法?PHP MWNamespace::isSubject怎麽用?PHP MWNamespace::isSubject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MWNamespace的用法示例。


在下文中一共展示了MWNamespace::isSubject方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testIsSubject

 /**
  * Please make sure to change testIsTalk() if you change the assertions below
  */
 public function testIsSubject()
 {
     // Special namespaces
     $this->assertIsSubject(NS_MEDIA);
     $this->assertIsSubject(NS_SPECIAL);
     // Subject pages
     $this->assertIsSubject(NS_MAIN);
     $this->assertIsSubject(NS_USER);
     $this->assertIsSubject(100);
     # user defined
     // Talk pages
     $this->assertIsNotSubject(NS_TALK);
     $this->assertIsNotSubject(NS_USER_TALK);
     $this->assertIsNotSubject(101);
     # user defined
     // Back compat
     $this->assertTrue(MWNamespace::isMain(NS_MAIN) == MWNamespace::isSubject(NS_MAIN));
     $this->assertTrue(MWNamespace::isMain(NS_USER_TALK) == MWNamespace::isSubject(NS_USER_TALK));
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:22,代碼來源:MWNamespaceTest.php

示例2: register

 function register()
 {
     global $wgContLang, $wgNamespaceAliases, $wgNonincludableNamespaces;
     $lib = array('loadSiteStats' => array($this, 'loadSiteStats'), 'getNsIndex' => array($this, 'getNsIndex'), 'pagesInCategory' => array($this, 'pagesInCategory'), 'pagesInNamespace' => array($this, 'pagesInNamespace'), 'usersInGroup' => array($this, 'usersInGroup'));
     $info = array('siteName' => $GLOBALS['wgSitename'], 'server' => $GLOBALS['wgServer'], 'scriptPath' => $GLOBALS['wgScriptPath'], 'stylePath' => $GLOBALS['wgStylePath'], 'currentVersion' => SpecialVersion::getVersion());
     if (!self::$namespacesCache) {
         $namespaces = array();
         $namespacesByName = array();
         foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
             $canonical = MWNamespace::getCanonicalName($ns);
             $namespaces[$ns] = array('id' => $ns, 'name' => $title, 'canonicalName' => strtr($canonical, '_', ' '), 'hasSubpages' => MWNamespace::hasSubpages($ns), 'hasGenderDistinction' => MWNamespace::hasGenderDistinction($ns), 'isCapitalized' => MWNamespace::isCapitalized($ns), 'isContent' => MWNamespace::isContent($ns), 'isIncludable' => !($wgNonincludableNamespaces && in_array($ns, $wgNonincludableNamespaces)), 'isMovable' => MWNamespace::isMovable($ns), 'isSubject' => MWNamespace::isSubject($ns), 'isTalk' => MWNamespace::isTalk($ns), 'aliases' => array());
             if ($ns >= NS_MAIN) {
                 $namespaces[$ns]['subject'] = MWNamespace::getSubject($ns);
                 $namespaces[$ns]['talk'] = MWNamespace::getTalk($ns);
                 $namespaces[$ns]['associated'] = MWNamespace::getAssociated($ns);
             } else {
                 $namespaces[$ns]['subject'] = $ns;
             }
             $namespacesByName[strtr($title, ' ', '_')] = $ns;
             if ($canonical) {
                 $namespacesByName[$canonical] = $ns;
             }
         }
         $aliases = array_merge($wgNamespaceAliases, $wgContLang->getNamespaceAliases());
         foreach ($aliases as $title => $ns) {
             if (!isset($namespacesByName[$title])) {
                 $ct = count($namespaces[$ns]['aliases']);
                 $namespaces[$ns]['aliases'][$ct + 1] = $title;
                 $namespacesByName[$title] = $ns;
             }
         }
         $namespaces[NS_MAIN]['displayName'] = wfMessage('blanknamespace')->text();
         self::$namespacesCache = $namespaces;
     }
     $info['namespaces'] = self::$namespacesCache;
     if (self::$siteStatsLoaded) {
         $stats = $this->loadSiteStats();
         $info['stats'] = $stats[0];
     }
     $this->getEngine()->registerInterface('mw.site.lua', $lib, $info);
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:41,代碼來源:SiteLibrary.php

示例3: register

 function register()
 {
     global $wgContLang, $wgNamespaceAliases, $wgDisableCounters;
     $lib = array('getNsIndex' => array($this, 'getNsIndex'), 'pagesInCategory' => array($this, 'pagesInCategory'), 'pagesInNamespace' => array($this, 'pagesInNamespace'), 'usersInGroup' => array($this, 'usersInGroup'), 'interwikiMap' => array($this, 'interwikiMap'));
     $info = array('siteName' => $GLOBALS['wgSitename'], 'server' => $GLOBALS['wgServer'], 'scriptPath' => $GLOBALS['wgScriptPath'], 'stylePath' => $GLOBALS['wgStylePath'], 'currentVersion' => SpecialVersion::getVersion());
     if (!self::$namespacesCache || self::$namespacesCacheLang !== $wgContLang->getCode()) {
         $namespaces = array();
         $namespacesByName = array();
         foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
             $canonical = MWNamespace::getCanonicalName($ns);
             $namespaces[$ns] = array('id' => $ns, 'name' => $title, 'canonicalName' => strtr($canonical, '_', ' '), 'hasSubpages' => MWNamespace::hasSubpages($ns), 'hasGenderDistinction' => MWNamespace::hasGenderDistinction($ns), 'isCapitalized' => MWNamespace::isCapitalized($ns), 'isContent' => MWNamespace::isContent($ns), 'isIncludable' => !MWNamespace::isNonincludable($ns), 'isMovable' => MWNamespace::isMovable($ns), 'isSubject' => MWNamespace::isSubject($ns), 'isTalk' => MWNamespace::isTalk($ns), 'defaultContentModel' => MWNamespace::getNamespaceContentModel($ns), 'aliases' => array());
             if ($ns >= NS_MAIN) {
                 $namespaces[$ns]['subject'] = MWNamespace::getSubject($ns);
                 $namespaces[$ns]['talk'] = MWNamespace::getTalk($ns);
                 $namespaces[$ns]['associated'] = MWNamespace::getAssociated($ns);
             } else {
                 $namespaces[$ns]['subject'] = $ns;
             }
             $namespacesByName[strtr($title, ' ', '_')] = $ns;
             if ($canonical) {
                 $namespacesByName[$canonical] = $ns;
             }
         }
         $aliases = array_merge($wgNamespaceAliases, $wgContLang->getNamespaceAliases());
         foreach ($aliases as $title => $ns) {
             if (!isset($namespacesByName[$title]) && isset($namespaces[$ns])) {
                 $ct = count($namespaces[$ns]['aliases']);
                 $namespaces[$ns]['aliases'][$ct + 1] = $title;
                 $namespacesByName[$title] = $ns;
             }
         }
         $namespaces[NS_MAIN]['displayName'] = wfMessage('blanknamespace')->inContentLanguage()->text();
         self::$namespacesCache = $namespaces;
         self::$namespacesCacheLang = $wgContLang->getCode();
     }
     $info['namespaces'] = self::$namespacesCache;
     $info['stats'] = array('pages' => (int) SiteStats::pages(), 'articles' => (int) SiteStats::articles(), 'files' => (int) SiteStats::images(), 'edits' => (int) SiteStats::edits(), 'views' => $wgDisableCounters ? null : (int) SiteStats::views(), 'users' => (int) SiteStats::users(), 'activeUsers' => (int) SiteStats::activeUsers(), 'admins' => (int) SiteStats::numberingroup('sysop'));
     return $this->getEngine()->registerInterface('mw.site.lua', $lib, $info);
 }
開發者ID:sammykumar,項目名稱:TheVRForums,代碼行數:39,代碼來源:SiteLibrary.php

示例4: getDestinationTitle

 /**
  * Get the preferred destination title for a given target page.
  * @param integer $ns The destination namespace ID
  * @param string $name The conflicting prefix
  * @param integer $sourceNs The source namespace
  * @param integer $sourceDbk The source DB key (i.e. page_title)
  * @param array $options Associative array of validated command-line options
  * @return Title|false
  */
 private function getDestinationTitle($ns, $name, $sourceNs, $sourceDbk, $options)
 {
     $dbk = substr($sourceDbk, strlen("{$name}:"));
     if ($ns == 0) {
         // An interwiki; try an alternate encoding with '-' for ':'
         $dbk = "{$name}-" . $dbk;
     }
     $destNS = $ns;
     if ($sourceNs == NS_TALK && MWNamespace::isSubject($ns)) {
         // This is an associated talk page moved with the --move-talk feature.
         $destNS = MWNamespace::getTalk($destNS);
     }
     $newTitle = Title::makeTitleSafe($destNS, $dbk);
     if (!$newTitle || !$newTitle->canExist()) {
         return false;
     }
     return $newTitle;
 }
開發者ID:admonkey,項目名稱:mediawiki,代碼行數:27,代碼來源:namespaceDupes.php

示例5: guessPriority

 /**
  * If the namespace isn't listed on the priority list return the
  * default priority for the namespace, varies depending on whether it's
  * a talkpage or not.
  *
  * @param $namespace Integer: the namespace to get the priority for
  * @return String
  */
 function guessPriority($namespace)
 {
     return MWNamespace::isSubject($namespace) ? $this->priorities[self::GS_MAIN] : $this->priorities[self::GS_TALK];
 }
開發者ID:Grprashanthkumar,項目名稱:ColfusionWeb,代碼行數:12,代碼來源:generateSitemap.php


注:本文中的MWNamespace::isSubject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。