本文整理汇总了PHP中SugarThemeRegistry::_themes方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarThemeRegistry::_themes方法的具体用法?PHP SugarThemeRegistry::_themes怎么用?PHP SugarThemeRegistry::_themes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarThemeRegistry
的用法示例。
在下文中一共展示了SugarThemeRegistry::_themes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildRegistry
/**
* Builds the theme registry
*/
public static function buildRegistry()
{
self::$_themes = array();
// check for a default themedef file
$themedefDefault = array();
if (SugarAutoLoader::existing("custom/themes/default/themedef.php")) {
$themedef = array();
require "custom/themes/default/themedef.php";
$themedefDefault = $themedef;
}
foreach (SugarAutoLoader::getFilesCustom("themes", true) as $file) {
if (SugarAutoLoader::existing("{$file}/themedef.php")) {
$themedef = array();
require "{$file}/themedef.php";
$themedef = array_merge($themedef, $themedefDefault);
$themedef['dirName'] = basename($file);
if (self::exists($themedef['dirName'])) {
$existingTheme = self::get($themedef['dirName']);
foreach (SugarTheme::getThemeDefFields() as $field) {
if (!isset($themedef[$field])) {
$themedef[$field] = $existingTheme->{$field};
}
}
self::remove($themedef['dirName']);
}
if (isset($themedef['name'])) {
self::add($themedef);
}
}
}
// default to setting the default theme as the current theme
if (!isset($GLOBALS['sugar_config']['default_theme']) || !self::set($GLOBALS['sugar_config']['default_theme'])) {
if (count(self::availableThemes()) == 0) {
sugar_die('No valid themes are found on this instance');
} else {
self::set(self::getDefaultThemeKey());
}
}
}
示例2: buildRegistry
/**
* Builds the theme registry
*/
public static function buildRegistry()
{
self::$_themes = array();
$dirs = array("themes/", "custom/themes/");
// check for a default themedef file
$themedefDefault = array();
if (sugar_is_file("custom/themes/default/themedef.php")) {
$themedef = array();
require "custom/themes/default/themedef.php";
$themedefDefault = $themedef;
}
foreach ($dirs as $dirPath) {
if (sugar_is_dir('./' . $dirPath) && is_readable('./' . $dirPath) && ($dir = opendir('./' . $dirPath))) {
while (($file = readdir($dir)) !== false) {
if ($file == ".." || $file == "." || $file == ".svn" || $file == "CVS" || $file == "Attic" || $file == "default" || !sugar_is_dir("./{$dirPath}" . $file) || !sugar_is_file("./{$dirPath}{$file}/themedef.php")) {
continue;
}
$themedef = array();
require "./{$dirPath}{$file}/themedef.php";
$themedef = array_merge($themedef, $themedefDefault);
$themedef['dirName'] = $file;
// check for theme already existing in the registry
// if so, then it will override the current one
if (self::exists($themedef['dirName'])) {
$existingTheme = self::get($themedef['dirName']);
foreach (SugarTheme::getThemeDefFields() as $field) {
if (!isset($themedef[$field])) {
$themedef[$field] = $existingTheme->{$field};
}
}
self::remove($themedef['dirName']);
}
if (isset($themedef['name'])) {
self::add($themedef);
}
}
closedir($dir);
}
}
// default to setting the default theme as the current theme
if (!isset($GLOBALS['sugar_config']['default_theme']) || !self::set($GLOBALS['sugar_config']['default_theme'])) {
if (count(self::availableThemes()) == 0) {
sugar_die('No valid themes are found on this instance');
} else {
self::set(self::getDefaultThemeKey());
}
}
}
示例3: buildRegistry
/**
* Builds the theme registry
*/
public static function buildRegistry()
{
self::$_themes = array();
$dirs = array("themes/", "custom/themes/");
foreach ($dirs as $dirPath) {
if (sugar_is_dir('./' . $dirPath) && ($dir = opendir('./' . $dirPath))) {
while (($file = readdir($dir)) !== false) {
if ($file == ".." || $file == "." || $file == ".svn" || $file == "CVS" || $file == "Attic" || !sugar_is_dir("./{$dirPath}" . $file) || !sugar_is_file("./{$dirPath}{$file}/themedef.php")) {
continue;
}
$themedef = array();
require "./{$dirPath}{$file}/themedef.php";
$themedef['dirName'] = $file;
// check for theme already existing in the registry
// if so, then it will override the current one
if (self::exists($themedef['dirName'])) {
$existingTheme = self::get($themedef['dirName']);
foreach (SugarTheme::getThemeDefFields() as $field) {
if (!isset($themedef[$field])) {
$themedef[$field] = $existingTheme->{$field};
}
}
self::remove($themedef['dirName']);
}
if (isset($themedef['name'])) {
self::add($themedef);
}
}
closedir($dir);
}
}
// default to setting the default theme as the current theme
self::set($GLOBALS['sugar_config']['default_theme']);
}