minify the HTML document

@param array $options Options passed to PrettyMin::__construct()
@return HtmlPage
@throws \Exception
194609
public function minify(array $options = array())
    {
        if (!class_exists('Wa72\\HtmlPrettymin\\PrettyMin')) {
            throw new \Exception('Function minify needs composer package wa72/html-pretty-min');
        }
        $pm = new PrettyMin($options);
        $pm->load($this->dom)->minify();
        return $this;
    }
641360
protected function prepareOptions(array $options = [])
    {
        $helper = $this->formHelper;
        $rulesParser = $helper->createRulesParser($this);
        $rules = $this->getOption('rules');
        $parsedRules = $rules ? $rulesParser->parse($rules) : [];

        $this->options = $helper->mergeOptions($this->options, $options);

        foreach (['attr', 'label_attr', 'wrapper'] as $appendable) {
            // Append values to the 'class' attribute
            if ($this->getOption("{$appendable}.class_append")) {
                // Combine the current class attribute with the appends
                $append = $this->getOption("{$appendable}.class_append");
                $classAttribute = $this->getOption("{$appendable}.class", '').' '.$append;
                $this->setOption("{$appendable}.class", $classAttribute);

                // Then remove the class_append option to prevent it from showing up as an attribute in the HTML
                $this->setOption("{$appendable}.class_append", null);
            }
        }

        if ($this->getOption('attr.multiple') && !$this->getOption('tmp.multipleBracesSet')) {
            $this->name = $this->name.'[]';
            $this->setOption('tmp.multipleBracesSet', true);
        }

        if ($this->parent->haveErrorsEnabled()) {
            $this->addErrorClass();
        }

        if ($this->getOption('required') === true || isset($parsedRules['required'])) {
            $lblClass = $this->getOption('label_attr.class', '');
            $requiredClass = $this->getConfig('defaults.required_class', 'required');

            if (! Str::contains($lblClass, $requiredClass)) {
                $lblClass .= ' '.$requiredClass;
                $this->setOption('label_attr.class', $lblClass);
            }

            if ($this->parent->clientValidationEnabled()) {
                $this->setOption('attr.required', 'required');
            }
        }

        if ($this->parent->clientValidationEnabled() && $parsedRules) {
            $attrs = $this->getOption('attr') + $parsedRules;
            $this->setOption('attr', $attrs);
        }

        $this->setOption('wrapperAttrs', $helper->prepareAttributes($this->getOption('wrapper')));
        $this->setOption('errorAttrs', $helper->prepareAttributes($this->getOption('errors')));

        if ($this->getOption('help_block.text')) {
            $this->setOption(
                'help_block.helpBlockAttrs',
                $helper->prepareAttributes($this->getOption('help_block.attr'))
            );
        }

        return $this->options;
    }
261773
public function createOptions(Array $options) {

		$this->options = [];

		foreach($options as $k => $v) {
			$this->appendOption(new SelectOptionElement($k, $v, $this));
		}

		$this->setValue();

		return $this;

	}
492407
protected static function normalizeInputOptions($options)
    {
        self::addSpanClass($options);
        self::addTextAlignClass($options);
        $size = TbArray::popValue('size', $options);
        if (TbArray::popValue('block', $options, false)) {
            self::addCssClass('input-block-level', $options);
        } else {
            if (!empty($size)) {
                self::addCssClass('input-' . $size, $options);
            }
        }
        return $options;
    }
405085
private function loadPaginated(array $options, $limit, $page, $pageSize)
    {
        $pageSize = intval($pageSize);
        $offset = ($page - 1) * $pageSize;

        $position = $pageSize * $page;
        if (null !== $limit && $position >= $limit) {
            $pageSize = $limit - $offset;
            $loadLimit = $pageSize;
        } else {
            $loadLimit = $pageSize + 1;
        }

        return $this->contentQueryExecutor->execute(
            $options['webspaceKey'],
            [$options['locale']],
            $this->contentQueryBuilder,
            true,
            -1,
            $loadLimit,
            $offset
        );
    }
83453
public static function createCustom($options)
    {
        // unpack optional arguments (merging with default values) into named variables
        // NOTE: the default value of stylesheet=null will not pass validation, this essentially
        //       means that stylesheet is not optional. its still purposely left as part of the
        //       $options argument so that it can become truly optional in the future.
        $defaults = array('stylesheet' => null);
        $options = array_merge($defaults, array_intersect_key($options, $defaults));
        list($stylesheet) = array_values($options);

        // validate arguments
        Validators::validateLayoutStylesheet($stylesheet);

        return new Layout('custom', $stylesheet);
    }
1274240
public function fromOptions(array $options)
    {
        $this->seo = $this->setupSeo($options);
        if (null !== $this->seo) {
            $this->language = $this->seo->getLanguage();
            $this->page = $this->seo->getPage();
        }
    }
752836
public function setHTML($content, array $options = array()) {
        $this->html = $content;
        $this->htmlCharset = (isset($options['charset'])) ? $options['charset'] : 'utf-8';
        if (@$options['autoSetText']) {
            $this->setText(strip_tags($this->html), $this->htmlCharset);
        }
        return $this;
    }
488480
public function expand(array $options = [])
    {
        if (!empty($this->href)) {
            return $this->href;
        } else if (!empty($this->{'href-template'})) {
            $parser = new UriTemplate();
            return $parser->expand($this->{'href-template'}, $this->_convertOptions($options));
        } else {
            throw new LinkException('Cannot expand link because no href or href-template defined');
        }
    }
774106
protected function minifyDirectToOutput($js, $options)
	{
		$this->initialize($js, $options);
		$this->loop();
		$this->clean();
	}
513739
public function def(array $options=[]) {
		if(!$this->widget)
			throw new \Exception('No default render function for this field');
		return $this->render($this->widget, $options);
	}
522087
protected function minifyJs()
    {
        $minifier = new Minify\JS();

        // Components
        $this->addJsToMinifier($minifier, 'dropdowns', 'dropdown');

        // Components w/ JavaScript
        $this->addJsToMinifier($minifier, 'modals', 'modal');
        $this->addJsToMinifier($minifier, 'tooltip');
        $this->addJsToMinifier($minifier, 'popovers', 'popover');
        $this->addJsToMinifier($minifier, 'carousel');

        // Pure JavaScript components
        $this->addJsToMinifier($minifier, 'affix');
        $this->addJsToMinifier($minifier, 'alert');
        $this->addJsToMinifier($minifier, 'button');
        $this->addJsToMinifier($minifier, 'collapse');
        $this->addJsToMinifier($minifier, 'scrollspy');
        $this->addJsToMinifier($minifier, 'tab');
        $this->addJsToMinifier($minifier, 'transition');

        return $minifier->minify();
    }
137449
private function _minifyHtml($buffer) {
        $search = ['/\>[^\S ]+/s', '/[^\S ]+\</s', '/\>(\s)+/s', '/(\s)+\</s'];
        $replace = ['> ', ' <', '> ', ' <'];
        $buffer = preg_replace($search, $replace, $buffer);

        return $buffer;
    }
1023168
public function setOptions($options)
        {
            if(!is_array($options)) {
                throw new \Thin\Exception(get_class() . ": " . __METHOD__ . " expects an array as parametre, " . gettype($options) . " given.");
            }

            foreach($options as $option => $value) {
                $this->setOption($option, $value);
            }

            return $this;
        }
12275
protected function minify(string $view): string
    {
        $html = $this->compile($view);

        if ($this->minify)
        {
            $html = \Minify_HTML::minify(\trim($html), [
                'cssMinifier' => [\Minify_CSSmin::class, 'minify'],
                'jsMinifier'  => [JSMin::class, 'minify'],
            ]);
        }

        if (!empty($this->extends))
        {
            $html = (new HTML($html, $this->extends))
                ->apply();
        }

        return $html;
    }
201366
protected function minify($html)
    {
        $html = str_replace('<?xml encoding="UTF-8">', '', $html);

        $html = trim(preg_replace('/\s+/', ' ', $html));

        $html = str_replace('> <', '><', $html);

        return str_replace(array(' />', '/>'), '>', $html);
    }
1004229
public function useZooming( array $options = array('mode'=>'xy') )
    {
        $this->zooming = true;
        $this->setNestedOptVal( $this->options, 'selection', 'mode', $options['mode'] );
        $this->files[] = 'jquery.flot.selection.js';
        return $this;
    }