當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConfigFile::opened方法代碼示例

本文整理匯總了PHP中ConfigFile::opened方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigFile::opened方法的具體用法?PHP ConfigFile::opened怎麽用?PHP ConfigFile::opened使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ConfigFile的用法示例。


在下文中一共展示了ConfigFile::opened方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: initTheme

 public function initTheme()
 {
     $result = false;
     if (strlen($this->mTheme)) {
         global $gEnv;
         import('com.solarix.ampoliros.core.Ampoliros');
         $amp = Ampoliros::instance('Ampoliros');
         if ($this->mTheme == 'default') {
             $this->mTheme = $gEnv['hui']['theme']['default'];
         }
         if ($this->mTheme != 'userdefined') {
             if (file_exists(CONFIG_PATH . $this->mTheme . '.huitheme')) {
                 $this->mThemeFile = CONFIG_PATH . $this->mTheme . '.huitheme';
             } else {
                 $this->mTheme = $gEnv['hui']['theme']['default'];
                 $this->mThemeFile = CONFIG_PATH . $gEnv['hui']['theme']['default'] . '.huitheme';
             }
             OpenLibrary('configman.library');
             $cfg_file = new ConfigFile($this->mThemeFile);
             if ($cfg_file->opened()) {
                 $this->mIconsSetName = $cfg_file->Value('THEME.ICONSSET');
                 $this->mColorsSetName = $cfg_file->Value('THEME.COLORSSET');
                 $this->mStyleName = $cfg_file->Value('THEME.STYLE');
             } else {
                 import('com.solarix.ampoliros.io.log.Logger');
                 $log = new Logger(AMP_LOG);
                 $log->LogEvent('ampoliros.huithemes_library.huitheme_class.inittheme', 'Unable to open theme configuration file ' . $this->mThemeFile, LOGGER_ERROR);
             }
         } else {
             $this->mIconsSetName = $this->mUserSettings['iconsset'];
             $this->mColorsSetName = $this->mUserSettings['colorsset'];
             $this->mStyleName = $this->mUserSettings['stylename'];
         }
         $this->mIconsSetBase = CGI_URL . 'icons/' . $this->mIconsSetName . '/';
         $this->mIconsBase = CGI_URL . 'icons/';
         $this->mIconsSetDir = CGI_PATH . 'icons/' . $this->mIconsSetName . '/';
         $this->mStyleBase = CGI_URL . 'styles/';
         $this->mStyleDir = CGI_PATH . 'styles/' . $this->mStyleName . '/';
         $hui_colors = new HuiColorsSet($this->mrAmpDb, $this->mColorsSetName);
         $hui_icons = new HuiIconsSet($this->mrAmpDb, $this->mIconsSetName);
         $hui_style = new HuiStyle($this->mrAmpDb, $this->mStyleName);
         if ($amp->getState() != Ampoliros::STATE_SETUP) {
             $cached_iconsset = new CachedItem($this->mrAmpDb, 'ampoliros', 'huiiconsset-' . $this->mIconsSetName);
             $cached_colorsset = new CachedItem($this->mrAmpDb, 'ampoliros', 'huicolorsset-' . $this->mColorsSetName);
             $cached_style = new CachedItem($this->mrAmpDb, 'ampoliros', 'huistyle-' . $this->mStyleName);
             $this->mIconsSet = unserialize($cached_iconsset->Retrieve());
             $this->mColorsSet = unserialize($cached_colorsset->Retrieve());
             $this->mStyle = unserialize($cached_style->Retrieve());
         }
         if (!$this->mIconsSet or !$this->mColorsSet or !$this->mStyle) {
             if ($gEnv['hui']['theme']['default'] == $this->mTheme) {
                 $this->mColorsSet = $hui_colors->GetColorsSet();
                 $this->mIconsSet = $hui_icons->GetIconsSet();
                 $this->mStyle = $hui_style->GetStyle();
             } else {
                 OpenLibrary('configman.library');
                 $def_cfg_file = new ConfigFile(CONFIG_PATH . $gEnv['hui']['theme']['default'] . '.huitheme');
                 if ($def_cfg_file->Opened()) {
                     $def_icons_set_name = $def_cfg_file->Value('THEME.ICONSSET');
                     $def_colors_set_name = $def_cfg_file->Value('THEME.COLORSSET');
                     $def_style_name = $def_cfg_file->Value('THEME.STYLE');
                 } else {
                     import('com.solarix.ampoliros.io.log.Logger');
                     $log = new Logger(AMP_LOG);
                     $log->LogEvent('ampoliros.huithemes_library.huitheme_class.inittheme', 'Unable to open default theme configuration file ' . CONFIG_PATH . $gEnv['hui']['theme']['default'] . '.huitheme', LOGGER_ERROR);
                 }
                 $hui_def_colors = new HuiColorsSet($this->mrAmpDb, $def_colors_set_name);
                 $hui_def_icons = new HuiIconsSet($this->mrAmpDb, $def_icons_set_name);
                 $hui_def_style = new HuiStyle($this->mrAmpDb, $def_style_name);
                 $this->mColorsSet = $this->DefOpts($hui_def_colors->GetColorsSet(), $hui_colors->GetColorsSet());
                 $this->mIconsSet = $this->DefOpts($hui_def_icons->GetIconsSet(), $hui_icons->GetIconsSet());
                 $this->mStyle = $this->DefOpts($hui_def_style->GetStyle(), $hui_style->GetStyle());
             }
             while (list($style_name, $style_item) = each($this->mStyle)) {
                 $this->mStyle[$style_name] = $this->mStyleBase . $style_item['base'] . '/' . $style_item['value'];
             }
             if ($amp->getState() != Ampoliros::STATE_SETUP) {
                 $cached_iconsset->Store(serialize($this->mIconsSet));
                 $cached_colorsset->Store(serialize($this->mColorsSet));
                 $cached_style->Store(serialize($this->mStyle));
             }
         }
     }
     return $result;
 }
開發者ID:alexpagnoni,項目名稱:ampoliros,代碼行數:85,代碼來源:HuiTheme.php


注:本文中的ConfigFile::opened方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。