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


PHP ResourceLoaderContext::getSkin方法代码示例

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


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

示例1: getPages

 /**
  * @param $context ResourceLoaderContext
  * @return array
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     $username = $context->getUser();
     if ($username === null) {
         return array();
     }
     // Get the normalized title of the user's user page
     $userpageTitle = Title::makeTitleSafe(NS_USER, $username);
     if (!$userpageTitle instanceof Title) {
         return array();
     }
     $userpage = $userpageTitle->getPrefixedDBkey();
     // Needed so $excludepages works
     $pages = array("{$userpage}/common.js" => array('type' => 'script'), "{$userpage}/" . $context->getSkin() . '.js' => array('type' => 'script'), "{$userpage}/common.css" => array('type' => 'style'), "{$userpage}/" . $context->getSkin() . '.css' => array('type' => 'style'));
     // Hack for bug 26283: if we're on a preview page for a CSS/JS page,
     // we need to exclude that page from this module. In that case, the excludepage
     // parameter will be set to the name of the page we need to exclude.
     $excludepage = $context->getRequest()->getVal('excludepage');
     if (isset($pages[$excludepage])) {
         // This works because $excludepage is generated with getPrefixedDBkey(),
         // just like the keys in $pages[] above
         unset($pages[$excludepage]);
     }
     return $pages;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:29,代码来源:ResourceLoaderUserModule.php

示例2: getPages

 /**
  * Get list of pages used by this module
  *
  * @param ResourceLoaderContext $context
  * @return array List of pages
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     $allowUserJs = $this->getConfig()->get('AllowUserJs');
     $allowUserCss = $this->getConfig()->get('AllowUserCss');
     if (!$allowUserJs && !$allowUserCss) {
         return array();
     }
     $user = $context->getUserObj();
     if (!$user || $user->isAnon()) {
         return array();
     }
     // Needed so $excludepages works
     $userPage = $user->getUserPage()->getPrefixedDBkey();
     $pages = array();
     if ($allowUserJs) {
         $pages["{$userPage}/common.js"] = array('type' => 'script');
         $pages["{$userPage}/" . $context->getSkin() . '.js'] = array('type' => 'script');
     }
     if ($allowUserCss) {
         $pages["{$userPage}/common.css"] = array('type' => 'style');
         $pages["{$userPage}/" . $context->getSkin() . '.css'] = array('type' => 'style');
     }
     // Hack for bug 26283: if we're on a preview page for a CSS/JS page,
     // we need to exclude that page from this module. In that case, the excludepage
     // parameter will be set to the name of the page we need to exclude.
     $excludepage = $context->getRequest()->getVal('excludepage');
     if (isset($pages[$excludepage])) {
         // This works because $excludepage is generated with getPrefixedDBkey(),
         // just like the keys in $pages[] above
         unset($pages[$excludepage]);
     }
     return $pages;
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:39,代码来源:ResourceLoaderUserModule.php

示例3: getPages

 protected function getPages(ResourceLoaderContext $context)
 {
     if ($context->getUser()) {
         $username = $context->getUser();
         return array("User:{$username}/common.js" => array('type' => 'script'), "User:{$username}/" . $context->getSkin() . '.js' => array('type' => 'script'), "User:{$username}/common.css" => array('type' => 'style'), "User:{$username}/" . $context->getSkin() . '.css' => array('type' => 'style'));
     }
     return array();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:8,代码来源:ResourceLoaderUserModule.php

示例4: getPages

 /**
  * Gets list of pages used by this module
  *
  * @param $context ResourceLoaderContext
  *
  * @return Array: List of pages
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     global $wgHandheldStyle;
     $pages = array('MediaWiki:Common.js' => array('type' => 'script'), 'MediaWiki:Common.css' => array('type' => 'style'), 'MediaWiki:' . ucfirst($context->getSkin()) . '.js' => array('type' => 'script'), 'MediaWiki:' . ucfirst($context->getSkin()) . '.css' => array('type' => 'style'), 'MediaWiki:Print.css' => array('type' => 'style', 'media' => 'print'));
     if ($wgHandheldStyle) {
         $pages['MediaWiki:Handheld.css'] = array('type' => 'style', 'media' => 'handheld');
     }
     return $pages;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:16,代码来源:ResourceLoaderSiteModule.php

示例5: getPages

 /**
  * Get list of pages used by this module
  *
  * @param ResourceLoaderContext $context
  * @return array List of pages
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     $pages = array();
     if ($this->getConfig()->get('UseSiteJs')) {
         $pages['MediaWiki:Common.js'] = array('type' => 'script');
         $pages['MediaWiki:' . ucfirst($context->getSkin()) . '.js'] = array('type' => 'script');
     }
     if ($this->getConfig()->get('UseSiteCss')) {
         $pages['MediaWiki:Common.css'] = array('type' => 'style');
         $pages['MediaWiki:' . ucfirst($context->getSkin()) . '.css'] = array('type' => 'style');
         $pages['MediaWiki:Print.css'] = array('type' => 'style', 'media' => 'print');
     }
     return $pages;
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:20,代码来源:ResourceLoaderSiteModule.php

示例6: getPages

 /**
  * Gets list of pages used by this module
  *
  * @param $context ResourceLoaderContext
  *
  * @return Array: List of pages
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     global $wgUseSiteJs, $wgUseSiteCss;
     $pages = array();
     if ($wgUseSiteJs) {
         $pages['MediaWiki:Common.js'] = array('type' => 'script');
         $pages['MediaWiki:' . ucfirst($context->getSkin()) . '.js'] = array('type' => 'script');
     }
     if ($wgUseSiteCss) {
         $pages['MediaWiki:Common.css'] = array('type' => 'style');
         $pages['MediaWiki:' . ucfirst($context->getSkin()) . '.css'] = array('type' => 'style');
     }
     $pages['MediaWiki:Print.css'] = array('type' => 'style', 'media' => 'print');
     return $pages;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:22,代码来源:ResourceLoaderSiteModule.php

示例7: getConfigSettings

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 protected function getConfigSettings($context)
 {
     $hash = $context->getHash();
     if (isset($this->configVars[$hash])) {
         return $this->configVars[$hash];
     }
     global $wgContLang;
     $mainPage = Title::newMainPage();
     /**
      * Namespace related preparation
      * - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
      * - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
      */
     $namespaceIds = $wgContLang->getNamespaceIds();
     $caseSensitiveNamespaces = array();
     foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
         $namespaceIds[$wgContLang->lc($name)] = $index;
         if (!MWNamespace::isCapitalized($index)) {
             $caseSensitiveNamespaces[] = $index;
         }
     }
     $conf = $this->getConfig();
     // Build list of variables
     $vars = array('wgLoadScript' => wfScript('load'), 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $conf->get('StylePath'), 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $conf->get('ArticlePath'), 'wgScriptPath' => $conf->get('ScriptPath'), 'wgScriptExtension' => $conf->get('ScriptExtension'), 'wgScript' => wfScript(), 'wgSearchType' => $conf->get('SearchType'), 'wgVariantArticlePath' => $conf->get('VariantArticlePath'), 'wgActionPaths' => (object) $conf->get('ActionPaths'), 'wgServer' => $conf->get('Server'), 'wgServerName' => $conf->get('ServerName'), 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgTranslateNumerals' => $conf->get('TranslateNumerals'), 'wgVersion' => $conf->get('Version'), 'wgEnableAPI' => $conf->get('EnableAPI'), 'wgEnableWriteAPI' => $conf->get('EnableWriteAPI'), 'wgMainPageTitle' => $mainPage->getPrefixedText(), 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgContentNamespaces' => MWNamespace::getContentNamespaces(), 'wgSiteName' => $conf->get('Sitename'), 'wgDBname' => $conf->get('DBname'), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $conf->get('ExtensionAssetsPath'), 'wgCookiePrefix' => $conf->get('CookiePrefix'), 'wgCookieDomain' => $conf->get('CookieDomain'), 'wgCookiePath' => $conf->get('CookiePath'), 'wgCookieExpiration' => $conf->get('CookieExpiration'), 'wgResourceLoaderMaxQueryLength' => $conf->get('ResourceLoaderMaxQueryLength'), 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass(Title::legalChars()), 'wgResourceLoaderStorageVersion' => $conf->get('ResourceLoaderStorageVersion'), 'wgResourceLoaderStorageEnabled' => $conf->get('ResourceLoaderStorageEnabled'));
     Hooks::run('ResourceLoaderGetConfigVars', array(&$vars));
     $this->configVars[$hash] = $vars;
     return $this->configVars[$hash];
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:32,代码来源:ResourceLoaderStartUpModule.php

示例8: getSkin

 public function getSkin()
 {
     if ($this->skin === self::INHERIT_VALUE) {
         return $this->context->getSkin();
     }
     return $this->skin;
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:7,代码来源:DerivativeResourceLoaderContext.php

示例9: getConfig

 /**
  * @param ResourceLoaderContext $context
  * @return array
  */
 protected function getConfig($context)
 {
     $hash = $context->getHash();
     if (isset($this->configVars[$hash])) {
         return $this->configVars[$hash];
     }
     global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension, $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgVariantArticlePath, $wgActionPaths, $wgVersion, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgResourceLoaderStorageEnabled, $wgResourceLoaderStorageVersion, $wgSearchType;
     $mainPage = Title::newMainPage();
     /**
      * Namespace related preparation
      * - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
      * - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
      */
     $namespaceIds = $wgContLang->getNamespaceIds();
     $caseSensitiveNamespaces = array();
     foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
         $namespaceIds[$wgContLang->lc($name)] = $index;
         if (!MWNamespace::isCapitalized($index)) {
             $caseSensitiveNamespaces[] = $index;
         }
     }
     // Build list of variables
     $vars = array('wgLoadScript' => $wgLoadScript, 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $wgStylePath, 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $wgArticlePath, 'wgScriptPath' => $wgScriptPath, 'wgScriptExtension' => $wgScriptExtension, 'wgScript' => $wgScript, 'wgSearchType' => $wgSearchType, 'wgVariantArticlePath' => $wgVariantArticlePath, 'wgActionPaths' => (object) $wgActionPaths, 'wgServer' => $wgServer, 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgVersion' => $wgVersion, 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgMainPageTitle' => $mainPage->getPrefixedText(), 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgContentNamespaces' => MWNamespace::getContentNamespaces(), 'wgSiteName' => $wgSitename, 'wgFileExtensions' => array_values(array_unique($wgFileExtensions)), 'wgDBname' => $wgDBname, 'wgFileCanRotate' => BitmapHandler::canRotate(), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $wgExtensionAssetsPath, 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass(Title::legalChars()), 'wgResourceLoaderStorageVersion' => $wgResourceLoaderStorageVersion, 'wgResourceLoaderStorageEnabled' => $wgResourceLoaderStorageEnabled);
     wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
     $this->configVars[$hash] = $vars;
     return $this->configVars[$hash];
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:31,代码来源:ResourceLoaderStartUpModule.php

示例10: getPages

 /**
  * @param ResourceLoaderContext $context
  * @return array List of pages
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     $config = $this->getConfig();
     $user = $context->getUserObj();
     if ($user->isAnon()) {
         return [];
     }
     // Use localised/normalised variant to ensure $excludepage matches
     $userPage = $user->getUserPage()->getPrefixedDBkey();
     $pages = [];
     if ($config->get('AllowUserCss')) {
         $pages["{$userPage}/common.css"] = ['type' => 'style'];
         $pages["{$userPage}/" . $context->getSkin() . '.css'] = ['type' => 'style'];
     }
     // User group pages are maintained site-wide and enabled with site JS/CSS.
     if ($config->get('UseSiteCss')) {
         foreach ($user->getEffectiveGroups() as $group) {
             if ($group == '*') {
                 continue;
             }
             $pages["MediaWiki:Group-{$group}.css"] = ['type' => 'style'];
         }
     }
     // Hack for T28283: Allow excluding pages for preview on a CSS/JS page.
     // The excludepage parameter is set by OutputPage.
     $excludepage = $context->getRequest()->getVal('excludepage');
     if (isset($pages[$excludepage])) {
         unset($pages[$excludepage]);
     }
     return $pages;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:35,代码来源:ResourceLoaderUserStylesModule.php

示例11: getSkin

 public function getSkin()
 {
     if (!is_null($this->skin)) {
         return $this->skin;
     } else {
         return $this->context->getSkin();
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:8,代码来源:DerivativeResourceLoaderContext.php

示例12: getPages

 /**
  * Get list of pages used by this module
  *
  * @param ResourceLoaderContext $context
  * @return array List of pages
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     $config = $this->getConfig();
     $user = $context->getUserObj();
     if ($user->isAnon()) {
         return [];
     }
     // Use localised/normalised variant to ensure $excludepage matches
     $userPage = $user->getUserPage()->getPrefixedDBkey();
     $pages = [];
     if ($config->get('AllowUserJs')) {
         $pages["{$userPage}/common.js"] = ['type' => 'script'];
         $pages["{$userPage}/" . $context->getSkin() . '.js'] = ['type' => 'script'];
     }
     if ($config->get('AllowUserCss')) {
         $pages["{$userPage}/common.css"] = ['type' => 'style'];
         $pages["{$userPage}/" . $context->getSkin() . '.css'] = ['type' => 'style'];
     }
     $useSiteJs = $config->get('UseSiteJs');
     $useSiteCss = $config->get('UseSiteCss');
     // User group pages are maintained site-wide and enabled with site JS/CSS.
     if ($useSiteJs || $useSiteCss) {
         foreach ($user->getEffectiveGroups() as $group) {
             if ($group == '*') {
                 continue;
             }
             if ($useSiteJs) {
                 $pages["MediaWiki:Group-{$group}.js"] = ['type' => 'script'];
             }
             if ($useSiteCss) {
                 $pages["MediaWiki:Group-{$group}.css"] = ['type' => 'style'];
             }
         }
     }
     // Hack for bug 26283: if we're on a preview page for a CSS/JS page,
     // we need to exclude that page from this module. In that case, the excludepage
     // parameter will be set to the name of the page we need to exclude.
     $excludepage = $context->getRequest()->getVal('excludepage');
     if (isset($pages[$excludepage])) {
         // This works because $excludepage is generated with getPrefixedDBkey(),
         // just like the keys in $pages[] above
         unset($pages[$excludepage]);
     }
     return $pages;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:51,代码来源:ResourceLoaderUserModule.php

示例13: getPages

 /**
  * Get list of pages used by this module
  *
  * @param ResourceLoaderContext $context
  * @return array List of pages
  */
 protected function getPages(ResourceLoaderContext $context)
 {
     $pages = [];
     if ($this->getConfig()->get('UseSiteJs')) {
         $pages['MediaWiki:Common.js'] = ['type' => 'script'];
         $pages['MediaWiki:' . ucfirst($context->getSkin()) . '.js'] = ['type' => 'script'];
     }
     return $pages;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:15,代码来源:ResourceLoaderSiteModule.php

示例14: preloadModuleInfo

 /**
  * Load information stored in the database about modules.
  *
  * This method grabs modules dependencies from the database and updates modules
  * objects.
  *
  * This is not inside the module code because it is much faster to
  * request all of the information at once than it is to have each module
  * requests its own information. This sacrifice of modularity yields a substantial
  * performance improvement.
  *
  * @param array $modules List of module names to preload information for
  * @param ResourceLoaderContext $context Context to load the information within
  */
 public function preloadModuleInfo(array $modules, ResourceLoaderContext $context)
 {
     if (!count($modules)) {
         // Or else Database*::select() will explode, plus it's cheaper!
         return;
     }
     $dbr = wfGetDB(DB_SLAVE);
     $skin = $context->getSkin();
     $lang = $context->getLanguage();
     // Get file dependency information
     $res = $dbr->select('module_deps', array('md_module', 'md_deps'), array('md_module' => $modules, 'md_skin' => $skin), __METHOD__);
     // Set modules' dependencies
     $modulesWithDeps = array();
     foreach ($res as $row) {
         $module = $this->getModule($row->md_module);
         if ($module) {
             $module->setFileDependencies($skin, FormatJson::decode($row->md_deps, true));
             $modulesWithDeps[] = $row->md_module;
         }
     }
     // Register the absence of a dependency row too
     foreach (array_diff($modules, $modulesWithDeps) as $name) {
         $module = $this->getModule($name);
         if ($module) {
             $this->getModule($name)->setFileDependencies($skin, array());
         }
     }
     // Get message blob mtimes. Only do this for modules with messages
     $modulesWithMessages = array();
     foreach ($modules as $name) {
         $module = $this->getModule($name);
         if ($module && count($module->getMessages())) {
             $modulesWithMessages[] = $name;
         }
     }
     $modulesWithoutMessages = array_flip($modules);
     // Will be trimmed down by the loop below
     if (count($modulesWithMessages)) {
         $res = $dbr->select('msg_resource', array('mr_resource', 'mr_timestamp'), array('mr_resource' => $modulesWithMessages, 'mr_lang' => $lang), __METHOD__);
         foreach ($res as $row) {
             $module = $this->getModule($row->mr_resource);
             if ($module) {
                 $module->setMsgBlobMtime($lang, wfTimestamp(TS_UNIX, $row->mr_timestamp));
                 unset($modulesWithoutMessages[$row->mr_resource]);
             }
         }
     }
     foreach (array_keys($modulesWithoutMessages) as $name) {
         $module = $this->getModule($name);
         if ($module) {
             $module->setMsgBlobMtime($lang, 0);
         }
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:68,代码来源:ResourceLoader.php

示例15: testTypicalRequest

 public function testTypicalRequest()
 {
     $ctx = new ResourceLoaderContext($this->getResourceLoader(), new FauxRequest(['debug' => 'false', 'lang' => 'zh', 'modules' => 'foo|foo.quux,baz,bar|baz.quux', 'only' => 'styles', 'skin' => 'fallback']));
     // Request parameters
     $this->assertEquals($ctx->getModules(), ['foo', 'foo.quux', 'foo.baz', 'foo.bar', 'baz.quux']);
     $this->assertEquals(false, $ctx->getDebug());
     $this->assertEquals('zh', $ctx->getLanguage());
     $this->assertEquals('styles', $ctx->getOnly());
     $this->assertEquals('fallback', $ctx->getSkin());
     $this->assertEquals(null, $ctx->getUser());
     // Misc
     $this->assertEquals('ltr', $ctx->getDirection());
     $this->assertEquals('zh|fallback|||styles|||||', $ctx->getHash());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:ResourceLoaderContextTest.php


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