|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ArjanSchouten\HtmlMinifier; |
|
4
|
|
|
|
|
5
|
|
|
class Options |
|
6
|
|
|
{ |
|
7
|
|
|
const ALL = 'all'; |
|
8
|
|
|
const EMPTY_ATTRIBUTES = 'remove-empty-attributes'; |
|
9
|
|
|
const ATTRIBUTE_QUOTES = 'remove-attributequotes'; |
|
10
|
|
|
const BOOLEAN_ATTRIBUTES = 'boolean-attributes'; |
|
11
|
|
|
const OPTIONAL_ELEMENTS = 'optional-elements'; |
|
12
|
|
|
const REMOVE_DEFAULTS = 'remove-defaults'; |
|
13
|
|
|
const WHITESPACES = 'whitespaces'; |
|
14
|
|
|
const COMMENTS = 'comments'; |
|
15
|
|
|
|
|
16
|
|
|
private static $options; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Get all the options available for this minifier. |
|
20
|
|
|
* |
|
21
|
|
|
* @return array |
|
22
|
|
|
*/ |
|
23
|
2 |
|
public static function options() |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
2 |
|
if (self::$options === null) { |
|
26
|
|
|
self::$options = [ |
|
27
|
1 |
|
self::WHITESPACES => new Option(self::WHITESPACES, 'Remove redundant whitespaces', true), |
|
28
|
1 |
|
self::COMMENTS => new Option(self::COMMENTS, 'Remove comments', true), |
|
29
|
1 |
|
self::BOOLEAN_ATTRIBUTES => new Option(self::BOOLEAN_ATTRIBUTES, 'Collapse boolean attributes from checked="checked" to checked', true), |
|
30
|
1 |
|
self::ATTRIBUTE_QUOTES => new Option(self::ATTRIBUTE_QUOTES, 'Remove quotes around html attributes', false), |
|
31
|
1 |
|
self::OPTIONAL_ELEMENTS => new Option(self::OPTIONAL_ELEMENTS, 'Remove optional elements which can be implied by the browser', false), |
|
32
|
1 |
|
self::REMOVE_DEFAULTS => new Option(self::REMOVE_DEFAULTS, 'Remove defaults such as from <script type=text/javascript>', false), |
|
33
|
1 |
|
self::EMPTY_ATTRIBUTES => new Option(self::EMPTY_ATTRIBUTES, 'Remove empty attributes. HTML boolean attributes are skipped', false), |
|
34
|
|
|
]; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
2 |
|
return self::$options; |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
|