configure

@param HTMLPurifier_Config $config The config to use for HtmlPurifier.
@return void
764466
public static function configure($config)
    {
        // Don't set alt attributes to filenames by default
        $config->set('Attr.DefaultImageAlt', '');
        $config->set('Attr.DefaultInvalidImageAlt', '');

        // Add support for some HTML5 elements
        // see http://htmlpurifier.org/phorum/read.php?3,6731,6731
        $config->set('HTML.DefinitionID', '1');
        // see https://github.com/mewebstudio/Purifier/issues/32#issuecomment-182502361
        // see https://gist.github.com/lluchs/3303693
        if ($def = $config->maybeGetRawHTMLDefinition()) {
            // Content model actually excludes several tags, not modelled here
            $def->addElement('address', 'Block', 'Flow', 'Common');
            $def->addElement('hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common');

            // http://developers.whatwg.org/grouping-content.html
            $def->addElement('figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common');
            $def->addElement('figcaption', 'Inline', 'Flow', 'Common');

            // http://developers.whatwg.org/text-level-semantics.html
            $def->addElement('s', 'Inline', 'Inline', 'Common');
            $def->addElement('var', 'Inline', 'Inline', 'Common');
            $def->addElement('sub', 'Inline', 'Inline', 'Common');
            $def->addElement('sup', 'Inline', 'Inline', 'Common');
            $def->addElement('mark', 'Inline', 'Inline', 'Common');
            $def->addElement('wbr', 'Inline', 'Empty', 'Core');

            // http://developers.whatwg.org/edits.html
            $def->addElement('ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']);
            $def->addElement('del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']);
        }
    }
585531
protected function setupConfigStuff($config)
    {
        // setup allowed elements
        $support = "(for information on implementing this, see the " .
            "support forums) ";
        $allowed_properties = $config->get('CSS.AllowedProperties');
        if ($allowed_properties !== null) {
            foreach ($this->info as $name => $d) {
                if (!isset($allowed_properties[$name])) {
                    unset($this->info[$name]);
                }
                unset($allowed_properties[$name]);
            }
            // emit errors
            foreach ($allowed_properties as $name => $d) {
                // :TODO: Is this htmlspecialchars() call really necessary?
                $name = htmlspecialchars($name);
                trigger_error("Style attribute '$name' is not supported $support", E_USER_WARNING);
            }
        }

        $forbidden_properties = $config->get('CSS.ForbiddenProperties');
        if ($forbidden_properties !== null) {
            foreach ($this->info as $name => $d) {
                if (isset($forbidden_properties[$name])) {
                    unset($this->info[$name]);
                }
            }
        }
    }
264718
protected function configure(): void
    {

        $this->register('makeType');
        $this->register('makeValue');
        $this->register('makeArgument');
        $this->register('makeStrong');
        $this->register('makeExceptionHeader');
        $this->register('makeExceptionBody');
        $this->register('makeExceptionTrace');
        $this->register('makeEmpty');
    }
521537
public function setup($config)
    {
        if ($this->setup) {
            return;
        }
        $this->setup = true;
        $this->doSetup($config);
    }
765364
public function initServices(Config $config)
    {
        $serviceProviderLoader = new ServiceProviderLoader($this->getDI());
        $serviceProviderLoader->autoload(
            $config->application->serviceDir,
            $config->application->configDir
        );
    }
942527
protected function setUpGeneralConfigurations(Configuration $config)
    {
        $this->setupAnnotationMetadata();
        $config->setMetadataDriverImpl($this->getMetadataMappingDriver());

        $config->setProxyDir($this->getProxiesPath());
        $config->setProxyNamespace($this->getProxiesNamespace());
        $config->setAutoGenerateProxyClasses($this->getProxiesAutoGeneration());

        $config->setMetadataCacheImpl($this->getMetadataCacheDriver());
    }
103590
public function setConfig($config){
        $this->config = $config;
        foreach ($config as $key => $value) {
            $this->app->config($key, $value);
        }
    }
1290797
public function setConfig($config)
    {
        if (is_array($config)) {
            $this->config = $config;
        } else {
            $this->config = (array) gplcart_config_get((string) $config);
            $this->setDb($this->config['database']);
            $this->config = array_merge($this->config, $this->select());
        }
    }
279528
protected function applyCommonConfiguration($config)
    {
        $this->columnName = isset($config['columnName']) ? strval($config['columnName']) : $this->name;

        if (isset($config['visible'])) {
            $this->isVisible = (bool) $config['visible'];
        }
        if (isset($config['readOnly'])) {
            $this->isReadOnly = (bool) $config['readOnly'];
        }
        if (isset($config['defaultValue'])) {
            $this->defaultValue = $config['defaultValue'];
        }
        if (isset($config['accessor'])) {
            $this->accessor = strval($config['accessor']);
        }
        if (isset($config['mutator'])) {
            $this->mutator = strval($config['mutator']);
        }

        if (isset($config['validators'])) {
            $validators = $config['validators'];
            if (!is_array($validators)) {
                throw new UnexpectedValueException($this->translate(
                    'Field validators configuration should be an array.'
                ));
            }
            $this->validators = $validators;
        }

        if (isset($config['filters'])) {
            $filters = $config['filters'];
            if (!is_array($filters)) {
                throw new UnexpectedValueException($this->translate(
                    'Field filters configuration should be an array.'
                ));
            }
            $this->filters = $filters;
        }
    }
1062942
protected function _setConfig($config)
    {
        if (strlen($config['url']) > 1 && $config['url'][0] === '/') {
            $config['url'] = substr($config['url'], 1);
        }

        if (empty($config['session'])) {
            $config['session'] = new Session([
                'cookiePath' => $config['base']
            ]);
        }

        $this->_environment = $config['environment'];
        $this->cookies = $config['cookies'];

        if (isset($config['uri']) && $config['uri'] instanceof UriInterface) {
            $uri = $config['uri'];
        } else {
            $uri = ServerRequestFactory::createUri($config['environment']);
        }

        // Extract a query string from config[url] if present.
        // This is required for backwards compatibility and keeping
        // UriInterface implementations happy.
        $querystr = '';
        if (strpos($config['url'], '?') !== false) {
            list($config['url'], $querystr) = explode('?', $config['url']);
        }
        if (strlen($config['url'])) {
            $uri = $uri->withPath('/' . $config['url']);
        }
        if (strlen($querystr)) {
            $uri = $uri->withQuery($querystr);
        }

        $this->uri = $uri;
        $this->base = $config['base'];
        $this->webroot = $config['webroot'];

        $this->url = substr($uri->getPath(), 1);
        $this->here = $this->base . '/' . $this->url;

        if (isset($config['input'])) {
            $stream = new Stream('php://memory', 'rw');
            $stream->write($config['input']);
            $stream->rewind();
        } else {
            $stream = new PhpInputStream();
        }
        $this->stream = $stream;

        $config['post'] = $this->_processPost($config['post']);
        $this->data = $this->_processFiles($config['post'], $config['files']);
        $this->query = $this->_processGet($config['query'], $querystr);
        $this->params = $config['params'];
        $this->session = $config['session'];
    }
878392
protected function initializeConfig(array $config = null)
    {
        $default = $this->defaultConfigurations();

        $this->config = $config ? array_replace_recursive($default, $config) : $default;
    }
1133971
private function configure(array $config = [])
    {
        foreach ($config as $property => $value) {
            if (property_exists($this, $property)) {
                $this->{$property} = $value;
            }
        }
    }
633481
public function load(Config $config)
    {
        $php = new Service\PhpService();

        foreach ($php->getConfig() as $k => $v) {
            $config->set('php_'.$k, $v);
        }

        $config->setDefaultItem('commands', 'loc', ['cmd' => "!bin/phploc src", 'description' => "display code size (line of code, classes, ...)"]);
    }
229211
public function setConfig($config)
    {
        $this->config = $config;

        $this->routes = $config['routes'];
        $this->options = $config['options'];

        return $this;
    }
222731
protected function setup(array $config = [])
    {
        if (isset($config['renderer']) && (!($config['renderer'] instanceof \Closure) && !is_callable($config['renderer']))) {
            throw new Exception(translate('{renderer} must be callable'), 500, Exception::BADARGUMENTS);
        }

        if (isset($config['template']) && !is_string($config['template'])) {
            throw new Exception(translate('{template} must be a string'), 500, Exception::BADARGUMENTS);
        }

        if (isset($config['html_options']) && !is_array($config['html_options'])) {
            throw new Exception(translate('{html_options} must be an array'), 500, Exception::BADARGUMENTS);
        }

        foreach ($config as $property => $data) {
            if (property_exists($this, $property)) {
                $this->{$property} = $data;
            } elseif (property_exists($this, '_'.$property)) {
                $this->{'_'.$property} = $data;
            }
        }

        if (!$this->id) {
            $this->id = 'widget_'.static::$_counter;
        }

        if (isset($this->_html_options['id'])) {
            $this->id = $this->_html_options['id'];
        } else {
            $this->_html_options['id'] = $this->id;
        }
    }
1310756
private static function configure($config)
    {
        Driver\Connection\Metadata::$useCacheForMetadata = $config['useCache'];
        Driver\Connection::$monitorQueries               = $config['debug'];

        Db::setConfig(Config::get('database'));
        Cache::setConfig(Config::getOrEmpty('cache'));
        Log::setConfig(Config::getOrEmpty('log'));
    }
1327778
public function filter($string, HTMLPurifier_Config $config) {
        if (!$string) {
            return $string;
        }
        $config->finalize();
        $purifier = new HTMLPurifier($config);
        $string = $purifier->purify($string);
        return $string;
    }