Inject HTML in the navigation element

@param string $html The HTML string
@param array $meta Optional meta array
@return \ValidFormBuilder\StaticText
326685
public function addHtml($html, $meta = array())
    {
        $objString = new StaticText($html, $meta);
        $objString->setMeta("parent", $this, true);
        $this->__fields->addObject($objString);

        return $objString;
    }
1276286
public function loadHTML($html)
    {
        $html = str_replace(chr(13), '', $html);
        $html = '<?xml version="1.0" encoding="utf-8" ?><' . $this->PARENT_TAG_NAME . '>' . $html . '</' . $this->PARENT_TAG_NAME . '>';
        if (defined('LIBXML_HTML_NODEFDTD')) {
            return $this->dom->loadHTML($html, LIBXML_HTML_NODEFDTD);
        } else {
            return $this->dom->loadHTML($html);
        }


    }
427826
public function discoverFromHtml($html)
    {
        $links = $this->findLinks($html);

        if ( ! $link = reset($links)) {
            return;
        }

        $type = null;

        switch($link['type']) {
        case 'application/json+oembed':
            $type = Provider::TYPE_JSON;
            break;
        case 'text/xml+oembed':
            $type = Provider::TYPE_XML;
            break;
        }

        $url = $link['href'];
        $endpoint = $this->getEndpointUrl($url);

        return new Provider($endpoint, $type);
    }
1207635
public function withMeta($meta)
	{
		foreach (func_get_args() as $arg) {
			$metas = ($arg instanceof Collection) ? $arg->all() : is_array($arg) ? $arg : array($arg);
			
			foreach ($metas as $m) {
				if (is_object($m)) {
					$this->filters[]['metas'][] = array('id' => $m->id);
				}
				else {
					$this->filters[]['metas'][] = array('name' => $m);
				}
			}
		}
		
		return $this;
	}
1252196
protected function buildText(string $html): string
    {
        $text = Strings::replace($html, [
            '#<(style|script|head).*</\\1>#Uis' => '',
            '#<t[dh][ >]#i' => ' $0',
            '#<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>#is' => '$2 &lt;$1&gt;',
            '#[\r\n]+#' => ' ',
            '#<(/?p|/?h\d|li|br|/tr)[ >/]#i' => "\n$0",
        ]);
        $text = \html_entity_decode(\strip_tags($text), ENT_QUOTES, 'UTF-8');
        $text = Strings::replace($text, '#[ \t]+#', ' ');

        return \trim($text);
    }
209433
public function strip_tags($html, $escapeQuotes = true)
    {
        // recursive usage
        if (Any::isArray($html)) {
            foreach ($html as $key=>$value) {
                $html[$key] = $this->strip_tags($value, $escapeQuotes);
            }
            return $html;
        }

        $text = strip_tags($html);
        if ($escapeQuotes) {
            $text = $this->escapeQuotes($text);
        }

        return $text;
    }
469707
protected function getHtmlFromRealPage($html)
    {
        // set body tag to lower case
        $html = str_replace('<BODY', '<body', $html);
        $html = str_replace('</BODY', '</body', $html);

        // explode from the body tag. If no body tag => end
        $res = explode('<body', $html);

        // the html content is between body tag openning and closing
        $content = '<page'.$res[1];
        $content = explode('</body', $content);
        $content = $content[0].'</page>';

        // extract the link tags from the original html
        // and add them before the content
        preg_match_all('/<link ([^>]*)[\/]?>/isU', $html, $match);
        foreach ($match[1] as $src) {
            $content = '<link '.$src.'/>'.$content;
        }

        // extract the css style tags from the original html
        // and add them before the content
        preg_match_all('/<style[^>]*>(.*)<\/style[^>]*>/isU', $html, $match);
        foreach ($match[0] as $src) {
            $content = $src.$content;
        }

        return $content;
    }
697611
private static function code( $metaplate ) {
		foreach ( array( 'html', 'js', 'css' ) as $field ) {
			if ( isset( $metaplate[ $field ] ) ) {
				if ( is_object( $metaplate[ $field ] ) ) {
					$value = $metaplate[ $field ];
					$value = $value->code;
					unset( $metaplate[ $field ] );
					$metaplate[ $field ]['code' ] = $value;
				}

			}
			else {
				$metaplate[ $field ][ 'code' ] = 1;
			}
		}

		return $metaplate;

	}
1205911
public function addText($strText, $meta = array())
    {
        $objString = new StaticText($strText, $meta);
        $objString->setMeta("parent", $this, true);

        $this->__fields->addObject($objString);

        return $objString;
    }
590952
public function loadHTML($html)
    {
        if ($html instanceof Renderable) {
            $html = $html->render();
        }
        $this->html = $html;
        $this->file = null;
        return $this;
    }
238974
public static function getMetas(\DOMDocument $html)
    {
        $metas = [];

        foreach ($html->getElementsByTagName('meta') as $meta) {
            $name = trim(strtolower($meta->getAttribute('property') ?: $meta->getAttribute('name')));
            $value = $meta->getAttribute('content') ?: $meta->getAttribute('value');

            $metas[] = [$name, $value, $meta];
        }

        return $metas;
    }
985301
public function setInnerHtml($html)
    {
        if (!is_string($html)) {
            throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be string, %s given', __METHOD__, (is_object($html) ? get_class($html) : gettype($html))));
        }

        $this->removeChildren();

        if ($html !== '') {
            Errors::disable();

            $html = "<htmlfragment>$html</htmlfragment>";

            $document = new Document($html);

            $fragment = $document->first('htmlfragment')->getNode();

            foreach ($fragment->childNodes as $node) {
                $newNode = $this->node->ownerDocument->importNode($node, true);

                $this->node->appendChild($newNode);
            }

            Errors::restore();
        }

        return $this;
    }
331091
public function setHtml($html)
	{
		if (!$this->mpdf) {
			$this->init();
		}
		$this->mpdf->WriteHTML($html);
	}
196239
public function appendChildFromHtmlString($html)
    {
        $dom = new \DOMDocument;
        $dom->loadHTML($html);

        $element = simplexml_import_dom($dom);
        $element = current($element->xPath('//body/*'));

        $this->appendChildNode($element);
    }
1263025
public function html($name, $html, array $attr = null)
    {
        return $this->input($name, [ 'type' => 'html', 'html' => $html, 'attr' => $attr ]);
    }
186537
public function addMeta($metaName, $metaValue)
    {
        if (!is_scalar($metaName) || (!is_scalar($metaValue) && !is_array($metaValue))) {
            throw new \InvalidArgumentException(sprintf('Invalid meta name "%s" or value "%s". Please provide scalar meta name and scalar or array meta value.', gettype($metaName), gettype($metaValue)), __LINE__);
        }
        $metaValue = is_scalar($metaValue) ? ((is_numeric($metaValue) || is_bool($metaValue) ? $metaValue : trim($metaValue))) : $metaValue;
        if ((is_scalar($metaValue) && $metaValue !== '') || is_array($metaValue)) {
            if (!array_key_exists($metaName, $this->meta)) {
                $this->meta[$metaName] = $metaValue;
            } elseif (is_array($this->meta[$metaName]) && is_array($metaValue)) {
                $this->meta[$metaName] = array_merge($this->meta[$metaName], $metaValue);
            } elseif (is_array($this->meta[$metaName])) {
                array_push($this->meta[$metaName], $metaValue);
            } else {
                $this->meta[$metaName] = $metaValue;
            }
            ksort($this->meta);
        }
        return $this;
    }
1187210
public function render(array $metaTags = array())
    {
        $html = '';

        foreach ($metaTags as $metaTag) {
            if (!$metaTag instanceof Item) {
                throw new InvalidArgumentException('metaTags', 'Cannot render meta tag, not an instance of \Netgen\Bundle\OpenGraphBundle\MetaTag\Item');
            }

            $tagName = htmlspecialchars($metaTag->getTagName(), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
            $tagValue = htmlspecialchars($metaTag->getTagValue(), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');

            if (!empty($tagName) && !empty($tagValue)) {
                $html .= "<meta property=\"$tagName\" content=\"$tagValue\" />\n";
            }
        }

        return $html;
    }