PluginProbe
Autoptimize / 1.7.1
Autoptimize v1.7.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.7.1, at classes/autoptimizeHTML.php

52 lines 985 B
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 {
7 private $keepcomments = false;
8
9 //Does nothing
10 public function read($options)
11 {
12 //Remove the HTML comments?
13 $this->keepcomments = (bool) $options['keepcomments'];
14
15 //Nothing to read for HTML
16 return true;
17 }
18
19 //Joins and optimizes CSS
20 public function minify()
21 {
22 if(class_exists('Minify_HTML'))
23 {
24 // noptimize me
25 $this->content = $this->hide_noptimize($this->content);
26
27 // Minify html
28 $options = array('keepComments' => $this->keepcomments);
29 $this->content = Minify_HTML::minify($this->content,$options);
30
31 // restore noptimize
32 $this->content = $this->restore_noptimize($this->content);
33 return true;
34 }
35
36 //Didn't minify :(
37 return false;
38 }
39
40 //Does nothing
41 public function cache()
42 {
43 //No cache for HTML
44 return true;
45 }
46
47 //Returns the content
48 public function getcontent()
49 {
50 return $this->content;
51 }
52 }