PluginProbe
Autoptimize / 1.9.1
Autoptimize v1.9.1
2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 All 107 releases
autoptimize / classes / autoptimizeHTML.php

autoptimizeHTML.php in Autoptimize 1.9.1, at classes/autoptimizeHTML.php

59 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
5 class autoptimizeHTML extends autoptimizeBase {
6 private $keepcomments = false;
7
8 //Does nothing
9 public function read($options)
10 {
11 //Remove the HTML comments?
12 $this->keepcomments = (bool) $options['keepcomments'];
13
14 //Nothing to read for HTML
15 return true;
16 }
17
18 //Joins and optimizes CSS
19 public function minify()
20 {
21 if(class_exists('Minify_HTML'))
22 {
23 // noptimize me
24 $this->content = $this->hide_noptimize($this->content);
25
26 // Minify html
27 $options = array('keepComments' => $this->keepcomments);
28
29 if (@is_callable(array(new Minify_HTML,"minify"))) {
30 $tmp_content = Minify_HTML::minify($this->content,$options);
31 if (!empty($tmp_content)) {
32 $this->content = $tmp_content;
33 unset($tmp_content);
34 }
35 }
36
37 // restore noptimize
38 $this->content = $this->restore_noptimize($this->content);
39 return true;
40 }
41
42 //Didn't minify :(
43 return false;
44 }
45
46 //Does nothing
47 public function cache()
48 {
49 //No cache for HTML
50 return true;
51 }
52
53 //Returns the content
54 public function getcontent()
55 {
56 return $this->content;
57 }
58 }
59