ideatic/html-parser

description

dev-main 2023-11-08 20:28 UTC

This package is not auto-updated.

Last update: 2024-04-19 06:37:53 UTC


README

  $dom = HTML_Parser::parse($html);

        foreach ($dom->children as $node) {
            if ($node instanceof HTML_Parser_Element) {
                $this->_processNode($node, $html, $path, $getTranslation);
            }
        }

        // Remove i18n attributes
        if ($getTranslation) {
            $dom->walk(
                function ($node) {
                    if ($node instanceof HTML_Parser_Element && $node->hasAttribute('i18n')) {
                        $node->hasAttribute('i18n')->remove();
                    }
                }
            );
        }

  return $dom->render();