예제 #1
0
 /**
  * Merge the action's view configuration with the application's default view configuration.
  * 
  * @return 
  */
 public function mergeConfig($moduleName, $actionName, $viewName)
 {
     $config = $this->fixForDeepMerge($this->configValues);
     $configFile = coreConfig::get('app_module_dir') . '/' . $moduleName . '/config/view' . self::CONFIG_FILE_EXT;
     if (is_readable($configFile)) {
         $configValues = (require $configFile);
         // php config file must return an array
         if (!is_array($configValues)) {
             throw new coreException('Error loading configuration file ' . $configFile);
         }
         // the default view configuration for this module
         $allConfig = isset($configValues['all']) ? $configValues['all'] : null;
         // FIXME  Decide to keep the 'Success' suffix like Symfony, or loose it.
         if ($viewName === coreView::SUCCESS) {
             $viewName = '';
         }
         // this view's configuration values
         $viewKey = $actionName . $viewName;
         $viewConfig = isset($configValues[$viewKey]) ? $configValues[$viewKey] : null;
         if ($allConfig !== null) {
             $config = coreToolkit::arrayDeepMerge($config, $this->fixForDeepMerge($allConfig));
         }
         if ($viewConfig !== null) {
             $config = coreToolkit::arrayDeepMerge($config, $this->fixForDeepMerge($viewConfig));
         }
     }
     $this->configValues = $config;
 }
예제 #2
0
파일: core.php 프로젝트: nikitakit/RevTK
 /**
  * Return environment-specific application settings.
  * 
  * @return array
  */
 public function getApplicationSettings()
 {
     $settings = (require coreConfig::get('app_config_dir') . '/settings.php');
     $appSettings = isset($settings['all']) ? $settings['all'] : array();
     $envName = $this->getEnvironment();
     $envSettings = isset($settings[$envName]) ? $settings[$envName] : null;
     if ($envSettings !== null) {
         $appSettings = coreToolkit::arrayDeepMerge($appSettings, $envSettings);
     }
     //  DBG::printr($appSettings);exit;
     return $appSettings;
 }