-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTinyMinify.php
More file actions
33 lines (24 loc) · 777 Bytes
/
TinyMinify.php
File metadata and controls
33 lines (24 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
if (!defined('K_COUCH_DIR')) die(); // cannot be loaded directly
require 'TinyHtmlMinifier.php';
class TinyMinify
{
public static function minify($params, $node)
{
global $FUNCS;
$options = $FUNCS->get_named_vars(
array(
'collapse_whitespace' => "false",
'disable_comments' => "false"
), $params);
foreach ($options as &$option) {
$option= (int) filter_var($option, FILTER_VALIDATE_BOOLEAN);
}
foreach ($node->children as $child) {
$html .= $child->get_HTML();
}
$minifier = new TinyHtmlMinifier($options);
return $minifier->minify($html);
}
}
$FUNCS->register_tag('minify', array('TinyMinify', 'minify'));