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


PHP Zend_Application::_loadConfig方法代碼示例

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


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

示例1: _loadConfig

 /**
  * Load configuration file of options
  *
  * @param string $file configuration file
  *
  * @throws Zend_Application_Exception When invalid configuration file is provided
  *
  * @return array
  */
 protected function _loadConfig($file)
 {
     if ($this->isFileUpToDate($file) && ($config = $this->getConfigFromCache())) {
         return $config;
     }
     return $this->storeConfigInCache(parent::_loadConfig($file));
 }
開發者ID:JellyBellyDev,項目名稱:zle,代碼行數:16,代碼來源:Application.php

示例2: _loadConfig

    /**
     * Creates and caches Zend_Config. This can't be done in the bootstrap
     * because the application requires a configuration in order to be
     * created.
     *
     * @param   string      Config file
     * @return  array
     */
    protected function _loadConfig($file)
    {
        $frontendOptions = array(
            'automatic_serialization'   => true,
            'master_file'               => $file,
            'cache_id_prefix'           => APPLICATION_ENV
        );

        if (extension_loaded('apc')) {
            $cache = Zend_Cache::factory('File', 'Apc', $frontendOptions);
        } else {
            $cache = Zend_Cache::factory('File', 'File', $frontendOptions, array(
                'cache_dir'     => PROJECT_BASE_PATH . '/cache',
                'file_locking'  => true
            ));
        }

        if (APPLICATION_ENV != 'production' || (!$config = $cache->load('config'))) {
            $config = parent::_loadConfig($file);

            // Initialize WordPress configuration values
            $config = $this->_initWordPress($config);

            if (APPLICATION_ENV == 'production') {
                $cache->save($config, 'config');
            }
        }

        // Save for bootstrapping
        Zend_Registry::set('config', $obj = new Zend_Config($config));

        return $config;
    }
開發者ID:RemiWoler,項目名稱:vulnero,代碼行數:41,代碼來源:Application.php

示例3: _loadConfig

 /**
  * Load configuration file of options.
  *
  * Optionally will cache the configuration.
  *
  * @param  string $file
  * @throws Zend_Application_Exception When invalid configuration file is provided
  * @return array
  */
 protected function _loadConfig($file)
 {
     $suffix = pathinfo($file, PATHINFO_EXTENSION);
     $suffix = $suffix === 'dist' ? pathinfo(basename($file, ".{$suffix}"), PATHINFO_EXTENSION) : $suffix;
     if ($suffix == 'ini') {
         $config = Garp_Config_Ini::getCached($file, $this->getEnvironment())->toArray();
     } else {
         $config = parent::_loadConfig($file);
     }
     return $config;
 }
開發者ID:grrr-amsterdam,項目名稱:garp3,代碼行數:20,代碼來源:Application.php

示例4: _loadConfig

 /**
  * Load configuration file of options.
  *
  * Optionally will cache the configuration.
  *
  * @param  string $file
  * @throws Zend_Application_Exception When invalid configuration file is provided
  * @return array
  */
 protected function _loadConfig($file)
 {
     if (!$this->_cacheConfig) {
         return parent::_loadConfig($file);
     }
     require_once 'Zend/Cache.php';
     $cache = Zend_Cache::factory($this->_cacheOptions['frontendType'], $this->_cacheOptions['backendType'], array_merge(array('master_file' => $file, 'automatic_serialization' => true), $this->_cacheOptions['frontendOptions']), array_merge(array('cache_dir' => APPLICATION_PATH . '/../data/cache'), $this->_cacheOptions['backendOptions']));
     $config = $cache->load('Zend_Application_Config');
     if (!$config) {
         $config = parent::_loadConfig($file);
         $cache->save($config, 'Zend_Application_Config');
     }
     return $config;
 }
開發者ID:hukumonline,項目名稱:pmg,代碼行數:23,代碼來源:ZP.php

示例5: _loadConfig

 protected function _loadConfig($file)
 {
     $filename = str_replace('ini', 'php', basename($file));
     $path = APPLICATION_PATH . '/../data/cache/' . $filename;
     if (file_exists($path)) {
         return require $path;
     }
     $config = parent::_loadConfig($file);
     if (isset($config['resources']['cachemanager']['default']['active']) && $config['resources']['cachemanager']['default']['active'] || $this->_cacheEnabled) {
         $this->_cacheEnabled = true;
         $arrayString = "<?php\n return " . var_export($config, true) . ";\n";
         file_put_contents($path, $arrayString);
     }
     return $config;
 }
開發者ID:abdala,項目名稱:la,代碼行數:15,代碼來源:Application.php

示例6: _loadConfig

 protected function _loadConfig($file)
 {
     if ($this->_useCache == false) {
         return parent::_loadConfig($file);
     }
     $configMTime = filemtime($file);
     $cacheId = "application_conf_" . md5($file . $this->getEnvironment());
     $cacheLastMTime = $this->_configCache->test($cacheId);
     //Valid cache?
     if ($cacheLastMTime !== false && $configMTime <= $cacheLastMTime) {
         return $this->_configCache->load($cacheId, true);
     }
     $config = parent::_loadConfig($file);
     $this->_configCache->save($config, $cacheId, array(), null);
     return $config;
 }
開發者ID:henvic,項目名稱:MediaLab,代碼行數:16,代碼來源:Application.php

示例7: _loadConfig

 /**
  * Loads the configuration file from either cache or file
  *
  * @param string $file
  * @return array
  */
 protected function _loadConfig($file)
 {
     if (isset($this->_cacheOptions['enabled']) && false === $this->_cacheOptions['enabled']) {
         return parent::_loadConfig($file);
     }
     $frontendType = isset($this->_cacheOptions['frontendType']) ? $this->_cacheOptions['frontendType'] : 'File';
     $backendType = isset($this->_cacheOptions['backendType']) ? $this->_cacheOptions['backendType'] : 'File';
     $frontendOptions = isset($this->_cacheOptions['frontendOptions']) ? $this->_cacheOptions['frontendOptions'] : array();
     $backendOptions = isset($this->_cacheOptions['backendOptions']) ? $this->_cacheOptions['backendOptions'] : array();
     require_once 'Zend/Cache.php';
     $cache = Zend_Cache::factory($frontendType, $backendType, array_merge(array('master_file' => $file, 'automatic_serialization' => true), $frontendOptions), array_merge(array('cache_dir' => sys_get_temp_dir()), $backendOptions));
     $config = $cache->load('Zend_Application_Config');
     if (!$config) {
         $config = parent::_loadConfig($file);
         $cache->save($config, 'Zend_Application_Config');
     }
     return $config;
 }
開發者ID:robzienert,項目名稱:Drake,代碼行數:24,代碼來源:Application.php

示例8: _loadConfig

 /**
  * @param string $file
  * @param bool $fromDefault
  * @return Zend_Config
  * @author Se#
  * @version 0.0.1
  */
 protected function _loadConfig($file, $fromDefault = false)
 {
     // define is default config need
     $default = $fromDefault ? false : $this->_defaultConfig();
     $suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
     if ($this->_configCache === null || $suffix == 'php' || $suffix == 'inc') {
         //No need for caching those
         return $default ? $this->_mergeConfigs($default, parent::_loadConfig($file)) : parent::_loadConfig($file);
     }
     $configMTime = filemtime($file);
     $cacheId = $this->_cacheId($file);
     $cacheLastMTime = $this->_configCache->test($cacheId);
     if ($cacheLastMTime !== false && $configMTime < $cacheLastMTime) {
         //Valid cache?
         return $this->_configCache->load($cacheId, true);
     } else {
         $config = parent::_loadConfig($file);
         $this->_configCache->save($config, $cacheId, array(), null);
         return $default ? $this->_mergeConfigs($default, $config) : $config;
     }
 }
開發者ID:nurikk,項目名稱:EvilRocketFramework,代碼行數:28,代碼來源:Application.php


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