PluginProbe
Autoptimize / 1.8.1
Autoptimize v1.8.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.8.1, at classes/autoptimizeHTML.php

56 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 $tmp_content = Minify_HTML::minify($this->content,$options);
29 if (!empty($tmp_content)) {
30 $this->content = $tmp_content;
31 unset($tmp_content);
32 }
33
34 // restore noptimize
35 $this->content = $this->restore_noptimize($this->content);
36 return true;
37 }
38
39 //Didn't minify :(
40 return false;
41 }
42
43 //Does nothing
44 public function cache()
45 {
46 //No cache for HTML
47 return true;
48 }
49
50 //Returns the content
51 public function getcontent()
52 {
53 return $this->content;
54 }
55 }
56