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


PHP Skin::getAllowedSkins方法代码示例

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


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

示例1: generateSkinOptions

 /**
  * @param User $user The User object
  * @param IContextSource $context
  * @return array Text/links to display as key; $skinkey as value
  */
 static function generateSkinOptions($user, IContextSource $context)
 {
     $ret = array();
     $mptitle = Title::newMainPage();
     $previewtext = $context->msg('skin-preview')->escaped();
     # Only show skins that aren't disabled in $wgSkipSkins
     $validSkinNames = Skin::getAllowedSkins();
     # Sort by UI skin name. First though need to update validSkinNames as sometimes
     # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
     foreach ($validSkinNames as $skinkey => &$skinname) {
         $msg = $context->msg("skinname-{$skinkey}");
         if ($msg->exists()) {
             $skinname = htmlspecialchars($msg->text());
         }
     }
     asort($validSkinNames);
     $config = $context->getConfig();
     $defaultSkin = $config->get('DefaultSkin');
     $allowUserCss = $config->get('AllowUserCss');
     $allowUserJs = $config->get('AllowUserJs');
     $foundDefault = false;
     foreach ($validSkinNames as $skinkey => $sn) {
         $linkTools = array();
         # Mark the default skin
         if (strcasecmp($skinkey, $defaultSkin) === 0) {
             $linkTools[] = $context->msg('default')->escaped();
             $foundDefault = true;
         }
         # Create preview link
         $mplink = htmlspecialchars($mptitle->getLocalURL(array('useskin' => $skinkey)));
         $linkTools[] = "<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>";
         # Create links to user CSS/JS pages
         if ($allowUserCss) {
             $cssPage = Title::makeTitleSafe(NS_USER, $user->getName() . '/' . $skinkey . '.css');
             $linkTools[] = Linker::link($cssPage, $context->msg('prefs-custom-css')->escaped());
         }
         if ($allowUserJs) {
             $jsPage = Title::makeTitleSafe(NS_USER, $user->getName() . '/' . $skinkey . '.js');
             $linkTools[] = Linker::link($jsPage, $context->msg('prefs-custom-js')->escaped());
         }
         $display = $sn . ' ' . $context->msg('parentheses')->rawParams($context->getLanguage()->pipeList($linkTools))->escaped();
         $ret[$display] = $skinkey;
     }
     if (!$foundDefault) {
         // If the default skin is not available, things are going to break horribly because the
         // default value for skin selector will not be a valid value. Let's just not show it then.
         return array();
     }
     return $ret;
 }
开发者ID:guochangjiang,项目名称:mediawiki,代码行数:55,代码来源:Preferences.php

示例2: appendSkins

 public function appendSkins($property)
 {
     $data = array();
     $allowed = Skin::getAllowedSkins();
     $default = Skin::normalizeKey('default');
     foreach (Skin::getSkinNames() as $name => $displayName) {
         $msg = $this->msg("skinname-{$name}");
         $code = $this->getParameter('inlanguagecode');
         if ($code && Language::isValidCode($code)) {
             $msg->inLanguage($code);
         } else {
             $msg->inContentLanguage();
         }
         if ($msg->exists()) {
             $displayName = $msg->text();
         }
         $skin = array('code' => $name);
         ApiResult::setContentValue($skin, 'name', $displayName);
         if (!isset($allowed[$name])) {
             $skin['unusable'] = true;
         }
         if ($name === $default) {
             $skin['default'] = true;
         }
         $data[] = $skin;
     }
     ApiResult::setIndexedTagName($data, 'skin');
     return $this->getResult()->addValue('query', $property, $data);
 }
开发者ID:spicy-tmw,项目名称:wiki-raw,代码行数:29,代码来源:ApiQuerySiteinfo.php

示例3: appendSkins

 public function appendSkins($property)
 {
     $data = array();
     $allowed = Skin::getAllowedSkins();
     $default = Skin::normalizeKey('default');
     foreach (Skin::getSkinNames() as $name => $displayName) {
         $skin = array('code' => $name);
         ApiResult::setContent($skin, $displayName);
         if (!isset($allowed[$name])) {
             $skin['unusable'] = '';
         }
         if ($name === $default) {
             $skin['default'] = '';
         }
         $data[] = $skin;
     }
     $this->getResult()->setIndexedTagName($data, 'skin');
     return $this->getResult()->addValue('query', $property, $data);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:19,代码来源:ApiQuerySiteinfo.php

示例4: generateSkinOptions

 /**
  * @param $user User The User object
  * @param $context IContextSource
  * @return Array: text/links to display as key; $skinkey as value
  */
 static function generateSkinOptions($user, IContextSource $context)
 {
     global $wgDefaultSkin, $wgAllowUserCss, $wgAllowUserJs;
     $ret = array();
     $mptitle = Title::newMainPage();
     $previewtext = $context->msg('skin-preview')->text();
     # Only show skins that aren't disabled in $wgSkipSkins
     $validSkinNames = Skin::getAllowedSkins();
     # Sort by UI skin name. First though need to update validSkinNames as sometimes
     # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
     foreach ($validSkinNames as $skinkey => &$skinname) {
         $msg = $context->msg("skinname-{$skinkey}");
         if ($msg->exists()) {
             $skinname = htmlspecialchars($msg->text());
         }
     }
     asort($validSkinNames);
     foreach ($validSkinNames as $skinkey => $sn) {
         $linkTools = array();
         # Mark the default skin
         if ($skinkey == $wgDefaultSkin) {
             $linkTools[] = $context->msg('default')->escaped();
         }
         # Create preview link
         $mplink = htmlspecialchars($mptitle->getLocalURL(array('useskin' => $skinkey)));
         $linkTools[] = "<a target='_blank' href=\"{$mplink}\">{$previewtext}</a>";
         # Create links to user CSS/JS pages
         if ($wgAllowUserCss) {
             $cssPage = Title::makeTitleSafe(NS_USER, $user->getName() . '/' . $skinkey . '.css');
             $linkTools[] = Linker::link($cssPage, $context->msg('prefs-custom-css')->escaped());
         }
         if ($wgAllowUserJs) {
             $jsPage = Title::makeTitleSafe(NS_USER, $user->getName() . '/' . $skinkey . '.js');
             $linkTools[] = Linker::link($jsPage, $context->msg('prefs-custom-js')->escaped());
         }
         $display = $sn . ' ' . $context->msg('parentheses', $context->getLanguage()->pipeList($linkTools))->text();
         $ret[$display] = $skinkey;
     }
     return $ret;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:45,代码来源:Preferences.php


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