pQuery\HtmlFormatter::format PHP Method

format() public method

Formats HTML/Javascript
See also: format_html()
public format ( &$node )
    function format(&$node)
    {
        $this->errors = array();
        if ($this->options['minify_script']) {
            $a = self::minify_javascript($node, $this->indent_string, true, true);
            if (is_array($a)) {
                foreach ($a as $error) {
                    $this->errors[] = $error[0]->getMessage() . ' >>> ' . $error[1];
                }
            }
        }
        return $this->format_html($node);
    }

Usage Example

Esempio n. 1
0
/**
 * Format/beautify DOM
 * @param DomNode $root
 * @param array $options Extra formatting options {@link Formatter::$options}
 * @return bool
 */
function dom_format(&$root, $options = array())
{
    $formatter = new HtmlFormatter($options);
    return $formatter->format($root);
}