本文整理汇总了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);
});
}
示例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;
}
示例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;
}
示例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);
}
示例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.");
}
}
示例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;
}
示例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;
}