public function initialize(AgaviContext $context, array $parameters = array()) { parent::initialize($context, $parameters); $this->rq = $context->getRequest(); //merge default options, earlier set options and parameters from the xml config. $defaultOptions = array('sections' => array('routing', 'globalrd', 'actions', 'translation', 'environment', 'log')); $options = array_merge($defaultOptions, $this->rq->getAttribute('options', self::NS, array()), $this->getParameters()); $this->rq->setAttribute('options', $options, self::NS); //external data sources foreach ($this->getParameter('datasources', array()) as $datasource) { $ds = new $datasource['class'](); $ds->initialize($context, isset($datasource['parameters']) && is_array($datasource['parameters']) ? $datasource['parameters'] : array()); $this->rq->appendAttribute('datasources', $ds, self::NS); } }
/** * Initialize this filter. * * @param AgaviContext The current application context. * @param array An associative array of initialization parameters. * * @throws <b>AgaviFilterException</b> If an error occurs during * initialization * * @author David Zülke <*****@*****.**> * @since 0.11.0 */ public function initialize(AgaviContext $context, array $parameters = array()) { // set defaults $this->setParameters(array('methods' => array(), 'output_types' => null, 'populate' => null, 'skip' => null, 'include_hidden_inputs' => true, 'include_password_inputs' => false, 'force_output_mode' => false, 'force_encoding' => false, 'force_request_uri' => false, 'force_request_url' => false, 'cdata_fix' => true, 'parse_xhtml_as_xml' => true, 'remove_auto_xml_prolog' => true, 'dom_substitute_entities' => false, 'dom_resolve_externals' => false, 'dom_validate_on_parse' => false, 'dom_preserve_white_space' => true, 'dom_format_output' => false, 'savexml_options' => array(), 'error_class' => 'error', 'error_class_map' => array(), 'error_messages' => array(), 'field_error_messages' => array(), 'multi_field_error_messages' => array(), 'ignore_parse_errors' => LIBXML_ERR_ERROR, 'log_parse_errors' => true, 'logging_logger' => null)); // initialize parent parent::initialize($context, $parameters); // and "clean up" some of the params just in case the user messed up $errorClassMap = (array) $this->getParameter('error_class_map'); // append a match-all expression to the map, which assigns the default error class $errorClassMap['self::${htmlnsPrefix}*'] = $this->getParameter('error_class'); $this->setParameter('error_class_map', $errorClassMap); $this->setParameter('methods', (array) $this->getParameter('methods')); if ($ot = $this->getParameter('output_types')) { $this->setParameter('output_types', (array) $ot); } $savexmlOptions = 0; foreach ((array) $this->getParameter('savexml_options', array()) as $option) { if (is_numeric($option)) { $savexmlOptions |= (int) $option; } elseif (defined($option)) { $savexmlOptions |= constant($option); } } $this->setParameter('savexml_options', $savexmlOptions); $ignoreParseErrors =& $this->getParameter('ignore_parse_errors'); if (is_string($ignoreParseErrors) && defined($ignoreParseErrors)) { $ignoreParseErrors = constant($ignoreParseErrors); } // BC if ($ignoreParseErrors === true) { $ignoreParseErrors = LIBXML_ERR_FATAL; } elseif ($ignoreParseErrors === false) { $ignoreParseErrors = LIBXML_ERR_NONE; } // and now copy all that to the request namespace so it can all be modified at runtime, not just overwritten $this->context->getRequest()->setAttributes($this->getParameters(), 'org.agavi.filter.FormPopulationFilter'); }
/** * Initialize this filter. * * @param AgaviContext The current application context. * @param array An associative array of initialization parameters. * * @throws <b>AgaviFilterException</b> If an error occurs during * initialization. * * @author Sean Kerr <*****@*****.**> * @author David Zülke <*****@*****.**> * @since 0.9.0 */ public function initialize(AgaviContext $context, array $parameters = array()) { // set defaults $this->setParameter('comment', true); $this->setParameter('replace', null); $this->setParameter('output_types', null); // initialize parent parent::initialize($context, $parameters); }
/** * Initialize this filter. * * @param AgaviContext The current application context. * @param array An associative array of initialization parameters. * * @throws <b>AgaviFilterException</b> If an error occurs during * initialization * * @author David Zülke <*****@*****.**> * @since 0.11.0 */ public function initialize(AgaviContext $context, array $parameters = array()) { // set defaults $this->setParameters(array('methods' => null, 'output_types' => null, 'tidy_options' => array(), 'tidy_encoding' => null, 'ignore_errors' => true, 'log_errors' => true, 'logging_severity' => AgaviLogger::WARN, 'logging_logger' => null)); // initialize parent parent::initialize($context, $parameters); }