PHP Class pQuery\HtmlFormatter

Used like: format($root); ?>
Mostrar archivo Open project: tburry/pquery Class Usage Examples

Public Properties

Property Type Description
$block_elements Determines which elements start on a new line and which function as block
$errors array Errors found during formatting
$indent_string string String that is used to generate correct indenting
$linebreak_string string String that is used to break lines
$options array Other formatting options
$whitespace Determines which characters are considered whitespace

Public Methods

Method Description
__construct ( array $options = [] ) Class constructor
__invoke ( &$node ) Class magic invoke method, performs {@link format()}
format ( &$node ) Formats HTML/Javascript
format_html ( DomNode &$root, boolean $recursive = null ) Formats HTML
minify_html ( DomNode &$root, boolean $strip_comments = true, boolean $recursive = true ) Minifies HTML / removes unneeded whitespace
minify_javascript ( DomNode &$root, string $indent_string = ' ', boolean $wrap_comment = true, boolean $recursive = true ) : boolean | array Minifies javascript using JSMin+

Method Details

__construct() public method

Class constructor
public __construct ( array $options = [] )
$options array {@link $options}

__invoke() public method

Class magic invoke method, performs {@link format()}
public __invoke ( &$node )

format() public method

Formats HTML/Javascript
See also: format_html()
public format ( &$node )

format_html() public method

Formats HTML
public format_html ( DomNode &$root, boolean $recursive = null )
$root DomNode
$recursive boolean

minify_html() static public method

Minifies HTML / removes unneeded whitespace
static public minify_html ( DomNode &$root, boolean $strip_comments = true, boolean $recursive = true )
$root DomNode
$strip_comments boolean
$recursive boolean

minify_javascript() static public method

Minifies javascript using JSMin+
static public minify_javascript ( DomNode &$root, string $indent_string = ' ', boolean $wrap_comment = true, boolean $recursive = true ) : boolean | array
$root DomNode
$indent_string string
$wrap_comment boolean Wrap javascript in HTML comments ()
$recursive boolean
return boolean | array Array of errors on failure, true on succes

Property Details

$block_elements public_oe property

Determines which elements start on a new line and which function as block
public $block_elements

$errors public_oe property

Errors found during formatting
public array $errors
return array

$indent_string public_oe property

String that is used to generate correct indenting
public string $indent_string
return string

$linebreak_string public_oe property

String that is used to break lines
public string $linebreak_string
return string

$options public_oe property

Other formatting options
public array $options
return array

$whitespace public_oe property

Determines which characters are considered whitespace
public $whitespace