Example #1
0
 /**
  * Get options
  *
  * @return Zend_Config
  */
 protected function _getOptions()
 {
     if ($formCache = ZLayer_Cache::get('form')) {
         $cacheId = ZLayer_Cache::id('form_dojo_' . $this->_module . $this->_form);
         if ($formCache->test($cacheId) !== false) {
             $this->_options = $formCache->load($cacheId, true);
             return $this->_options;
         } else {
             $this->_makeDojoOptions();
             $formCache->save($this->_options, $cacheId, array(), null);
             return $this->_options;
         }
     } else {
         $this->_makeDojoOptions();
         return $this->_options;
     }
 }
Example #2
0
 /**
  * Initialize Front Controller
  *
  */
 public function init()
 {
     $resOptions = $this->getOptions();
     $this->_basePath = $resOptions["basePath"];
     $cacheId = ZLayer_Cache::id("theme");
     if ($requestCache = ZLayer_Cache::get('theme')) {
         if ($requestCache->test($cacheId) !== false) {
             $optionsAr = $requestCache->load($cacheId, true);
         } else {
             $optionsAr = $this->_getThemesOptions($resOptions["name"]);
             $requestCache->save($optionsAr, $cacheId, array(), null);
         }
     } else {
         $optionsAr = $this->_getThemesOptions($resOptions["name"]);
     }
     if (!isset($optionsAr["resources"])) {
         return;
     }
     $bootstrap = $this->getBootstrap();
     $resAr = $optionsAr["resources"];
     $bootstrap = $this->getBootstrap();
     $bootOptionsAr = $bootstrap->getOptions();
     foreach ($resAr as $resKey => $resValue) {
         if (isset($bootOptionsAr["resources"][$resKey])) {
             $bootResOptionsAr = $bootOptionsAr["resources"][$resKey];
             if (is_array($bootResOptionsAr)) {
                 $resValue = array_merge_recursive($bootResOptionsAr, $resValue);
             }
         }
         $resource = $bootstrap->getPluginResource($resKey);
         $resource->setOptions($resValue);
         if ($resKey != "theme") {
             $bootstrap->bootstrap(ucfirst($resKey));
         }
     }
 }
Example #3
0
 /**
  * _getFileOptions
  *
  * @param  string $file
  * @param  string $baseDir
  * @return array|bool
  */
 private function _getFileOptions($file, $baseDir)
 {
     if ($fileCache = $requestCache = ZLayer_Cache::get('request')) {
         $cacheId = ZLayer_Cache::id("request_file_" . $baseDir . $file);
         if ($fileCache->test($cacheId) !== false) {
             return $fileCache->load($cacheId, true);
         } else {
             $array = $this->_makeFileOptions($file, $baseDir);
             $fileCache->save($array, $cacheId, array(), null);
             return $array;
         }
     } else {
         return $this->_makeFileOptions($file, $baseDir);
     }
 }