SG Optimizer - Version 6.0.5

Version Description

Download this release

Release Info

Developer elenachavdarova
Plugin Icon 128x128 SG Optimizer
Version 6.0.5
Comparing to
See all releases

Code changes from version 6.0.3 to 6.0.5

assets/images/banner-es.png ADDED
Binary file
assets/images/banner-it.png ADDED
Binary file
assets/images/ebook-es.png ADDED
Binary file
assets/images/ebook-it.png ADDED
Binary file
assets/images/logo-white.svg CHANGED
File without changes
core/Admin/Admin.php CHANGED
@@ -254,8 +254,9 @@ class Admin {
254
 
255
  if (
256
  is_multisite() &&
257
- ! is_network_admin()
258
- && 0 === intval( get_site_option( $this->multisite_permissions[ $id ], 0 ) )
 
259
  ) {
260
  continue;
261
  }
254
 
255
  if (
256
  is_multisite() &&
257
+ ! is_network_admin() &&
258
+ array_key_exists( $id, $this->multisite_permissions ) &&
259
+ 0 === intval( get_site_option( $this->multisite_permissions[ $id ], 0 ) )
260
  ) {
261
  continue;
262
  }
core/Analysis/Analysis.php CHANGED
@@ -67,7 +67,7 @@ class Analysis {
67
  'non-composited-animations',
68
  'third-party-facades',
69
  ),
70
- 'general_optimiazions' => array(
71
  'server-response-time',
72
  'uses-text-compression',
73
  'redirects',
@@ -92,7 +92,6 @@ class Analysis {
92
  * @param array $result Speed test results.
93
  */
94
  public function process_analysis( $result ) {
95
-
96
  // Bail if the are no results.
97
  if ( empty( $result ) ) {
98
  wp_send_json_error();
@@ -110,6 +109,14 @@ class Analysis {
110
  foreach ( $result['lighthouseResult']['categories'] as $group ) {
111
  foreach ( $group['auditRefs'] as $ref ) {
112
 
 
 
 
 
 
 
 
 
113
  if ( empty( $ref['group'] ) ) {
114
  continue;
115
  }
@@ -122,14 +129,6 @@ class Analysis {
122
  continue;
123
  }
124
 
125
- if ( 'server-response-time' === $ref['id'] ) {
126
- $items['scores']['ttfb'] = round( $result['lighthouseResult']['audits'][ $ref['id'] ]['numericValue'] );
127
- }
128
-
129
- if ( 'first-contentful-paint' === $ref['id'] ) {
130
- $items['scores']['fcp'] = $result['lighthouseResult']['audits'][ $ref['id'] ]['numericValue'];
131
- }
132
-
133
  $audit = $result['lighthouseResult']['audits'][ $ref['id'] ];
134
  $optimization_group = 'other';
135
  if ( in_array( $ref['group'], array( 'load-opportunities', 'diagnostics' ) ) ) {
@@ -172,6 +171,7 @@ class Analysis {
172
  }
173
  }
174
 
 
175
  unset( $items['data']['budgets'] );
176
  unset( $items['data']['diagnostics'] );
177
  unset( $items['data']['metrics'] );
67
  'non-composited-animations',
68
  'third-party-facades',
69
  ),
70
+ 'general_optimizations' => array(
71
  'server-response-time',
72
  'uses-text-compression',
73
  'redirects',
92
  * @param array $result Speed test results.
93
  */
94
  public function process_analysis( $result ) {
 
95
  // Bail if the are no results.
96
  if ( empty( $result ) ) {
97
  wp_send_json_error();
109
  foreach ( $result['lighthouseResult']['categories'] as $group ) {
110
  foreach ( $group['auditRefs'] as $ref ) {
111
 
112
+ if ( 'server-response-time' === $ref['id'] ) {
113
+ $items['scores']['ttfb'] = round( $result['lighthouseResult']['audits'][ $ref['id'] ]['numericValue'] );
114
+ }
115
+
116
+ if ( 'first-contentful-paint' === $ref['id'] ) {
117
+ $items['scores']['fcp'] = $result['lighthouseResult']['audits'][ $ref['id'] ]['numericValue'];
118
+ }
119
+
120
  if ( empty( $ref['group'] ) ) {
121
  continue;
122
  }
129
  continue;
130
  }
131
 
 
 
 
 
 
 
 
 
132
  $audit = $result['lighthouseResult']['audits'][ $ref['id'] ];
133
  $optimization_group = 'other';
134
  if ( in_array( $ref['group'], array( 'load-opportunities', 'diagnostics' ) ) ) {
171
  }
172
  }
173
 
174
+
175
  unset( $items['data']['budgets'] );
176
  unset( $items['data']['diagnostics'] );
177
  unset( $items['data']['metrics'] );
core/Cli/Cli_Https.php CHANGED
@@ -3,6 +3,7 @@ namespace SiteGround_Optimizer\Cli;
3
 
4
  use SiteGround_Optimizer\Ssl\Ssl;
5
  use SiteGround_Optimizer\Options\Options;
 
6
  /**
7
  * WP-CLI: wp sg memcached enable/disable.
8
  *
@@ -39,20 +40,20 @@ class Cli_Https {
39
  case 'enable':
40
  $result = $this->ssl->enable();
41
  true === $result ? Options::enable_option( 'siteground_optimizer_ssl_enabled' ) : '';
42
- $type = true;
43
  break;
44
 
45
  case 'disable':
46
  $result = $this->ssl->disable();
47
  true === $result ? Options::disable_option( 'siteground_optimizer_ssl_enabled' ) : '';
48
- $type = false;
49
  break;
50
  default:
51
  \WP_CLI::error( 'Please specify action' );
52
  break;
53
  }
54
 
55
- $message = $this->option_service->get_response_message( $result, 'siteground_optimizer_ssl_enabled', $type );
56
 
57
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
58
  }
3
 
4
  use SiteGround_Optimizer\Ssl\Ssl;
5
  use SiteGround_Optimizer\Options\Options;
6
+ use SiteGround_Optimizer\Message_Service\Message_Service;
7
  /**
8
  * WP-CLI: wp sg memcached enable/disable.
9
  *
40
  case 'enable':
41
  $result = $this->ssl->enable();
42
  true === $result ? Options::enable_option( 'siteground_optimizer_ssl_enabled' ) : '';
43
+ $type = 1;
44
  break;
45
 
46
  case 'disable':
47
  $result = $this->ssl->disable();
48
  true === $result ? Options::disable_option( 'siteground_optimizer_ssl_enabled' ) : '';
49
+ $type = 0;
50
  break;
51
  default:
52
  \WP_CLI::error( 'Please specify action' );
53
  break;
54
  }
55
 
56
+ $message = Message_Service::get_response_message( $result, 'ssl', $type );
57
 
58
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
59
  }
core/Cli/Cli_Memcache.php CHANGED
@@ -47,7 +47,7 @@ class Cli_Memcache {
47
 
48
  // Send success if the dropin has been created.
49
  if ( $memcache->create_memcached_dropin() ) {
50
- return \WP_CLI::success( 'Memcached Enabled' );
51
  }
52
 
53
  // Dropin cannot be created.
47
 
48
  // Send success if the dropin has been created.
49
  if ( $memcache->create_memcached_dropin() ) {
50
+ return \WP_CLI::success( 'Memcached Enabled!' );
51
  }
52
 
53
  // Dropin cannot be created.
core/Cli/Cli_Optimizer.php CHANGED
@@ -3,6 +3,7 @@ namespace SiteGround_Optimizer\Cli;
3
 
4
  use SiteGround_Optimizer\Options\Options;
5
  use SiteGround_Optimizer\Htaccess\Htaccess;
 
6
  /**
7
  * WP-CLI: wp sg optimize {option} enable/disable.
8
  *
@@ -40,18 +41,14 @@ class Cli_Optimizer {
40
  * - combine-css
41
  * - querystring
42
  * - emojis
43
- * - images
44
  * - backup-media
45
  * - lazyload
46
  * - webp
47
  * - resize-images
48
  * - web-fonts
49
- * - backup_media
50
- * - fix_insecure_content
51
  * - database-optimization
52
- * - dns-prefetch
53
- * - heartbeat-control
54
- * - preload-combined-css
55
  * ---
56
  * <action>
57
  * : The action: enable\disable.
@@ -82,13 +79,10 @@ class Cli_Optimizer {
82
  case 'webp':
83
  case 'backup-media':
84
  case 'resize-images':
85
- case 'dns-prefetch':
86
- case 'heartbeat-control':
87
- case 'backup_media':
88
  case 'preload-combined-css':
89
  return $this->optimize( $args[1], $args[0], $blog_id );
90
- case 'lazyload':
91
- return $this->optimize_lazyload( $args[1], $blog_id );
92
  case 'database-optimization':
93
  return $this->optimize_database( $args[1] );
94
  case 'mobile-cache':
@@ -134,17 +128,16 @@ class Cli_Optimizer {
134
  'js-async' => 'siteground_optimizer_optimize_javascript_async',
135
  'css' => 'siteground_optimizer_optimize_css',
136
  'combine-css' => 'siteground_optimizer_combine_css',
 
137
  'combine-js' => 'siteground_optimizer_combine_javascript',
138
  'querystring' => 'siteground_optimizer_remove_query_strings',
139
  'emojis' => 'siteground_optimizer_disable_emojis',
140
  'backup-media' => 'siteground_optimizer_backup_media',
141
  'webp' => 'siteground_optimizer_webp_support',
142
  'resize-images' => 'siteground_optimizer_resize_images',
143
- 'fix_insecure_content' => 'siteground_optimizer_fix_insecure_content',
144
- 'dns-prefetch' => 'siteground_optimizer_dns_prefetch',
145
- 'heartbeat-control' => 'siteground_optimizer_heartbeat_control',
146
  'preload-combined-css' => 'siteground_optimizer_preload_combined_css',
147
- 'backup_media' => 'siteground_optimizer_backup_media',
148
  );
149
 
150
  switch ( $action ) {
@@ -154,7 +147,7 @@ class Cli_Optimizer {
154
  } else {
155
  $result = $this->option_service::enable_mu_option( $blog_id, $mapping[ $option ] );
156
  }
157
- $type = true;
158
  break;
159
 
160
  case 'disable':
@@ -164,7 +157,7 @@ class Cli_Optimizer {
164
  $result = $this->option_service::disable_mu_option( $blog_id, $mapping[ $option ] );
165
  }
166
 
167
- $type = false;
168
  break;
169
  }
170
 
@@ -172,53 +165,12 @@ class Cli_Optimizer {
172
  \WP_CLI::error( 'Please specify action' );
173
  }
174
 
175
- $message = $this->option_service->get_response_message( $result, $mapping[ $option ], $type );
176
 
177
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
178
 
179
  }
180
 
181
- public function optimize_lazyload( $action, $blog_id=false ) {
182
- $this->validate_multisite( 'lazyload', $blog_id );
183
-
184
- $options = array(
185
- 'siteground_optimizer_lazyload_images',
186
- 'siteground_optimizer_lazyload_gravatars',
187
- 'siteground_optimizer_lazyload_thumbnails',
188
- 'siteground_optimizer_lazyload_responsive',
189
- 'siteground_optimizer_lazyload_textwidgets',
190
- 'siteground_optimizer_lazyload_woocommerce',
191
- 'siteground_optimizer_lazyload_shortcodes',
192
- 'siteground_optimizer_lazyload_videos',
193
- 'siteground_optimizer_lazyload_iframes',
194
- );
195
-
196
- $status = array();
197
-
198
- foreach ( $options as $option ) {
199
- if ( 'enable' === $action ) {
200
- if ( false === $blog_id ) {
201
- $status[] = Options::enable_option( $option );
202
- } else {
203
- $status[] = Options::enable_mu_option( $blog_id, $option );
204
- }
205
- } else {
206
- if ( false === $blog_id ) {
207
- $status[] = Options::disable_option( $option );
208
- } else {
209
- $status[] = Options::disable_mu_option( $blog_id, $option );
210
- }
211
- }
212
- }
213
-
214
- if ( in_array( false, $status ) ) {
215
- return \WP_CLI::error( 'Could not ' . ucwords( $action ) . ' Lazy Loading Images' );
216
- }
217
-
218
- return \WP_CLI::success( 'Lazy Loading Images ' . ucwords( $action ) );
219
-
220
- }
221
-
222
  /**
223
  * Enable/disable Datbase Optimization
224
  *
@@ -249,7 +201,7 @@ class Cli_Optimizer {
249
  $type = false;
250
  }
251
  // Set the message.
252
- $message = $this->option_service->get_response_message( $result, 'siteground_optimizer_database_optimization', $type );
253
 
254
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
255
  }
@@ -265,7 +217,7 @@ class Cli_Optimizer {
265
  $type = false;
266
  }
267
 
268
- $message = $this->option_service->get_response_message( $result, 'siteground_optimizer_user_agent_header', $type );
269
 
270
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
271
  }
3
 
4
  use SiteGround_Optimizer\Options\Options;
5
  use SiteGround_Optimizer\Htaccess\Htaccess;
6
+ use SiteGround_Optimizer\Message_Service\Message_Service;
7
  /**
8
  * WP-CLI: wp sg optimize {option} enable/disable.
9
  *
41
  * - combine-css
42
  * - querystring
43
  * - emojis
 
44
  * - backup-media
45
  * - lazyload
46
  * - webp
47
  * - resize-images
48
  * - web-fonts
49
+ * - fix-insecure-content
 
50
  * - database-optimization
51
+ * - preload-combined-css
 
 
52
  * ---
53
  * <action>
54
  * : The action: enable\disable.
79
  case 'webp':
80
  case 'backup-media':
81
  case 'resize-images':
82
+ case 'fix-insecure-content':
83
+ case 'lazyload':
 
84
  case 'preload-combined-css':
85
  return $this->optimize( $args[1], $args[0], $blog_id );
 
 
86
  case 'database-optimization':
87
  return $this->optimize_database( $args[1] );
88
  case 'mobile-cache':
128
  'js-async' => 'siteground_optimizer_optimize_javascript_async',
129
  'css' => 'siteground_optimizer_optimize_css',
130
  'combine-css' => 'siteground_optimizer_combine_css',
131
+ 'web-fonts' => 'siteground_optimizer_optimize_web_fonts',
132
  'combine-js' => 'siteground_optimizer_combine_javascript',
133
  'querystring' => 'siteground_optimizer_remove_query_strings',
134
  'emojis' => 'siteground_optimizer_disable_emojis',
135
  'backup-media' => 'siteground_optimizer_backup_media',
136
  'webp' => 'siteground_optimizer_webp_support',
137
  'resize-images' => 'siteground_optimizer_resize_images',
138
+ 'fix-insecure-content' => 'siteground_optimizer_fix_insecure_content',
 
 
139
  'preload-combined-css' => 'siteground_optimizer_preload_combined_css',
140
+ 'lazyload' => 'siteground_optimizer_lazyload_images',
141
  );
142
 
143
  switch ( $action ) {
147
  } else {
148
  $result = $this->option_service::enable_mu_option( $blog_id, $mapping[ $option ] );
149
  }
150
+ $type = 1;
151
  break;
152
 
153
  case 'disable':
157
  $result = $this->option_service::disable_mu_option( $blog_id, $mapping[ $option ] );
158
  }
159
 
160
+ $type = 0;
161
  break;
162
  }
163
 
165
  \WP_CLI::error( 'Please specify action' );
166
  }
167
 
168
+ $message = Message_Service::get_response_message( $result, str_replace( 'siteground_optimizer_', '', $mapping[ $option ] ), $type );
169
 
170
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
171
 
172
  }
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  /**
175
  * Enable/disable Datbase Optimization
176
  *
201
  $type = false;
202
  }
203
  // Set the message.
204
+ $message = Message_Service::get_response_message( $result, 'database_optimization', $type );
205
 
206
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
207
  }
217
  $type = false;
218
  }
219
 
220
+ $message = Message_Service::get_response_message( $result, 'user_agent_header', $type );
221
 
222
  return true === $result ? \WP_CLI::success( $message ) : \WP_CLI::error( $message );
223
  }
core/Cli/Cli_Status.php CHANGED
@@ -3,6 +3,7 @@ namespace SiteGround_Optimizer\Cli;
3
 
4
  use SiteGround_Optimizer\Options\Options;
5
  use SiteGround_Optimizer\Htaccess\Htaccess;
 
6
  /**
7
  * WP-CLI: wp sg status {type}.
8
  *
@@ -37,11 +38,7 @@ class Cli_Status {
37
  * - querystring
38
  * - emojis
39
  * - webp
40
- * - lazyload_images
41
- * - image_compression
42
- * - heartbeat_post_interval
43
- * - heartbeat_dashboard_interval
44
- * - heartbeat_frontend_interval
45
  * - memcache
46
  * - ssl
47
  * - ssl-fix
@@ -49,8 +46,7 @@ class Cli_Status {
49
  * - dynamic-cache
50
  * - google-fonts
51
  * - database-optimization
52
- * - dns-prefetch
53
- * - heartbeat-control
54
  * ---
55
  *
56
  * [--blog_id=<blog_id>]
@@ -86,18 +82,13 @@ class Cli_Status {
86
  'combine-css' => 'siteground_optimizer_combine_css',
87
  'querystring' => 'siteground_optimizer_remove_query_strings',
88
  'emojis' => 'siteground_optimizer_disable_emojis',
89
- 'lazyload_images' => 'siteground_optimizer_lazyload_images',
90
- 'heartbeat_post_interval' => 'siteground_optimizer_heartbeat_post_interval',
91
- 'heartbeat_dashboard_interval' => 'siteground_optimizer_heartbeat_dashboard_interval',
92
- 'heartbeat_frontend_interval' => 'siteground_optimizer_heartbeat_frontend_interval',
93
- 'image_compression' => 'siteground_optimizer_compression_level',
94
  'ssl' => 'siteground_optimizer_ssl_enabled',
95
  'google-fonts' => 'siteground_optimizer_optimize_web_fonts',
96
  'combine-js' => 'siteground_optimizer_combine_javascript',
97
  'webp' => 'siteground_optimizer_webp_support',
98
  'database-optimization' => 'siteground_optimizer_database_optimization',
99
- 'dns-prefetch' => 'siteground_optimizer_dns_prefetch',
100
- 'heartbeat-control' => 'siteground_optimizer_heartbeat_control',
101
  );
102
 
103
  if ( ! array_key_exists( $type, $mapping ) ) {
@@ -117,7 +108,7 @@ class Cli_Status {
117
  }
118
 
119
  // Very ugly way to get meaningful message.
120
- $message = str_replace( ' Disabled', '', $this->option_service->get_response_message( true, $mapping[ $type ], false ) );
121
 
122
  // The optimization is disabled.
123
  if ( false === $status ) {
3
 
4
  use SiteGround_Optimizer\Options\Options;
5
  use SiteGround_Optimizer\Htaccess\Htaccess;
6
+ use SiteGround_Optimizer\Message_Service\Message_Service;
7
  /**
8
  * WP-CLI: wp sg status {type}.
9
  *
38
  * - querystring
39
  * - emojis
40
  * - webp
41
+ * - lazyload-images
 
 
 
 
42
  * - memcache
43
  * - ssl
44
  * - ssl-fix
46
  * - dynamic-cache
47
  * - google-fonts
48
  * - database-optimization
49
+ * - browser-caching
 
50
  * ---
51
  *
52
  * [--blog_id=<blog_id>]
82
  'combine-css' => 'siteground_optimizer_combine_css',
83
  'querystring' => 'siteground_optimizer_remove_query_strings',
84
  'emojis' => 'siteground_optimizer_disable_emojis',
85
+ 'lazyload-images' => 'siteground_optimizer_lazyload_images',
 
 
 
 
86
  'ssl' => 'siteground_optimizer_ssl_enabled',
87
  'google-fonts' => 'siteground_optimizer_optimize_web_fonts',
88
  'combine-js' => 'siteground_optimizer_combine_javascript',
89
  'webp' => 'siteground_optimizer_webp_support',
90
  'database-optimization' => 'siteground_optimizer_database_optimization',
91
+ 'browser-caching' => 'siteground_optimizer_user_agent_header',
 
92
  );
93
 
94
  if ( ! array_key_exists( $type, $mapping ) ) {
108
  }
109
 
110
  // Very ugly way to get meaningful message.
111
+ $message = Message_Service::get_response_message( $result, str_replace( 'siteground_optimizer_', '', $mapping[ $type ] ), null );
112
 
113
  // The optimization is disabled.
114
  if ( false === $status ) {
core/Cli/Cli_Webp.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SiteGround_Optimizer\Cli;
3
+ /**
4
+ * WP-CLI: wp sg webp {setting} value.
5
+ *
6
+ * Run the `wp sg webp {setting} value` command to change the settgins of specific plugin functionality.
7
+ *
8
+ * @since 5.0.0
9
+ * @package Cli
10
+ * @subpackage Cli/Cli_Optimizer
11
+ */
12
+
13
+ /**
14
+ * Define the {@link Cli_Optimizer} class.
15
+ *
16
+ * @since 5.0.0
17
+ */
18
+ class Cli_Webp {
19
+ /**
20
+ * Enable specific setting for SiteGround Optimizer plugin.
21
+ *
22
+ * ## OPTIONS
23
+ *
24
+ * <setting>
25
+ * : setting name.
26
+ * ---
27
+ * options:
28
+ * - type
29
+ * - quality
30
+ * ---
31
+ * <value>
32
+ * : The new value of the setting.
33
+ */
34
+ public function __invoke( $args ) {
35
+ switch ( $args[0] ) {
36
+ case 'type':
37
+ return $this->change_type( $args[1] );
38
+ case 'quality':
39
+ return $this->change_quality( $args[1] );
40
+ }
41
+ }
42
+
43
+ public function change_type( $type ) {
44
+ $types = array(
45
+ 'lossy',
46
+ 'lossless',
47
+ );
48
+
49
+ if ( ! in_array( $type, $types ) ) {
50
+ \WP_CLI::error( 'The ' . $type . 'is not supported. Please choose between lossy and lossless' );
51
+ }
52
+
53
+ $status = update_option( 'siteground_optimizer_quality_type', $type );
54
+
55
+ if ( false === $status ) {
56
+ \WP_CLI::error( 'Error updating WebP optimization type' );
57
+ }
58
+
59
+ \WP_CLI::success( 'WebP Optimization Type Updated!' );
60
+ }
61
+
62
+ public function change_quality( $quality ) {
63
+
64
+ $quality = intval( $quality );
65
+
66
+ if ( ! is_int( $quality ) ) {
67
+ \WP_CLI::error( 'The ' . $quality . 'is not supported. Please choose between a number between 1 and 100' );
68
+ }
69
+
70
+ if (
71
+ $quality < 1 ||
72
+ $quality > 101
73
+ ) {
74
+ \WP_CLI::error( 'The ' . $quality . 'is not supported. Please choose between a number between 1 and 100' );
75
+ }
76
+
77
+ $status = update_option( 'siteground_optimizer_quality_webp', $quality );
78
+
79
+ if ( false === $status ) {
80
+ \WP_CLI::error( 'Error Updating WebP Optimization Quality' );
81
+ }
82
+
83
+ \WP_CLI::success( 'WebP Optimization Quality Changed!' );
84
+ }
85
+ }
core/Loader/Loader.php CHANGED
@@ -572,6 +572,9 @@ class Loader {
572
  */
573
  public function add_ssl_hooks() {
574
  add_action( 'update_option_siteurl', array( $this->ssl, 'maybe_switch_rules' ), 10, 2 );
575
- add_action( 'wp_login', array( $this->ssl, 'maybe_switch_option' ), 1 );
 
 
 
576
  }
577
  }
572
  */
573
  public function add_ssl_hooks() {
574
  add_action( 'update_option_siteurl', array( $this->ssl, 'maybe_switch_rules' ), 10, 2 );
575
+
576
+ if ( ! is_multisite() ) {
577
+ add_action( 'wp_login', array( $this->ssl, 'maybe_switch_option' ), 1 );
578
+ }
579
  }
580
  }
core/Message_Service/Message_Service.php CHANGED
@@ -19,60 +19,55 @@ class Message_Service {
19
  public static function get_response_message( $result, $option, $type = null ) {
20
  // Array containing message responses.
21
  $messages = array(
22
- 'enable_cache' => __( 'Dynamic Cache', 'sg-cachepress' ),
23
- 'autoflush_cache' => __( 'Autoflush', 'sg-cachepress' ),
24
- 'user_agent_header' => __( 'Browser-Specific Caching', 'sg-cachepress' ),
25
- 'enable_memcached' => __( 'Memcached', 'sg-cachepress' ),
26
- 'ssl' => __( 'HTTPS', 'sg-cachepress' ),
27
- 'fix_insecure_content' => __( 'Insecure Content Fix', 'sg-cachepress' ),
28
- 'enable_gzip_compression' => __( 'GZIP Compression', 'sg-cachepress' ),
29
- 'enable_browser_caching' => __( 'Browser Caching', 'sg-cachepress' ),
30
- 'optimize_html' => __( 'HTML Minification', 'sg-cachepress' ),
31
- 'optimize_javascript' => __( 'JavaScript Minification', 'sg-cachepress' ),
32
- 'optimize_javascript_async' => __( 'Defer Render-blocking JS', 'sg-cachepress' ),
33
- 'optimize_css' => __( 'CSS Minification', 'sg-cachepress' ),
34
- 'combine_css' => __( 'CSS Combination', 'sg-cachepress' ),
35
- 'combine_javascript' => __( 'JavaScript Files Combination', 'sg-cachepress' ),
36
- 'optimize_web_fonts' => __( 'Web Fonts Optimization', 'sg-cachepress' ),
37
- 'remove_query_strings' => __( 'Query Strings Removal', 'sg-cachepress' ),
38
- 'disable_emojis' => __( 'Emoji Removal Filter', 'sg-cachepress' ),
39
- 'backup_media' => __( 'Backup Media', 'sg-cachepress' ),
40
- 'lazyload_images' => __( 'Lazy Loading Images', 'sg-cachepress' ),
41
- 'webp_support' => __( 'WebP Generation for New Images', 'sg-cachepress' ),
42
- 'lazyload_gravatars' => __( 'Lazy Loading Gravatars', 'sg-cachepress' ),
43
- 'lazyload_thumbnails' => __( 'Lazy Loading Thumbnails', 'sg-cachepress' ),
44
- 'lazyload_responsive' => __( 'Lazy Loading Responsive Images', 'sg-cachepress' ),
45
- 'lazyload_textwidgets' => __( 'Lazy Loading Widgets', 'sg-cachepress' ),
46
- 'lazyload_mobile' => __( 'Lazy Load for Mobile', 'sg-cachepress' ),
47
- 'lazyload_woocommerce' => __( 'Lazy Load for Product Images', 'sg-cachepress' ),
48
- 'lazyload_shortcodes' => __( 'Fix for Lazy Loading Short Codes', 'sg-cachepress' ),
49
- 'lazyload_videos' => __( 'Lazy Load Videos', 'sg-cachepress' ),
50
- 'lazyload_iframes' => __( 'Lazy Load Iframes', 'sg-cachepress' ),
51
- 'resize_images' => __( 'Maximum Image Width', 'sg-cachepress' ),
52
- 'supercacher_permissions' => __( 'Can Config SuperCacher', 'sg-cachepress' ),
53
- 'frontend_permissions' => __( 'Can Optimize Frontend', 'sg-cachepress' ),
54
- 'images_permissions' => __( 'Can Optimize Images', 'sg-cachepress' ),
55
- 'environment_permissions' => __( 'Can Optimize Environment', 'sg-cachepress' ),
56
- 'heartbeat_control' => __( 'Heartbeat Optimization', 'sg-cachepress' ),
57
- 'database_optimization' => __( 'Scheduled Database Maintenance', 'sg-cachepress' ),
58
- 'dns_prefetch' => __( 'DNS Prefetching', 'sg-cachepress' ),
59
- 'preload_combined_css' => __( 'Preload Combined CSS', 'sg-cachepress' ),
60
- 'cloudflare_optimization' => __( 'Cloudflare Optimization', 'sg-cachepress' ),
61
- 'enable_ssl_no_certificate' => __( 'Please, install an SSL certificate first!', 'sg-cachepress' ),
62
- 'enable_memcache_empty_port' => __( 'SiteGround Optimizer was unable to connect to the Memcached server and it was disabled. Please, check your SiteGround control panel and turn it on if disabled.', 'sg-cachepress' ),
63
- 'excluded_urls' => __( 'List of excluded urls is updated', 'sg-cachepress' ),
64
- 'dns_prefetch_urls' => __( 'List of external URLs is updated', 'sg-cachepress' ),
65
- 'minify_html_exclude' => __( 'List of excluded urls is updated', 'sg-cachepress' ),
66
- 'fonts_preload_urls' => __( 'Preloaded fonts successfully modified', 'sg-cachepress' ),
67
- 'post_types_exclude' => __( 'List of excluded post types is updated', 'sg-cachepress' ),
68
- 'minify_css_exclude' => __( 'List of excluded styles is updated', 'sg-cachepress' ),
69
- 'combine_css_exclude' => __( 'List of excluded styles is updated', 'sg-cachepress' ),
70
- 'minify_javascript_exclude' => __( 'List of excluded scrpts is updated', 'sg-cachepress' ),
71
- 'combine_javascript_exclude' => __( 'List of excluded scrpts is updated', 'sg-cachepress' ),
72
- 'async_javascript_exclude' => __( 'List of excluded scrpts is updated', 'sg-cachepress' ),
73
- 'excluded_lazy_load_classes' => __( 'List of excluded class names is updated', 'sg-cachepress' ),
74
- 'excluded_lazy_load_media_types' => __( 'List of excluded media types is updated', 'sg-cachepress' ),
75
- 'image_compression_settings' => __( 'Compression settings updated', 'sg-cachepress' ),
76
  );
77
 
78
  if ( is_null( $type ) ) {
19
  public static function get_response_message( $result, $option, $type = null ) {
20
  // Array containing message responses.
21
  $messages = array(
22
+ 'enable_cache' => __( 'Dynamic Cache', 'sg-cachepress' ),
23
+ 'autoflush_cache' => __( 'Autoflush', 'sg-cachepress' ),
24
+ 'user_agent_header' => __( 'Browser-Specific Caching', 'sg-cachepress' ),
25
+ 'enable_memcached' => __( 'Memcached', 'sg-cachepress' ),
26
+ 'ssl' => __( 'HTTPS', 'sg-cachepress' ),
27
+ 'fix_insecure_content' => __( 'Insecure Content Fix', 'sg-cachepress' ),
28
+ 'enable_gzip_compression' => __( 'GZIP Compression', 'sg-cachepress' ),
29
+ 'enable_browser_caching' => __( 'Browser Caching', 'sg-cachepress' ),
30
+ 'optimize_html' => __( 'HTML Minification', 'sg-cachepress' ),
31
+ 'optimize_javascript' => __( 'JavaScript Minification', 'sg-cachepress' ),
32
+ 'optimize_javascript_async' => __( 'Defer Render-blocking JS', 'sg-cachepress' ),
33
+ 'optimize_css' => __( 'CSS Minification', 'sg-cachepress' ),
34
+ 'combine_css' => __( 'CSS Combination', 'sg-cachepress' ),
35
+ 'combine_javascript' => __( 'JavaScript Files Combination', 'sg-cachepress' ),
36
+ 'optimize_web_fonts' => __( 'Web Fonts Optimization', 'sg-cachepress' ),
37
+ 'remove_query_strings' => __( 'Query Strings Removal', 'sg-cachepress' ),
38
+ 'disable_emojis' => __( 'Emoji Removal Filter', 'sg-cachepress' ),
39
+ 'backup_media' => __( 'Backup Media', 'sg-cachepress' ),
40
+ 'lazyload_images' => __( 'Lazy Loading Images', 'sg-cachepress' ),
41
+ 'webp_support' => __( 'WebP Generation for New Images', 'sg-cachepress' ),
42
+ 'resize_images' => __( 'Maximum Image Width', 'sg-cachepress' ),
43
+ 'supercacher_permissions' => __( 'Can Config SuperCacher', 'sg-cachepress' ),
44
+ 'frontend_permissions' => __( 'Can Optimize Frontend', 'sg-cachepress' ),
45
+ 'images_permissions' => __( 'Can Optimize Images', 'sg-cachepress' ),
46
+ 'environment_permissions' => __( 'Can Optimize Environment', 'sg-cachepress' ),
47
+ 'heartbeat_control' => __( 'Heartbeat Optimization', 'sg-cachepress' ),
48
+ 'database_optimization' => __( 'Scheduled Database Maintenance', 'sg-cachepress' ),
49
+ 'dns_prefetch' => __( 'DNS Prefetching', 'sg-cachepress' ),
50
+ 'preload_combined_css' => __( 'Preload Combined CSS', 'sg-cachepress' ),
51
+ 'cloudflare_optimization' => __( 'Cloudflare Optimization', 'sg-cachepress' ),
52
+ 'enable_ssl_no_certificate' => __( 'Please, install an SSL certificate first!', 'sg-cachepress' ),
53
+ 'enable_memcache_empty_port' => __( 'SiteGround Optimizer was unable to connect to the Memcached server and it was disabled. Please, check your SiteGround control panel and turn it on if disabled.', 'sg-cachepress' ),
54
+ 'excluded_urls' => __( 'List of excluded urls is updated', 'sg-cachepress' ),
55
+ 'dns_prefetch_urls' => __( 'List of external URLs is updated', 'sg-cachepress' ),
56
+ 'minify_html_exclude' => __( 'List of excluded urls is updated', 'sg-cachepress' ),
57
+ 'fonts_preload_urls' => __( 'Preloaded fonts successfully modified', 'sg-cachepress' ),
58
+ 'post_types_exclude' => __( 'List of excluded post types is updated', 'sg-cachepress' ),
59
+ 'minify_css_exclude' => __( 'List of excluded styles is updated', 'sg-cachepress' ),
60
+ 'combine_css_exclude' => __( 'List of excluded styles is updated', 'sg-cachepress' ),
61
+ 'minify_javascript_exclude' => __( 'List of excluded scrpts is updated', 'sg-cachepress' ),
62
+ 'combine_javascript_exclude' => __( 'List of excluded scrpts is updated', 'sg-cachepress' ),
63
+ 'async_javascript_exclude' => __( 'List of excluded scrpts is updated', 'sg-cachepress' ),
64
+ 'excluded_lazy_load_classes' => __( 'List of excluded class names is updated', 'sg-cachepress' ),
65
+ 'excluded_lazy_load_media_types' => __( 'List of excluded media types is updated', 'sg-cachepress' ),
66
+ 'image_compression_settings' => __( 'Compression settings updated', 'sg-cachepress' ),
67
+ 'siteground_optimizer_supercacher_permissions' => __( 'Can Config SuperCacher', 'sg-cachepress' ),
68
+ 'siteground_optimizer_frontend_permissions' => __( 'Can Optimize Frontend', 'sg-cachepress' ),
69
+ 'siteground_optimizer_images_permissions' => __( 'Can Optimize Images', 'sg-cachepress' ),
70
+ 'siteground_optimizer_environment_permissions' => __( 'Can Optimize Environment', 'sg-cachepress' ),
 
 
 
 
 
71
  );
72
 
73
  if ( is_null( $type ) ) {
core/Options/Options.php CHANGED
@@ -347,79 +347,6 @@ class Options {
347
  return $post_types;
348
  }
349
 
350
- /**
351
- * Prepare response message for react app.
352
- *
353
- * @since 5.0.0
354
- *
355
- * @param bool $status The result of operation.
356
- * @param string $key The option key.
357
- * @param bool $type True for enable, false for disable option.
358
- *
359
- * @return string The response message.
360
- */
361
- public function get_response_message( $status, $key, $type ) {
362
- $messages = array(
363
- 'siteground_optimizer_enable_cache' => __( 'Dynamic Cache', 'sg-cachepress' ),
364
- 'siteground_optimizer_autoflush_cache' => __( 'Autoflush', 'sg-cachepress' ),
365
- 'siteground_optimizer_purge_rest_cache' => __( 'Autoflush Rest Cache', 'sg-cachepress' ),
366
- 'siteground_optimizer_user_agent_header' => __( 'Browser-Specific Caching', 'sg-cachepress' ),
367
- 'siteground_optimizer_enable_memcached' => __( 'Memcache', 'sg-cachepress' ),
368
- 'siteground_optimizer_ssl_enabled' => __( 'HTTPS', 'sg-cachepress' ),
369
- 'siteground_optimizer_fix_insecure_content' => __( 'Insecure Content Fix', 'sg-cachepress' ),
370
- 'siteground_optimizer_enable_gzip_compression' => __( 'GZIP Compression', 'sg-cachepress' ),
371
- 'siteground_optimizer_enable_browser_caching' => __( 'Browser Caching', 'sg-cachepress' ),
372
- 'siteground_optimizer_optimize_html' => __( 'HTML Minification', 'sg-cachepress' ),
373
- 'siteground_optimizer_optimize_javascript' => __( 'JavaScript Minification', 'sg-cachepress' ),
374
- 'siteground_optimizer_optimize_javascript_async' => __( 'Defer Render-blocking JS', 'sg-cachepress' ),
375
- 'siteground_optimizer_optimize_css' => __( 'CSS Minification', 'sg-cachepress' ),
376
- 'siteground_optimizer_combine_css' => __( 'CSS Combination', 'sg-cachepress' ),
377
- 'siteground_optimizer_combine_javascript' => __( 'JavaScript Files Combination', 'sg-cachepress' ),
378
- 'siteground_optimizer_optimize_web_fonts' => __( 'Web Fonts Optimization', 'sg-cachepress' ),
379
- 'siteground_optimizer_remove_query_strings' => __( 'Query Strings Removal', 'sg-cachepress' ),
380
- 'siteground_optimizer_disable_emojis' => __( 'Emoji Removal Filter', 'sg-cachepress' ),
381
- 'siteground_optimizer_backup_media' => __( 'Backup Media', 'sg-cachepress' ),
382
- 'siteground_optimizer_resize_images' => __( 'Maximum Image Width', 'sg-cachepress' ),
383
- 'siteground_optimizer_lazyload_images' => __( 'Lazy Loading Images', 'sg-cachepress' ),
384
- 'siteground_optimizer_webp_support' => __( 'WebP Generation for New Images', 'sg-cachepress' ),
385
- 'siteground_optimizer_lazyload_gravatars' => __( 'Lazy Loading Gravatars', 'sg-cachepress' ),
386
- 'siteground_optimizer_lazyload_thumbnails' => __( 'Lazy Loading Thumbnails', 'sg-cachepress' ),
387
- 'siteground_optimizer_lazyload_responsive' => __( 'Lazy Loading Responsive Images', 'sg-cachepress' ),
388
- 'siteground_optimizer_lazyload_textwidgets' => __( 'Lazy Loading Widgets', 'sg-cachepress' ),
389
- 'siteground_optimizer_lazyload_mobile' => __( 'Lazy Load for Mobile', 'sg-cachepress' ),
390
- 'siteground_optimizer_lazyload_woocommerce' => __( 'Lazy Load for Product Images', 'sg-cachepress' ),
391
- 'siteground_optimizer_lazyload_shortcodes' => __( 'Fix for Lazy Loading Short Codes', 'sg-cachepress' ),
392
- 'siteground_optimizer_lazyload_videos' => __( 'Lazy Load Videos', 'sg-cachepress' ),
393
- 'siteground_optimizer_lazyload_iframes' => __( 'Lazy Load Iframes', 'sg-cachepress' ),
394
- 'siteground_optimizer_supercacher_permissions' => __( 'Can Config SuperCacher', 'sg-cachepress' ),
395
- 'siteground_optimizer_frontend_permissions' => __( 'Can Optimize Frontend', 'sg-cachepress' ),
396
- 'siteground_optimizer_images_permissions' => __( 'Can Optimize Images', 'sg-cachepress' ),
397
- 'siteground_optimizer_environment_permissions' => __( 'Can Optimize Environment', 'sg-cachepress' ),
398
- 'siteground_optimizer_heartbeat_control' => __( 'Heartbeat Optimization', 'sg-cachepress' ),
399
- 'siteground_optimizer_database_optimization' => __( 'Scheduled Database Maintenance', 'sg-cachepress' ),
400
- 'siteground_optimizer_dns_prefetch' => __( 'DNS Prefetching', 'sg-cachepress' ),
401
- 'siteground_optimizer_cloudflare_optimization_status' => __( 'Cloudflare Optimization', 'sg-cachepress' ),
402
- );
403
-
404
- // Get the option name. Fallback to `Option` if the option key doens't exists in predefined messages.
405
- $option = ! array_key_exists( $key, $messages ) ? __( 'Option', 'sg-cachepress' ) : $messages[ $key ];
406
-
407
- if ( true === $status ) {
408
- if ( true === $type ) {
409
- return sprintf( __( '%s Enabled', 'sg-cachepress' ), $option );
410
- }
411
-
412
- return sprintf( __( '%s Disabled', 'sg-cachepress' ), $option );
413
-
414
- }
415
-
416
- if ( true === $type ) {
417
- return sprintf( __( 'Could not enable %s', 'sg-cachepress' ), $option );
418
- }
419
-
420
- return sprintf( __( 'Could not disable %s', 'sg-cachepress' ), $option );
421
- }
422
-
423
  /**
424
  * Retrieves the possible options for the exclusion of media types from the lazy load logic.
425
  *
347
  return $post_types;
348
  }
349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
  /**
351
  * Retrieves the possible options for the exclusion of media types from the lazy load logic.
352
  *
core/Rest/Rest.php CHANGED
@@ -108,7 +108,7 @@ class Rest {
108
  * @return WP_Error|bool
109
  */
110
  public function check_permissions( $request ) {
111
- return current_user_can( 'activate_plugins' );
112
  }
113
 
114
  /**
108
  * @return WP_Error|bool
109
  */
110
  public function check_permissions( $request ) {
111
+ return current_user_can( 'manage_options' );
112
  }
113
 
114
  /**
core/Rest/Rest_Helper_Dashboard.php CHANGED
@@ -160,23 +160,51 @@ class Rest_Helper_Dashboard extends Rest_Helper {
160
  */
161
  public function ebook() {
162
 
 
 
163
  $data = array(
164
- 'image' => SiteGround_Optimizer\URL . '/assets/images/ebook.png',
165
- 'link' => 'https://www.siteground.com/wordpress-speed-optimization-ebook?utm_source=sitegroundoptimizer',
166
- 'title' => __( 'Free Ebook', 'sg-cachepress' ),
 
 
 
 
 
 
 
 
 
167
  );
168
 
169
- if ( ! file_exists( '/Z' ) ) {
 
 
 
 
170
  $data = array(
171
- 'image' => SiteGround_Optimizer\URL . '/assets/images/banner.png',
172
- 'link' => 'https://www.siteground.com/wordpress-hosting.htm?mktafcode=8df9fe65af8e6fd3d868748fb344b2ed',
173
- 'title' => __( 'Get Secure WordPress Hosting', 'sg-cachepress' ),
 
 
 
 
 
 
 
 
 
174
  );
175
  }
176
 
 
 
 
 
177
  self::send_json_success(
178
  '',
179
- $data
180
  );
181
  }
182
 
160
  */
161
  public function ebook() {
162
 
163
+ $locale = get_locale();
164
+
165
  $data = array(
166
+ 'it_IT' => array(
167
+ 'image' => SiteGround_Optimizer\URL . '/assets/images/ebook-it.png',
168
+ 'link' => 'https://it.siteground.com/ebook-wordpress?utm_medium=banner&utm_source=sgoptimizerplugin&utm_campaign=ebook_banner_sg_optimizer',
169
+ ),
170
+ 'es_ES' => array(
171
+ 'image' => SiteGround_Optimizer\URL . '/assets/images/ebook-es.png',
172
+ 'link' => 'https://www.siteground.es/ebook-wordpress?utm_medium=banner&utm_source=sgoptimizerplugin&utm_campaign=ebook_banner_sg_optimizer',
173
+ ),
174
+ 'default' => array(
175
+ 'image' => SiteGround_Optimizer\URL . '/assets/images/ebook.png',
176
+ 'link' => 'https://www.siteground.com/wordpress-speed-optimization-ebook?utm_source=sitegroundoptimizer',
177
+ ),
178
  );
179
 
180
+ $title = __( 'Free Ebook', 'sg-cachepress' );
181
+
182
+ if ( file_exists( '/Z' ) ) {
183
+ $title = __( 'Get Secure WordPress Hosting', 'sg-cachepress' );
184
+
185
  $data = array(
186
+ 'it_IT' => array(
187
+ 'image' => SiteGround_Optimizer\URL . '/assets/images/banner-it.png',
188
+ 'link' => 'https://it.siteground.com/hosting-wordpress?mktafcode=8df9fe65af8e6fd3d868748fb344b2ed',
189
+ ),
190
+ 'es_ES' => array(
191
+ 'image' => SiteGround_Optimizer\URL . '/assets/images/banner-es.png',
192
+ 'link' => 'https://www.siteground.es/wordpress-hosting.htm?mktafcode=8df9fe65af8e6fd3d868748fb344b2ed',
193
+ ),
194
+ 'default' => array(
195
+ 'image' => SiteGround_Optimizer\URL . '/assets/images/banner.png',
196
+ 'link' => 'https://www.siteground.com/wordpress-hosting.htm?mktafcode=8df9fe65af8e6fd3d868748fb344b2ed',
197
+ ),
198
  );
199
  }
200
 
201
+ $response = array_key_exists( $locale, $data ) ? $data[ $locale ] : $data['default'];
202
+
203
+ $response['title'] = $title;
204
+
205
  self::send_json_success(
206
  '',
207
+ $response
208
  );
209
  }
210
 
core/Rest/Rest_Helper_Options.php CHANGED
@@ -92,7 +92,7 @@ class Rest_Helper_Options extends Rest_Helper {
92
  array(
93
  'success' => $result,
94
  'data' => array(
95
- 'message' => $this->options->get_response_message( $result, $key, true ),
96
  ),
97
  )
98
  );
@@ -120,7 +120,7 @@ class Rest_Helper_Options extends Rest_Helper {
120
  array(
121
  'success' => $result,
122
  'data' => array(
123
- 'message' => $this->options->get_response_message( $result, $key, false ),
124
  ),
125
  )
126
  );
92
  array(
93
  'success' => $result,
94
  'data' => array(
95
+ 'message' => self::get_response_message( $result, str_replace( 'siteground_optimizer_default_', '', $key ), 1 ),
96
  ),
97
  )
98
  );
120
  array(
121
  'success' => $result,
122
  'data' => array(
123
+ 'message' => self::get_response_message( $result, str_replace( 'siteground_optimizer_default_', '', $key ), 0 ),
124
  ),
125
  )
126
  );
core/Supercacher/Supercacher_Comments.php CHANGED
@@ -31,7 +31,7 @@ class Supercacher_Comments {
31
  $this->update_queue(
32
  array(
33
  get_rest_url(),
34
- get_permalink( $commentdata->comment_post_ID ),
35
  )
36
  );
37
  }
31
  $this->update_queue(
32
  array(
33
  get_rest_url(),
34
+ get_permalink( intval( $commentdata->comment_post_ID ) ),
35
  )
36
  );
37
  }
core/Supercacher/Supercacher_Posts.php CHANGED
@@ -24,6 +24,15 @@ class Supercacher_Posts {
24
  'custom_css',
25
  // ttm-plugin plugin.
26
  'dn_wp_yt_log',
 
 
 
 
 
 
 
 
 
27
  );
28
 
29
  /**
24
  'custom_css',
25
  // ttm-plugin plugin.
26
  'dn_wp_yt_log',
27
+ // post-smtp plugin.
28
+ 'postman_sent_mail',
29
+ // Flamingo plugin.
30
+ 'flamingo_contact',
31
+ 'flamingo_inbound',
32
+ 'flamingo_outbound',
33
+ // Stop-spammers-premium plugin.
34
+ 'ssp-firewall',
35
+ 'pf_contact',
36
  );
37
 
38
  /**
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Hristo Sg, siteground, sstoqnov, stoyangeorgiev, elenachavdarova
3
  Tags: nginx, caching, speed, memcache, memcached, performance, siteground, nginx, supercacher
4
  Requires at least: 4.7
5
  Requires PHP: 7.0
6
- Tested up to: 5.8
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -66,6 +66,26 @@ You can modify the max image width setting using the filter we've designed for t
66
  return $max_allowed_width;
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  = SiteGround Optimizer Speed Test Page =
70
 
71
  Our performance check is powered by Google PageSpeed. Here you can check how well your website is optimized. The detailed test results will provide you with additional information on what can be optimized more.
@@ -186,43 +206,59 @@ You can exclude images from Lazy Load using the following filter:
186
 
187
  In version 5.0 we've added full WP-CLI support for all plugin options and functionalities.
188
 
189
- * `wp sg purge (url)` - purges the entire cache or if URL is passed
 
190
  * `wp sg memcached enable|disable` - enables or disables Memcached
 
 
 
 
 
 
191
  * `wp sg forcehttps enable|disable` - enables or disables HTTPS for your site
192
- * `wp sg optimize` - enables or disables different optimization options for your site:
193
- * `wp sg optimize html enable|disable` - enables or disables HTML minification
194
- * `wp sg optimize js enable|disable` - enables or disables JS minification
 
 
 
195
  * `wp sg optimize css enable|disable` - enables or disables CSS minification
196
  * `wp sg optimize combine-css enable|disable` - enables or disables CSS combination
 
 
197
  * `wp sg optimize combine-js enable|disable` - enables or disables JS combination
 
 
 
198
  * `wp sg optimize querystring enable|disable` - enables or disables query strings removal
199
  * `wp sg optimize emojis enable|disable` - enables or disables stripping of the Emoji scripts
200
- * `wp sg optimize images enable|disable` - enables or disables New image optimization
 
 
 
201
  * `wp sg optimize webp enable|disable` - enables or disables WebP image optimization
202
  * `wp sg optimize lazyload enable|disable` - enables or disables Lazy loading of images
203
- * `wp sg optimize browsercache enable|disable` - enables or disables Browser caching rules
204
- * `wp sg optimize dynamic-cache enable|disable` - enables or disables Dynamic caching rules
205
- * `wp sg optimize web-fonts enable|disable` - enables or disables Web Fonts Optimization
206
- * `wp sg optimize fix_insecure_content enable|disable` - enables or disables Insecure Content Fix
207
- * `wp sg optimize database-optimization enable|disable` - enables or disables the DB Optimization
208
- * `wp sg optimize dns-prefetch enable|disable add|remove|urls <value>` - enables or disables the DNS Prefetching, add, remove or list urls.
209
- * `wp sg optimize heartbeat-control enable|disable frontend|dashboard|post --frequency=<frequency>` enables or disables the Heartbeat control for a specific location and sets the frequency
210
  * `wp sg settings export` - exports the current plugin settings
211
  * `wp sg settings import --hash=<string>` - imports plugin settings and applies them
212
  * `wp sg status (optimization option)` - returns optimization current status (enabled|disabled)
213
 
214
- = Available WP-CLI optimization options =
215
 
216
- * dynamic-cache|autoflush-cache|mobile-cache|browser-caching
 
 
 
217
  * html|js|css
218
  * combine-css|combine-js
219
  * js-async
 
220
  * querystring
221
  * emojis
222
- * images|webp
223
- * memcache
224
- * ssl|ssl-fix
225
- * web-fonts
226
 
227
  = Requirements =
228
 
@@ -254,6 +290,21 @@ Our plugin uses a cookie in order to function properly. It does not store person
254
 
255
  == Changelog ==
256
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  = Version 6.0.3 =
258
  Release Date: November 8th, 2021
259
 
@@ -965,11 +1016,14 @@ Release Date: November 8th, 2021
965
  = 1.0 =
966
  * Plugin created.
967
 
 
 
 
968
  == Screenshots ==
969
 
970
  1. The SiteGround Optimizer Dashboard Page offers a quick look at the current optimization status of your website, along with shortcuts to the relevant optimization pages.
971
  2. The SiteGround Optimizer Caching Page handles your Dynamic caching and Memcached. Here, you can exclude URls from the cache, test your site and purge the Dynamic caching manually.
972
  3. The SiteGround Optimizer Environment Page, you can force HTTPS for your site, tweak the WordPress Heartbeat Optimization, pre-fetch external domains and enable the Database Maintenance.
973
  4. The SiteGround Optimizer Frontend Optimization Page allows you to Minify HTML, CSS & JS, as well as to remove query strings from your static resources and disable the Emoji support.
974
- 5. The SiteGround Optimizer Media Page allows you to optimize your Media Library images, aswell as adds Lazy Loading functionality for your site.
975
- 6. The SiteGround Optimizer Speed Test Page, allows you to test your site loading speed, aswell as additional tips on improving your site performance.
3
  Tags: nginx, caching, speed, memcache, memcached, performance, siteground, nginx, supercacher
4
  Requires at least: 4.7
5
  Requires PHP: 7.0
6
+ Tested up to: 5.9
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
66
  return $max_allowed_width;
67
  }
68
 
69
+ You can modify the default Webp quality setting using the filter we've designed for that purpose. The default setting is 80, you can use values between 0 and 100:
70
+
71
+ add_filter( 'sgo_webp_quality', 'webp_quality' );
72
+ function webp_quality( $quality ) {
73
+ // Add the value you want to adjust as Webp image quality.
74
+ $quality = 100;
75
+
76
+ return $quality;
77
+ }
78
+
79
+ You can modify the default Webp quality type setting using the filter we've designed for that purpose. The default quality type is lossy which equals to 0, if you want to set it to lossless - adjust the type to 1 as follows:
80
+
81
+ add_filter( 'sgo_webp_quality_type', 'reset_webp_quality_type' );
82
+ function reset_webp_quality_type( $quality_type ) {
83
+ // Add the value you want to adjust as max image width.
84
+ $quality_type = 1;
85
+
86
+ return $quality_type;
87
+ }
88
+
89
  = SiteGround Optimizer Speed Test Page =
90
 
91
  Our performance check is powered by Google PageSpeed. Here you can check how well your website is optimized. The detailed test results will provide you with additional information on what can be optimized more.
206
 
207
  In version 5.0 we've added full WP-CLI support for all plugin options and functionalities.
208
 
209
+ Caching:
210
+ * `wp sg optimize dynamic-cache enable|disable` - enables or disables Dynamic caching rules
211
  * `wp sg memcached enable|disable` - enables or disables Memcached
212
+ * `wp sg optimize autoflush-cache enable|disable` - enables or disables Automatic Purge cache option
213
+ * `wp sg optimize purge-rest-cache enable|disable` - enables or disables Automatic Purge for WordPress API cache
214
+ * `wp sg purge (url)` - purges the entire cache or if URL is passed
215
+ * `wp sg optimize mobile-cache enable|disable` - enables or disables Browser caching rules
216
+
217
+ Environment:
218
  * `wp sg forcehttps enable|disable` - enables or disables HTTPS for your site
219
+ * `wp sg optimize fix-insecure-content enable|disable` - enables or disables Insecure Content Fix
220
+ * `wp sg heartbeat frontend|dashboard|post --frequency=<frequency>` - Adjust Heartbeat control frequency for a specific location
221
+ * `wp sg dns-prefetch add|remove|urls <value>` - add, remove or list urls in the DNS Prefetch list.
222
+ * `wp sg optimize database-optimization enable|disable` - enables or disables the DB Optimization
223
+
224
+ Frontend:
225
  * `wp sg optimize css enable|disable` - enables or disables CSS minification
226
  * `wp sg optimize combine-css enable|disable` - enables or disables CSS combination
227
+ * `wp sg optimize preload-combined-css enable|disable` - enables or disables Preload Combined CSS
228
+ * `wp sg optimize js enable|disable` - enables or disables JS minification
229
  * `wp sg optimize combine-js enable|disable` - enables or disables JS combination
230
+ * `wp sg optimize js-async enable|disable` - enables or disables Defer Render-blocking JavaScript option
231
+ * `wp sg optimize html enable|disable` - enables or disables HTML minification
232
+ * `wp sg optimize web-fonts enable|disable` - enables or disables Web Fonts Optimization
233
  * `wp sg optimize querystring enable|disable` - enables or disables query strings removal
234
  * `wp sg optimize emojis enable|disable` - enables or disables stripping of the Emoji scripts
235
+
236
+ Media:
237
+ * `wp sg images --compression-level=<int>` - adjusts images optimization compression level - <value> should be set as follows: 0 for Disabled, 1 for Low(25%), 2 for Medium(60%), 3 for High(85%)
238
+ * `wp sg optimize backup-media enable|disable` - enables or disables Backup Media option
239
  * `wp sg optimize webp enable|disable` - enables or disables WebP image optimization
240
  * `wp sg optimize lazyload enable|disable` - enables or disables Lazy loading of images
241
+ * `wp sg optimize resize-images enable|disable` - enables or disables Maximum Image Width optimization
242
+
243
+ Others:
 
 
 
 
244
  * `wp sg settings export` - exports the current plugin settings
245
  * `wp sg settings import --hash=<string>` - imports plugin settings and applies them
246
  * `wp sg status (optimization option)` - returns optimization current status (enabled|disabled)
247
 
248
+ = Available wp sg status options =
249
 
250
+ * dynamic-cache|autoflush|browser-caching
251
+ * memcache
252
+ * ssl|ssl-fix
253
+ * database-optimization
254
  * html|js|css
255
  * combine-css|combine-js
256
  * js-async
257
+ * google-fonts
258
  * querystring
259
  * emojis
260
+ * webp
261
+ * lazyload-images
 
 
262
 
263
  = Requirements =
264
 
290
 
291
  == Changelog ==
292
 
293
+
294
+ = Version 6.0.5 =
295
+ Release Date: November 17th, 2021
296
+
297
+ * Improved HTML minification
298
+
299
+ = Version 6.0.4 =
300
+ Release Date: November 16th, 2021
301
+
302
+ * Improved HTML minification
303
+ * Improved HTTPS Enfore for multisites
304
+ * Improved Google PageSpeed Integration
305
+ * Improved multisite permissions for admins
306
+ * Improved autoflush
307
+
308
  = Version 6.0.3 =
309
  Release Date: November 8th, 2021
310
 
1016
  = 1.0 =
1017
  * Plugin created.
1018
 
1019
+ == Credits ==
1020
+ Photo credits to Anna Shvets https://www.pexels.com/@shvetsa
1021
+
1022
  == Screenshots ==
1023
 
1024
  1. The SiteGround Optimizer Dashboard Page offers a quick look at the current optimization status of your website, along with shortcuts to the relevant optimization pages.
1025
  2. The SiteGround Optimizer Caching Page handles your Dynamic caching and Memcached. Here, you can exclude URls from the cache, test your site and purge the Dynamic caching manually.
1026
  3. The SiteGround Optimizer Environment Page, you can force HTTPS for your site, tweak the WordPress Heartbeat Optimization, pre-fetch external domains and enable the Database Maintenance.
1027
  4. The SiteGround Optimizer Frontend Optimization Page allows you to Minify HTML, CSS & JS, as well as to remove query strings from your static resources and disable the Emoji support.
1028
+ 5. The SiteGround Optimizer Media Page allows you to optimize your Media Library images, as well as adds Lazy Loading functionality for your site.
1029
+ 6. The SiteGround Optimizer Speed Test Page, allows you to test your site loading speed, as well as additional tips on improving your site performance.
sg-cachepress.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: SiteGround 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: 6.0.3
14
  * Author: SiteGround
15
  * Author URI: https://www.siteground.com
16
  * Text Domain: sg-cachepress
@@ -32,7 +32,7 @@ if ( ! defined( 'WPINC' ) ) {
32
 
33
  // Define version constant.
34
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
35
- define( __NAMESPACE__ . '\VERSION', '6.0.3' );
36
  }
37
 
38
  // Define slug constant.
10
  * Plugin Name: SiteGround 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: 6.0.5
14
  * Author: SiteGround
15
  * Author URI: https://www.siteground.com
16
  * Text Domain: sg-cachepress
32
 
33
  // Define version constant.
34
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
35
+ define( __NAMESPACE__ . '\VERSION', '6.0.5' );
36
  }
37
 
38
  // Define slug constant.