protected function init($args) { parent::init($args); //get global options from the site soap section $args = array_merge(Kurogo::getOptionalSiteSection('soap'), $args); if (isset($args['WSDL']) && $args['WSDL']) { $this->setWSDL($args['WSDL']); } if (isset($args['BASE_URL'])) { $this->location = $args['BASE_URL']; $this->setSoapOption('location', $args['BASE_URL']); if (isset($args['URI'])) { $this->setSoapOption('uri', $args['URI']); } else { $this->setSoapOption('uri', FULL_URL_BASE); } } if (isset($args['METHOD'])) { $this->setMethod($args['METHOD']); } if (isset($args['PARAMETERS'])) { if (!is_array($args['PARAMETERS'])) { throw new KurogoConfigurationException("Parameters must be an array"); } $this->setParameters($args['PARAMETERS']); } if (isset($args['SSL_VERIFY'])) { $this->setSoapOption('ssl_verify', $args['SSL_VERIFY']); } }
/** * Public factory method. This is the designated way to instantiated data controllers. Takes a string * for the classname to load and an array of arguments. Subclasses should generally not override this * method, but instead override init() to provide initialization behavior * @param string $controllerClass the classname to instantiate * @param array $args an associative array of arguments that get passed to init() and the data parser * @return DataController a data controller object */ public static function factory($controllerClass, $args = array()) { $args = is_array($args) ? $args : array(); Kurogo::log(LOG_DEBUG, "Initializing DataController {$controllerClass}", "data"); if (!class_exists($controllerClass)) { throw new KurogoConfigurationException("Controller class {$controllerClass} not defined"); } $controller = new $controllerClass(); if (!$controller instanceof DataController) { throw new KurogoConfigurationException("{$controllerClass} is not a subclass of DataController"); } $controller->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG')); //get global options from the site data_controller section $args = array_merge(Kurogo::getOptionalSiteSection('data_controller'), $args); $controller->init($args); return $controller; }
public function messagingEnabled() { // if module doesn't specify messaging parameter, use site value $siteConfig = Kurogo::getOptionalSiteSection('notifications'); $siteEnabled = Kurogo::arrayVal($siteConfig, 'ENABLED_BY_DEFAULT', false); return $this->getOptionalModuleVar('messaging', $siteEnabled, null, 'module'); }
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); }
protected function getPlatformConfig() { $config = Kurogo::getOptionalSiteSection('apps'); $config['CLEAR_WEB_CACHES_ON_SUSPEND'] = (bool) Kurogo::arrayVal($config, 'CLEAR_WEB_CACHES_ON_SUSPEND', false); return $config; }