NitroPack - Version 1.4.0

Version Description

  • New feature: Extended WP-CLI compatibility with ability to purge/invalidate by URL or tag
  • New feature: Add a method for dynamically preventing automated purge/invalidate
  • Improvement: Compatibility with jQuery 3
  • Improvement: Better compatibility with SiteGround's dynamic cache layer
  • Improvement: Overall stability improvements
  • Bug fix: Resolve an issue with undefined HTTP_HOST key
Download this release

Release Info

Developer nitropack
Plugin Icon 128x128 NitroPack
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.19 to 1.4.0

constants.php CHANGED
@@ -6,7 +6,7 @@ function nitropack_trailingslashit($string) {
6
  return rtrim( $string, '/\\' ) . '/';
7
  }
8
 
9
- define( 'NITROPACK_VERSION', '1.3.19' );
10
  define( 'NITROPACK_OPTION_GROUP', 'nitropack' );
11
  define( 'NITROPACK_DATA_DIR', nitropack_trailingslashit(WP_CONTENT_DIR) . 'nitropack' );
12
  define( 'NITROPACK_CONFIG_FILE', nitropack_trailingslashit(NITROPACK_DATA_DIR) . 'config.json' );
6
  return rtrim( $string, '/\\' ) . '/';
7
  }
8
 
9
+ define( 'NITROPACK_VERSION', '1.4.0' );
10
  define( 'NITROPACK_OPTION_GROUP', 'nitropack' );
11
  define( 'NITROPACK_DATA_DIR', nitropack_trailingslashit(WP_CONTENT_DIR) . 'nitropack' );
12
  define( 'NITROPACK_CONFIG_FILE', nitropack_trailingslashit(NITROPACK_DATA_DIR) . 'config.json' );
diagnostics.php CHANGED
@@ -8,7 +8,7 @@ if (!function_exists('get_plugins')) {
8
 
9
  $np_diag_functions = array(
10
  'general-info-status' => 'npdiag_get_general_info',
11
- 'active-pligins-status' => 'npdiag_get_active_plugins',
12
  'conflicting-plugins-status' => 'npdiag_get_conflicting_plugins',
13
  'user-config-status' => 'npdiag_get_user_config',
14
  'dir-info-status' => 'npdiag_get_dir_info',
8
 
9
  $np_diag_functions = array(
10
  'general-info-status' => 'npdiag_get_general_info',
11
+ 'active-plugins-status' => 'npdiag_get_active_plugins',
12
  'conflicting-plugins-status' => 'npdiag_get_conflicting_plugins',
13
  'user-config-status' => 'npdiag_get_user_config',
14
  'dir-info-status' => 'npdiag_get_dir_info',
functions.php CHANGED
@@ -14,6 +14,7 @@ $np_preUpdateTaxonomies = array();
14
  $np_loggedPurges = array();
15
  $np_loggedInvalidations = array();
16
  $np_sdkObjects = array();
 
17
  $np_integrationSetupEvent = "muplugins_loaded";
18
 
19
  function nitropack_is_logged_in() {
@@ -235,7 +236,9 @@ function nitropack_handle_webhook() {
235
  foreach ($urls as $url) {
236
  $sanitizedUrl = nitropack_sanitize_url_input($url);
237
  if ($proxyPurgeOnly) {
238
- $nitro->purgeProxyCache($sanitizedUrl);
 
 
239
  do_action('nitropack_integration_purge_url', $sanitizedUrl);
240
  } else {
241
  nitropack_sdk_purge_local($sanitizedUrl);
@@ -243,7 +246,9 @@ function nitropack_handle_webhook() {
243
  }
244
  } else {
245
  if ($proxyPurgeOnly) {
246
- $nitro->purgeProxyCache();
 
 
247
  do_action('nitropack_integration_purge_all');
248
  } else {
249
  nitropack_sdk_purge_local();
@@ -434,6 +439,7 @@ function nitropack_init() {
434
  } else {
435
  if (!isset($_GET["wpf_action"]) && nitropack_passes_cookie_requirements() && nitropack_passes_page_requirements()) {
436
  add_action('wp_footer', 'nitropack_print_beacon_script');
 
437
 
438
  $active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
439
  if (in_array('woocommerce-multilingual/wpml-woocommerce.php', $active_plugins, true) && (!isset($_COOKIE["np_wc_currency"]) || !isset($_COOKIE["np_wc_currency_language"]))) {
@@ -472,8 +478,9 @@ function nitropack_init() {
472
  }
473
  } else {
474
  header("X-Nitro-Disabled: 1");
475
- if ((null !== $nitro = get_nitropack_sdk()) && !$nitro->isAllowedBrowser()) {
476
- add_action('wp_footer', 'nitropack_print_beacon_script'); // This clears any proxy cache when a proxy cached non-optimized request due to unsupported browser
 
477
  }
478
  }
479
  }
@@ -548,6 +555,8 @@ function nitropack_set_custom_expiration() {
548
  }
549
 
550
  function nitropack_print_beacon_script() {
 
 
551
  echo nitropack_get_beacon_script();
552
  }
553
 
@@ -1417,6 +1426,8 @@ function nitropack_handle_comment_post($commentID, $isApproved) {
1417
  }
1418
 
1419
  function nitropack_handle_post_transition($new, $old, $post) {
 
 
1420
  if (!get_option("nitropack-autoCachePurge", 1)) return;
1421
 
1422
  try {
@@ -1512,6 +1523,11 @@ function nitropack_handle_the_post($post) {
1512
  }
1513
  }
1514
 
 
 
 
 
 
1515
  function nitropack_get_taxonomies($post) {
1516
  $term_taxonomy_ids = array();
1517
  $taxonomies = get_object_taxonomies($post->post_type);
@@ -1549,7 +1565,9 @@ function nitropack_get_taxonomies_pre_update($post) {
1549
  }
1550
 
1551
  function nitropack_log_post_pre_update($postID) {
1552
- global $np_preUpdatePosts, $np_preUpdateTaxonomies;
 
 
1553
  $post = get_post($postID);
1554
  $np_preUpdatePosts[$postID] = $post;
1555
  $np_preUpdateTaxonomies[$postID] = nitropack_get_taxonomies($post);
@@ -1630,8 +1648,9 @@ function nitropack_verify_connect($siteId, $siteSecret) {
1630
  nitropack_json_and_exit(array("status" => "error", "message" => "Site ID and Site Secret cannot be empty"));
1631
  }
1632
 
1633
- $siteId = esc_attr($siteId);
1634
- $siteSecret = esc_attr($siteSecret);
 
1635
 
1636
  if (!nitropack_validate_site_id($siteId) || !nitropack_validate_site_secret($siteSecret)) {
1637
  nitropack_json_and_exit(array("status" => "error", "message" => "Invalid Site ID or Site Secret value"));
@@ -1931,7 +1950,9 @@ function nitropack_config_exists() {
1931
  function nitropack_get_site_config() {
1932
  $siteConfig = null;
1933
  $npConfig = nitropack_get_config();
1934
- $currentUrl = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
 
 
1935
  $matchLength = 0;
1936
 
1937
  if (stripos($currentUrl, "www.") === 0) {
@@ -2154,8 +2175,11 @@ function nitropack_handle_request($servedFrom = "unknown") {
2154
 
2155
  if ($nitro->hasLocalCache()) {
2156
  $cacheControlOverride = defined("NITROPACK_CACHE_CONTROL_OVERRIDE") ? NITROPACK_CACHE_CONTROL_OVERRIDE : NULL;
2157
- if (!$cacheControlOverride && !empty($siteConfig["hosting"]) && $siteConfig["hosting"] == "pagely") {
2158
  $cacheControlOverride = "public,max-age=30";
 
 
 
2159
  }
2160
 
2161
  if ($cacheControlOverride) {
14
  $np_loggedPurges = array();
15
  $np_loggedInvalidations = array();
16
  $np_sdkObjects = array();
17
+ $np_ignoreUpdatePostIDs = array();
18
  $np_integrationSetupEvent = "muplugins_loaded";
19
 
20
  function nitropack_is_logged_in() {
236
  foreach ($urls as $url) {
237
  $sanitizedUrl = nitropack_sanitize_url_input($url);
238
  if ($proxyPurgeOnly) {
239
+ if (null !== $nitro = get_nitropack_sdk($siteConfig["siteId"], $siteConfig["siteSecret"]) ) {
240
+ $nitro->purgeProxyCache($sanitizedUrl);
241
+ }
242
  do_action('nitropack_integration_purge_url', $sanitizedUrl);
243
  } else {
244
  nitropack_sdk_purge_local($sanitizedUrl);
246
  }
247
  } else {
248
  if ($proxyPurgeOnly) {
249
+ if (null !== $nitro = get_nitropack_sdk($siteConfig["siteId"], $siteConfig["siteSecret"]) ) {
250
+ $nitro->purgeProxyCache();
251
+ }
252
  do_action('nitropack_integration_purge_all');
253
  } else {
254
  nitropack_sdk_purge_local();
439
  } else {
440
  if (!isset($_GET["wpf_action"]) && nitropack_passes_cookie_requirements() && nitropack_passes_page_requirements()) {
441
  add_action('wp_footer', 'nitropack_print_beacon_script');
442
+ add_action('get_footer', 'nitropack_print_beacon_script');
443
 
444
  $active_plugins = apply_filters('active_plugins', get_option('active_plugins'));
445
  if (in_array('woocommerce-multilingual/wpml-woocommerce.php', $active_plugins, true) && (!isset($_COOKIE["np_wc_currency"]) || !isset($_COOKIE["np_wc_currency_language"]))) {
478
  }
479
  } else {
480
  header("X-Nitro-Disabled: 1");
481
+ if ((null !== $nitro = get_nitropack_sdk()) && !$nitro->isAllowedBrowser()) { // This clears any proxy cache when a proxy cached non-optimized request due to unsupported browser
482
+ add_action('wp_footer', 'nitropack_print_beacon_script');
483
+ add_action('get_footer', 'nitropack_print_beacon_script');
484
  }
485
  }
486
  }
555
  }
556
 
557
  function nitropack_print_beacon_script() {
558
+ if (defined("NITROPACK_BEACON_PRINTED")) return;
559
+ define("NITROPACK_BEACON_PRINTED", true);
560
  echo nitropack_get_beacon_script();
561
  }
562
 
1426
  }
1427
 
1428
  function nitropack_handle_post_transition($new, $old, $post) {
1429
+ global $np_ignoreUpdatePostIDs;
1430
+ if (!empty($post->ID) && in_array($post->ID, $np_ignoreUpdatePostIDs)) return;
1431
  if (!get_option("nitropack-autoCachePurge", 1)) return;
1432
 
1433
  try {
1523
  }
1524
  }
1525
 
1526
+ function nitropack_ignore_post_updates($postID) {
1527
+ global $np_ignoreUpdatePostIDs;
1528
+ $np_ignoreUpdatePostIDs[] = $postID;
1529
+ }
1530
+
1531
  function nitropack_get_taxonomies($post) {
1532
  $term_taxonomy_ids = array();
1533
  $taxonomies = get_object_taxonomies($post->post_type);
1565
  }
1566
 
1567
  function nitropack_log_post_pre_update($postID) {
1568
+ global $np_preUpdatePosts, $np_preUpdateTaxonomies, $np_ignoreUpdatePostIDs;
1569
+ if (in_array($postID, $np_ignoreUpdatePostIDs)) return;
1570
+
1571
  $post = get_post($postID);
1572
  $np_preUpdatePosts[$postID] = $post;
1573
  $np_preUpdateTaxonomies[$postID] = nitropack_get_taxonomies($post);
1648
  nitropack_json_and_exit(array("status" => "error", "message" => "Site ID and Site Secret cannot be empty"));
1649
  }
1650
 
1651
+ //remove tags and whitespaces
1652
+ $siteId = trim(esc_attr($siteId));
1653
+ $siteSecret = trim(esc_attr($siteSecret));
1654
 
1655
  if (!nitropack_validate_site_id($siteId) || !nitropack_validate_site_secret($siteSecret)) {
1656
  nitropack_json_and_exit(array("status" => "error", "message" => "Invalid Site ID or Site Secret value"));
1950
  function nitropack_get_site_config() {
1951
  $siteConfig = null;
1952
  $npConfig = nitropack_get_config();
1953
+ $host = !empty($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : "";
1954
+ $uri = !empty($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "";
1955
+ $currentUrl = $host . $uri;
1956
  $matchLength = 0;
1957
 
1958
  if (stripos($currentUrl, "www.") === 0) {
2175
 
2176
  if ($nitro->hasLocalCache()) {
2177
  $cacheControlOverride = defined("NITROPACK_CACHE_CONTROL_OVERRIDE") ? NITROPACK_CACHE_CONTROL_OVERRIDE : NULL;
2178
+ if (!$cacheControlOverride && !empty($siteConfig["hosting"]) && in_array($siteConfig["hosting"], array("pagely", "siteground")) ) {
2179
  $cacheControlOverride = "public,max-age=30";
2180
+ if ($siteConfig["hosting"] == "siteground") {
2181
+ header('X-Cache-Enabled: True');
2182
+ }
2183
  }
2184
 
2185
  if ($cacheControlOverride) {
integrations.php CHANGED
@@ -259,13 +259,17 @@ function nitropack_is_nginx_helper_active() {
259
 
260
  function nitropack_nginx_helper_purge_url($url) {
261
  global $nginx_purger;
262
- $nginx_purger->purge_url($url);
 
 
263
  return true;
264
  }
265
 
266
  function nitropack_nginx_helper_purge_all() {
267
  global $nginx_purger;
268
- $nginx_purger->purge_all();
 
 
269
  return true;
270
  }
271
 
259
 
260
  function nitropack_nginx_helper_purge_url($url) {
261
  global $nginx_purger;
262
+ if ($nginx_purger) {
263
+ $nginx_purger->purge_url($url);
264
+ }
265
  return true;
266
  }
267
 
268
  function nitropack_nginx_helper_purge_all() {
269
  global $nginx_purger;
270
+ if ($nginx_purger) {
271
+ $nginx_purger->purge_all();
272
+ }
273
  return true;
274
  }
275
 
main.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: NitroPack
4
- Plugin URI: https://nitropack.io/download/plugin/nitropack-for-wordpress
5
  Description: Everything you need for a fast website. Simple set up, easy to use, awesome support. Caching, Lazy Loading, Minification, Defer CSS/JS, CDN and more!
6
- Version: 1.3.19
7
  Author: NitroPack LLC
8
  Author URI: https://nitropack.io/
9
  License: GPL2
1
  <?php
2
  /*
3
  Plugin Name: NitroPack
4
+ Plugin URI: https://nitropack.io/platform/wordpress
5
  Description: Everything you need for a fast website. Simple set up, easy to use, awesome support. Caching, Lazy Loading, Minification, Defer CSS/JS, CDN and more!
6
+ Version: 1.4.0
7
  Author: NitroPack LLC
8
  Author URI: https://nitropack.io/
9
  License: GPL2
nitropack-sdk/vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit8fcbb1a5ffa2542d92b974779798cb81::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit3dcb0cd3b9802939155e959c3c6cfd5d::getLoader();
nitropack-sdk/vendor/composer/ClassLoader.php CHANGED
@@ -37,8 +37,8 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
@@ -60,7 +60,7 @@ class ClassLoader
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
63
- return call_user_func_array('array_merge', $this->prefixesPsr0);
64
  }
65
 
66
  return array();
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see https://www.php-fig.org/psr/psr-0/
41
+ * @see https://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
63
+ return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
64
  }
65
 
66
  return array();
nitropack-sdk/vendor/composer/InstalledVersions.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Composer;
4
+
5
+ use Composer\Semver\VersionParser;
6
+
7
+
8
+
9
+
10
+
11
+
12
+ class InstalledVersions
13
+ {
14
+ private static $installed = array (
15
+ 'root' =>
16
+ array (
17
+ 'pretty_version' => 'dev-master',
18
+ 'version' => 'dev-master',
19
+ 'aliases' =>
20
+ array (
21
+ ),
22
+ 'reference' => 'e50e27c8dfb5f2ad66e67c0f414ba8cd3ceacf66',
23
+ 'name' => 'nitropack/nitropackcloud-sdk',
24
+ ),
25
+ 'versions' =>
26
+ array (
27
+ 'nitropack/httpclient' =>
28
+ array (
29
+ 'pretty_version' => 'dev-master',
30
+ 'version' => 'dev-master',
31
+ 'aliases' =>
32
+ array (
33
+ 0 => '9999999-dev',
34
+ ),
35
+ 'reference' => 'b1e792a4e99279d5c5b12cb0a35921d90f0043c2',
36
+ ),
37
+ 'nitropack/nitropackcloud-sdk' =>
38
+ array (
39
+ 'pretty_version' => 'dev-master',
40
+ 'version' => 'dev-master',
41
+ 'aliases' =>
42
+ array (
43
+ ),
44
+ 'reference' => 'e50e27c8dfb5f2ad66e67c0f414ba8cd3ceacf66',
45
+ ),
46
+ 'nitropack/url' =>
47
+ array (
48
+ 'pretty_version' => 'dev-master',
49
+ 'version' => 'dev-master',
50
+ 'aliases' =>
51
+ array (
52
+ 0 => '9999999-dev',
53
+ ),
54
+ 'reference' => 'd10e616a333f5a5107137f88313c7ceba638c8a0',
55
+ ),
56
+ ),
57
+ );
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+ public static function getInstalledPackages()
66
+ {
67
+ return array_keys(self::$installed['versions']);
68
+ }
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ public static function isInstalled($packageName)
79
+ {
80
+ return isset(self::$installed['versions'][$packageName]);
81
+ }
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ public static function satisfies(VersionParser $parser, $packageName, $constraint)
97
+ {
98
+ $constraint = $parser->parseConstraints($constraint);
99
+ $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
100
+
101
+ return $provided->matches($constraint);
102
+ }
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+ public static function getVersionRanges($packageName)
114
+ {
115
+ if (!isset(self::$installed['versions'][$packageName])) {
116
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
117
+ }
118
+
119
+ $ranges = array();
120
+ if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
121
+ $ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
122
+ }
123
+ if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
124
+ $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
125
+ }
126
+ if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
127
+ $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
128
+ }
129
+ if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
130
+ $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
131
+ }
132
+
133
+ return implode(' || ', $ranges);
134
+ }
135
+
136
+
137
+
138
+
139
+
140
+ public static function getVersion($packageName)
141
+ {
142
+ if (!isset(self::$installed['versions'][$packageName])) {
143
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
144
+ }
145
+
146
+ if (!isset(self::$installed['versions'][$packageName]['version'])) {
147
+ return null;
148
+ }
149
+
150
+ return self::$installed['versions'][$packageName]['version'];
151
+ }
152
+
153
+
154
+
155
+
156
+
157
+ public static function getPrettyVersion($packageName)
158
+ {
159
+ if (!isset(self::$installed['versions'][$packageName])) {
160
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
161
+ }
162
+
163
+ if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
164
+ return null;
165
+ }
166
+
167
+ return self::$installed['versions'][$packageName]['pretty_version'];
168
+ }
169
+
170
+
171
+
172
+
173
+
174
+ public static function getReference($packageName)
175
+ {
176
+ if (!isset(self::$installed['versions'][$packageName])) {
177
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
178
+ }
179
+
180
+ if (!isset(self::$installed['versions'][$packageName]['reference'])) {
181
+ return null;
182
+ }
183
+
184
+ return self::$installed['versions'][$packageName]['reference'];
185
+ }
186
+
187
+
188
+
189
+
190
+
191
+ public static function getRootPackage()
192
+ {
193
+ return self::$installed['root'];
194
+ }
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+ public static function getRawData()
203
+ {
204
+ return self::$installed;
205
+ }
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ public static function reload($data)
226
+ {
227
+ self::$installed = $data;
228
+ }
229
+ }
nitropack-sdk/vendor/composer/autoload_classmap.php CHANGED
@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  );
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
  );
nitropack-sdk/vendor/composer/autoload_psr4.php CHANGED
@@ -7,5 +7,5 @@ $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
  'NitroPack\\SDK\\' => array($baseDir . '/NitroPack/SDK'),
10
- 'NitroPack\\' => array($vendorDir . '/nitropack/httpclient/src', $vendorDir . '/nitropack/url/src'),
11
  );
7
 
8
  return array(
9
  'NitroPack\\SDK\\' => array($baseDir . '/NitroPack/SDK'),
10
+ 'NitroPack\\' => array($vendorDir . '/nitropack/url/src', $vendorDir . '/nitropack/httpclient/src'),
11
  );
nitropack-sdk/vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit8fcbb1a5ffa2542d92b974779798cb81
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit8fcbb1a5ffa2542d92b974779798cb81
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit8fcbb1a5ffa2542d92b974779798cb81', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit8fcbb1a5ffa2542d92b974779798cb81', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
- require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInit8fcbb1a5ffa2542d92b974779798cb81::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit3dcb0cd3b9802939155e959c3c6cfd5d
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit3dcb0cd3b9802939155e959c3c6cfd5d', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit3dcb0cd3b9802939155e959c3c6cfd5d', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
+ require __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit3dcb0cd3b9802939155e959c3c6cfd5d::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
nitropack-sdk/vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit8fcbb1a5ffa2542d92b974779798cb81
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'N' =>
@@ -21,16 +21,21 @@ class ComposerStaticInit8fcbb1a5ffa2542d92b974779798cb81
21
  ),
22
  'NitroPack\\' =>
23
  array (
24
- 0 => __DIR__ . '/..' . '/nitropack/httpclient/src',
25
- 1 => __DIR__ . '/..' . '/nitropack/url/src',
26
  ),
27
  );
28
 
 
 
 
 
29
  public static function getInitializer(ClassLoader $loader)
30
  {
31
  return \Closure::bind(function () use ($loader) {
32
- $loader->prefixLengthsPsr4 = ComposerStaticInit8fcbb1a5ffa2542d92b974779798cb81::$prefixLengthsPsr4;
33
- $loader->prefixDirsPsr4 = ComposerStaticInit8fcbb1a5ffa2542d92b974779798cb81::$prefixDirsPsr4;
 
34
 
35
  }, null, ClassLoader::class);
36
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit3dcb0cd3b9802939155e959c3c6cfd5d
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'N' =>
21
  ),
22
  'NitroPack\\' =>
23
  array (
24
+ 0 => __DIR__ . '/..' . '/nitropack/url/src',
25
+ 1 => __DIR__ . '/..' . '/nitropack/httpclient/src',
26
  ),
27
  );
28
 
29
+ public static $classMap = array (
30
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
31
+ );
32
+
33
  public static function getInitializer(ClassLoader $loader)
34
  {
35
  return \Closure::bind(function () use ($loader) {
36
+ $loader->prefixLengthsPsr4 = ComposerStaticInit3dcb0cd3b9802939155e959c3c6cfd5d::$prefixLengthsPsr4;
37
+ $loader->prefixDirsPsr4 = ComposerStaticInit3dcb0cd3b9802939155e959c3c6cfd5d::$prefixDirsPsr4;
38
+ $loader->classMap = ComposerStaticInit3dcb0cd3b9802939155e959c3c6cfd5d::$classMap;
39
 
40
  }, null, ClassLoader::class);
41
  }
nitropack-sdk/vendor/composer/installed.json CHANGED
@@ -1,65 +1,93 @@
1
- [
2
- {
3
- "name": "nitropack/httpclient",
4
- "version": "dev-master",
5
- "version_normalized": "9999999-dev",
6
- "source": {
7
- "type": "git",
8
- "url": "git@bitbucket.org:nitropack/httpclient.git",
9
- "reference": "b1e792a4e99279d5c5b12cb0a35921d90f0043c2"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  },
11
- "require": {
12
- "nitropack/url": "dev-master"
13
- },
14
- "time": "2020-11-04T09:25:18+00:00",
15
- "type": "library",
16
- "installation-source": "source",
17
- "autoload": {
18
- "psr-4": {
19
- "NitroPack\\": "src/"
20
- }
21
- },
22
- "authors": [
23
- {
24
- "name": "Ivailo Hristov"
25
- }
26
- ],
27
- "description": "HttpClient library written in PHP, without relying on cURL nor url_fopen",
28
- "keywords": [
29
- "client",
30
- "http",
31
- "library",
32
- "php"
33
- ]
34
- },
35
- {
36
- "name": "nitropack/url",
37
- "version": "dev-master",
38
- "version_normalized": "9999999-dev",
39
- "source": {
40
- "type": "git",
41
- "url": "git@bitbucket.org:nitropack/url.git",
42
- "reference": "d10e616a333f5a5107137f88313c7ceba638c8a0"
43
- },
44
- "time": "2020-11-04T10:08:34+00:00",
45
- "type": "library",
46
- "installation-source": "source",
47
- "autoload": {
48
- "psr-4": {
49
- "NitroPack\\": "src/"
50
- }
51
- },
52
- "authors": [
53
- {
54
- "name": "Ivailo Hristov"
55
- }
56
- ],
57
- "description": "URL manipulation library",
58
- "keywords": [
59
- "library",
60
- "manipulation",
61
- "php",
62
- "url"
63
- ]
64
- }
65
- ]
1
+ {
2
+ "packages": [
3
+ {
4
+ "name": "nitropack/httpclient",
5
+ "version": "dev-master",
6
+ "version_normalized": "dev-master",
7
+ "source": {
8
+ "type": "git",
9
+ "url": "https://bitbucket.org/nitropack/httpclient.git",
10
+ "reference": "b1e792a4e99279d5c5b12cb0a35921d90f0043c2"
11
+ },
12
+ "dist": {
13
+ "type": "zip",
14
+ "url": "https://bitbucket.org/nitropack/httpclient/get/b1e792a4e99279d5c5b12cb0a35921d90f0043c2.zip",
15
+ "reference": "b1e792a4e99279d5c5b12cb0a35921d90f0043c2",
16
+ "shasum": ""
17
+ },
18
+ "require": {
19
+ "nitropack/url": "dev-master"
20
+ },
21
+ "time": "2020-11-04T09:25:18+00:00",
22
+ "default-branch": true,
23
+ "type": "library",
24
+ "installation-source": "source",
25
+ "autoload": {
26
+ "psr-4": {
27
+ "NitroPack\\": "src/"
28
+ }
29
+ },
30
+ "authors": [
31
+ {
32
+ "name": "Ivailo Hristov"
33
+ }
34
+ ],
35
+ "description": "HttpClient library written in PHP, without relying on cURL nor url_fopen",
36
+ "homepage": "https://bitbucket.org/nitropack/httpclient",
37
+ "keywords": [
38
+ "client",
39
+ "http",
40
+ "library",
41
+ "php"
42
+ ],
43
+ "support": {
44
+ "source": "https://bitbucket.org/nitropack/httpclient/src/b1e792a4e99279d5c5b12cb0a35921d90f0043c2/?at=master",
45
+ "issues": "https://bitbucket.org/nitropack/httpclient/issues"
46
+ },
47
+ "install-path": "../nitropack/httpclient"
48
  },
49
+ {
50
+ "name": "nitropack/url",
51
+ "version": "dev-master",
52
+ "version_normalized": "dev-master",
53
+ "source": {
54
+ "type": "git",
55
+ "url": "https://bitbucket.org/nitropack/url.git",
56
+ "reference": "d10e616a333f5a5107137f88313c7ceba638c8a0"
57
+ },
58
+ "dist": {
59
+ "type": "zip",
60
+ "url": "https://bitbucket.org/nitropack/url/get/d10e616a333f5a5107137f88313c7ceba638c8a0.zip",
61
+ "reference": "d10e616a333f5a5107137f88313c7ceba638c8a0",
62
+ "shasum": ""
63
+ },
64
+ "time": "2020-11-04T10:08:34+00:00",
65
+ "default-branch": true,
66
+ "type": "library",
67
+ "installation-source": "source",
68
+ "autoload": {
69
+ "psr-4": {
70
+ "NitroPack\\": "src/"
71
+ }
72
+ },
73
+ "authors": [
74
+ {
75
+ "name": "Ivailo Hristov"
76
+ }
77
+ ],
78
+ "description": "URL manipulation library",
79
+ "homepage": "https://bitbucket.org/nitropack/url",
80
+ "keywords": [
81
+ "library",
82
+ "manipulation",
83
+ "php",
84
+ "url"
85
+ ],
86
+ "support": {
87
+ "source": "https://bitbucket.org/nitropack/url/src/d10e616a333f5a5107137f88313c7ceba638c8a0/?at=master"
88
+ },
89
+ "install-path": "../nitropack/url"
90
+ }
91
+ ],
92
+ "dev": true
93
+ }
 
 
 
 
 
 
 
 
 
 
nitropack-sdk/vendor/composer/installed.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php return array (
2
+ 'root' =>
3
+ array (
4
+ 'pretty_version' => 'dev-master',
5
+ 'version' => 'dev-master',
6
+ 'aliases' =>
7
+ array (
8
+ ),
9
+ 'reference' => 'e50e27c8dfb5f2ad66e67c0f414ba8cd3ceacf66',
10
+ 'name' => 'nitropack/nitropackcloud-sdk',
11
+ ),
12
+ 'versions' =>
13
+ array (
14
+ 'nitropack/httpclient' =>
15
+ array (
16
+ 'pretty_version' => 'dev-master',
17
+ 'version' => 'dev-master',
18
+ 'aliases' =>
19
+ array (
20
+ 0 => '9999999-dev',
21
+ ),
22
+ 'reference' => 'b1e792a4e99279d5c5b12cb0a35921d90f0043c2',
23
+ ),
24
+ 'nitropack/nitropackcloud-sdk' =>
25
+ array (
26
+ 'pretty_version' => 'dev-master',
27
+ 'version' => 'dev-master',
28
+ 'aliases' =>
29
+ array (
30
+ ),
31
+ 'reference' => 'e50e27c8dfb5f2ad66e67c0f414ba8cd3ceacf66',
32
+ ),
33
+ 'nitropack/url' =>
34
+ array (
35
+ 'pretty_version' => 'dev-master',
36
+ 'version' => 'dev-master',
37
+ 'aliases' =>
38
+ array (
39
+ 0 => '9999999-dev',
40
+ ),
41
+ 'reference' => 'd10e616a333f5a5107137f88313c7ceba638c8a0',
42
+ ),
43
+ ),
44
+ );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: cache,perfomance,optimize,pagespeed,lazy load,cdn,critical css,compression
4
  Requires at least: 4.7
5
  Tested up to: 5.5
6
  Requires PHP: 5.3
7
- Stable tag: trunk
8
  License: GNU General Public License, version 2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -169,6 +169,17 @@ No. We’ve designed NitroPack to be a very lightweight solution that adds no CP
169
 
170
  == Changelog ==
171
 
 
 
 
 
 
 
 
 
 
 
 
172
  = 1.3.19 =
173
  * Improvement: Stability improvements
174
 
4
  Requires at least: 4.7
5
  Tested up to: 5.5
6
  Requires PHP: 5.3
7
+ Stable tag: 1.4.0
8
  License: GNU General Public License, version 2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
169
 
170
  == Changelog ==
171
 
172
+ = 1.4.0 =
173
+ * New feature: Extended WP-CLI compatibility with ability to purge/invalidate by URL or tag
174
+ * New feature: Add a method for dynamically preventing automated purge/invalidate
175
+ * Improvement: Compatibility with jQuery 3
176
+ * Improvement: Better compatibility with SiteGround's dynamic cache layer
177
+ * Improvement: Overall stability improvements
178
+ * Bug fix: Resolve an issue with undefined HTTP_HOST key
179
+
180
+ = 1.3.20 =
181
+ * Bug fix: Resolve an issue with reverse proxy cache purge through the webhook
182
+
183
  = 1.3.19 =
184
  * Improvement: Stability improvements
185
 
view/admin.php CHANGED
@@ -12,7 +12,7 @@
12
  <li><a class="nav-tab" href="#help" data-toggle="tab">Help</a></li>
13
  <li><a class="nav-tab" href="#diag" data-toggle="tab">Diagnostics</a></li>
14
  </ul>
15
- <div class="tab-content">
16
  <div id="dashboard" class="tab-pane hidden">
17
  <?php require_once "dashboard.php"; ?>
18
  </div>
@@ -85,7 +85,7 @@
85
  };
86
  }
87
 
88
- $(window).load(_ => {
89
  //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
90
  $('link[href*="jobcareer"').remove();
91
  $('link[href*="jobhunt"').remove();
12
  <li><a class="nav-tab" href="#help" data-toggle="tab">Help</a></li>
13
  <li><a class="nav-tab" href="#diag" data-toggle="tab">Diagnostics</a></li>
14
  </ul>
15
+ <div class="tab-content" style="display:block">
16
  <div id="dashboard" class="tab-pane hidden">
17
  <?php require_once "dashboard.php"; ?>
18
  </div>
85
  };
86
  }
87
 
88
+ $(window).on("load", _ => {
89
  //Remove styles from jobcareer and jobhunt plugins since they break our layout. They should not be loaded on our options page anyway.
90
  $('link[href*="jobcareer"').remove();
91
  $('link[href*="jobhunt"').remove();
view/dashboard.php CHANGED
@@ -207,7 +207,7 @@
207
  ($ => {
208
  var getOptimizationsTimeout = null;
209
 
210
- $(window).load(function() {
211
  $("#optimizations-widget").cardOverlay("loading", {message: "Loading optimizations data"});
212
  $("#plan-details-widget").cardOverlay("loading", {message: "Loading plan data"});
213
  $("#quicksetup-widget").cardOverlay("loading", {message: "Loading settings"});
207
  ($ => {
208
  var getOptimizationsTimeout = null;
209
 
210
+ $(window).on("load",function() {
211
  $("#optimizations-widget").cardOverlay("loading", {message: "Loading optimizations data"});
212
  $("#plan-details-widget").cardOverlay("loading", {message: "Loading plan data"});
213
  $("#quicksetup-widget").cardOverlay("loading", {message: "Loading settings"});
view/diag.php CHANGED
@@ -18,12 +18,12 @@
18
  </span>
19
  </li>
20
  <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
21
- <span id="loading-pligins-status">
22
  Include actve plugins list
23
  </span>
24
- <span id="active-pligins-toggle">
25
- <label id="active-pligins-slider" class="switch">
26
- <input type="checkbox" class="diagnostic-option" id="active-pligins-status" checked>
27
  <span class="slider"></span>
28
  </label>
29
  </span>
@@ -77,7 +77,7 @@
77
  <script>
78
  /*
79
  var toggled01 = {"general-info-status":document.getElementById("general-info-status").checked ,
80
- "active-pligins-status":document.getElementById("active-pligins-status").checked ,
81
  "user-config-status":document.getElementById("user-config-status").checked ,
82
  "dir-info-status":document.getElementById("dir-info-status").checked
83
  };function() {
@@ -98,7 +98,7 @@
98
  action: 'nitropack_generate_report',
99
  toggled: {
100
  "general-info-status": $("#general-info-status:checked").length,
101
- "active-pligins-status": $("#active-pligins-status:checked").length,
102
  "conflicting-plugins-status": $("#conflicting-plugins-status:checked").length,
103
  "user-config-status": $("#user-config-status:checked").length,
104
  "dir-info-status": $("#dir-info-status:checked").length
18
  </span>
19
  </li>
20
  <li class="list-group-item px-0 d-flex justify-content-between align-items-center">
21
+ <span id="loading-plugins-status">
22
  Include actve plugins list
23
  </span>
24
+ <span id="active-plugins-toggle">
25
+ <label id="active-plugins-slider" class="switch">
26
+ <input type="checkbox" class="diagnostic-option" id="active-plugins-status" checked>
27
  <span class="slider"></span>
28
  </label>
29
  </span>
77
  <script>
78
  /*
79
  var toggled01 = {"general-info-status":document.getElementById("general-info-status").checked ,
80
+ "active-plugins-status":document.getElementById("active-plugins-status").checked ,
81
  "user-config-status":document.getElementById("user-config-status").checked ,
82
  "dir-info-status":document.getElementById("dir-info-status").checked
83
  };function() {
98
  action: 'nitropack_generate_report',
99
  toggled: {
100
  "general-info-status": $("#general-info-status:checked").length,
101
+ "active-plugins-status": $("#active-plugins-status:checked").length,
102
  "conflicting-plugins-status": $("#conflicting-plugins-status:checked").length,
103
  "user-config-status": $("#user-config-status:checked").length,
104
  "dir-info-status": $("#dir-info-status:checked").length
view/javascript/admin_bar_menu.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(window).load(_ => {
2
 
3
  function clearCacheSingleHandler(clearCacheAction, elem) {
4
  jQuery.ajax({
1
+ jQuery(window).on("load", _ => {
2
 
3
  function clearCacheSingleHandler(clearCacheAction, elem) {
4
  jQuery.ajax({
wp-cli.php CHANGED
@@ -45,7 +45,14 @@ function nitropack_cli_disconnect($args, $assocArgs) {
45
  */
46
 
47
  function nitropack_cli_purge($args, $assocArgs) {
48
- nitropack_purge_cache();
 
 
 
 
 
 
 
49
  }
50
 
51
  /**
@@ -57,7 +64,14 @@ function nitropack_cli_purge($args, $assocArgs) {
57
  */
58
 
59
  function nitropack_cli_invalidate($args, $assocArgs) {
60
- nitropack_invalidate_cache();
 
 
 
 
 
 
 
61
  }
62
 
63
  /**
45
  */
46
 
47
  function nitropack_cli_purge($args, $assocArgs) {
48
+ $url = !empty($assocArgs["purge-url"]) ? $assocArgs["purge-url"] : NULL;
49
+ $tag = !empty($assocArgs["purge-tag"]) ? $assocArgs["purge-tag"] : NULL;
50
+ $reason = !empty($assocArgs["purge-reason"]) ? $assocArgs["purge-reason"] : NULL;
51
+ if ($url || $tag || $reason) {
52
+ nitropack_purge($url, $tag, $reason);
53
+ } else {
54
+ nitropack_purge_cache();
55
+ }
56
  }
57
 
58
  /**
64
  */
65
 
66
  function nitropack_cli_invalidate($args, $assocArgs) {
67
+ $url = !empty($assocArgs["purge-url"]) ? $assocArgs["purge-url"] : NULL;
68
+ $tag = !empty($assocArgs["purge-tag"]) ? $assocArgs["purge-tag"] : NULL;
69
+ $reason = !empty($assocArgs["purge-reason"]) ? $assocArgs["purge-reason"] : NULL;
70
+ if ($url || $tag || $reason) {
71
+ nitropack_invalidate($url, $tag, $reason);
72
+ } else {
73
+ nitropack_invalidate_cache();
74
+ }
75
  }
76
 
77
  /**