Пример #1
0
 /**
  * The initialization function. Sets the common parameters based on the $args. This method is
  * called by the public factory method. Subclasses can override this method, but must call parent::init()
  * FIRST. Optional parameters include PARSER_CLASS, BASE_URL, TITLE and CACHE_LIFETIME. Arguments
  * are also passed to the data parser object
  * @param array $args an associative array of arguments and paramters
  */
 protected function init($args)
 {
     $this->initArgs = $args;
     if (isset($args['DEBUG_MODE'])) {
         $this->setDebugMode($args['DEBUG_MODE']);
     }
     // use a parser class if set, otherwise use the default parser class from the controller
     $args['PARSER_CLASS'] = isset($args['PARSER_CLASS']) ? $args['PARSER_CLASS'] : $this->DEFAULT_PARSER_CLASS;
     // instantiate the parser class and add it to the controller
     $parser = DataParser::factory($args['PARSER_CLASS'], $args);
     $this->setParser($parser);
     $parser->setDataController($this);
     if (isset($args['BASE_URL'])) {
         $this->setBaseURL($args['BASE_URL']);
     }
     if (isset($args['TITLE'])) {
         $this->setTitle($args['TITLE']);
     }
     if (isset($args['CACHE_LIFETIME'])) {
         $this->setCacheLifetime($args['CACHE_LIFETIME']);
     }
     $this->initStreamContext($args);
 }
Пример #2
0
 function parseWSDL($wsdl_data)
 {
     $parser = DataParser::factory('WSDLParser', array());
     $wsdl = $parser->parseData($wsdl_data);
     return $wsdl;
 }
    protected function init($args)
    {
        $args['PARSER_CLASS'] = isset($args['PARSER_CLASS']) ? $args['PARSER_CLASS'] : $this->DEFAULT_PARSER_CLASS;
        $parser = DataParser::factory($args['PARSER_CLASS'], $args);
        
        $this->setParser($parser);
        
        if (isset($args['BASE_URL'])) {
            $this->setBaseURL($args['BASE_URL']);
        }

        if (isset($args['TITLE'])) {
            $this->setTitle($args['TITLE']);
        }

        if (isset($args['CACHE_LIFETIME'])) {
            $this->setCacheLifetime($args['CACHE_LIFETIME']);
        }
        
    }
Пример #4
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);
 }
Пример #5
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);
 }