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


PHP MWNamespace::isNonincludable方法代码示例

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


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

示例1: 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

示例2: braceSubstitution


//.........这里部分代码省略.........
             $titleProfileIn = __METHOD__ . "-title-" . $title->getPrefixedDBkey();
             wfProfileIn($titleProfileIn);
             // template in
         }
         wfProfileIn(__METHOD__ . '-loadtpl');
         if (!$title->isExternal()) {
             if ($title->isSpecialPage() && $this->mOptions->getAllowSpecialInclusion() && $this->ot['html']) {
                 // Pass the template arguments as URL parameters.
                 // "uselang" will have no effect since the Language object
                 // is forced to the one defined in ParserOptions.
                 $pageArgs = array();
                 for ($i = 0; $i < $args->getLength(); $i++) {
                     $bits = $args->item($i)->splitArg();
                     if (strval($bits['index']) === '') {
                         $name = trim($frame->expand($bits['name'], PPFrame::STRIP_COMMENTS));
                         $value = trim($frame->expand($bits['value']));
                         $pageArgs[$name] = $value;
                     }
                 }
                 // Create a new context to execute the special page
                 $context = new RequestContext();
                 $context->setTitle($title);
                 $context->setRequest(new FauxRequest($pageArgs));
                 $context->setUser($this->getUser());
                 $context->setLanguage($this->mOptions->getUserLangObj());
                 $ret = SpecialPageFactory::capturePath($title, $context);
                 if ($ret) {
                     $text = $context->getOutput()->getHTML();
                     $this->mOutput->addOutputPageMetadata($context->getOutput());
                     $found = true;
                     $isHTML = true;
                     $this->disableCache();
                 }
             } elseif (MWNamespace::isNonincludable($title->getNamespace())) {
                 $found = false;
                 # access denied
                 wfDebug(__METHOD__ . ": template inclusion denied for " . $title->getPrefixedDBkey() . "\n");
             } else {
                 list($text, $title) = $this->getTemplateDom($title);
                 if ($text !== false) {
                     $found = true;
                     $isChildObj = true;
                 }
             }
             # If the title is valid but undisplayable, make a link to it
             if (!$found && ($this->ot['html'] || $this->ot['pre'])) {
                 $text = "[[:{$titleText}]]";
                 $found = true;
             }
         } elseif ($title->isTrans()) {
             # Interwiki transclusion
             if ($this->ot['html'] && !$forceRawInterwiki) {
                 $text = $this->interwikiTransclude($title, 'render');
                 $isHTML = true;
             } else {
                 $text = $this->interwikiTransclude($title, 'raw');
                 # Preprocess it like a template
                 $text = $this->preprocessToDom($text, self::PTD_FOR_INCLUSION);
                 $isChildObj = true;
             }
             $found = true;
         }
         # Do infinite loop check
         # This has to be done after redirect resolution to avoid infinite loops via redirects
         if (!$frame->loopCheck($title)) {
             $found = true;
开发者ID:Tarendai,项目名称:spring-website,代码行数:67,代码来源:Parser.php

示例3: testIsNonincludable

 /**
  * @covers MWNamespace::isNonincludable
  */
 public function testIsNonincludable()
 {
     global $wgNonincludableNamespaces;
     $wgNonincludableNamespaces = array(NS_USER);
     $this->assertTrue(MWNamespace::isNonincludable(NS_USER));
     $this->assertFalse(MWNamespace::isNonincludable(NS_TEMPLATE));
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:10,代码来源:MWNamespaceTest.php

示例4: appendNamespaces

 protected function appendNamespaces($property)
 {
     global $wgContLang;
     $data = array();
     foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
         $data[$ns] = array('id' => intval($ns), 'case' => MWNamespace::isCapitalized($ns) ? 'first-letter' : 'case-sensitive');
         ApiResult::setContent($data[$ns], $title);
         $canonical = MWNamespace::getCanonicalName($ns);
         if (MWNamespace::hasSubpages($ns)) {
             $data[$ns]['subpages'] = '';
         }
         if ($canonical) {
             $data[$ns]['canonical'] = strtr($canonical, '_', ' ');
         }
         if (MWNamespace::isContent($ns)) {
             $data[$ns]['content'] = '';
         }
         if (MWNamespace::isNonincludable($ns)) {
             $data[$ns]['nonincludable'] = '';
         }
         $contentmodel = MWNamespace::getNamespaceContentModel($ns);
         if ($contentmodel) {
             $data[$ns]['defaultcontentmodel'] = $contentmodel;
         }
     }
     $this->getResult()->setIndexedTagName($data, 'ns');
     return $this->getResult()->addValue('query', $property, $data);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:28,代码来源:ApiQuerySiteinfo.php

示例5: expandTemplate

 /**
  * Handler for expandTemplate()
  */
 function expandTemplate($frameId, $titleText, $args)
 {
     $frame = $this->getFrameById($frameId);
     $title = Title::newFromText($titleText, NS_TEMPLATE);
     if (!$title) {
         throw new Scribunto_LuaError("expandTemplate: invalid title \"{$titleText}\"");
     }
     if ($frame->depth >= $this->parser->mOptions->getMaxTemplateDepth()) {
         throw new Scribunto_LuaError('expandTemplate: template depth limit exceeded');
     }
     if (MWNamespace::isNonincludable($title->getNamespace())) {
         throw new Scribunto_LuaError('expandTemplate: template inclusion denied');
     }
     list($dom, $finalTitle) = $this->parser->getTemplateDom($title);
     if ($dom === false) {
         throw new Scribunto_LuaError("expandTemplate: template \"{$titleText}\" does not exist");
     }
     if (!$frame->loopCheck($finalTitle)) {
         throw new Scribunto_LuaError('expandTemplate: template loop detected');
     }
     $fargs = $this->getParser()->getPreprocessor()->newPartNodeArray($args);
     $newFrame = $frame->newChild($fargs, $finalTitle);
     $text = $this->doCachedExpansion($newFrame, $dom, array('template' => $finalTitle->getPrefixedDBkey(), 'args' => $args));
     return array($text);
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:28,代码来源:LuaCommon.php


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