SG Optimizer - Version 5.3.1

Version Description

Download this release

Release Info

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

Code changes from version 5.3.0 to 5.3.1

core/Combinator/Combinator.php CHANGED
@@ -47,6 +47,7 @@ class Combinator {
47
  'elementor-pro', // Excluded in 5.2.2.
48
  'elementor-global', // Excluded in 5.2.5.
49
  'tve_style_family_tve_flt', // Excluded in 5.3.0.
 
50
  );
51
 
52
  /**
47
  'elementor-pro', // Excluded in 5.2.2.
48
  'elementor-global', // Excluded in 5.2.5.
49
  'tve_style_family_tve_flt', // Excluded in 5.3.0.
50
+ 'siteorigin-widget-icon-font-fontawesome',
51
  );
52
 
53
  /**
core/Images_Optimizer/Images_Optimizer.php CHANGED
@@ -297,6 +297,13 @@ class Images_Optimizer {
297
  $status
298
  );
299
 
 
 
 
 
 
 
 
300
  return $status;
301
  }
302
 
297
  $status
298
  );
299
 
300
+ // exec(
301
+ // sprintf(
302
+ // 'cwebp -q 50 -lossless %1$s -o %1$s.webp 2>&1',
303
+ // $filepath
304
+ // )
305
+ // );
306
+
307
  return $status;
308
  }
309
 
core/Install_Service/Install_5_3_1.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SiteGround_Optimizer\Install_Service;
3
+
4
+ use SiteGround_Optimizer\Ssl\Ssl;
5
+ use SiteGround_Optimizer\Options\Options;
6
+
7
+ class Install_5_3_1 extends Install {
8
+
9
+ /**
10
+ * The default install version. Overridden by the installation packages.
11
+ *
12
+ * @since 5.3.1
13
+ *
14
+ * @access protected
15
+ *
16
+ * @var string $version The install version.
17
+ */
18
+ protected static $version = '5.3.1';
19
+
20
+ public function __construct() {
21
+ $this->ssl_service = new Ssl();
22
+ }
23
+ /**
24
+ * Run the install procedure.
25
+ *
26
+ * @since 5.3.1
27
+ */
28
+ public function install() {
29
+ if ( Options::is_enabled( 'siteground_optimizer_ssl_enabled' ) ) {
30
+ $this->ssl_service->enable();
31
+ }
32
+
33
+ }
34
+
35
+ }
core/Install_Service/Install_Service.php CHANGED
@@ -13,6 +13,7 @@ use SiteGround_Optimizer\Install_Service\Install_5_0_13;
13
  use SiteGround_Optimizer\Install_Service\Install_5_2_0;
14
  use SiteGround_Optimizer\Install_Service\Install_5_2_5;
15
  use SiteGround_Optimizer\Install_Service\Install_5_3_0;
 
16
  use SiteGround_Optimizer\Supercacher\Supercacher;
17
 
18
  /**
@@ -63,6 +64,7 @@ class Install_Service {
63
  new Install_5_2_0(),
64
  new Install_5_2_5(),
65
  new Install_5_3_0(),
 
66
  );
67
 
68
  $version = null;
13
  use SiteGround_Optimizer\Install_Service\Install_5_2_0;
14
  use SiteGround_Optimizer\Install_Service\Install_5_2_5;
15
  use SiteGround_Optimizer\Install_Service\Install_5_3_0;
16
+ use SiteGround_Optimizer\Install_Service\Install_5_3_1;
17
  use SiteGround_Optimizer\Supercacher\Supercacher;
18
 
19
  /**
64
  new Install_5_2_0(),
65
  new Install_5_2_5(),
66
  new Install_5_3_0(),
67
+ new Install_5_3_1(),
68
  );
69
 
70
  $version = null;
core/Rest/Rest.php CHANGED
@@ -26,7 +26,7 @@ class Rest {
26
  * @return WP_Error|bool
27
  */
28
  public function check_permissions( $request ) {
29
- return current_user_can( 'administrator' );
30
  }
31
 
32
  /**
26
  * @return WP_Error|bool
27
  */
28
  public function check_permissions( $request ) {
29
+ return current_user_can( 'activate_plugins' );
30
  }
31
 
32
  /**
core/Ssl/Ssl.php CHANGED
@@ -14,6 +14,8 @@ class Ssl {
14
  public function __construct() {
15
  $this->htaccess_service = new Htaccess();
16
 
 
 
17
  // Replace unsecure links if the option is enabled.
18
  if ( Options::is_enabled( 'siteground_optimizer_fix_insecure_content' ) ) {
19
  add_action( 'init', array( $this, 'start_buffer' ) );
@@ -21,6 +23,24 @@ class Ssl {
21
  }
22
  }
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  /**
25
  * Check if the current domain has valis ssl certificate.
26
  *
@@ -108,9 +128,20 @@ class Ssl {
108
  $protocol_switched = $this->switch_protocol( true );
109
  $enable_from_htaccess = true;
110
 
 
 
 
 
 
111
  // Add rule to htaccess for single sites.
112
  if ( ! is_multisite() ) {
113
- $enable_from_htaccess = $this->htaccess_service->enable( 'ssl' );
 
 
 
 
 
 
114
  }
115
 
116
  if (
14
  public function __construct() {
15
  $this->htaccess_service = new Htaccess();
16
 
17
+ add_action( 'update_option_siteurl', array( $this, 'maybe_switch_rules' ), 10, 2 );
18
+
19
  // Replace unsecure links if the option is enabled.
20
  if ( Options::is_enabled( 'siteground_optimizer_fix_insecure_content' ) ) {
21
  add_action( 'init', array( $this, 'start_buffer' ) );
23
  }
24
  }
25
 
26
+ /**
27
+ * Enable the ssl when the siteurl is changed.
28
+ *
29
+ * @since 5.3.1
30
+ *
31
+ * @param mixed $old The old option value.
32
+ * @param mixed $new The new option value.
33
+ *
34
+ * @return mixed The new option value.
35
+ */
36
+ public function maybe_switch_rules( $old, $new ) {
37
+ if ( Options::is_enabled( 'siteground_optimizer_ssl_enabled' ) ) {
38
+ $this->enable();
39
+ }
40
+
41
+ return $new;
42
+ }
43
+
44
  /**
45
  * Check if the current domain has valis ssl certificate.
46
  *
128
  $protocol_switched = $this->switch_protocol( true );
129
  $enable_from_htaccess = true;
130
 
131
+ $replacements = array(
132
+ 'search' => '{MAYBE_WWW}',
133
+ 'replace' => '',
134
+ );
135
+
136
  // Add rule to htaccess for single sites.
137
  if ( ! is_multisite() ) {
138
+ $parsed = parse_url( get_option( 'siteurl' ) );
139
+
140
+ if ( strpos( $parsed['host'], 'www.' ) === 0 ) {
141
+ $replacements['replace'] = 'www.';
142
+ }
143
+
144
+ $enable_from_htaccess = $this->htaccess_service->enable( 'ssl', $replacements );
145
  }
146
 
147
  if (
readme.txt CHANGED
@@ -169,6 +169,10 @@ Our plugin uses a cookie in order to function properly. It does not store person
169
 
170
  == Changelog ==
171
 
 
 
 
 
172
  = Version 5.3.0 =
173
  * Refactoring of the Lazy Load functionality
174
  * Redesign of the Lazy Load screen
169
 
170
  == Changelog ==
171
 
172
+ = Version 5.3.1 =
173
+ * Better SSL force to accommodate websites with WWW in the URL
174
+ * Global exclusion of siteorigin-widget-icon-font-fontawesome from Combine CSS
175
+
176
  = Version 5.3.0 =
177
  * Refactoring of the Lazy Load functionality
178
  * Redesign of the Lazy Load screen
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.3.0
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.3.0' );
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.3.1
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.3.1' );
35
  }
36
 
37
  // Define slug constant.
templates/ssl.tpl CHANGED
@@ -2,6 +2,6 @@
2
  <IfModule mod_rewrite.c>
3
  RewriteEngine On
4
  RewriteCond %{HTTPS} off
5
- RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
6
  </IfModule>
7
  # END HTTPS
2
  <IfModule mod_rewrite.c>
3
  RewriteEngine On
4
  RewriteCond %{HTTPS} off
5
+ RewriteRule ^(.*)$ https://{MAYBE_WWW}%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
6
  </IfModule>
7
  # END HTTPS
vendor/phar-io/manifest/composer.lock ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "f00846dde236d314a19d00d268d737dd",
8
+ "packages": [
9
+ {
10
+ "name": "phar-io/version",
11
+ "version": "2.0.1",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/phar-io/version.git",
15
+ "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6",
20
+ "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6",
21
+ "shasum": ""
22
+ },
23
+ "require": {
24
+ "php": "^5.6 || ^7.0"
25
+ },
26
+ "type": "library",
27
+ "autoload": {
28
+ "classmap": [
29
+ "src/"
30
+ ]
31
+ },
32
+ "notification-url": "https://packagist.org/downloads/",
33
+ "license": [
34
+ "BSD-3-Clause"
35
+ ],
36
+ "authors": [
37
+ {
38
+ "name": "Arne Blankerts",
39
+ "email": "arne@blankerts.de",
40
+ "role": "Developer"
41
+ },
42
+ {
43
+ "name": "Sebastian Heuer",
44
+ "email": "sebastian@phpeople.de",
45
+ "role": "Developer"
46
+ },
47
+ {
48
+ "name": "Sebastian Bergmann",
49
+ "email": "sebastian@phpunit.de",
50
+ "role": "Developer"
51
+ }
52
+ ],
53
+ "description": "Library for handling version information and constraints",
54
+ "time": "2018-07-08T19:19:57+00:00"
55
+ }
56
+ ],
57
+ "packages-dev": [],
58
+ "aliases": [],
59
+ "minimum-stability": "stable",
60
+ "stability-flags": [],
61
+ "prefer-stable": false,
62
+ "prefer-lowest": false,
63
+ "platform": {
64
+ "php": "^5.6 || ^7.0",
65
+ "ext-dom": "*",
66
+ "ext-phar": "*"
67
+ },
68
+ "platform-dev": []
69
+ }
vendor/sebastian/type/.idea/type.iml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
6
+ <sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
7
+ <excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
8
+ <excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />
9
+ <excludeFolder url="file://$MODULE_DIR$/vendor/myclabs/deep-copy" />
10
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/manifest" />
11
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phar-io/version" />
12
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-common" />
13
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-docblock" />
14
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/type-resolver" />
15
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpspec/prophecy" />
16
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-code-coverage" />
17
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-file-iterator" />
18
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-text-template" />
19
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-timer" />
20
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-token-stream" />
21
+ <excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
22
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
23
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/comparator" />
24
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/diff" />
25
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/environment" />
26
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/exporter" />
27
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/global-state" />
28
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/object-enumerator" />
29
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/object-reflector" />
30
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
31
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/resource-operations" />
32
+ <excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/version" />
33
+ <excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
34
+ <excludeFolder url="file://$MODULE_DIR$/vendor/theseer/tokenizer" />
35
+ <excludeFolder url="file://$MODULE_DIR$/vendor/webmozart/assert" />
36
+ </content>
37
+ <orderEntry type="inheritedJdk" />
38
+ <orderEntry type="sourceFolder" forTests="false" />
39
+ </component>
40
+ </module>