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


PHP SSViewer::get_themes方法代码示例

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


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

示例1: getAvailableThemes

 /**
  * Get all active themes
  *
  * @param string $baseDir
  *
  * @return array
  */
 public function getAvailableThemes($baseDir = null)
 {
     $themes = SSViewer::get_themes($baseDir);
     $disabled = (array) Config::inst()->forClass('SiteConfig')->disabled_themes;
     return array_filter($themes, function ($theme) use($disabled) {
         return !array_key_exists($theme, $disabled);
     });
 }
开发者ID:helpfulrobot,项目名称:samdognz-templater,代码行数:15,代码来源:TemplaterPageExtension.php

示例2: getAvailableThemes

 /**
  * Get all available themes that haven't been marked as disabled.
  * @param string $baseDir Optional alternative theme base directory for testing
  * @return array of theme directory names
  */
 public function getAvailableThemes($baseDir = null)
 {
     $themes = SSViewer::get_themes($baseDir);
     foreach (self::$disabled_themes as $theme) {
         if (isset($themes[$theme])) {
             unset($themes[$theme]);
         }
     }
     return $themes;
 }
开发者ID:rixrix,项目名称:silverstripe-cms,代码行数:15,代码来源:SiteConfig.php

示例3: getAvailableThemes

 /**
  * Get all available themes that haven't been marked as disabled.
  * @param string $baseDir Optional alternative theme base directory for testing
  * @return array of theme directory names
  */
 public function getAvailableThemes($baseDir = null)
 {
     $themes = SSViewer::get_themes($baseDir);
     $disabled = (array) $this->config()->disabled_themes;
     foreach ($disabled as $theme) {
         if (isset($themes[$theme])) {
             unset($themes[$theme]);
         }
     }
     return $themes;
 }
开发者ID:i-lateral,项目名称:silverstripe-siteconfig,代码行数:16,代码来源:SiteConfig.php

示例4: testThemeRetrieval

 /**
  * @covers SSViewer::get_themes()
  */
 public function testThemeRetrieval()
 {
     $ds = DIRECTORY_SEPARATOR;
     $testThemeBaseDir = TEMP_FOLDER . $ds . 'test-themes';
     if (file_exists($testThemeBaseDir)) {
         Filesystem::removeFolder($testThemeBaseDir);
     }
     mkdir($testThemeBaseDir);
     mkdir($testThemeBaseDir . $ds . 'blackcandy');
     mkdir($testThemeBaseDir . $ds . 'blackcandy_blog');
     mkdir($testThemeBaseDir . $ds . 'darkshades');
     mkdir($testThemeBaseDir . $ds . 'darkshades_blog');
     $this->assertEquals(array('blackcandy' => 'blackcandy', 'darkshades' => 'darkshades'), SSViewer::get_themes($testThemeBaseDir), 'Our test theme directory contains 2 themes');
     $this->assertEquals(array('blackcandy' => 'blackcandy', 'blackcandy_blog' => 'blackcandy_blog', 'darkshades' => 'darkshades', 'darkshades_blog' => 'darkshades_blog'), SSViewer::get_themes($testThemeBaseDir, true), 'Our test theme directory contains 2 themes and 2 sub-themes');
     // Remove all the test themes we created
     Filesystem::removeFolder($testThemeBaseDir);
 }
开发者ID:normann,项目名称:sapphire,代码行数:20,代码来源:SSViewerTest.php

示例5: themedJavascript

 /**
  * Registers the given themeable javascript as required.
  *
  * A javascript file in the current theme path name 'themename/javascript/$name.js' is first searched for,
  * and it that doesn't exist and the module parameter is set then a javascript file with that name in
  * the module is used.
  *
  * @param string $name   The name of the file - eg '/js/File.js' would have the name 'File'
  * @param string $type  Comma-separated list of types to use in the script tag
  *                       (e.g. 'text/javascript,text/ecmascript')
  */
 public function themedJavascript($name, $type = null)
 {
     $path = ThemeResourceLoader::instance()->findThemedJavascript($name, SSViewer::get_themes());
     if ($path) {
         $opts = [];
         if ($type) {
             $opts['type'] = $type;
         }
         $this->javascript($path, $opts);
     } else {
         throw new \InvalidArgumentException("The javascript file doesn't exists. Please check if the file {$name}.js exists in any " . "context or search for themedJavascript references calling this file in your templates.");
     }
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:24,代码来源:Requirements.php

示例6: getAvailableThemesExtended

 /**
  * Get all available themes that haven't been marked as disabled.
  * @param string $baseDir Optional alternative theme base directory for testing
  * @return array of theme directory names
  */
 public function getAvailableThemesExtended($baseDir = null)
 {
     if (class_exists('Subsite') && Subsite::currentSubsiteID()) {
         $subsiteThemes = Subsite::config()->allowed_themes;
         // Make sure set theme is allowed
         $subsite = Subsite::currentSubsite();
         if ($subsite->Theme && !in_array($subsite->Theme, $subsiteThemes)) {
             $subsiteThemes[] = $subsite->Theme;
         }
         // Make sure default theme is allowed
         $theme = Config::inst()->get('SSViewer', 'theme');
         if ($theme && !in_array($theme, $subsiteThemes)) {
             $subsiteThemes[] = $theme;
         }
         return array_combine($subsiteThemes, $subsiteThemes);
     }
     $themes = SSViewer::get_themes($baseDir);
     $disabled = (array) $this->owner->config()->disabled_themes;
     foreach ($disabled as $theme) {
         if (isset($themes[$theme])) {
             unset($themes[$theme]);
         }
     }
     return $themes;
 }
开发者ID:lekoala,项目名称:silverstripe-theme-framework,代码行数:30,代码来源:ThemeSiteConfigExtension.php

示例7: getEditorCSS

 /**
  * Get location of all editor.css files
  *
  * @return array
  */
 protected function getEditorCSS()
 {
     $editor = array();
     // Add standard editor.css
     $editor[] = Director::absoluteURL(FRAMEWORK_ADMIN_DIR . '/client/dist/styles/editor.css');
     // Themed editor.css
     $themedEditor = ThemeResourceLoader::instance()->findThemedCSS('editor', SSViewer::get_themes());
     if ($themedEditor) {
         $editor[] = Director::absoluteURL($themedEditor, Director::BASE);
     }
     return $editor;
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:17,代码来源:TinyMCEConfig.php


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