-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
40 lines (36 loc) · 938 Bytes
/
index.php
File metadata and controls
40 lines (36 loc) · 938 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
34
35
36
37
38
39
40
<?php
function sanitize_output($buffer) {
$search = array(
'/(\n|^)(\x20+|\t)/',
'/(\n|^)\/\/(.*?)(\n|$)/',
'/\n/',
'/\<\!--.*?-->/',
'/(\x20+|\t)/', # Delete multispace (Without \n)
'/\>\s+\</', # strip whitespaces between tags
'/(\"|\')\s+\>/', # strip whitespaces between quotation ("') and end tags
'/=\s+(\"|\')/'); # strip whitespaces between = "'
$replace = array(
"\n",
"\n",
" ",
"",
" ",
"><",
"$1>",
"=$1");
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
ob_start("sanitize_output");
?>
<!-- Start HTML codes -->
<!DOCTYPE html>
<html>
<head>
<title>HTML Minifier</title>
</head>
<body>
</body>
</html>
<!-- End HTML codes -->
<?php ob_end_flush(); ?>