예제 #1
0
 private function initCacheIfNeeded()
 {
     if ($this->cache) {
         return $this->cache;
     }
     // init a DiskCache to save all user form data
     $this->cache = DataCache::factory("DataCache", array());
     // cache life time set to 1 hour
     $this->cache->setCacheLifetime(3600);
     $this->cache->setCacheGroup("GoogleJSMapImageSize");
 }
예제 #2
0
 public function init($args)
 {
     $this->initArgs = $args;
     if (isset($args['HALT_ON_PARSE_ERRORS'])) {
         $this->haltOnParseErrors($args['HALT_ON_PARSE_ERRORS']);
     }
     $this->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
     $cacheClass = isset($args['CACHE_CLASS']) ? $args['CACHE_CLASS'] : 'DataCache';
     $this->cache = DataCache::factory($cacheClass, $args);
 }
예제 #3
0
 protected function init($args)
 {
     $this->initArgs = $args;
     if (isset($args['DEBUG_MODE'])) {
         $this->setDebugMode($args['DEBUG_MODE']);
     }
     if (isset($args['OPTIONS']) && is_array($args['OPTIONS'])) {
         $this->setOptions($args['OPTIONS']);
     }
     if (isset($args['AUTHORITY'])) {
         if ($authority = AuthenticationAuthority::getAuthenticationAuthority($args['AUTHORITY'])) {
             $this->setAuthority($authority);
         }
     }
     if (!isset($args['PARSER_CLASS'])) {
         if ($this->DEFAULT_PARSER_CLASS) {
             $args['PARSER_CLASS'] = $this->DEFAULT_PARSER_CLASS;
         } elseif (isset($args['DEFAULT_PARSER_CLASS']) && strlen($args['DEFAULT_PARSER_CLASS'])) {
             $args['PARSER_CLASS'] = $args['DEFAULT_PARSER_CLASS'];
         } else {
             $args['PARSER_CLASS'] = 'PassthroughDataParser';
         }
     }
     if (!isset($args['CACHE_LIFETIME'])) {
         $args['CACHE_LIFETIME'] = $this->DEFAULT_CACHE_LIFETIME;
     }
     // instantiate the parser class
     $parser = DataParser::factory($args['PARSER_CLASS'], $args);
     $this->setParser($parser);
     $cacheClass = isset($args['CACHE_CLASS']) ? $args['CACHE_CLASS'] : 'DataCache';
     $this->cache = DataCache::factory($cacheClass, $args);
 }
예제 #4
0
 protected function init($args)
 {
     //get global options from the site data_retriever section
     $args = array_merge(Kurogo::getOptionalSiteSection('data_retriever'), $args);
     $this->initArgs = $args;
     if (isset($args['DEBUG_MODE'])) {
         $this->setDebugMode($args['DEBUG_MODE']);
     }
     if (isset($args['DEFAULT_CACHE_LIFETIME'])) {
         $this->DEFAULT_CACHE_LIFETIME = $args['DEFAULT_CACHE_LIFETIME'];
     }
     if (isset($args['OPTIONS']) && is_array($args['OPTIONS'])) {
         $this->setOptions($args['OPTIONS']);
     }
     if (isset($args['AUTHORITY'])) {
         if ($authority = AuthenticationAuthority::getAuthenticationAuthority($args['AUTHORITY'])) {
             $this->setAuthority($authority);
         }
     }
     if (!isset($args['PARSER_CLASS'])) {
         if ($this->DEFAULT_PARSER_CLASS) {
             $args['PARSER_CLASS'] = $this->DEFAULT_PARSER_CLASS;
         } elseif (isset($args['DEFAULT_PARSER_CLASS']) && strlen($args['DEFAULT_PARSER_CLASS'])) {
             $args['PARSER_CLASS'] = $args['DEFAULT_PARSER_CLASS'];
         } else {
             $args['PARSER_CLASS'] = 'PassthroughDataParser';
         }
     }
     if (isset($args['CACHE_LIFETIME'])) {
         $this->cacheLifetime = $args['CACHE_LIFETIME'];
     } else {
         $args['CACHE_LIFETIME'] = $this->DEFAULT_CACHE_LIFETIME;
     }
     if (isset($args['SHOW_WARNINGS'])) {
         $this->showWarnings = (bool) $args['SHOW_WARNINGS'];
     }
     // instantiate the parser class
     $parser = DataParser::factory($args['PARSER_CLASS'], $args);
     $this->setParser($parser);
     $cacheClass = isset($args['CACHE_CLASS']) ? $args['CACHE_CLASS'] : 'DataCache';
     $this->cache = DataCache::factory($cacheClass, $args);
 }