SG Optimizer - Version 5.7.8

Version Description

Download this release

Release Info

Developer sstoqnov
Plugin Icon 128x128 SG Optimizer
Version 5.7.8
Comparing to
See all releases

Code changes from version 5.7.7 to 5.7.8

core/Minifier/Minifier.php CHANGED
@@ -318,7 +318,12 @@ class Minifier {
318
  1 => array( 'pipe', 'w' ), // stdout is a pipe that the child will write to.
319
  );
320
 
321
- $process = proc_open( '/usr/local/bin/minify --type=html', $descriptorspec, $pipes );
 
 
 
 
 
322
 
323
  if ( is_resource( $process ) ) {
324
  fwrite( $pipes[0], $html );
@@ -331,6 +336,11 @@ class Minifier {
331
  $return_value = proc_close( $process );
332
  }
333
 
 
 
 
 
 
334
  return $output;
335
  }
336
 
318
  1 => array( 'pipe', 'w' ), // stdout is a pipe that the child will write to.
319
  );
320
 
321
+ $process = proc_open( '/usr/bin/minify --type=html', $descriptorspec, $pipes );
322
+
323
+ if ( Helper::is_avalon() ) {
324
+ $process = proc_open( '/usr/local/bin/minify --type=html', $descriptorspec, $pipes );
325
+ }
326
+
327
 
328
  if ( is_resource( $process ) ) {
329
  fwrite( $pipes[0], $html );
336
  $return_value = proc_close( $process );
337
  }
338
 
339
+ // Something went wrong during minification.
340
+ if ( empty( $output ) ) {
341
+ return $html;
342
+ }
343
+
344
  return $output;
345
  }
346
 
core/Parser/Parser.php CHANGED
@@ -44,10 +44,6 @@ class Parser {
44
  return $html;
45
  }
46
 
47
- if ( Options::is_enabled( 'siteground_optimizer_optimize_html' ) ) {
48
- $html = Minifier::get_instance()->run( $html );
49
- }
50
-
51
  if ( Options::is_enabled( 'siteground_optimizer_combine_css' ) ) {
52
  $html = Css_Combinator::get_instance()->run( $html );
53
  }
@@ -64,6 +60,10 @@ class Parser {
64
  $html = Prefetch::get_instance()->run( $html );
65
  }
66
 
 
 
 
 
67
  return $html;
68
  }
69
 
44
  return $html;
45
  }
46
 
 
 
 
 
47
  if ( Options::is_enabled( 'siteground_optimizer_combine_css' ) ) {
48
  $html = Css_Combinator::get_instance()->run( $html );
49
  }
60
  $html = Prefetch::get_instance()->run( $html );
61
  }
62
 
63
+ if ( Options::is_enabled( 'siteground_optimizer_optimize_html' ) ) {
64
+ $html = Minifier::get_instance()->run( $html );
65
+ }
66
+
67
  return $html;
68
  }
69
 
readme.txt CHANGED
@@ -212,6 +212,9 @@ Our plugin uses a cookie in order to function properly. It does not store person
212
 
213
  == Changelog ==
214
 
 
 
 
215
  = Version 5.7.7 =
216
  * HTML Minification Refactoring
217
 
212
 
213
  == Changelog ==
214
 
215
+ = Version 5.7.8 =
216
+ * Fix HTML Minification Refactoring
217
+
218
  = Version 5.7.7 =
219
  * HTML Minification Refactoring
220
 
sg-cachepress.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: SG Optimizer
11
  * Plugin URI: https://siteground.com
12
  * Description: This plugin will link your WordPress application with all the performance optimizations provided by SiteGround
13
- * Version: 5.7.7
14
  * Author: SiteGround
15
  * Author URI: https://www.siteground.com
16
  * Text Domain: sg-cachepress
@@ -31,7 +31,7 @@ if ( ! defined( 'WPINC' ) ) {
31
 
32
  // Define version constant.
33
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
34
- define( __NAMESPACE__ . '\VERSION', '5.7.7' );
35
  }
36
 
37
  // Define slug constant.
10
  * Plugin Name: SG Optimizer
11
  * Plugin URI: https://siteground.com
12
  * Description: This plugin will link your WordPress application with all the performance optimizations provided by SiteGround
13
+ * Version: 5.7.8
14
  * Author: SiteGround
15
  * Author URI: https://www.siteground.com
16
  * Text Domain: sg-cachepress
31
 
32
  // Define version constant.
33
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
34
+ define( __NAMESPACE__ . '\VERSION', '5.7.8' );
35
  }
36
 
37
  // Define slug constant.