SG Optimizer - Version 7.1.1

Version Description

Download this release

Release Info

Developer stoyangeorgiev
Plugin Icon 128x128 SG Optimizer
Version 7.1.1
Comparing to
See all releases

Code changes from version 7.0.9 to 7.1.1

Files changed (37) hide show
  1. core/Admin/Admin.php +9 -2
  2. core/Campaign_Service/Campaign_Service.php +227 -0
  3. core/Combinator/Css_Combinator.php +1 -1
  4. core/Combinator/Js_Combinator.php +17 -0
  5. core/Database_Optimizer/Database_Optimizer.php +17 -0
  6. core/Front_End_Optimization/Front_End_Optimization.php +18 -0
  7. core/Helper/File_Cacher_Trait.php +5 -6
  8. core/Helper/Helper.php +29 -0
  9. core/Install_Service/Install_6_0_0.php +8 -0
  10. core/Install_Service/Install_7_1_0.php +34 -0
  11. core/Install_Service/Install_Service.php +2 -0
  12. core/Loader/Loader.php +32 -0
  13. core/Minifier/Minifier.php +10 -0
  14. core/Ssl/Ssl.php +14 -2
  15. core/Supercacher/Supercacher.php +5 -0
  16. core/Supercacher/Supercacher_Posts.php +10 -0
  17. readme.txt +68 -2
  18. sg-cachepress.php +2 -2
  19. templates/campaigns/campaign-template.php +151 -0
  20. vendor/autoload.php +1 -1
  21. vendor/composer/autoload_psr4.php +1 -0
  22. vendor/composer/autoload_real.php +7 -7
  23. vendor/composer/autoload_static.php +10 -5
  24. vendor/composer/installed.json +28 -16
  25. vendor/composer/installed.php +16 -5
  26. vendor/matthiasmullie/minify/.github/FUNDING.yml +1 -1
  27. vendor/matthiasmullie/minify/.github/workflows/test.yml +37 -0
  28. vendor/matthiasmullie/minify/Dockerfile +1 -0
  29. vendor/matthiasmullie/minify/docker-compose.yml +6 -0
  30. vendor/matthiasmullie/minify/src/CSS.php +5 -1
  31. vendor/matthiasmullie/minify/src/JS.php +34 -7
  32. vendor/matthiasmullie/minify/src/Minify.php +35 -39
  33. vendor/siteground/siteground-emails/composer.json +9 -0
  34. vendor/siteground/siteground-emails/composer.lock +18 -0
  35. vendor/siteground/siteground-emails/readme.md +49 -0
  36. vendor/siteground/siteground-emails/src/Email_Service.php +215 -0
  37. vendor/siteground/siteground-helper/src/Helper_Service.php +1 -19
core/Admin/Admin.php CHANGED
@@ -37,6 +37,11 @@ class Admin {
37
  'sgo_environment' => 'siteground_optimizer_environment_permissions',
38
  );
39
 
 
 
 
 
 
40
  /**
41
  * Get the subpages id.
42
  *
@@ -113,8 +118,10 @@ class Admin {
113
  return;
114
  }
115
 
116
- // Removing conflicting fonts.
117
- wp_dequeue_style( 'auxin-front-icon' );
 
 
118
 
119
  wp_enqueue_style(
120
  'siteground-optimizer-admin',
37
  'sgo_environment' => 'siteground_optimizer_environment_permissions',
38
  );
39
 
40
+ public $dequeued_styles = array(
41
+ 'auxin-front-icon', // Phlox Theme.
42
+ 'mks_shortcodes_simple_line_icons' // Meks Flexible Shortcodes.
43
+ );
44
+
45
  /**
46
  * Get the subpages id.
47
  *
118
  return;
119
  }
120
 
121
+ // Dequeue conflicting styles.
122
+ foreach ( $this->dequeued_styles as $style ) {
123
+ wp_dequeue_style( $style );
124
+ }
125
 
126
  wp_enqueue_style(
127
  'siteground-optimizer-admin',
core/Campaign_Service/Campaign_Service.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace SiteGround_Optimizer\Campaign_Service;
4
+
5
+ use SiteGround_Helper\Helper_Service;
6
+ use SiteGround_Emails\Email_Service;
7
+
8
+ /**
9
+ * Email Campaign class.
10
+ */
11
+ class Campaign_Service {
12
+
13
+ /**
14
+ * The campaign steps count.
15
+ *
16
+ * @var int
17
+ */
18
+ public $campaign_steps;
19
+
20
+ /**
21
+ * The Constructor.
22
+ *
23
+ * @since 7.1.0
24
+ */
25
+ public function __construct() {
26
+ // Get the number of campaign steps we've made.
27
+ $this->campaign_steps = (int) get_option( 'siteground_optimizer_campaign_steps', 0 );
28
+ // Prepare the email service.
29
+ $this->prepare_email_service();
30
+ }
31
+
32
+ /**
33
+ * Prepare the email service helper.
34
+ *
35
+ * @since 7.1.0
36
+ */
37
+ public function prepare_email_service() {
38
+ // Modify the next run based on campaign step.
39
+ $next_run = 0 === $this->campaign_steps ? strtotime( '+1 day' ) : strtotime( '+1 week' );
40
+
41
+ // Initiate the Email Service Class.
42
+ $this->campaign_service_email = new Email_Service(
43
+ 'sgo_campaign_cron',
44
+ 'weekly',
45
+ $next_run,
46
+ array(
47
+ 'recipients_option' => 'admin_email',
48
+ 'subject' => array( '\SiteGround_Optimizer\Campaign_Service\Campaign_Service', 'get_email_subject' ),
49
+ 'body_method' => array( '\SiteGround_Optimizer\Campaign_Service\Campaign_Service', 'generate_message_body' ),
50
+ 'from_name' => 'SiteGround Optimizer',
51
+ )
52
+ );
53
+ }
54
+
55
+ /**
56
+ * Make a request to the remote server in order to fetch the correct email subject.
57
+ *
58
+ * @since 7.1.0
59
+ *
60
+ * @return string The email subject.
61
+ */
62
+ static function get_email_subject() {
63
+ // The campaign steps.
64
+ $campaign_steps = (int) get_option( 'siteground_optimizer_campaign_steps', 0 );
65
+
66
+ // Bail if we reached the campaign limit.
67
+ if ( 2 < $campaign_steps ) {
68
+ return;
69
+ }
70
+
71
+ // Get the campaign content.
72
+ $response = wp_remote_get( 'https://sgwpdemo.com/jsons/campaigns/sg-cachepress-subject.json' );
73
+
74
+ // Bail if the request fails.
75
+ if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
76
+ return 'SiteGround Optimizer';
77
+ }
78
+
79
+ // Get the body of the response.
80
+ $body = wp_remote_retrieve_body( $response );
81
+
82
+ // Decode the json response.
83
+ $json_args = json_decode( $body, true );
84
+
85
+ // Get the locale.
86
+ $locale = get_locale();
87
+
88
+ // Set the proper args.
89
+ return array_key_exists( $locale, $json_args[ $campaign_steps ] ) ? $json_args[ $campaign_steps ][ $locale ] : $json_args[ $campaign_steps ]['default'];
90
+ }
91
+
92
+ /**
93
+ * Bump the number of emails we've sent.
94
+ *
95
+ * @since 7.1.0
96
+ */
97
+ public function bump_campaign_count() {
98
+ update_option( 'siteground_optimizer_campaign_steps', $this->campaign_steps + 1 );
99
+ }
100
+
101
+ /**
102
+ * Checks for starting the email campaign.
103
+ *
104
+ * @since 7.1.0
105
+ *
106
+ * @return bool true/false if we should send emails.
107
+ */
108
+ public function maybe_send_emails() {
109
+ // Check if it is a non SiteGround user.
110
+ if ( 1 === Helper_Service::is_siteground() ) {
111
+ return false;
112
+ }
113
+
114
+ // Check if user has given email consent.
115
+ if ( 0 === (int) get_option( 'siteground_email_consent', 0 ) ) {
116
+ return false;
117
+ }
118
+
119
+ // Check if we are sending notifications emails via SiteGround Security.
120
+ if ( wp_next_scheduled( 'sgs_email_cron' ) ) {
121
+ return false;
122
+ }
123
+
124
+ // Check if we meet the required time period for sending emails.
125
+ if ( $this->maybe_has_promo_emails() ) {
126
+ return false;
127
+ }
128
+
129
+ // Check if we can get the users admin email.
130
+ if ( empty( get_option( 'admin_email', array() ) ) ) {
131
+ return false;
132
+ }
133
+
134
+ // Check if we completed the campaign.
135
+ if ( 2 < (int) $this->campaign_steps ) {
136
+ return false;
137
+ }
138
+
139
+ return true;
140
+ }
141
+
142
+ /**
143
+ * Calculate the period from last promo email from SG Security and check if we meet the required times.
144
+ *
145
+ * @since 7.1.0
146
+ *
147
+ * @return bool true/false.
148
+ */
149
+ public function maybe_has_promo_emails() {
150
+ // Get the timestamp of the last security email.
151
+ $sg_security_last_mail = (int) get_option( 'sg_security_weekly_email_timestamp', 0 );
152
+
153
+ // Bail if we do not have a timestamp.
154
+ if ( 0 === $sg_security_last_mail ) {
155
+ return false;
156
+ }
157
+
158
+ // Bail if the period of 14 days is less than the last email we've sent.
159
+ if ( ( 2 * WEEK_IN_SECONDS ) < ( strtotime( 'now' ) - $sg_security_last_mail ) ) {
160
+ return false;
161
+ }
162
+
163
+ return true;
164
+ }
165
+
166
+ /**
167
+ * Update the timestamp when the cron event was last ran.
168
+ *
169
+ * @since 7.1.0
170
+ */
171
+ public function update_last_cron_run_timestamp() {
172
+ update_option( 'sgo_campaign_cron_timestamp', time() );
173
+ }
174
+
175
+ /**
176
+ * Generate the message body and return it to the constructor.
177
+ *
178
+ * @since 7.1.0
179
+ *
180
+ * @return mixed false on failure, HTML of the message body on success.
181
+ */
182
+ static function generate_message_body() {
183
+ // SG Settings page.
184
+ $settings_page = admin_url( 'options-general.php?page=siteground_settings' );
185
+
186
+ // The campaign steps.
187
+ $campaign_steps = (int) get_option( 'siteground_optimizer_campaign_steps', 0 );
188
+
189
+ // Get the campaign content.
190
+ $response = wp_remote_get( 'https://sgwpdemo.com/jsons/campaigns/sg-cachepress-body.json' );
191
+
192
+ // Bail if the request fails.
193
+ if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
194
+ return false;
195
+ }
196
+
197
+ // Get the body of the response.
198
+ $body = wp_remote_retrieve_body( $response );
199
+
200
+ // Decode the json response.
201
+ $json_args = json_decode( $body, true );
202
+
203
+ // Get the locale.
204
+ $locale = get_locale();
205
+
206
+ // Set the proper args.
207
+ $args = array_key_exists( $locale, $json_args[ $campaign_steps ] ) ? $json_args[ $campaign_steps ][ $locale ] : $json_args[ $campaign_steps ]['default'];
208
+
209
+ // Add any additional arguments.
210
+ $args['unsubscribe_link'] = $settings_page;
211
+
212
+ // Start the output biffering.
213
+ ob_start();
214
+
215
+ // Include the template file.
216
+ include \SiteGround_Optimizer\DIR . '/templates/campaigns/campaign-template.php';
217
+
218
+ // Pass the contents of the output buffer to a variable.
219
+ $message_body = ob_get_contents();
220
+
221
+ // Clean the output buffer and end the buffering.
222
+ ob_end_clean();
223
+
224
+ // Return the message body content as a string.
225
+ return $message_body;
226
+ }
227
+ }
core/Combinator/Css_Combinator.php CHANGED
@@ -326,7 +326,7 @@ class Css_Combinator extends Abstract_Combinator {
326
  // Get the file dir.
327
  $dir = trailingslashit( dirname( $url ) );
328
  // Check for imports in the style.
329
- preg_match_all( '/@import\s+["\'](.+?)["\']/i', $content, $matches );
330
 
331
  // Return the content if there are no matches.
332
  if ( empty( $matches ) ) {
326
  // Get the file dir.
327
  $dir = trailingslashit( dirname( $url ) );
328
  // Check for imports in the style.
329
+ preg_match_all( '/@import\s+["\'](.+?)["\'];?/i', $content, $matches );
330
 
331
  // Return the content if there are no matches.
332
  if ( empty( $matches ) ) {
core/Combinator/Js_Combinator.php CHANGED
@@ -4,6 +4,7 @@ namespace SiteGround_Optimizer\Combinator;
4
  use SiteGround_Optimizer\Options\Options;
5
  use SiteGround_Optimizer\Front_End_Optimization\Front_End_Optimization;
6
  use SiteGround_Helper\Helper_Service;
 
7
 
8
  /**
9
  * SG JS_Combinator main plugin class
@@ -502,6 +503,17 @@ class Js_Combinator extends Abstract_Combinator {
502
  'wp-hooks',
503
  );
504
 
 
 
 
 
 
 
 
 
 
 
 
505
  /**
506
  * The singleton instance.
507
  *
@@ -611,6 +623,11 @@ class Js_Combinator extends Abstract_Combinator {
611
  $registered = array_keys( $wp_scripts->registered );
612
  $excluded = array();
613
 
 
 
 
 
 
614
  // Loop through all excluded handles and get their src.
615
  foreach ( $excluded_handles as $handle ) {
616
  // Bail if handle is now found.
4
  use SiteGround_Optimizer\Options\Options;
5
  use SiteGround_Optimizer\Front_End_Optimization\Front_End_Optimization;
6
  use SiteGround_Helper\Helper_Service;
7
+ use SiteGround_Optimizer\Helper\Helper;
8
 
9
  /**
10
  * SG JS_Combinator main plugin class
503
  'wp-hooks',
504
  );
505
 
506
+ /**
507
+ * Array containing all script handle regex' that should be excluded.
508
+ *
509
+ * @since 7.1.0
510
+ *
511
+ * @var array Array containing all script handle regex' that should be excluded.
512
+ */
513
+ private $combined_scripts_exclude_regex = array(
514
+ 'sv-wc-payment-gateway-payment-form-', // Authorize.NET payment gateway payment form script.
515
+ );
516
+
517
  /**
518
  * The singleton instance.
519
  *
623
  $registered = array_keys( $wp_scripts->registered );
624
  $excluded = array();
625
 
626
+ // Remove excluded script handles using regex.
627
+ foreach( $this->combined_scripts_exclude_regex as $regex ) {
628
+ $excluded_handles = array_merge( $excluded_handles, Helper::get_script_handle_regex( $regex, $registered ) );
629
+ }
630
+
631
  // Loop through all excluded handles and get their src.
632
  foreach ( $excluded_handles as $handle ) {
633
  // Bail if handle is now found.
core/Database_Optimizer/Database_Optimizer.php CHANGED
@@ -197,8 +197,25 @@ class Database_Optimizer {
197
  return;
198
  }
199
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  // Loop trough and optimize table.
201
  foreach ( $tables as $table ) {
 
 
 
 
 
202
  $this->wpdb->query( "OPTIMIZE TABLE $table->table_name" );
203
  }
204
  }
197
  return;
198
  }
199
 
200
+ // Add filter to skip specific tables from being optimized.
201
+ $excluded_tables = apply_filters( 'sgo_db_optimization_exclude', array() );
202
+
203
+ // Add prefixes to all tables.
204
+ $prefix_tables = preg_filter( '/^/', $this->wpdb->prefix, $excluded_tables );
205
+
206
+ // Get the tables without prefix.
207
+ $diffs = array_diff( $excluded_tables, $prefix_tables );
208
+
209
+ // Merge user input and prefixed tables if custom tables are skipped.
210
+ $all_tables = array_merge( $diffs, $prefix_tables );
211
+
212
  // Loop trough and optimize table.
213
  foreach ( $tables as $table ) {
214
+ // Check if we need to skip that specific table from the optimization.
215
+ if ( in_array( $table->table_name, $all_tables ) ) {
216
+ continue;
217
+ }
218
+
219
  $this->wpdb->query( "OPTIMIZE TABLE $table->table_name" );
220
  }
221
  }
core/Front_End_Optimization/Front_End_Optimization.php CHANGED
@@ -4,6 +4,7 @@ namespace SiteGround_Optimizer\Front_End_Optimization;
4
  use SiteGround_Optimizer\Supercacher\Supercacher;
5
  use SiteGround_Optimizer\File_Cacher\File_Cacher;
6
  use SiteGround_Helper\Helper_Service;
 
7
 
8
  /**
9
  * SG Front_End_Optimization main plugin class
@@ -56,6 +57,18 @@ class Front_End_Optimization {
56
  'wpascript',
57
  );
58
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  /**
60
  * The singleton instance.
61
  *
@@ -204,6 +217,11 @@ class Front_End_Optimization {
204
 
205
  $excluded_scripts = apply_filters( 'sgo_js_async_exclude', $this->blacklisted_async_scripts );
206
 
 
 
 
 
 
207
  // Get groups of handles.
208
  foreach ( $scripts->to_do as $handle ) {
209
  // We don't want to load footer scripts asynchronous.
4
  use SiteGround_Optimizer\Supercacher\Supercacher;
5
  use SiteGround_Optimizer\File_Cacher\File_Cacher;
6
  use SiteGround_Helper\Helper_Service;
7
+ use SiteGround_Optimizer\Helper\Helper;
8
 
9
  /**
10
  * SG Front_End_Optimization main plugin class
57
  'wpascript',
58
  );
59
 
60
+ /**
61
+ * Array containing all script handle regex' that should be excluded.
62
+ *
63
+ * @since 7.1.0
64
+ *
65
+ * @var array Array containing all script handle regex' that should be excluded.
66
+ */
67
+ private $blacklisted_async_regex = array(
68
+ 'sv-wc-payment-gateway-payment-form-v', // Authorize.NET payment gateway payment form script.
69
+ );
70
+
71
+
72
  /**
73
  * The singleton instance.
74
  *
217
 
218
  $excluded_scripts = apply_filters( 'sgo_js_async_exclude', $this->blacklisted_async_scripts );
219
 
220
+ // Remove excluded script handles using regex.
221
+ foreach( $this->blacklisted_async_regex as $regex ) {
222
+ $excluded_scripts = array_merge( $excluded_scripts, Helper::get_script_handle_regex( $regex, $scripts->to_do ) );
223
+ }
224
+
225
  // Get groups of handles.
226
  foreach ( $scripts->to_do as $handle ) {
227
  // We don't want to load footer scripts asynchronous.
core/Helper/File_Cacher_Trait.php CHANGED
@@ -41,12 +41,11 @@ trait File_Cacher_Trait {
41
  $this->bypass_cookies = array_diff( $this->bypass_cookies, array( 'wordpress_logged_in_' ) );
42
  }
43
 
44
-
45
  if ( $this->has_bypass_cookies() ) {
46
  return false;
47
  }
48
 
49
- if ( $this->has_ignore_query_params() ) {
50
  return false;
51
  }
52
 
@@ -60,11 +59,11 @@ trait File_Cacher_Trait {
60
  *
61
  * @return boolean True/False.
62
  */
63
- public function has_ignore_query_params() {
64
- // Iterate through the query array and unset the unneeded params.
65
  foreach ( $_GET as $param => $value ) {
66
- if ( ! in_array( $param, $this->bypass_query_params, true ) ) {
67
- true;
68
  }
69
  }
70
 
41
  $this->bypass_cookies = array_diff( $this->bypass_cookies, array( 'wordpress_logged_in_' ) );
42
  }
43
 
 
44
  if ( $this->has_bypass_cookies() ) {
45
  return false;
46
  }
47
 
48
+ if ( $this->has_skip_cache_query_params() ) {
49
  return false;
50
  }
51
 
59
  *
60
  * @return boolean True/False.
61
  */
62
+ public function has_skip_cache_query_params() {
63
+ // Iterate through the query array and check for skip cache params.
64
  foreach ( $_GET as $param => $value ) {
65
+ if ( in_array( $param, $this->bypass_query_params, true ) ) {
66
+ return true;
67
  }
68
  }
69
 
core/Helper/Helper.php CHANGED
@@ -187,4 +187,33 @@ class Helper {
187
 
188
  return preg_match( '/<\?xml version="/', $xml_part );
189
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  }
187
 
188
  return preg_match( '/<\?xml version="/', $xml_part );
189
  }
190
+
191
+
192
+ /**
193
+ * Get script handle by substring
194
+ *
195
+ * @since 7.1.0
196
+ *
197
+ * @param string $regex Substring that is searched for.
198
+ * @param array $scripts Array of strings, containing all script handles.
199
+ *
200
+ * @return array $matched_handles Array with all matching handles.
201
+ */
202
+ public static function get_script_handle_regex( $regex, $scripts ) {
203
+ // Bail if regex or scripts are empty.
204
+ if ( empty( $regex ) || empty( $scripts ) ) {
205
+ return array();
206
+ }
207
+
208
+ $matched_handles = array();
209
+
210
+ // Go through all scripts and check for substring in each item.
211
+ foreach ( $scripts as $handle ) {
212
+ if ( false !== strpos( $handle, $regex ) ) {
213
+ $matched_handles[] = $handle;
214
+ }
215
+ }
216
+
217
+ return $matched_handles;
218
+ }
219
  }
core/Install_Service/Install_6_0_0.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  namespace SiteGround_Optimizer\Install_Service;
3
 
 
 
4
  class Install_6_0_0 extends Install {
5
 
6
  /**
@@ -59,6 +61,12 @@ class Install_6_0_0 extends Install {
59
  foreach ( $this->legacy_options as $option ) {
60
  delete_option( $this->prefix . $option );
61
  }
 
 
 
 
 
 
62
  }
63
 
64
  /**
1
  <?php
2
  namespace SiteGround_Optimizer\Install_Service;
3
 
4
+ use SiteGround_Helper\Helper_Service;
5
+
6
  class Install_6_0_0 extends Install {
7
 
8
  /**
61
  foreach ( $this->legacy_options as $option ) {
62
  delete_option( $this->prefix . $option );
63
  }
64
+
65
+ // Automatically enable Dynamic Cache for SiteGround users.
66
+ if ( Helper_Service::is_siteground() ) {
67
+ update_option( 'siteground_optimizer_enable_cache', 1 );
68
+ update_option( 'siteground_optimizer_autoflush_cache', 1 );
69
+ }
70
  }
71
 
72
  /**
core/Install_Service/Install_7_1_0.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SiteGround_Optimizer\Install_Service;
3
+
4
+ use SiteGround_Helper\Helper_Service;
5
+
6
+ class Install_7_1_0 extends Install {
7
+
8
+ /**
9
+ * The default install version. Overridden by the installation packages.
10
+ *
11
+ * @since 7.1.0
12
+ *
13
+ * @access protected
14
+ *
15
+ * @var string $version The install version.
16
+ */
17
+ protected static $version = '7.1.0';
18
+
19
+ /**
20
+ * Run the install procedure.
21
+ *
22
+ * @since 7.1.0
23
+ */
24
+ public function install() {
25
+ // Check user status.
26
+ if (
27
+ ! Helper_Service::is_siteground() &&
28
+ false === get_option( 'siteground_settings_optimizer', false ) &&
29
+ false === get_option( 'siteground_settings_optimizer_hello', false )
30
+ ) {
31
+ update_option( 'siteground_settings_optimizer_hello', 1 );
32
+ }
33
+ }
34
+ }
core/Install_Service/Install_Service.php CHANGED
@@ -32,6 +32,7 @@ use SiteGround_Optimizer\Install_Service\Install_5_9_2;
32
  use SiteGround_Optimizer\Install_Service\Install_6_0_0;
33
  use SiteGround_Optimizer\Install_Service\Install_6_0_2;
34
  use SiteGround_Optimizer\Install_Service\Install_6_0_3;
 
35
  use SiteGround_Optimizer\Install_Service\Install_Cleanup;
36
  use SiteGround_Optimizer\Supercacher\Supercacher;
37
 
@@ -75,6 +76,7 @@ class Install_Service {
75
  new Install_6_0_0(),
76
  new Install_6_0_2(),
77
  new Install_6_0_3(),
 
78
  );
79
  }
80
 
32
  use SiteGround_Optimizer\Install_Service\Install_6_0_0;
33
  use SiteGround_Optimizer\Install_Service\Install_6_0_2;
34
  use SiteGround_Optimizer\Install_Service\Install_6_0_3;
35
+ use SiteGround_Optimizer\Install_Service\Install_7_1_0;
36
  use SiteGround_Optimizer\Install_Service\Install_Cleanup;
37
  use SiteGround_Optimizer\Supercacher\Supercacher;
38
 
76
  new Install_6_0_0(),
77
  new Install_6_0_2(),
78
  new Install_6_0_3(),
79
+ new Install_7_1_0(),
80
  );
81
  }
82
 
core/Loader/Loader.php CHANGED
@@ -45,6 +45,7 @@ class Loader {
45
  'supercacher_helper' => 'supercacher',
46
  'file_cacher' => 'file_cacher',
47
  'ssl' => 'ssl',
 
48
  ),
49
  );
50
 
@@ -685,4 +686,35 @@ class Loader {
685
  add_action( 'wp_login', array( $this->ssl, 'maybe_switch_option' ), 1 );
686
  }
687
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
688
  }
45
  'supercacher_helper' => 'supercacher',
46
  'file_cacher' => 'file_cacher',
47
  'ssl' => 'ssl',
48
+ 'campaign_service' => 'campaign_service',
49
  ),
50
  );
51
 
686
  add_action( 'wp_login', array( $this->ssl, 'maybe_switch_option' ), 1 );
687
  }
688
  }
689
+
690
+ /**
691
+ * Add the campaign service hooks.
692
+ *
693
+ * @since 7.1.0
694
+ */
695
+ public function add_campaign_service_hooks() {
696
+ // Check if we need to start the campaign check.
697
+ if ( false === get_option( 'siteground_settings_optimizer_hello', false ) ) {
698
+ return;
699
+ }
700
+
701
+ // Check if we are suposed to send emails.
702
+ if ( $this->campaign_service->maybe_send_emails() ) {
703
+ // Check if we need to schedule the cron.
704
+ if ( ! wp_next_scheduled( 'sgo_campaign_cron' ) ) {
705
+ $this->campaign_service->campaign_service_email->schedule_event();
706
+ }
707
+ } else {
708
+ $this->campaign_service->campaign_service_email->unschedule_event();
709
+ }
710
+
711
+ // Update the campaing last timestamp before the mail is sent.
712
+ add_action( 'sgo_campaign_cron', array( $this->campaign_service, 'update_last_cron_run_timestamp' ), 1 );
713
+
714
+ // Sent the campaign email.
715
+ add_action( 'sgo_campaign_cron', array( $this->campaign_service->campaign_service_email, 'sg_handle_email' ) );
716
+
717
+ // Bump the campaign step counters after the mail is sent.
718
+ add_action( 'sgo_campaign_cron', array( $this->campaign_service, 'bump_campaign_count' ), PHP_INT_MAX );
719
+ }
720
  }
core/Minifier/Minifier.php CHANGED
@@ -161,6 +161,11 @@ class Minifier {
161
  // Build the minified version filename.
162
  $filename = $this->assets_dir . $wp_scripts->registered[ $handle ]->handle . '.min.js';
163
 
 
 
 
 
 
164
  // Check for original file modifications and create the minified copy.
165
  $is_minified_file_ok = $this->check_and_create_file( $filename, $original_filepath );
166
 
@@ -312,6 +317,11 @@ class Minifier {
312
  // Build the minified version filename.
313
  $filename = dirname( $original_filepath ) . '/' . $wp_styles->registered[ $handle ]->handle . '.min.css';
314
 
 
 
 
 
 
315
  if ( ! empty( $parsed_url['query'] ) ) {
316
  $filename = $filename . '?' . $parsed_url['query'];
317
  }
161
  // Build the minified version filename.
162
  $filename = $this->assets_dir . $wp_scripts->registered[ $handle ]->handle . '.min.js';
163
 
164
+ // Check if the handle of the script has forward slashes in it, if so - replace them with dashes.
165
+ if ( false !== strpos( $wp_scripts->registered[ $handle ]->handle, '/' ) ) {
166
+ $filename = dirname( $original_filepath ) . '/' . str_replace( '/', '-', $wp_scripts->registered[ $handle ]->handle ) . '.min.css';
167
+ }
168
+
169
  // Check for original file modifications and create the minified copy.
170
  $is_minified_file_ok = $this->check_and_create_file( $filename, $original_filepath );
171
 
317
  // Build the minified version filename.
318
  $filename = dirname( $original_filepath ) . '/' . $wp_styles->registered[ $handle ]->handle . '.min.css';
319
 
320
+ // Check if the handle of the style has forward slashes in it, if so - replace them with dashes.
321
+ if ( false !== strpos( $wp_styles->registered[ $handle ]->handle, '/' ) ) {
322
+ $filename = dirname( $original_filepath ) . '/' . str_replace( '/', '-', $wp_styles->registered[ $handle ]->handle ) . '.min.css';
323
+ }
324
+
325
  if ( ! empty( $parsed_url['query'] ) ) {
326
  $filename = $filename . '?' . $parsed_url['query'];
327
  }
core/Ssl/Ssl.php CHANGED
@@ -91,13 +91,25 @@ class Ssl {
91
  )
92
  );
93
 
94
- $read = @fopen( $site_url, 'rb', false, $stream );
 
 
 
 
 
 
 
 
 
 
 
95
 
96
- // Check if the response from the url is 200, if not - return false.
97
  if ( false === $read ) {
98
  return false;
99
  }
100
 
 
101
  $cont = @stream_context_get_params( $read );
102
 
103
  return is_null( $cont['options']['ssl']['peer_certificate'] ) ? false : true;
91
  )
92
  );
93
 
94
+ // Parse the url.
95
+ $parse_url = parse_url( $site_url, PHP_URL_HOST );
96
+
97
+ // Create the stream socket client.
98
+ $read = @stream_socket_client(
99
+ 'ssl://' . $parse_url . ':443' ,
100
+ $errno,
101
+ $errstr,
102
+ 3,
103
+ STREAM_CLIENT_CONNECT,
104
+ $stream
105
+ );
106
 
107
+ // Bail if the stream failed.
108
  if ( false === $read ) {
109
  return false;
110
  }
111
 
112
+ // Get the params we are checking.
113
  $cont = @stream_context_get_params( $read );
114
 
115
  return is_null( $cont['options']['ssl']['peer_certificate'] ) ? false : true;
core/Supercacher/Supercacher.php CHANGED
@@ -34,6 +34,11 @@ class Supercacher {
34
  'hook' => 'wp_trash_post',
35
  'priority' => 1,
36
  ),
 
 
 
 
 
37
  ),
38
  'supercacher_terms' => array(
39
  array(
34
  'hook' => 'wp_trash_post',
35
  'priority' => 1,
36
  ),
37
+ array(
38
+ 'option' => 'purge_all_post_cache',
39
+ 'hook' => 'publish_post',
40
+ 'priority' => 1,
41
+ ),
42
  ),
43
  'supercacher_terms' => array(
44
  array(
core/Supercacher/Supercacher_Posts.php CHANGED
@@ -138,6 +138,16 @@ class Supercacher_Posts {
138
  // Get the post.
139
  $post = get_post( $post_id );
140
 
 
 
 
 
 
 
 
 
 
 
141
  // Bail if post type is excluded from cache purge.
142
  if ( true === $this->is_post_excluded_from_cache_purge( $post ) ) {
143
  return;
138
  // Get the post.
139
  $post = get_post( $post_id );
140
 
141
+ // Bail if the current hook is save_post and the post is scheduled.
142
+ if ( 'save_post' === current_action() && 'future' === get_post_status( $post_id ) ) {
143
+ return;
144
+ }
145
+
146
+ // Bail if the current hook is publish_post and the post isn't scheduled.
147
+ if ( 'publish_post' === current_action() && 'future' !== get_post_status( $post_id ) ) {
148
+ return;
149
+ }
150
+
151
  // Bail if post type is excluded from cache purge.
152
  if ( true === $this->is_post_excluded_from_cache_purge( $post ) ) {
153
  return;
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.9
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -75,10 +75,58 @@ Here's an example of the code, you can add to your functions.php file:
75
  return $xml_urls;
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  = SiteGround Optimizer Environment Page =
79
 
80
  Here, you can force HTTPS for your site and fix insecure content errors. You can activate Database Optimization which will remove all unnecessary items from your database and optimize its tables. If you are using the InnoDB storage engine, the optimization of tables is done automatically by the engine. Use DNS-Prefetching to increase load speeds for external resources. It works by resolving the domain name, before a resource is requested. You can also manage Heartbeat Control to modify the frequency of the WP Heartbeat for different locations. By default, the WordPress Heartbeat API checks every 15 seconds on your post edit pages and every 60 seconds on your dashboard and front end whether there are scheduled tasks to be executed. With this option, you can make the checks run less frequently or completely disable them.
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  = SiteGround Optimizer Frontend Optimization Page =
83
 
84
  The page is split into three tabs - CSS, JAVASCRIPT and GENERAL. In the CSS tab, you can enable/disable Minification of CSS files, activate/deactivate CSS combinations to reduce the numbers of requests to the server, and also Preload Combined CSS. Here you can also exclude styles from being combined/minified.
@@ -328,6 +376,24 @@ Our plugin uses a cookie in order to function properly. It does not store person
328
 
329
  == Changelog ==
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  = Version 7.0.9 =
332
  Release Date: April 7th, 2022
333
 
@@ -349,7 +415,7 @@ Release Date: March 24th, 2022
349
  = Version 7.0.6 =
350
  Release Date: March 4th, 2022
351
 
352
- * Improved installation for users not hosted on SiteGround.
353
 
354
  = Version 7.0.5 =
355
  Release Date: March 2nd, 2022
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: 6.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
75
  return $xml_urls;
76
  }
77
 
78
+ Keep in mind that when modifying the file-cache related filters below, you need to flush the cache, so the sgo-config is re-generated and the filters are added to it.
79
+
80
+ If you need to add a cache bypass cookie to the default ones, you can use the following filter:
81
+
82
+ add_filter( 'sgo_bypass_cookies', 'add_sgo_bypass_cookies');
83
+ function add_sgo_bypass_cookies( $bypass_cookies ) {
84
+ // Add the cookies, that you need to bypass the cache.
85
+ $bypass_cookies[] = 'cookie_name';
86
+ $bypass_cookies[] = 'cookie_name_2';
87
+
88
+ return $bypass_cookies;
89
+ }
90
+
91
+ If you need to skip the cache for a specific query parameter, you can use the following filter:
92
+
93
+ add_filter( 'sgo_bypass_query_params', 'add_sgo_bypass_query_params');
94
+ function add_sgo_bypass_query_params( $bypass_query_params ) {
95
+ // Add custom query params, that will skip the cache.
96
+ $bypass_query_params[] = 'query_param';
97
+ $bypass_query_params[] = 'query_param2';
98
+
99
+ return $bypass_query_params;
100
+ }
101
+
102
+ If you need to add a specific query parameter which will be ignored in the cache-creation and cache-spawn processes you can do it using this filter:
103
+
104
+ add_filter( 'sgo_ignored_query_params', 'add_sgo_ignored_query_params');
105
+ function add_sgo_ignored_query_params( $ignored_query_params ) {
106
+ // The query parameters which will be ignored.
107
+ $ignored_query_params[] = 'query_param';
108
+ $ignored_query_params[] = 'query_param2';
109
+
110
+ return $ignored_query_params;
111
+ }
112
+
113
  = SiteGround Optimizer Environment Page =
114
 
115
  Here, you can force HTTPS for your site and fix insecure content errors. You can activate Database Optimization which will remove all unnecessary items from your database and optimize its tables. If you are using the InnoDB storage engine, the optimization of tables is done automatically by the engine. Use DNS-Prefetching to increase load speeds for external resources. It works by resolving the domain name, before a resource is requested. You can also manage Heartbeat Control to modify the frequency of the WP Heartbeat for different locations. By default, the WordPress Heartbeat API checks every 15 seconds on your post edit pages and every 60 seconds on your dashboard and front end whether there are scheduled tasks to be executed. With this option, you can make the checks run less frequently or completely disable them.
116
 
117
+ We have a filter that allows you to exclude specific tables from being optimized. You need to specify the table name without the database prefix.
118
+
119
+ Here's an example of the code, you can add to your functions.php file:
120
+
121
+ add_filter( 'sgo_db_optimization_exclude', 'sgo_db_optimization_exclude_table' );
122
+ function sgo_db_optimization_exclude_table( $excluded_tables ) {
123
+ // Add tables that you need to exclude without the wpdb prefix.
124
+ $excluded_tables[] = 'table_name';
125
+ $excluded_tables[] = 'another_table_name';
126
+
127
+ return $excluded_tables;
128
+ }
129
+
130
  = SiteGround Optimizer Frontend Optimization Page =
131
 
132
  The page is split into three tabs - CSS, JAVASCRIPT and GENERAL. In the CSS tab, you can enable/disable Minification of CSS files, activate/deactivate CSS combinations to reduce the numbers of requests to the server, and also Preload Combined CSS. Here you can also exclude styles from being combined/minified.
376
 
377
  == Changelog ==
378
 
379
+ = Version 7.1.1 =
380
+ Release Date: May 20th, 2022
381
+
382
+ * Improved default settings
383
+
384
+ = Version 7.1.0 =
385
+ Release Date: May 10th, 2022
386
+
387
+ * Improved HTTPS Enforce
388
+ * Improved Database Optimization
389
+ * Improved Auto Purge functionality for scheduled posts
390
+ * Improved File-Based cache exclude filtering
391
+ * Improved CSS Combination
392
+ * Improved JS Minification
393
+ * Improved Meks Flexible Shortcodes plugin support
394
+ * Improved All in One SEO plugin support
395
+ * Improved Authorize.Net Gateway support
396
+
397
  = Version 7.0.9 =
398
  Release Date: April 7th, 2022
399
 
415
  = Version 7.0.6 =
416
  Release Date: March 4th, 2022
417
 
418
+ * Improved installation for users not hosted on SiteGround
419
 
420
  = Version 7.0.5 =
421
  Release Date: March 2nd, 2022
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: 7.0.9
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', '7.0.9' );
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: 7.1.1
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', '7.1.1' );
36
  }
37
 
38
  // Define slug constant.
templates/campaigns/campaign-template.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"
3
+ xmlns:v="urn:schemas-microsoft-com:vml"
4
+ xmlns:o="urn:schemas-microsoft-com:office:office">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <!--[if !mso]><!-->
8
+ <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
9
+ <!--<![endif]-->
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
11
+ <meta name="color-scheme" content="light dark"/>
12
+ <meta name="supported-color-schemes" content="light dark"/>
13
+ <meta name="description" content="SiteGround Newsletter"/>
14
+ <title>SiteGround Newsletter</title>
15
+ <link rel="preconnect" href="https://fonts.googleapis.com">
16
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
17
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&family=Roboto:wght@400;700&display=swap" rel="stylesheet"> <style>
18
+ :root {
19
+ color-scheme: light dark;
20
+ supported-color-schemes: light dark;
21
+ }
22
+ body { margin: 0; padding: 0; width: 100% !important; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
23
+ img { max-width: 100%;outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; display: block !important; border: none;}
24
+ #backgroundTable { margin: 0; width: 100% !important; line-height: 100%;}
25
+ @media screen and (max-width: 480px), screen and (max-device-width: 480px) {
26
+ .flex, [class=flex] { width: 100% !important; }
27
+ .dblock, [class=dblock] { display: block !important; width: 100% !important; max-width: 100%; padding: 0 !important; max-height: none !important; }
28
+ a { word-break: break-word;}
29
+ }
30
+ @media (prefers-color-scheme: dark) {
31
+ .dark-img {display:block !important; width: auto !important; overflow: visible !important; float: none !important; max-height:inherit !important; max-width:inherit !important; line-height: auto !important; margin-top:0px !important; visibility:inherit !important; }
32
+ .light-img { display:none !important; }
33
+ #backgroundTable, body {background: inherit !important;}
34
+ .body-text, h1, h2, p, strong, em, b { color: #f2f2f2 !important; }
35
+ .infobox { background: #363636666 !important;}
36
+ .datatable td, .datatable th{background: #363636 !important;}
37
+ a{ color: #3adcf7 !important; }
38
+ [data-ogsc] .dark-img {display:block !important; width: auto !important; overflow: visible !important; float: none !important; max-height:inherit !important; max-width:inherit !important; line-height: auto !important; margin-top:0px !important; visibility:inherit !important; }
39
+ [data-ogsc] .light-img { display:none !important; }
40
+ [data-ogsb] #backgroundTable, body { background: #363636 !important;}
41
+ [data-ogsc] .body-text, h1, h2, p, strong, em, b { color: #f2f2f2 !important; }
42
+ [data-ogsb] .infobox { background: #363636666 !important;}
43
+ [data-ogsb] .datatable td, .datatable th{background: #363636 !important;}
44
+ [data-ogsc] a{ color: #3adcf7 !important; }
45
+ }
46
+ </style>
47
+ <!--Fallback For Outlook -->
48
+ <!--[if mso]>
49
+ <style type=”text/css”>
50
+ .body-text {
51
+ font-family: Arial, sans-serif !important;
52
+ }
53
+ </style>
54
+ <![endif]-->
55
+ <!--MS Outlook 120 DPI fix-->
56
+ <!--[if gte mso 9]>
57
+ <xml>
58
+ <o:OfficeDocumentSettings>
59
+ <o:AllowPNG/>
60
+ <o:PixelsPerInch>96</o:PixelsPerInch>
61
+ </o:OfficeDocumentSettings>
62
+ </xml>
63
+ <![endif]-->
64
+ </head>
65
+ <body style="margin: 0; padding: 0;">
66
+ <table class="flex" border="0" cellpadding="0" cellspacing="0" width="100%" id="backgroundTable" style="background: #ffffff;">
67
+ <tr>
68
+ <td style="padding: 0 20px; ">
69
+ <!-- Main Container -->
70
+ <table class="flex" align="center" border="0" cellpadding="0" cellspacing="0" width="600"
71
+ style="border-collapse: collapse; font-family: 'Roboto', Arial, Helvetica, sans-serif;">
72
+ <tr>
73
+ <td>
74
+ <!-- Header -->
75
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
76
+ <tr>
77
+ <td height="30"
78
+ style="padding: 20px 0 30px 0;">
79
+ <a style="border: none" href="<?php echo $args['logo_link'] ?>" target="_blank" rel="noreferrer">
80
+ <img class="light-img" style="border: none; outline: none;" src="<?php echo $args['logo_image_light'] ?>" width="170" alt="SiteGround"/>
81
+ <!--[if !mso]><! -->
82
+ <div class="dark-img" style="display:none; overflow:hidden; float:left; width:0px; max-height:0px; max-width:0px; line-height:0px; visibility:hidden;"><img style="border: none; outline: none;" src="<?php echo $args['logo_image_dark'] ?>" width="170" alt="<?php echo $args['logo_image_alt'] ?>"/></div>
83
+ <!--<![endif]-->
84
+ </a>
85
+ </td>
86
+ </tr>
87
+ </table>
88
+ <!-- End Header -->
89
+ </td>
90
+ </tr>
91
+ <tr>
92
+ <td style="padding: 0 0 40px 0">
93
+ <a href="<?php echo $args['header_link'] ?>" target="_blank" rel="noreferrer" style="border: none;"><img src="<?php echo $args['header_image'] ?>" width="600" alt="<?php echo $args['header_alt'] ?>" style="max-height: 300px;"></a>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <td class="body-text"
98
+ style="color: #363636; font-weight: 600; font-family: 'Poppins', Arial, Helvetica, sans-serif; font-size: 30px; line-height: 40px; padding: 0 0 30px 0"><?php echo $args['title']; ?>
99
+ </td>
100
+ </tr>
101
+ <?php foreach( $args['text'] as $paragraph ) : ?>
102
+ <tr>
103
+ <td class="body-text"
104
+ style="color: #363636; font-weight: 400; font-family: 'Roboto', Arial, Helvetica, sans-serif; font-size: 18px; line-height: 30px; padding: 0px 0 30px 0"><?php echo $paragraph; ?>
105
+ </td>
106
+ </tr>
107
+ <?php endforeach ;?>
108
+ <?php if ( ! empty( $args['table'] ) ) : ?>
109
+ <tr>
110
+ <td style="padding: 0 0 30px 0;">
111
+ <!--Start List-->
112
+ <table border="0" cellpadding="0" cellspacing="0" width="100%">
113
+ <?php foreach( $args['table'] as $row ) : ?>
114
+ <tr>
115
+ <td class="body-text"
116
+ style="color: #363636; font-weight: 400; font-family: 'Roboto', Arial, Helvetica, sans-serif; font-size: 18px; line-height: 30px;">
117
+ <span style="color: #363636; display: inline-block; padding: 0 5px 0 0;">&#8226;</span><?php echo $row; ?>
118
+ </td>
119
+ </tr>
120
+ <?php endforeach; ?>
121
+ </table>
122
+ </td>
123
+ </tr>
124
+ <?php endif; ?>
125
+ <?php if( array_key_exists( 'after_text', $args ) ) : ?>
126
+ <tr>
127
+ <td class="body-text"
128
+ style="color: #363636; font-weight: 400; font-family: 'Roboto', Arial, Helvetica, sans-serif; font-size: 18px; line-height: 30px; padding: 0 0 30px 0"><?php echo $args['after_text']; ?>
129
+ </td>
130
+ </tr>
131
+ <?php endif;?>
132
+ <tr>
133
+ <td class="body-text"
134
+ style="padding: 0px 0 60px 0">
135
+ <a href="<?php echo $args['button_link'] ?>" class="body-text"
136
+ target="_blank" rel="noreferrer" style="font-family: 'Poppins', Arial, Helvetica, sans-serif; font-size: 18px; font-weight: 600; line-height: 20px; text-transform: uppercase; text-decoration: none; display: inline-block; border-top: 15px solid #4343f0; border-bottom: 15px solid #4343f0; border-left: 30px solid #4343f0; border-right: 30px solid #4343f0; color: #ffffff; background: #4343f0; border-radius: 25px;"><?php echo $args['button']; ?></a>
137
+ </td>
138
+ </tr>
139
+ <tr>
140
+ <td class="body-text"
141
+ style="color: #a4a4a4; font-weight: 400; font-family: 'Roboto', Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px; padding: 0 0 30px 0"><?php esc_html_e( 'You are receiving this email because you’re using the SiteGround Optimizer WordPress plugin and you have agreed to receive promotional emails from us. You can unsubscribe or manage your email preferences in the WordPress admin panel.', 'sg-security' ); ?>
142
+ </td>
143
+ </tr>
144
+ </table>
145
+
146
+ <!-- End Main Container -->
147
+ </td>
148
+ </tr>
149
+ </table>
150
+ </body>
151
+ </html>
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit5e9a43c4fda23d0d4bf91f87900634f1::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit41f6b662d9353f9163f563d74935e475::getLoader();
vendor/composer/autoload_psr4.php CHANGED
@@ -9,6 +9,7 @@ return array(
9
  'SiteGround_i18n\\' => array($vendorDir . '/siteground/siteground-i18n/src'),
10
  'SiteGround_Optimizer\\' => array($baseDir . '/core'),
11
  'SiteGround_Helper\\' => array($vendorDir . '/siteground/siteground-helper/src'),
 
12
  'SiteGround_Data\\' => array($vendorDir . '/siteground/siteground-data/src'),
13
  'MatthiasMullie\\PathConverter\\' => array($vendorDir . '/matthiasmullie/path-converter/src'),
14
  'MatthiasMullie\\Minify\\' => array($vendorDir . '/matthiasmullie/minify/src'),
9
  'SiteGround_i18n\\' => array($vendorDir . '/siteground/siteground-i18n/src'),
10
  'SiteGround_Optimizer\\' => array($baseDir . '/core'),
11
  'SiteGround_Helper\\' => array($vendorDir . '/siteground/siteground-helper/src'),
12
+ 'SiteGround_Emails\\' => array($vendorDir . '/siteground/siteground-emails/src'),
13
  'SiteGround_Data\\' => array($vendorDir . '/siteground/siteground-data/src'),
14
  'MatthiasMullie\\PathConverter\\' => array($vendorDir . '/matthiasmullie/path-converter/src'),
15
  'MatthiasMullie\\Minify\\' => array($vendorDir . '/matthiasmullie/minify/src'),
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit5e9a43c4fda23d0d4bf91f87900634f1
6
  {
7
  private static $loader;
8
 
@@ -24,15 +24,15 @@ class ComposerAutoloaderInit5e9a43c4fda23d0d4bf91f87900634f1
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
- spl_autoload_register(array('ComposerAutoloaderInit5e9a43c4fda23d0d4bf91f87900634f1', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
- spl_autoload_unregister(array('ComposerAutoloaderInit5e9a43c4fda23d0d4bf91f87900634f1', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
- call_user_func(\Composer\Autoload\ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
@@ -53,12 +53,12 @@ class ComposerAutoloaderInit5e9a43c4fda23d0d4bf91f87900634f1
53
  $loader->register(true);
54
 
55
  if ($useStaticLoader) {
56
- $includeFiles = Composer\Autoload\ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1::$files;
57
  } else {
58
  $includeFiles = require __DIR__ . '/autoload_files.php';
59
  }
60
  foreach ($includeFiles as $fileIdentifier => $file) {
61
- composerRequire5e9a43c4fda23d0d4bf91f87900634f1($fileIdentifier, $file);
62
  }
63
 
64
  return $loader;
@@ -70,7 +70,7 @@ class ComposerAutoloaderInit5e9a43c4fda23d0d4bf91f87900634f1
70
  * @param string $file
71
  * @return void
72
  */
73
- function composerRequire5e9a43c4fda23d0d4bf91f87900634f1($fileIdentifier, $file)
74
  {
75
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
76
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit41f6b662d9353f9163f563d74935e475
6
  {
7
  private static $loader;
8
 
24
 
25
  require __DIR__ . '/platform_check.php';
26
 
27
+ spl_autoload_register(array('ComposerAutoloaderInit41f6b662d9353f9163f563d74935e475', 'loadClassLoader'), true, true);
28
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
29
+ spl_autoload_unregister(array('ComposerAutoloaderInit41f6b662d9353f9163f563d74935e475', 'loadClassLoader'));
30
 
31
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
32
  if ($useStaticLoader) {
33
  require __DIR__ . '/autoload_static.php';
34
 
35
+ call_user_func(\Composer\Autoload\ComposerStaticInit41f6b662d9353f9163f563d74935e475::getInitializer($loader));
36
  } else {
37
  $map = require __DIR__ . '/autoload_namespaces.php';
38
  foreach ($map as $namespace => $path) {
53
  $loader->register(true);
54
 
55
  if ($useStaticLoader) {
56
+ $includeFiles = Composer\Autoload\ComposerStaticInit41f6b662d9353f9163f563d74935e475::$files;
57
  } else {
58
  $includeFiles = require __DIR__ . '/autoload_files.php';
59
  }
60
  foreach ($includeFiles as $fileIdentifier => $file) {
61
+ composerRequire41f6b662d9353f9163f563d74935e475($fileIdentifier, $file);
62
  }
63
 
64
  return $loader;
70
  * @param string $file
71
  * @return void
72
  */
73
+ function composerRequire41f6b662d9353f9163f563d74935e475($fileIdentifier, $file)
74
  {
75
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
76
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1
8
  {
9
  public static $files = array (
10
  '0d5072bb3af3f8dc141e158c7699adf2' => __DIR__ . '/../..' . '/helpers/helpers.php',
@@ -16,6 +16,7 @@ class ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1
16
  'SiteGround_i18n\\' => 16,
17
  'SiteGround_Optimizer\\' => 21,
18
  'SiteGround_Helper\\' => 18,
 
19
  'SiteGround_Data\\' => 16,
20
  ),
21
  'M' =>
@@ -43,6 +44,10 @@ class ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1
43
  array (
44
  0 => __DIR__ . '/..' . '/siteground/siteground-helper/src',
45
  ),
 
 
 
 
46
  'SiteGround_Data\\' =>
47
  array (
48
  0 => __DIR__ . '/..' . '/siteground/siteground-data/src',
@@ -91,10 +96,10 @@ class ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1
91
  public static function getInitializer(ClassLoader $loader)
92
  {
93
  return \Closure::bind(function () use ($loader) {
94
- $loader->prefixLengthsPsr4 = ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1::$prefixLengthsPsr4;
95
- $loader->prefixDirsPsr4 = ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1::$prefixDirsPsr4;
96
- $loader->prefixesPsr0 = ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1::$prefixesPsr0;
97
- $loader->classMap = ComposerStaticInit5e9a43c4fda23d0d4bf91f87900634f1::$classMap;
98
 
99
  }, null, ClassLoader::class);
100
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit41f6b662d9353f9163f563d74935e475
8
  {
9
  public static $files = array (
10
  '0d5072bb3af3f8dc141e158c7699adf2' => __DIR__ . '/../..' . '/helpers/helpers.php',
16
  'SiteGround_i18n\\' => 16,
17
  'SiteGround_Optimizer\\' => 21,
18
  'SiteGround_Helper\\' => 18,
19
+ 'SiteGround_Emails\\' => 18,
20
  'SiteGround_Data\\' => 16,
21
  ),
22
  'M' =>
44
  array (
45
  0 => __DIR__ . '/..' . '/siteground/siteground-helper/src',
46
  ),
47
+ 'SiteGround_Emails\\' =>
48
+ array (
49
+ 0 => __DIR__ . '/..' . '/siteground/siteground-emails/src',
50
+ ),
51
  'SiteGround_Data\\' =>
52
  array (
53
  0 => __DIR__ . '/..' . '/siteground/siteground-data/src',
96
  public static function getInitializer(ClassLoader $loader)
97
  {
98
  return \Closure::bind(function () use ($loader) {
99
+ $loader->prefixLengthsPsr4 = ComposerStaticInit41f6b662d9353f9163f563d74935e475::$prefixLengthsPsr4;
100
+ $loader->prefixDirsPsr4 = ComposerStaticInit41f6b662d9353f9163f563d74935e475::$prefixDirsPsr4;
101
+ $loader->prefixesPsr0 = ComposerStaticInit41f6b662d9353f9163f563d74935e475::$prefixesPsr0;
102
+ $loader->classMap = ComposerStaticInit41f6b662d9353f9163f563d74935e475::$classMap;
103
 
104
  }, null, ClassLoader::class);
105
  }
vendor/composer/installed.json CHANGED
@@ -103,17 +103,17 @@
103
  },
104
  {
105
  "name": "matthiasmullie/minify",
106
- "version": "1.3.66",
107
- "version_normalized": "1.3.66.0",
108
  "source": {
109
  "type": "git",
110
  "url": "https://github.com/matthiasmullie/minify.git",
111
- "reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6"
112
  },
113
  "dist": {
114
  "type": "zip",
115
- "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
116
- "reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
117
  "shasum": ""
118
  },
119
  "require": {
@@ -129,7 +129,7 @@
129
  "suggest": {
130
  "psr/cache-implementation": "Cache implementation to use with Minify::cache"
131
  },
132
- "time": "2021-01-06T15:18:10+00:00",
133
  "bin": [
134
  "bin/minifycss",
135
  "bin/minifyjs"
@@ -164,19 +164,11 @@
164
  ],
165
  "support": {
166
  "issues": "https://github.com/matthiasmullie/minify/issues",
167
- "source": "https://github.com/matthiasmullie/minify/tree/1.3.66"
168
  },
169
  "funding": [
170
  {
171
- "url": "https://github.com/[user1",
172
- "type": "github"
173
- },
174
- {
175
- "url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.",
176
- "type": "github"
177
- },
178
- {
179
- "url": "https://github.com/user2",
180
  "type": "github"
181
  }
182
  ],
@@ -373,6 +365,26 @@
373
  ],
374
  "install-path": "../siteground/siteground-data"
375
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  {
377
  "name": "siteground/siteground-helper",
378
  "version": "dev-master",
103
  },
104
  {
105
  "name": "matthiasmullie/minify",
106
+ "version": "1.3.68",
107
+ "version_normalized": "1.3.68.0",
108
  "source": {
109
  "type": "git",
110
  "url": "https://github.com/matthiasmullie/minify.git",
111
+ "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297"
112
  },
113
  "dist": {
114
  "type": "zip",
115
+ "url": "https://api.github.com/repos/matthiasmullie/minify/zipball/c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297",
116
+ "reference": "c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297",
117
  "shasum": ""
118
  },
119
  "require": {
129
  "suggest": {
130
  "psr/cache-implementation": "Cache implementation to use with Minify::cache"
131
  },
132
+ "time": "2022-04-19T08:28:56+00:00",
133
  "bin": [
134
  "bin/minifycss",
135
  "bin/minifyjs"
164
  ],
165
  "support": {
166
  "issues": "https://github.com/matthiasmullie/minify/issues",
167
+ "source": "https://github.com/matthiasmullie/minify/tree/1.3.68"
168
  },
169
  "funding": [
170
  {
171
+ "url": "https://github.com/matthiasmullie",
 
 
 
 
 
 
 
 
172
  "type": "github"
173
  }
174
  ],
365
  ],
366
  "install-path": "../siteground/siteground-data"
367
  },
368
+ {
369
+ "name": "siteground/siteground-emails",
370
+ "version": "dev-master",
371
+ "version_normalized": "dev-master",
372
+ "source": {
373
+ "type": "git",
374
+ "url": "https://gitlab.siteground.com/wordpress/siteground-emails.git",
375
+ "reference": "488bda959c356fd330d0ecfb45885fc0f421f5b7"
376
+ },
377
+ "time": "2022-05-04T06:04:35+00:00",
378
+ "default-branch": true,
379
+ "type": "library",
380
+ "installation-source": "source",
381
+ "autoload": {
382
+ "psr-4": {
383
+ "SiteGround_Emails\\": "src/"
384
+ }
385
+ },
386
+ "install-path": "../siteground/siteground-emails"
387
+ },
388
  {
389
  "name": "siteground/siteground-helper",
390
  "version": "dev-master",
vendor/composer/installed.php CHANGED
@@ -5,7 +5,7 @@
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'fa6b38a9c5a254651979fd3aa230eb938e5378cd',
9
  'name' => '__root__',
10
  'dev' => true,
11
  ),
@@ -16,7 +16,7 @@
16
  'type' => 'library',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => 'fa6b38a9c5a254651979fd3aa230eb938e5378cd',
20
  'dev_requirement' => false,
21
  ),
22
  'a5hleyrich/wp-background-processing' => array(
@@ -40,12 +40,12 @@
40
  'dev_requirement' => false,
41
  ),
42
  'matthiasmullie/minify' => array(
43
- 'pretty_version' => '1.3.66',
44
- 'version' => '1.3.66.0',
45
  'type' => 'library',
46
  'install_path' => __DIR__ . '/../matthiasmullie/minify',
47
  'aliases' => array(),
48
- 'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
49
  'dev_requirement' => false,
50
  ),
51
  'matthiasmullie/path-converter' => array(
@@ -86,6 +86,17 @@
86
  'reference' => 'c1281835d47feb1f43d93ffa500e04856498362b',
87
  'dev_requirement' => false,
88
  ),
 
 
 
 
 
 
 
 
 
 
 
89
  'siteground/siteground-helper' => array(
90
  'pretty_version' => 'dev-master',
91
  'version' => 'dev-master',
5
  'type' => 'library',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => '2aca6cdc6a1f88b3720e06d66177969d641714c4',
9
  'name' => '__root__',
10
  'dev' => true,
11
  ),
16
  'type' => 'library',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => '2aca6cdc6a1f88b3720e06d66177969d641714c4',
20
  'dev_requirement' => false,
21
  ),
22
  'a5hleyrich/wp-background-processing' => array(
40
  'dev_requirement' => false,
41
  ),
42
  'matthiasmullie/minify' => array(
43
+ 'pretty_version' => '1.3.68',
44
+ 'version' => '1.3.68.0',
45
  'type' => 'library',
46
  'install_path' => __DIR__ . '/../matthiasmullie/minify',
47
  'aliases' => array(),
48
+ 'reference' => 'c00fb02f71b2ef0a5f53fe18c5a8b9aa30f48297',
49
  'dev_requirement' => false,
50
  ),
51
  'matthiasmullie/path-converter' => array(
86
  'reference' => 'c1281835d47feb1f43d93ffa500e04856498362b',
87
  'dev_requirement' => false,
88
  ),
89
+ 'siteground/siteground-emails' => array(
90
+ 'pretty_version' => 'dev-master',
91
+ 'version' => 'dev-master',
92
+ 'type' => 'library',
93
+ 'install_path' => __DIR__ . '/../siteground/siteground-emails',
94
+ 'aliases' => array(
95
+ 0 => '9999999-dev',
96
+ ),
97
+ 'reference' => '488bda959c356fd330d0ecfb45885fc0f421f5b7',
98
+ 'dev_requirement' => false,
99
+ ),
100
  'siteground/siteground-helper' => array(
101
  'pretty_version' => 'dev-master',
102
  'version' => 'dev-master',
vendor/matthiasmullie/minify/.github/FUNDING.yml CHANGED
@@ -1,6 +1,6 @@
1
  # These are supported funding model platforms
2
 
3
- github: [matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
  patreon: # Replace with a single Patreon username
5
  open_collective: # Replace with a single Open Collective username
6
  ko_fi: # Replace with a single Ko-fi username
1
  # These are supported funding model platforms
2
 
3
+ github: [matthiasmullie]
4
  patreon: # Replace with a single Patreon username
5
  open_collective: # Replace with a single Open Collective username
6
  ko_fi: # Replace with a single Ko-fi username
vendor/matthiasmullie/minify/.github/workflows/test.yml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: test-suite
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+
11
+ build:
12
+
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v2
17
+
18
+ - name: Test PHP 8.1 & submit codecov
19
+ run: make test PHP=8.1 UP=1 DOWN=0 && bash <(curl -s https://codecov.io/bash) && make down PHP=8.1
20
+
21
+ - name: Test PHP 8.0
22
+ run: make test PHP=8.0
23
+
24
+ - name: Test PHP 7.4
25
+ run: make test PHP=7.4
26
+
27
+ - name: Test PHP 7.3
28
+ run: make test PHP=7.3
29
+
30
+ - name: Test PHP 7.2
31
+ run: make test PHP=7.2
32
+
33
+ - name: Test PHP 7.1
34
+ run: make test PHP=7.1
35
+
36
+ - name: Test PHP 5.6
37
+ run: make test PHP=5.6
vendor/matthiasmullie/minify/Dockerfile CHANGED
@@ -8,6 +8,7 @@ RUN apt-get update
8
  RUN apt-get install -y zip unzip libzip-dev git
9
  RUN docker-php-ext-install zip
10
  RUN docker-php-ext-install pcntl
 
11
  RUN curl -sS https://getcomposer.org/installer | php
12
  RUN mv composer.phar /usr/local/bin/composer
13
  RUN composer install
8
  RUN apt-get install -y zip unzip libzip-dev git
9
  RUN docker-php-ext-install zip
10
  RUN docker-php-ext-install pcntl
11
+ RUN pecl install xdebug || pecl install xdebug-2.7.2 || pecl install -f xdebug-2.5.5 && docker-php-ext-enable xdebug
12
  RUN curl -sS https://getcomposer.org/installer | php
13
  RUN mv composer.phar /usr/local/bin/composer
14
  RUN composer install
vendor/matthiasmullie/minify/docker-compose.yml CHANGED
@@ -8,7 +8,13 @@ services:
8
  - ./src:/var/www/src
9
  - ./data:/var/www/data
10
  - ./tests:/var/www/tests
 
11
  - ./phpunit.xml.dist:/var/www/phpunit.xml.dist
 
 
 
 
 
12
  '8.0':
13
  extends: php
14
  build:
8
  - ./src:/var/www/src
9
  - ./data:/var/www/data
10
  - ./tests:/var/www/tests
11
+ - ./build:/var/www/build
12
  - ./phpunit.xml.dist:/var/www/phpunit.xml.dist
13
+ '8.1':
14
+ extends: php
15
+ build:
16
+ args:
17
+ version: 8.1-cli
18
  '8.0':
19
  extends: php
20
  build:
vendor/matthiasmullie/minify/src/CSS.php CHANGED
@@ -44,6 +44,10 @@ class CSS extends Minify
44
  'jpeg' => 'data:image/jpeg',
45
  'svg' => 'data:image/svg+xml',
46
  'woff' => 'data:application/x-font-woff',
 
 
 
 
47
  'tif' => 'image/tiff',
48
  'tiff' => 'image/tiff',
49
  'xbm' => 'image/x-xbitmap',
@@ -736,7 +740,7 @@ class CSS extends Minify
736
  // PHP only supports $this inside anonymous functions since 5.4
737
  $minifier = $this;
738
  $this->registerPattern(
739
- '/(?<=^|[;}])(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m',
740
  function ($match) use ($minifier) {
741
  $placeholder = '--custom-'. count($minifier->extracted) . ':0';
742
  $minifier->extracted[$placeholder] = $match[1] .':'. trim($match[2]);
44
  'jpeg' => 'data:image/jpeg',
45
  'svg' => 'data:image/svg+xml',
46
  'woff' => 'data:application/x-font-woff',
47
+ 'woff2' => 'data:application/x-font-woff2',
48
+ 'avif' => 'data:image/avif',
49
+ 'apng' => 'data:image/apng',
50
+ 'webp' => 'data:image/webp',
51
  'tif' => 'image/tiff',
52
  'tiff' => 'image/tiff',
53
  'xbm' => 'image/x-xbitmap',
740
  // PHP only supports $this inside anonymous functions since 5.4
741
  $minifier = $this;
742
  $this->registerPattern(
743
+ '/(?<=^|[;}])\s*(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m',
744
  function ($match) use ($minifier) {
745
  $placeholder = '--custom-'. count($minifier->extracted) . ':0';
746
  $minifier->extracted[$placeholder] = $match[1] .':'. trim($match[2]);
vendor/matthiasmullie/minify/src/JS.php CHANGED
@@ -198,15 +198,25 @@ class JS extends Minify
198
  // PHP only supports $this inside anonymous functions since 5.4
199
  $minifier = $this;
200
  $callback = function ($match) use ($minifier) {
201
- $count = count($minifier->extracted);
202
- $placeholder = '/*'.$count.'*/';
203
- $minifier->extracted[$placeholder] = $match[0];
 
 
 
 
 
 
 
 
 
 
204
 
205
- return $placeholder;
206
  };
 
207
  // multi-line comments
208
- $this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve).*?\*\/\n?/s', $callback);
209
- $this->registerPattern('/\/\*.*?\*\//s', '');
210
 
211
  // single-line comments
212
  $this->registerPattern('/\/\/.*$/m', '');
@@ -405,9 +415,26 @@ class JS extends Minify
405
  * to be the for-loop's body... Same goes for while loops.
406
  * I'm going to double that semicolon (if any) so after the next line,
407
  * which strips semicolons here & there, we're still left with this one.
 
 
 
 
 
 
 
 
408
  */
409
- $content = preg_replace('/(for\([^;\{]*;[^;\{]*;[^;\{]*\));(\}|$)/s', '\\1;;\\2', $content);
 
 
 
410
  $content = preg_replace('/(for\([^;\{]+\s+in\s+[^;\{]+\));(\}|$)/s', '\\1;;\\2', $content);
 
 
 
 
 
 
411
  /*
412
  * Below will also keep `;` after a `do{}while();` along with `while();`
413
  * While these could be stripped after do-while, detecting this
198
  // PHP only supports $this inside anonymous functions since 5.4
199
  $minifier = $this;
200
  $callback = function ($match) use ($minifier) {
201
+ if (
202
+ substr($match[2], 0, 1) === '!' ||
203
+ strpos($match[2], '@license') !== false ||
204
+ strpos($match[2], '@preserve') !== false
205
+ ) {
206
+ // preserve multi-line comments that start with /*!
207
+ // or contain @license or @preserve annotations
208
+ $count = count($minifier->extracted);
209
+ $placeholder = '/*'.$count.'*/';
210
+ $minifier->extracted[$placeholder] = $match[0];
211
+
212
+ return $match[1] . $placeholder . $match[3];
213
+ }
214
 
215
+ return $match[1] . $match[3];
216
  };
217
+
218
  // multi-line comments
219
+ $this->registerPattern('/(\n?)\/\*(.*?)\*\/(\n?)/s', $callback);
 
220
 
221
  // single-line comments
222
  $this->registerPattern('/\/\/.*$/m', '');
415
  * to be the for-loop's body... Same goes for while loops.
416
  * I'm going to double that semicolon (if any) so after the next line,
417
  * which strips semicolons here & there, we're still left with this one.
418
+ * Note the special recursive construct in the three inner parts of the for:
419
+ * (\{([^\{\}]*(?-2))*[^\{\}]*\})? - it is intended to match inline
420
+ * functions bodies, e.g.: i<arr.map(function(e){return e}).length.
421
+ * Also note that the construct is applied only once and multiplied
422
+ * for each part of the for, otherwise it risks a catastrophic backtracking.
423
+ * The limitation is that it will not allow closures in more than one
424
+ * of the three parts for a specific for() case.
425
+ * REGEX throwing catastrophic backtracking: $content = preg_replace('/(for\([^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*;[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*;[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*\));(\}|$)/s', '\\1;;\\8', $content);
426
  */
427
+ $content = preg_replace('/(for\((?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*);[^;\{]*;[^;\{]*\));(\}|$)/s', '\\1;;\\4', $content);
428
+ $content = preg_replace('/(for\([^;\{]*;(?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*);[^;\{]*\));(\}|$)/s', '\\1;;\\4', $content);
429
+ $content = preg_replace('/(for\([^;\{]*;[^;\{]*;(?:[^;\{]*|[^;\{]*function[^;\{]*(\{([^\{\}]*(?-2))*[^\{\}]*\})?[^;\{]*)\));(\}|$)/s', '\\1;;\\4', $content);
430
+
431
  $content = preg_replace('/(for\([^;\{]+\s+in\s+[^;\{]+\));(\}|$)/s', '\\1;;\\2', $content);
432
+
433
+ /*
434
+ * Do the same for the if's that don't have a body but are followed by ;}
435
+ */
436
+ $content = preg_replace('/(\bif\s*\([^{;]*\));\}/s', '\\1;;}', $content);
437
+
438
  /*
439
  * Below will also keep `;` after a `do{}while();` along with `while();`
440
  * While these could be stripped after do-while, detecting this
vendor/matthiasmullie/minify/src/Minify.php CHANGED
@@ -243,6 +243,9 @@ abstract class Minify
243
  /**
244
  * Register a pattern to execute against the source content.
245
  *
 
 
 
246
  * @param string $pattern PCRE pattern
247
  * @param string|callable $replacement Replacement value for matched pattern
248
  */
@@ -268,11 +271,13 @@ abstract class Minify
268
  */
269
  protected function replace($content)
270
  {
271
- $processed = '';
 
 
272
  $positions = array_fill(0, count($this->patterns), -1);
273
  $matches = array();
274
 
275
- while ($content) {
276
  // find first match for all patterns
277
  foreach ($this->patterns as $i => $pattern) {
278
  list($pattern, $replacement) = $pattern;
@@ -285,12 +290,12 @@ abstract class Minify
285
 
286
  // no need to re-run matches that are still in the part of the
287
  // content that hasn't been processed
288
- if ($positions[$i] >= 0) {
289
  continue;
290
  }
291
 
292
  $match = null;
293
- if (preg_match($pattern, $content, $match, PREG_OFFSET_CAPTURE)) {
294
  $matches[$i] = $match;
295
 
296
  // we'll store the match position as well; that way, we
@@ -307,61 +312,52 @@ abstract class Minify
307
 
308
  // no more matches to find: everything's been processed, break out
309
  if (!$matches) {
310
- $processed .= $content;
 
311
  break;
312
  }
313
 
314
  // see which of the patterns actually found the first thing (we'll
315
  // only want to execute that one, since we're unsure if what the
316
  // other found was not inside what the first found)
317
- $discardLength = min($positions);
318
- $firstPattern = array_search($discardLength, $positions);
319
- $match = $matches[$firstPattern][0][0];
320
 
321
  // execute the pattern that matches earliest in the content string
322
- list($pattern, $replacement) = $this->patterns[$firstPattern];
323
- $replacement = $this->replacePattern($pattern, $replacement, $content);
324
-
325
- // figure out which part of the string was unmatched; that's the
326
- // part we'll execute the patterns on again next
327
- $content = (string) substr($content, $discardLength);
328
- $unmatched = (string) substr($content, strpos($content, $match) + strlen($match));
329
-
330
- // move the replaced part to $processed and prepare $content to
331
- // again match batch of patterns against
332
- $processed .= substr($replacement, 0, strlen($replacement) - strlen($unmatched));
333
- $content = $unmatched;
334
-
335
- // first match has been replaced & that content is to be left alone,
336
- // the next matches will start after this replacement, so we should
337
- // fix their offsets
338
- foreach ($positions as $i => $position) {
339
- $positions[$i] -= $discardLength + strlen($match);
340
- }
341
  }
342
 
343
- return $processed;
344
  }
345
 
346
  /**
347
- * This is where a pattern is matched against $content and the matches
348
- * are replaced by their respective value.
349
- * This function will be called plenty of times, where $content will always
350
- * move up 1 character.
351
  *
352
- * @param string $pattern Pattern to match
353
  * @param string|callable $replacement Replacement value
354
- * @param string $content Content to match pattern against
355
  *
356
  * @return string
357
  */
358
- protected function replacePattern($pattern, $replacement, $content)
359
  {
360
- if (is_callable($replacement)) {
361
- return preg_replace_callback($pattern, $replacement, $content, 1, $count);
362
- } else {
363
- return preg_replace($pattern, $replacement, $content, 1, $count);
 
 
364
  }
 
365
  }
366
 
367
  /**
243
  /**
244
  * Register a pattern to execute against the source content.
245
  *
246
+ * If $replacement is a string, it must be plain text. Placeholders like $1 or \2 don't work.
247
+ * If you need that functionality, use a callback instead.
248
+ *
249
  * @param string $pattern PCRE pattern
250
  * @param string|callable $replacement Replacement value for matched pattern
251
  */
271
  */
272
  protected function replace($content)
273
  {
274
+ $contentLength = strlen($content);
275
+ $output = '';
276
+ $processedOffset = 0;
277
  $positions = array_fill(0, count($this->patterns), -1);
278
  $matches = array();
279
 
280
+ while ($processedOffset < $contentLength) {
281
  // find first match for all patterns
282
  foreach ($this->patterns as $i => $pattern) {
283
  list($pattern, $replacement) = $pattern;
290
 
291
  // no need to re-run matches that are still in the part of the
292
  // content that hasn't been processed
293
+ if ($positions[$i] >= $processedOffset) {
294
  continue;
295
  }
296
 
297
  $match = null;
298
+ if (preg_match($pattern, $content, $match, PREG_OFFSET_CAPTURE, $processedOffset)) {
299
  $matches[$i] = $match;
300
 
301
  // we'll store the match position as well; that way, we
312
 
313
  // no more matches to find: everything's been processed, break out
314
  if (!$matches) {
315
+ // output the remaining content
316
+ $output .= substr($content, $processedOffset);
317
  break;
318
  }
319
 
320
  // see which of the patterns actually found the first thing (we'll
321
  // only want to execute that one, since we're unsure if what the
322
  // other found was not inside what the first found)
323
+ $matchOffset = min($positions);
324
+ $firstPattern = array_search($matchOffset, $positions);
325
+ $match = $matches[$firstPattern];
326
 
327
  // execute the pattern that matches earliest in the content string
328
+ list(, $replacement) = $this->patterns[$firstPattern];
329
+
330
+ // add the part of the input between $processedOffset and the first match;
331
+ // that content wasn't matched by anything
332
+ $output .= substr($content, $processedOffset, $matchOffset - $processedOffset);
333
+ // add the replacement for the match
334
+ $output .= $this->executeReplacement($replacement, $match);
335
+ // advance $processedOffset past the match
336
+ $processedOffset = $matchOffset + strlen($match[0][0]);
 
 
 
 
 
 
 
 
 
 
337
  }
338
 
339
+ return $output;
340
  }
341
 
342
  /**
343
+ * If $replacement is a callback, execute it, passing in the match data.
344
+ * If it's a string, just pass it through.
 
 
345
  *
 
346
  * @param string|callable $replacement Replacement value
347
+ * @param array $match Match data, in PREG_OFFSET_CAPTURE form
348
  *
349
  * @return string
350
  */
351
+ protected function executeReplacement($replacement, $match)
352
  {
353
+ if (!is_callable($replacement)) {
354
+ return $replacement;
355
+ }
356
+ // convert $match from the PREG_OFFSET_CAPTURE form to the form the callback expects
357
+ foreach ($match as &$matchItem) {
358
+ $matchItem = $matchItem[0];
359
  }
360
+ return $replacement($match);
361
  }
362
 
363
  /**
vendor/siteground/siteground-emails/composer.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "siteground/siteground-emails",
3
+ "autoload": {
4
+ "psr-4": {
5
+ "SiteGround_Emails\\": "src/"
6
+ }
7
+ },
8
+ "require": {}
9
+ }
vendor/siteground/siteground-emails/composer.lock ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "94e85834790ba85975b7fa64fe420fc9",
8
+ "packages": [],
9
+ "packages-dev": [],
10
+ "aliases": [],
11
+ "minimum-stability": "stable",
12
+ "stability-flags": [],
13
+ "prefer-stable": false,
14
+ "prefer-lowest": false,
15
+ "platform": [],
16
+ "platform-dev": [],
17
+ "plugin-api-version": "2.1.0"
18
+ }
vendor/siteground/siteground-emails/readme.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SiteGround Email Service for WordPress
2
+ =========
3
+
4
+ The script can be used to generate an email and schedule it to be sent on specific time interval. It uses default WP Mail function.
5
+
6
+ Installation
7
+ =====
8
+
9
+ composer require siteground/siteground-emails
10
+
11
+ Usage
12
+ =====
13
+
14
+ use SiteGround_Emails\Email_Service;
15
+
16
+ // Initiate the Email Service Class.
17
+ $this->email = new Email_Service(
18
+ 'email_cron', // *REQUIRED* Type: string. Cron event name.
19
+ 'weekly', // *REQUIRED* Type: string. Cron event interval. The default supported recurrences are ‘hourly’, ‘twicedaily’, ‘daily’, and ‘weekly’.
20
+ time(), // *REQUIRED* Type: int. Timestamp used to schedule the cron event.
21
+ array(
22
+ 'headers' => array( '' ); // *Optional* Type: string[].
23
+ 'recipients_option' => 'database option where the message receipients are being stored', // *REQUIRED* Type: string[]. List of email addresses.
24
+ 'subject' => 'Message Subject', // *REQUIRED* Type: string. Message subject.
25
+ 'body_method' => array( 'NAMESPACE', 'Generate message body method' ), // *REQUIRED* Type: array. Array of the namespace and the method which will generate the message body.
26
+ )
27
+ );
28
+
29
+ // Schedule the event.
30
+ $this->email->schedule_event();
31
+
32
+ With the above code you will have a weekly cron event sending email to the defined recipients.
33
+
34
+ Make sure to include the defined Cron name as an action in the plugin and link it to the siteground-emails 'sg_handle_email' method.
35
+
36
+ In case you want to stop sending the messages you can call the unschedule_event method as follows:
37
+
38
+ // Unschedule the event.
39
+ $this->email->unschedule_event();
40
+
41
+ Notes
42
+ =====
43
+
44
+ Cron name, inteval and timestamp should be defined in the order listed above. Message arguments can be passed in mixed order.
45
+
46
+ License
47
+ =====
48
+
49
+ GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
vendor/siteground/siteground-emails/src/Email_Service.php ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SiteGround Email Service
4
+ */
5
+
6
+ namespace SiteGround_Emails;
7
+
8
+ /**
9
+ * SiteGround_Email_Service class.
10
+ */
11
+ class Email_Service {
12
+
13
+ /**
14
+ * Cron Name.
15
+ *
16
+ * @since 1.0.0
17
+ *
18
+ * @var string
19
+ * @access protected
20
+ */
21
+ protected $sg_cron_name;
22
+
23
+ /**
24
+ * Cron Interval.
25
+ *
26
+ * @since 1.0.0
27
+ *
28
+ * @var string
29
+ * @access protected
30
+ */
31
+ protected $sg_cron_interval;
32
+
33
+ /**
34
+ * Cron Next Run.
35
+ *
36
+ * @var int timestamp
37
+ * @access protected
38
+ */
39
+ protected $sg_cron_next_run;
40
+
41
+ /**
42
+ * Mail Headers.
43
+ *
44
+ * @since 1.0.0
45
+ *
46
+ * @var string[]
47
+ * @access protected
48
+ */
49
+ protected $sg_mail_headers;
50
+
51
+ /**
52
+ * Recipients list.
53
+ *
54
+ * @since 1.0.0
55
+ *
56
+ * @var string[]
57
+ * @access protected
58
+ */
59
+ protected $sg_mail_recipients;
60
+
61
+ /**
62
+ * Mail Subject.
63
+ *
64
+ * @since 1.0.0
65
+ *
66
+ * @var string
67
+ * @access protected
68
+ */
69
+ protected $sg_mail_subject;
70
+
71
+ /**
72
+ * Mail Body.
73
+ *
74
+ * @since 1.0.0
75
+ *
76
+ * @var string
77
+ * @access protected
78
+ */
79
+ protected $sg_mail_body;
80
+
81
+ /**
82
+ * Mail From Name.
83
+ *
84
+ * @since 1.0.1
85
+ *
86
+ * @var string
87
+ * @access protected
88
+ */
89
+ protected $sg_mail_from_name;
90
+
91
+ /**
92
+ * Initiate the email service.
93
+ *
94
+ * @since 1.0.0
95
+ *
96
+ * @param string $sg_cron_name Name of the Cron Event.
97
+ * @param string $sg_cron_interval The Cron Event interval.
98
+ * @param int $sg_cron_next_run Timestamp for cron schedule next run.
99
+ * @param array $mail_args Message Arguments.
100
+ */
101
+ public function __construct( $sg_cron_name, $sg_cron_interval, $sg_cron_next_run, $mail_args ) {
102
+ $this->sg_cron_name = $sg_cron_name;
103
+ $this->sg_cron_interval = $sg_cron_interval;
104
+ $this->sg_cron_next_run = $sg_cron_next_run;
105
+
106
+ $this->sg_mail_headers = array_key_exists( 'headers', $mail_args ) ? $mail_args['headers'] : array( 'Content-Type: text/html; charset=UTF-8' );
107
+ $this->sg_mail_recipients = $mail_args['recipients_option'];
108
+ $this->sg_mail_subject = $mail_args['subject'];
109
+ $this->sg_mail_body = $mail_args['body_method'];
110
+ $this->sg_mail_from_name = array_key_exists( 'from_name', $mail_args ) ? $mail_args['from_name'] : false;
111
+ }
112
+
113
+ /**
114
+ * Handle email.
115
+ *
116
+ * @since 1.0.0
117
+ *
118
+ * @return bool True on successfull message sent, False on failure.
119
+ */
120
+ public function sg_handle_email() {
121
+ $receipients = get_option( $this->sg_mail_recipients, array() );
122
+
123
+ // Make sure the mail recipients are passed as an array.
124
+ $receipients = is_array( $receipients ) ? $receipients : array( $receipients );
125
+
126
+ // Remove any invalid email addresses.
127
+ foreach ( $receipients as $key => $recipient ) {
128
+ if ( false === filter_var( $recipient, FILTER_VALIDATE_EMAIL ) ) {
129
+ unset( $receipients[ $key ] );
130
+ };
131
+ }
132
+
133
+ // Generate the message body from the callable method.
134
+ $body = call_user_func( $this->sg_mail_body );
135
+
136
+ // Get the specific subject for the SGO email.
137
+ if ( 'sgo_campaign_cron' === $this->sg_cron_name ) {
138
+ $this->sg_mail_subject = call_user_func( $this->sg_mail_subject );
139
+ }
140
+
141
+ // Bail if we fail to build the body of the message.
142
+ if ( false === $body ) {
143
+ // Unschedule the event, so we don't make additional actions if the body is empty.
144
+ $this->unschedule_event();
145
+
146
+ return false;
147
+ }
148
+
149
+ // Apply the from name if it is set.
150
+ if ( false !== $this->sg_mail_from_name ) {
151
+ add_filter( 'wp_mail_from_name', array( $this, 'set_mail_from_name' ) );
152
+ }
153
+
154
+ // Sent the email.
155
+ $result = wp_mail(
156
+ $receipients,
157
+ $this->sg_mail_subject,
158
+ $body,
159
+ $this->sg_mail_headers
160
+ );
161
+
162
+ // Remove the from name if it is set.
163
+ if ( false !== $this->sg_mail_from_name ) {
164
+ remove_filter( 'wp_mail_from_name', array( $this, 'set_mail_from_name' ) );
165
+ }
166
+
167
+ return $result;
168
+ }
169
+
170
+ /**
171
+ * Set "Mail From" name.
172
+ *
173
+ * @since 1.0.1
174
+ *
175
+ * @return string The Mail From Name.
176
+ */
177
+ public function set_mail_from_name( $from_name ) {
178
+ return $this->sg_mail_from_name;
179
+ }
180
+
181
+ /**
182
+ * Schedule event.
183
+ *
184
+ * @since 1.0.0
185
+ *
186
+ * @return bool True if event successfully/already scheduled. False or WP_Error on failure.
187
+ */
188
+ public function schedule_event() {
189
+ if ( ! wp_next_scheduled( $this->sg_cron_name ) ) {
190
+ return wp_schedule_event( $this->sg_cron_next_run, $this->sg_cron_interval, $this->sg_cron_name );
191
+ }
192
+
193
+ return true;
194
+ }
195
+
196
+ /**
197
+ * Unschedule event.
198
+ *
199
+ * @since 1.0.0
200
+ *
201
+ * @return bool True if event successfully/already unscheduled. False or WP_Error on failure.
202
+ */
203
+ public function unschedule_event() {
204
+ // Retrieve the next timestamp for the cron event.
205
+ $timestamp = wp_next_scheduled( $this->sg_cron_name );
206
+
207
+ // Return true if there is no such event scheduled.
208
+ if ( false === $timestamp ) {
209
+ return true;
210
+ }
211
+
212
+ // Unschedule the event.
213
+ return wp_unschedule_event( $timestamp, $this->sg_cron_name );
214
+ }
215
+ }
vendor/siteground/siteground-helper/src/Helper_Service.php CHANGED
@@ -188,28 +188,10 @@ class Helper_Service {
188
  */
189
  public static function is_siteground() {
190
  // Bail if open_basedir restrictions are set, and we are not able to check certain directories.
191
- if ( ! empty( ini_get( 'open_basedir' ) ) ) {
192
  return 0;
193
  }
194
 
195
  return (int) ( @file_exists( '/etc/yum.repos.d/baseos.repo' ) && @file_exists( '/Z' ) );
196
  }
197
-
198
- /**
199
- * Checks if the user is 2FA authenticated.
200
- *
201
- * @since 1.0.1
202
- *
203
- * @return boolean True/False.
204
- */
205
- public static function is_2fa_logged() {
206
- global $wpdb;
207
-
208
- // Return false if SG Security plugin is not active.
209
- $active_plugins = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_name = 'active_plugins'", OBJECT );
210
- error_log( print_r( $active_plugins, true ));
211
-
212
- // Return false if 2FA option is not enabled.
213
-
214
- }
215
  }
188
  */
189
  public static function is_siteground() {
190
  // Bail if open_basedir restrictions are set, and we are not able to check certain directories.
191
+ if ( ! empty( ini_get( 'open_basedir' ) ) ){
192
  return 0;
193
  }
194
 
195
  return (int) ( @file_exists( '/etc/yum.repos.d/baseos.repo' ) && @file_exists( '/Z' ) );
196
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  }