/**
  * Load the application config
  * @return Config
  */
 protected function loadConfig()
 {
     $config = null;
     if (CacheManager::resourceExists(self::CONFIG_RESOURCE_NAME, CacheManager::APPLICATION_SCOPE)) {
         $config = CacheManager::loadResource(self::CONFIG_RESOURCE_NAME, CacheManager::APPLICATION_SCOPE);
     } else {
         $config = ConfigLoader::load(CONFIG_FILE);
         CacheManager::saveResource(self::CONFIG_RESOURCE_NAME, $config, CacheManager::APPLICATION_SCOPE);
     }
     PiconApplication::get()->getConfigLoadListener()->onConfigLoaded($config);
     return $config;
 }
Example #2
0
 private function __construct(Component $component)
 {
     $this->component = $component;
     $page = $component->getPage() == null ? "" : get_class($component->getPage());
     $resourceName = self::PROPERTIES_CACHE_NAME . '_' . $page . '_' . $component->getComponentPath();
     if (CacheManager::resourceExists($resourceName, CacheManager::APPLICATION_SCOPE)) {
         $this->properties = CacheManager::loadResource($resourceName, CacheManager::APPLICATION_SCOPE);
     } else {
         $this->properties = $this->getProperties($this->component);
         CacheManager::saveResource($resourceName, $this->properties, CacheManager::APPLICATION_SCOPE);
     }
 }
Example #3
0
 /**
  * Load the associated markup file for a component
  * @param Component $component
  * @return MarkupElement The root markup tag, populated with child tags 
  */
 public function loadMarkup(Component $component)
 {
     $name = get_class($component);
     $fileSafeName = str_replace('\\', '_', $name);
     if (PiconApplication::get()->getProfile()->isCacheMarkup()) {
         if (CacheManager::resourceExists(self::MARKUP_RESOURCE_PREFIX . $fileSafeName, CacheManager::APPLICATION_SCOPE)) {
             return CacheManager::loadResource(self::MARKUP_RESOURCE_PREFIX . $fileSafeName, CacheManager::APPLICATION_SCOPE);
         } else {
             $markup = $this->internalLoadMarkup($name);
             CacheManager::saveResource(self::MARKUP_RESOURCE_PREFIX . $fileSafeName, $markup, CacheManager::APPLICATION_SCOPE);
             return $markup;
         }
     } else {
         return $this->internalLoadMarkup($name);
     }
 }