SG Optimizer - Version 5.4.5

Version Description

Download this release

Release Info

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

Code changes from version 5.4.4 to 5.4.5

core/Combinator/Combinator.php CHANGED
@@ -49,6 +49,7 @@ class Combinator {
49
  'tve_style_family_tve_flt', // Excluded in 5.3.0.
50
  'siteorigin-widget-icon-font-fontawesome',
51
  'woocommerce-smallscreen',
 
52
  );
53
 
54
  /**
@@ -232,6 +233,8 @@ class Combinator {
232
  foreach ( $contents as $url => $content ) {
233
  $dir = trailingslashit( dirname( $url ) );
234
 
 
 
235
  $regex = '/url\s*\(\s*(?!["\']?data:)(?![\'|\"]?[\#|\%|])([^)]+)\s*\)([^;},\s]*)/i';
236
 
237
  $replacements = array();
@@ -260,6 +263,37 @@ class Combinator {
260
  return implode( "\n", $new_content );
261
  }
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  /**
264
  * Create new stylesheet and return the url to it.
265
  *
49
  'tve_style_family_tve_flt', // Excluded in 5.3.0.
50
  'siteorigin-widget-icon-font-fontawesome',
51
  'woocommerce-smallscreen',
52
+ 'theme-css',
53
  );
54
 
55
  /**
233
  foreach ( $contents as $url => $content ) {
234
  $dir = trailingslashit( dirname( $url ) );
235
 
236
+ $content = $this->check_for_imports( $content, $url );
237
+
238
  $regex = '/url\s*\(\s*(?!["\']?data:)(?![\'|\"]?[\#|\%|])([^)]+)\s*\)([^;},\s]*)/i';
239
 
240
  $replacements = array();
263
  return implode( "\n", $new_content );
264
  }
265
 
266
+ /**
267
+ * Check for imports in the files and get the import content.
268
+ *
269
+ * @since 5.4.5
270
+ *
271
+ * @param string $content The file content.
272
+ * @param string $url The url to the file.
273
+ *
274
+ * @return string Original content + content from import clause.
275
+ */
276
+ private function check_for_imports( $content, $url ) {
277
+ $dir = trailingslashit( dirname( $url ) );
278
+ preg_match_all( '/@import\s+["\'](.+?)["\']/i', $content, $matches );
279
+
280
+ if ( empty( $matches ) ) {
281
+ return $content;
282
+ }
283
+
284
+ foreach ( $matches[1] as $match ) {
285
+ $import_content = $this->get_style_content_with_replacements(
286
+ array(
287
+ $url => $this->get_style_content( $dir . $match ),
288
+ )
289
+ );
290
+
291
+ $content = str_replace( $matches[0], $import_content, $content );
292
+ }
293
+
294
+ return $content;
295
+ }
296
+
297
  /**
298
  * Create new stylesheet and return the url to it.
299
  *
core/Helper/Helper.php CHANGED
@@ -275,13 +275,6 @@ class Helper {
275
  * @return boolean True/False.
276
  */
277
  public static function is_avalon() {
278
- $response = shell_exec( 'test -f /etc/yum.repos.d/baseos.repo && echo Avalon' );
279
-
280
- // The post for our new server is aloways the same.
281
- if ( 'Avalon' === trim( $response ) ) {
282
- return 1;
283
- }
284
-
285
- return 0;
286
  }
287
  }
275
  * @return boolean True/False.
276
  */
277
  public static function is_avalon() {
278
+ return (int) file_exists( '/etc/yum.repos.d/baseos.repo' );
 
 
 
 
 
 
 
279
  }
280
  }
core/Minifier/Minifier.php CHANGED
@@ -361,7 +361,7 @@ class Minifier {
361
  }
362
 
363
  // Get excluded params.
364
- $excluded_params = apply_filters( 'sgo_html_minify_exclude_params', array( 'pdf-catalog', 'tve' ) );
365
 
366
  // Check if any of the excluded params exists in the request.
367
  foreach ( $excluded_params as $param ) {
361
  }
362
 
363
  // Get excluded params.
364
+ $excluded_params = apply_filters( 'sgo_html_minify_exclude_params', array( 'pdf-catalog', 'tve', 'elementor-preview' ) );
365
 
366
  // Check if any of the excluded params exists in the request.
367
  foreach ( $excluded_params as $param ) {
readme.txt CHANGED
@@ -171,6 +171,11 @@ Our plugin uses a cookie in order to function properly. It does not store person
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
174
  = Version 5.4.4 =
175
  * Improved transients handling
176
  * Added Jet Popup support
171
 
172
  == Changelog ==
173
 
174
+ = Version 5.4.5 =
175
+ * Improved elementor support
176
+ * Improved flothemes support
177
+ * Improved handling of @imports in combine css
178
+
179
  = Version 5.4.4 =
180
  * Improved transients handling
181
  * Added Jet Popup support
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.4.4
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.4.4' );
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.4.5
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.4.5' );
35
  }
36
 
37
  // Define slug constant.