Varnish HTTP Purge - Version 4.7.0

Version Description

  • October 2018
  • WP-CLI: documentation
  • Bugfix: Nginx compatibility
  • Bugfix: Only enqueue CSS on front0end if the admin bar is used (props @mathieuhays)
  • Feature: Rebranding
  • Deprecation: "Right Now" button (not needed anymore)

=

Download this release

Release Info

Developer Ipstenu
Plugin Icon 128x128 Varnish HTTP Purge
Version 4.7.0
Comparing to
See all releases

Code changes from version 4.6.6 to 4.7.0

Files changed (7) hide show
  1. changelog.txt +83 -39
  2. debug.php +16 -10
  3. readme.txt +41 -77
  4. settings.php +29 -29
  5. style.css +4 -3
  6. varnish-http-purge.php +12 -51
  7. wp-cli.php +1 -1
changelog.txt CHANGED
@@ -1,6 +1,50 @@
1
  ## CHANGELOG
2
 
3
- === 4.5.1 ===
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  * June 2018
5
  * Due to contention (devs hate it, users like it) the empty cache button colour on the toolbar is removed, and replaced with a carrot icon (I did not make it orange, but I wanted to)
6
  * Add carrot icon to collapsed (mobile) toolbar
@@ -8,30 +52,30 @@
8
  * Fixed a stupid argument issue with flushing memcached and I should have known better but oh well
9
  * FAQ update re nginx
10
 
11
- === 4.5.0 ===
12
  * May 2018
13
  * Remote storage of problem plugins/themes
14
  * Prevent auto-loading of scan for improved disclosure and compliance
15
  * Changed colour of the purge button for improved visibility
16
  * Support for nginx proxy headers
17
 
18
- === 4.4.0 ===
19
  * March 2018
20
  * Improve translations
21
  * Massive improvements to the debugging tools
22
  * Allow for port to be added to host headers (props @davidbarratt)
23
  * WP-CLI for debugging
24
 
25
- === 4.3.1 ===
26
  * 10 October 2017
27
  * Copied a wrong line.
28
 
29
- === 4.3.0 ===
30
  * 10 October 2017
31
  * Add Varnish Flush for "this" page on front end
32
  * Do not flush non-public taxonomies
33
 
34
- === 4.2.0 ===
35
  * 30 August 2017
36
  * More flexible support for custom cat/tag bases
37
  * Added in support for custom taxonomies
@@ -39,13 +83,13 @@
39
  * Move right now box to be called later, preventing double calls
40
  * Extra check for if it's a URL, because some plugins are weird (props @danielkun)
41
 
42
- === 4.1.1 ===
43
 
44
  * JSON - fixed overzealous json assumptions from causing errors
45
  * WP-CLI - fixed prepending of domain on domain when using purge on a domain (props @ocean90)
46
  * Typos. We hate them.
47
 
48
- === 4.1 ===
49
 
50
  * JSON / REST API Support
51
  * Fix for Varnish Status Page on MAMP (props @jeremyclarke)
@@ -54,24 +98,24 @@
54
  * Drop support for pre 4.7 because of JSON / REST API
55
  * Support flushing cache for private pages
56
 
57
- === 4.0.3 ===
58
  * Better explanation when Cloudflare gets in the way of DNS
59
  * Rename flush button for people who don't speak Varnish
60
 
61
- === 4.0.2 ===
62
  * Support for WP-CLI commands and PHP > 5.5 (though please upgrade, props @robertpeake)
63
  * Better information regarding Cloudflare
64
  * Better failure on domains for scanner
65
  * Better IP detection
66
  * Break apart settings for faster saving
67
 
68
- === 4.0.1 ===
69
  * Fix typo (on -> one)
70
  * Correct permissions on Multisite (props @phh - resolves #27 #28)
71
  * Correct weird merge error (props @phh - resolves #25 #26)
72
  * Fix formatting in Changelog
73
 
74
- === 4.0 ===
75
  * Added Varnish Status Page - Tools -> Varnish Status (includes basic scanning etc)
76
  * Allow filter for `home_url()`
77
  * Update readme with list of filters.
@@ -82,17 +126,17 @@
82
  * Purge 'default' AMP URL as well
83
  * Cleanup on Uninstall
84
 
85
- === 3.9.3 ===
86
  * Update Documentation and Readme
87
 
88
- === 3.9.2 ===
89
  * Change purge notice so it can be dismissed.
90
  * Fix purging of deleted posts.
91
 
92
- === 3.9.1 ===
93
  * Fixing i18n which wasn't working and threw a stupid error on sites without pretty permalinks. (Props DH customer Rasmus and employee Heckman!)
94
 
95
- === 3.9 ===
96
  * Retain query params on purge
97
  * Do not use query part for regex purging [Credit: shaula](https://github.com/Ipstenu/varnish-http-purge/pull/18)
98
  * Allow Varnish IP to be filtered. [Credit: floatingio](https://wordpress.org/support/topic/supply-varnish-ip-via-filter)
@@ -100,91 +144,91 @@
100
  * Add filter so other plugins can add events to trigger purge when they have no post ID
101
  * Add compatibility with [Autoptimize](https://wordpress.org/plugins/autoptimize/) so it flushes Varnish when you flush their cache
102
 
103
- === 3.8 ===
104
  * Add varnish_http_purge_events filter to allow people to add their own events for purging. (props @norcross)
105
  * Add a method to grab the response from purge request and pass to the 'after_purge_url' action for debugging. (props @shaula)
106
  * Added wp-cli command: wp varnish purge (to purge varnish)
107
  * Adding some docblocks
108
  * Fixing i18n
109
 
110
- === 3.7.3 ===
111
  * Add varnish_http_purge_schema filter for changing the default schema. The default remains http (even if you set your home and/or site URL to https) because of sanity, but in order to support some edge cases, they can filter if they want. (props Drumba)
112
 
113
- === 3.7.2 ===
114
  * Revisions were being mishandled and purging all inappropriately. (props Cha0sgr)
115
 
116
- === 3.7.1 ===
117
  * Archives weren't purging. (props Ingraye)
118
 
119
- === 3.7 ===
120
  * Optimizing flushes.
121
  * Add filter to allow other people to hook in when 3rd party plugins are abjectly weird (props jnachtigall)
122
 
123
- === 3.6 ===
124
  * Making purge be http only, since Varnish doesn't support https. This will prevent other issues for people using SSL with Varnish (though goodness knows why...)
125
  * Forcing backslash on home_url. Why WP doesn't, I have no idea, but this will help sites not running regex.
126
 
127
- === 3.5.1 ===
128
  * Language fix
129
  * Using add_query_arg
130
  * Ignore revisions
131
 
132
- === 3.5 ===
133
  * Isset wrap for URL path and query which may not be set in rare conditions (props <a href="https://wordpress.org/support/topic/undefined-index-notices-4">hsz</a>)
134
  * Added in flushing for feeds (requested by <a href="https://wordpress.org/support/topic/feed-not-purged">heypete</a>)
135
 
136
- === 3.4 ===
137
  * Multisite support
138
  * Button in toolbar
139
  * Fix define message in debug mode
140
  * Better parsing for if you set the define in the DB or config.
141
 
142
- === 3.3.4 ===
143
  * Rollback. Sorry.
144
 
145
- === 3.3.3 ===
146
  * Per request of Jetpack team, added in a <code>wp_cache_flush()</code> call when manually purging. This should only impact server side PHP caches (APC, Memcached etc)
147
 
148
- === 3.3.2 ===
149
  * Varnish IP was too persnickity in PHP 5.4 (added in an 'and if not null' check - props <a href="http://wordpress.org/support/topic/patch-a-little-patch-to-purge-on-comment-posting">colinleroy</a>)
150
 
151
- === 3.3.1 ===
152
  * Language Pack fixing.
153
 
154
- === 3.3 ===
155
  * Quick and dirty fix for a plugin that is causing the URLs to purge <em>ALL THE TIME</em>
156
 
157
- === 3.2 ===
158
  * Correcting conflict with host's default config.
159
 
160
- === 3.1 ===
161
  * Refactoring Cleanup (otherwise known as Copy/Pasta error in variable name). (props Shredder)
162
 
163
- === 3.0 ===
164
  * Adds 'Purge Varnish' button
165
  * More selective purging, to account for different server setups
166
  * Tighened up what purges and when
167
  * Flushing categories and tags (per code from WP Super Cache, thanks!)
168
  * Clarify requirements (Varnish and Pretty Permalinks)
169
 
170
- === 2.3 ===
171
  * Purge images on deletion
172
  * Fix for a VarnishIP when behind proxy servers not working on all hosts (props Berler)
173
 
174
- === 2.2.1 ===
175
  * typo (hit . instead of / - Props John B. Manos)
176
 
177
- === 2.2 ===
178
  * Added in workaround for Varnish purge reqs going AWOL when another proxy server is in place. (props to Shredder and Berler)
179
  * Cache flushes when you change themes
180
 
181
- === 2.1 ===
182
  * Header Image
183
 
184
- === 2.0 ===
185
  * Commit access handed to Ipstenu
186
  * Changed CURL to wp_remote_request (thank you <a href="http://wordpress.org/support/topic/incompatability-with-editorial-calendar-plugin?replies=1">Kenn Wilson</a>) so we don't have to do <a href="http://wordpress.org/support/topic/plugin-varnish-http-purge-incompatibility-with-woocommerce?replies=6">CURLOPT_RETURNTRANSFER</a> Remember kids, CURL is okay, but wp_remote_request is more better.
187
 
188
- === 1.2.0 ===
189
  * Moved actual request execution to "shutdown" event
190
  * Removed GET request due to bad performance impact
1
  ## CHANGELOG
2
 
3
+ = 4.6.6 =
4
+ * September 2018
5
+ * Bugfix to allow Nginx proxy to flush individual pages.
6
+
7
+ = 4.6.5 =
8
+ * September 2018
9
+ * Bugfix to correct footer output. :facepalm: No broken functionality.
10
+
11
+ = 4.6.4 =
12
+
13
+ * September 2018
14
+ * Remove query variables from URLs to prevent URLs from being flushed more than once per update
15
+ * More selective loading of AMP urls
16
+
17
+ = 4.6.3 =
18
+
19
+ * August 2018
20
+ * Deprecated function support
21
+
22
+ = 4.6.2 =
23
+
24
+ * July 2018
25
+ * Fixing some translation output.
26
+ * Multisite fixes for settings pages.
27
+
28
+ = 4.6.1 =
29
+
30
+ * July 2018
31
+ * Fix situation where purging wasn't (props @carlalexander)
32
+
33
+ = 4.6.0 =
34
+
35
+ * July 2018
36
+ * Moved Varnish to it's own menu with a new custom icon (props Olesya)
37
+ * Add option to enable development for 24 hours (for super-admins only)
38
+ * Change debug mode to development mode and greatly improved overall
39
+ * Translation improvements
40
+ * Add new action hook for after a full purge (props @futtta)
41
+ * Change check for age-header to not require a second run (props @danielbachhuber)
42
+ * Confirm plugin and theme blacklist check (props @danielbachhuber)
43
+ * WP-CLI: add debug option to show all header output (props @danielbachhuber)
44
+ * WP-CLI: add debug option to grep content for known issues (props @danielbachhuber)
45
+ * WP-CLI: add new command to change devmode state
46
+
47
+ = 4.5.1 =
48
  * June 2018
49
  * Due to contention (devs hate it, users like it) the empty cache button colour on the toolbar is removed, and replaced with a carrot icon (I did not make it orange, but I wanted to)
50
  * Add carrot icon to collapsed (mobile) toolbar
52
  * Fixed a stupid argument issue with flushing memcached and I should have known better but oh well
53
  * FAQ update re nginx
54
 
55
+ = 4.5.0 =
56
  * May 2018
57
  * Remote storage of problem plugins/themes
58
  * Prevent auto-loading of scan for improved disclosure and compliance
59
  * Changed colour of the purge button for improved visibility
60
  * Support for nginx proxy headers
61
 
62
+ = 4.4.0 =
63
  * March 2018
64
  * Improve translations
65
  * Massive improvements to the debugging tools
66
  * Allow for port to be added to host headers (props @davidbarratt)
67
  * WP-CLI for debugging
68
 
69
+ = 4.3.1 =
70
  * 10 October 2017
71
  * Copied a wrong line.
72
 
73
+ = 4.3.0 =
74
  * 10 October 2017
75
  * Add Varnish Flush for "this" page on front end
76
  * Do not flush non-public taxonomies
77
 
78
+ = 4.2.0 =
79
  * 30 August 2017
80
  * More flexible support for custom cat/tag bases
81
  * Added in support for custom taxonomies
83
  * Move right now box to be called later, preventing double calls
84
  * Extra check for if it's a URL, because some plugins are weird (props @danielkun)
85
 
86
+ = 4.1.1 =
87
 
88
  * JSON - fixed overzealous json assumptions from causing errors
89
  * WP-CLI - fixed prepending of domain on domain when using purge on a domain (props @ocean90)
90
  * Typos. We hate them.
91
 
92
+ = 4.1 =
93
 
94
  * JSON / REST API Support
95
  * Fix for Varnish Status Page on MAMP (props @jeremyclarke)
98
  * Drop support for pre 4.7 because of JSON / REST API
99
  * Support flushing cache for private pages
100
 
101
+ = 4.0.3 =
102
  * Better explanation when Cloudflare gets in the way of DNS
103
  * Rename flush button for people who don't speak Varnish
104
 
105
+ = 4.0.2 =
106
  * Support for WP-CLI commands and PHP > 5.5 (though please upgrade, props @robertpeake)
107
  * Better information regarding Cloudflare
108
  * Better failure on domains for scanner
109
  * Better IP detection
110
  * Break apart settings for faster saving
111
 
112
+ = 4.0.1 =
113
  * Fix typo (on -> one)
114
  * Correct permissions on Multisite (props @phh - resolves #27 #28)
115
  * Correct weird merge error (props @phh - resolves #25 #26)
116
  * Fix formatting in Changelog
117
 
118
+ = 4.0 =
119
  * Added Varnish Status Page - Tools -> Varnish Status (includes basic scanning etc)
120
  * Allow filter for `home_url()`
121
  * Update readme with list of filters.
126
  * Purge 'default' AMP URL as well
127
  * Cleanup on Uninstall
128
 
129
+ = 3.9.3 =
130
  * Update Documentation and Readme
131
 
132
+ = 3.9.2 =
133
  * Change purge notice so it can be dismissed.
134
  * Fix purging of deleted posts.
135
 
136
+ = 3.9.1 =
137
  * Fixing i18n which wasn't working and threw a stupid error on sites without pretty permalinks. (Props DH customer Rasmus and employee Heckman!)
138
 
139
+ = 3.9 =
140
  * Retain query params on purge
141
  * Do not use query part for regex purging [Credit: shaula](https://github.com/Ipstenu/varnish-http-purge/pull/18)
142
  * Allow Varnish IP to be filtered. [Credit: floatingio](https://wordpress.org/support/topic/supply-varnish-ip-via-filter)
144
  * Add filter so other plugins can add events to trigger purge when they have no post ID
145
  * Add compatibility with [Autoptimize](https://wordpress.org/plugins/autoptimize/) so it flushes Varnish when you flush their cache
146
 
147
+ = 3.8 =
148
  * Add varnish_http_purge_events filter to allow people to add their own events for purging. (props @norcross)
149
  * Add a method to grab the response from purge request and pass to the 'after_purge_url' action for debugging. (props @shaula)
150
  * Added wp-cli command: wp varnish purge (to purge varnish)
151
  * Adding some docblocks
152
  * Fixing i18n
153
 
154
+ = 3.7.3 =
155
  * Add varnish_http_purge_schema filter for changing the default schema. The default remains http (even if you set your home and/or site URL to https) because of sanity, but in order to support some edge cases, they can filter if they want. (props Drumba)
156
 
157
+ = 3.7.2 =
158
  * Revisions were being mishandled and purging all inappropriately. (props Cha0sgr)
159
 
160
+ = 3.7.1 =
161
  * Archives weren't purging. (props Ingraye)
162
 
163
+ = 3.7 =
164
  * Optimizing flushes.
165
  * Add filter to allow other people to hook in when 3rd party plugins are abjectly weird (props jnachtigall)
166
 
167
+ = 3.6 =
168
  * Making purge be http only, since Varnish doesn't support https. This will prevent other issues for people using SSL with Varnish (though goodness knows why...)
169
  * Forcing backslash on home_url. Why WP doesn't, I have no idea, but this will help sites not running regex.
170
 
171
+ = 3.5.1 =
172
  * Language fix
173
  * Using add_query_arg
174
  * Ignore revisions
175
 
176
+ = 3.5 =
177
  * Isset wrap for URL path and query which may not be set in rare conditions (props <a href="https://wordpress.org/support/topic/undefined-index-notices-4">hsz</a>)
178
  * Added in flushing for feeds (requested by <a href="https://wordpress.org/support/topic/feed-not-purged">heypete</a>)
179
 
180
+ = 3.4 =
181
  * Multisite support
182
  * Button in toolbar
183
  * Fix define message in debug mode
184
  * Better parsing for if you set the define in the DB or config.
185
 
186
+ = 3.3.4 =
187
  * Rollback. Sorry.
188
 
189
+ = 3.3.3 =
190
  * Per request of Jetpack team, added in a <code>wp_cache_flush()</code> call when manually purging. This should only impact server side PHP caches (APC, Memcached etc)
191
 
192
+ = 3.3.2 =
193
  * Varnish IP was too persnickity in PHP 5.4 (added in an 'and if not null' check - props <a href="http://wordpress.org/support/topic/patch-a-little-patch-to-purge-on-comment-posting">colinleroy</a>)
194
 
195
+ = 3.3.1 =
196
  * Language Pack fixing.
197
 
198
+ = 3.3 =
199
  * Quick and dirty fix for a plugin that is causing the URLs to purge <em>ALL THE TIME</em>
200
 
201
+ = 3.2 =
202
  * Correcting conflict with host's default config.
203
 
204
+ = 3.1 =
205
  * Refactoring Cleanup (otherwise known as Copy/Pasta error in variable name). (props Shredder)
206
 
207
+ = 3.0 =
208
  * Adds 'Purge Varnish' button
209
  * More selective purging, to account for different server setups
210
  * Tighened up what purges and when
211
  * Flushing categories and tags (per code from WP Super Cache, thanks!)
212
  * Clarify requirements (Varnish and Pretty Permalinks)
213
 
214
+ = 2.3 =
215
  * Purge images on deletion
216
  * Fix for a VarnishIP when behind proxy servers not working on all hosts (props Berler)
217
 
218
+ = 2.2.1 =
219
  * typo (hit . instead of / - Props John B. Manos)
220
 
221
+ = 2.2 =
222
  * Added in workaround for Varnish purge reqs going AWOL when another proxy server is in place. (props to Shredder and Berler)
223
  * Cache flushes when you change themes
224
 
225
+ = 2.1 =
226
  * Header Image
227
 
228
+ = 2.0 =
229
  * Commit access handed to Ipstenu
230
  * Changed CURL to wp_remote_request (thank you <a href="http://wordpress.org/support/topic/incompatability-with-editorial-calendar-plugin?replies=1">Kenn Wilson</a>) so we don't have to do <a href="http://wordpress.org/support/topic/plugin-varnish-http-purge-incompatibility-with-woocommerce?replies=6">CURLOPT_RETURNTRANSFER</a> Remember kids, CURL is okay, but wp_remote_request is more better.
231
 
232
+ = 1.2.0 =
233
  * Moved actual request execution to "shutdown" event
234
  * Removed GET request due to bad performance impact
debug.php CHANGED
@@ -258,8 +258,8 @@ class VarnishDebug {
258
 
259
  // Headers used by Nginx.
260
  $x_varn_hit = ( $x_varnish && strpos( $headers['X-Varnish'], 'HIT' ) !== false ) ? true : false;
261
- $x_age_nginx = ( $x_age && $x_date && strtotime( $headers['Age'] ) < strtotime( $headers['Date'] ) ) ? true : false;
262
- $x_pragma = ( isset( $headers['Pragma'] ) && strpos( $headers['Pragma'], 'no-cache' ) === false ) ? true : false;
263
 
264
  // Headers used ONLY by Apache/Varnish.
265
  $x_cachable = ( isset( $headers['X-Cacheable'] ) && strpos( $headers['X-Cacheable'], 'YES' ) !== false ) ? true : false;
@@ -281,7 +281,7 @@ class VarnishDebug {
281
  $cache_service = false;
282
  if ( $x_varnish && $x_nginx ) {
283
  $cache_service = __( 'Nginx', 'varnish-http-purge' );
284
- $still_cachable = ( $is_cachable && $x_pragma && $x_age_nginx && $x_varn_hit ) ? true : false;
285
  } elseif ( $x_varnish && ! $x_nginx ) {
286
  $cache_service = __( 'Varnish', 'varnish-http-purge' );
287
  $still_cachable = ( $is_cachable && $x_cachable && $x_age_vapc ) ? true : false;
@@ -328,10 +328,16 @@ class VarnishDebug {
328
  * @param mixed $varniship - Varnish IP.
329
  * @return array
330
  */
331
- public static function remote_ip_results( $remote_ip, $varniship ) {
332
- $return = false;
 
333
 
334
- if ( false === $remote_ip && ! empty( $varniship ) ) {
 
 
 
 
 
335
  $return = array(
336
  // translators: %s is an IP address.
337
  'message' => sprintf( __( 'Your Varnish IP address is set to %s but a proxy (like Cloudflare or Sucuri) has not been detected. This is mostly harmless, but if you have issues with your cache not emptying when you make a post, you may need to remove your Varnish IP. Please check with your webhost or server admin before doing so.', 'varnish-http-purge' ), $varniship ),
@@ -764,17 +770,17 @@ class VarnishDebug {
764
  if ( file_exists( plugin_dir_path( __DIR__ ) . $info->path ) ) {
765
  $message = $messages[ $info->reason ];
766
  $warning = 'notice';
767
- $status = __( 'Inactive', 'varnish-http-purge' );
768
 
769
  // If the plugin is inactive, change the warning.
770
  if ( is_plugin_active( $info->path ) ) {
771
  $warning = $info->type;
772
- $status = __( 'Active', 'varnish-http-purge' );
773
  }
774
 
775
  $return[ 'Plugin: ' . ucfirst( $plugin ) ] = array(
776
  'icon' => $warning,
777
- 'message' => $message . ' (' . $status . ')',
778
  );
779
  }
780
  }
@@ -817,7 +823,7 @@ class VarnishDebug {
817
 
818
  // Basic Checks.
819
  $output['Cache Service'] = self::varnish_results( $headers );
820
- $output['Remote IP'] = self::remote_ip_results( $remote_ip, $varniship );
821
 
822
  // Server Results.
823
  $server_results = self::server_results( $headers, $remote_ip, $varniship );
258
 
259
  // Headers used by Nginx.
260
  $x_varn_hit = ( $x_varnish && strpos( $headers['X-Varnish'], 'HIT' ) !== false ) ? true : false;
261
+ $x_age_nginx = ( $x_varn_hit || ( $x_age && $x_date && ( strtotime( $headers['Age'] ) < strtotime( $headers['Date'] ) ) ) ) ? true : false;
262
+ $x_pragma = ( ! isset( $headers['Pragma'] ) || ( isset( $headers['Pragma'] ) && strpos( $headers['Pragma'], 'no-cache' ) === false ) ) ? true : false;
263
 
264
  // Headers used ONLY by Apache/Varnish.
265
  $x_cachable = ( isset( $headers['X-Cacheable'] ) && strpos( $headers['X-Cacheable'], 'YES' ) !== false ) ? true : false;
281
  $cache_service = false;
282
  if ( $x_varnish && $x_nginx ) {
283
  $cache_service = __( 'Nginx', 'varnish-http-purge' );
284
+ $still_cachable = ( $is_cachable && $x_age_nginx && $x_varn_hit && $x_pragma ) ? true : false;
285
  } elseif ( $x_varnish && ! $x_nginx ) {
286
  $cache_service = __( 'Varnish', 'varnish-http-purge' );
287
  $still_cachable = ( $is_cachable && $x_cachable && $x_age_vapc ) ? true : false;
328
  * @param mixed $varniship - Varnish IP.
329
  * @return array
330
  */
331
+ public static function remote_ip_results( $remote_ip, $varniship, $headers ) {
332
+ $return = false;
333
+ $x_nginx = ( isset( $headers['server'] ) && ( strpos( $headers['server'], 'nginx' ) !== false || strpos( $headers['server'], 'openresty' ) !== false ) ) ? true : false;
334
 
335
+ if ( $x_nginx && 'localhost' === $varniship ) {
336
+ $return = array(
337
+ 'icon' => 'awesome',
338
+ 'message' => __( 'Your Nginx Proxy is set up correctly.', 'varnish-http-purge' ),
339
+ );
340
+ } elseif ( false === $remote_ip && ! empty( $varniship ) ) {
341
  $return = array(
342
  // translators: %s is an IP address.
343
  'message' => sprintf( __( 'Your Varnish IP address is set to %s but a proxy (like Cloudflare or Sucuri) has not been detected. This is mostly harmless, but if you have issues with your cache not emptying when you make a post, you may need to remove your Varnish IP. Please check with your webhost or server admin before doing so.', 'varnish-http-purge' ), $varniship ),
770
  if ( file_exists( plugin_dir_path( __DIR__ ) . $info->path ) ) {
771
  $message = $messages[ $info->reason ];
772
  $warning = 'notice';
773
+ $active = __( 'Inactive', 'varnish-http-purge' );
774
 
775
  // If the plugin is inactive, change the warning.
776
  if ( is_plugin_active( $info->path ) ) {
777
  $warning = $info->type;
778
+ $active = __( 'Active', 'varnish-http-purge' );
779
  }
780
 
781
  $return[ 'Plugin: ' . ucfirst( $plugin ) ] = array(
782
  'icon' => $warning,
783
+ 'message' => $message . ' (' . $active . ')',
784
  );
785
  }
786
  }
823
 
824
  // Basic Checks.
825
  $output['Cache Service'] = self::varnish_results( $headers );
826
+ $output['Remote IP'] = self::remote_ip_results( $remote_ip, $varniship, $headers );
827
 
828
  // Server Results.
829
  $server_results = self::server_results( $headers, $remote_ip, $varniship );
readme.txt CHANGED
@@ -1,22 +1,24 @@
1
- = Varnish HTTP Purge =
2
  Contributors: Ipstenu, mikeschroder, techpriester, danielbachhuber
3
- Tags: varnish, purge, cache
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
- Stable tag: 4.6.6
7
  Requires PHP: 5.6
8
 
9
- Automatically empty Varnish Cache when content on your site is modified.
10
 
11
  == Description ==
12
 
13
- <a href="https://www.varnish-cache.org/">Varnish</a> is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. This plugin <em>does not</em> install Varnish for you, nor will it configure Varnish for WordPress.
14
 
15
- The Varnish HTTP Purge plugin sends a request to delete (aka flush) the cached data of a page or post every time it it modified. This happens when updating, publishing, commenting on, or deleting an post, and when changing themes.
16
 
17
- In addition, it provides debugging tools to help you determine how effective your site setup is with Varnish. In order to provide the most up to date compatibility information, this tool contacts a service hosted on DreamObjects. [Public information about this service is available on DreamObjects](https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt). The service is <em>ONLY</em> accessed when using the Varnish Debugging tool to check if Caching is working properly.
18
 
19
- = How it Works =
 
 
20
 
21
  When content on a site is updated by WordPress, the plugin reaches out to the Varnish service with the URL of the page, requesting the cache be deleted.
22
 
@@ -31,11 +33,11 @@ Not all page are deleted from the cache on every change. For example, when a pos
31
  In addition, your <em>entire</em> cache will be deleted on the following actions:
32
 
33
  * Changing themes
34
- * Pressing the <strong>Empty Cache</strong> button on the dashboard or toolbar
35
 
36
  Plugins can hook into the purge actions as well, to filter their own events to trigger a purge.
37
 
38
- On a multisite network using subfolders, only <strong>network admins</strong> can purge the main site. This is a security decision, as emptying the cache too often can be computationally expensive and cause server outages for a network.
39
 
40
  = Development Mode =
41
 
@@ -56,16 +58,20 @@ That will break cache on page loads. It is _not_ recommended for production!
56
 
57
  By default, no data is tracked. If you use the site scanner/debugging tool, your domain and IP address will access [a remote service hosted on DreamObjects](https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt). No personally identifying transaction data is recorded or stored, only overall usage. IP addresses of the website making the request may be recorded by the service, but there is no way to access them and use it to correspond with individuals or processes.
58
 
59
- Use of this service is required for the cache checking in order to provide up to date compatibility checks on plugins and themes that may conflict with running a server based cache (such as Varnish or Nginx) without needing to update the plugin every day.
60
 
61
  == Installation ==
62
 
63
- No special instructions apply. If you have a 3rd party proxy service (such as Sucuri or Cloudflare) you will need to add a Varnish IP address on the <em>Varnish -> Settings</em> page.
 
 
 
 
64
 
65
  = Requirements =
66
 
67
  * Pretty Permalinks enabled
68
- * Varnish 3.x or higher
69
 
70
  == Frequently Asked Questions ==
71
 
@@ -79,11 +85,11 @@ No. This plugin tells your cache system when content is updated, and to delete t
79
 
80
  = Why doesn't the plugin automatically delete the whole cache? =
81
 
82
- By design, this plugin embraces decisions, not options, as well as simplicity. Emptying too much of a cache on every change can slow a server down. In addition, users generally want things to 'just work.' With that in mind, this plugin determines what's best to delete on updates, and provides hooks for developers to use as needed.
83
 
84
  = Can I delete the entire cache? =
85
 
86
- Yes! Click the 'Empty Cache' button on the "Right Now" Dashboard (see the screenshot if you can't find it). There's also an "Empty Cache" button on the admin toolbar.
87
 
88
  If you don't see a button, then your account doesn't have the appropriate permissions. Only administrators can empty the entire cache. In the case of a subfolder multisite network, only the <em>network</em> admins can empty the cache for the primary site.
89
 
@@ -97,16 +103,16 @@ No. Some of them have behaviour that causes Varnish not to cache, either by acci
97
 
98
  = I'm a developer, can I tell your cache to empty in my plugin/theme? =
99
 
100
- Yes! [Full documentation can be found on Custom Filters in the wiki](https://github.com/Ipstenu/varnish-http-purge/wiki/Custom-Filters).
101
 
102
  = Can I turn off caching? =
103
 
104
- The plugin itself does not perform caching, but you can use development mode to have WordPress tell Varnish not to serve cached content. In order to do this, you must enter development mode. There are three ways to do this:
105
-
106
- 1. Chose 'Pause Cache (24hrs)' from the Cache dropdown menu in your toolbar
107
 
108
- 2. Go to Varnish -> Settings and enable development mode
109
 
 
 
110
  3. Add `define( 'VHP_DEVMODE', true );` to your `wp-config.php` file
111
 
112
  The first two options will enable development mode for 24 hours. If you're working on long term development, you can should use the define.
@@ -119,7 +125,7 @@ Due to the damage this can cause a site, access is limited to admins only. In th
119
 
120
  = Why do I still see cached content in development mode? =
121
 
122
- Remember, the plugin isn't doing the caching itself. While development mode is on, your server will actually continue to cache content but WordPress will tell it not to use the cached content. That means files that exist outside of WordPress (like CSS or images) will still be cached and _may_ serve cached content. The plugin does its best to add a No Cache parameter to javascript and CSS, however if a theme or plugin _doesn't_ use proper WordPress enqueues, then their content will be shown cached.
123
 
124
  = How can I tell if everything's caching? =
125
 
@@ -143,7 +149,7 @@ If you want to use WP-CLI, you can set an option in the database. This will not
143
 
144
  = Why do I get a 503 or 504 error on every post update? =
145
 
146
- Your Varnish IP address is probably wrong. Check the IP of your server and then the setting for your Varnish IP. If they're _not_ the same, that's likely why.
147
 
148
  = How do I find my Varnish IP? =
149
 
@@ -152,7 +158,7 @@ Your Varnish IP must be one of the IPs that Varnish is listening on. If you use
152
  If your webhost set up Varnish, you may need to ask them for the specifics if they don't have it documented. I've listed the ones I know about here, however you should still check with them if you're not sure.
153
 
154
  <ul>
155
- <li><strong>DreamHost</strong> - If you're using DreamPress and Cloudflare, go into the Panel and click on the DNS settings for the domain. The entry for <em>resolve-to.domain</em> is your varnish server: `resolve-to.www A 208.97.157.172` -- If you're <em>NOT</em> using Cloudflare, you don't need it; it's just your normal IP.</li>
156
  </ul>
157
 
158
  = What if I have multiple varnish IPs? =
@@ -177,60 +183,24 @@ This is a question beyond the support of plugin. I do not have the resources ava
177
 
178
  = How can I see what the plugin is sending to Varnish? =
179
 
180
- Danger! Here be dragons! If you're command line savvy, you can monitor the interactions between the plugin and Varnish. This can help you understand what's not working quite right, but it can very confusing. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki#debugging).
181
 
182
- = Hey, don't you work at DreamHost? Is this Official or DreamHost only? =
183
 
184
- * Yes, I do work for DreamHost.
185
- * No, this plugin is not really official nor DreamHost Only
186
 
187
  This plugin is installed by default for _all_ DreamPress installs on DreamHost, and I maintain it for DreamHost, but it was not originally an official DreamHost plugin which means I will continue to support all users to the best of my ability.
188
 
189
  == Changelog ==
190
 
191
- = 4.6.6 =
192
- * September 2018
193
- * Bugfix to allow Nginx proxy to flush individual pages.
194
-
195
- = 4.6.5 =
196
- * September 2018
197
- * Bugfix to correct footer output. :facepalm: No broken functionality.
198
-
199
- = 4.6.4 =
200
-
201
- * September 2018
202
- * Remove query variables from URLs to prevent URLs from being flushed more than once per update
203
- * More selective loading of AMP urls
204
-
205
- = 4.6.3 =
206
-
207
- * August 2018
208
- * Deprecated function support
209
-
210
- = 4.6.2 =
211
-
212
- * July 2018
213
- * Fixing some translation output.
214
- * Multisite fixes for settings pages.
215
-
216
- = 4.6.1 =
217
-
218
- * July 2018
219
- * Fix situation where purging wasn't (props @carlalexander)
220
-
221
- = 4.6.0 =
222
-
223
- * July 2018
224
- * Moved Varnish to it's own menu with a new custom icon (props Olesya)
225
- * Add option to enable development for 24 hours (for super-admins only)
226
- * Change debug mode to development mode and greatly improved overall
227
- * Translation improvements
228
- * Add new action hook for after a full purge (props @futtta)
229
- * Change check for age-header to not require a second run (props @danielbachhuber)
230
- * Confirm plugin and theme blacklist check (props @danielbachhuber)
231
- * WP-CLI: add debug option to show all header output (props @danielbachhuber)
232
- * WP-CLI: add debug option to grep content for known issues (props @danielbachhuber)
233
- * WP-CLI: add new command to change devmode state
234
 
235
  == Screenshots ==
236
 
@@ -238,12 +208,6 @@ This plugin is installed by default for _all_ DreamPress installs on DreamHost,
238
  2. Toolbar menu (with cache enabled)
239
  3. Toolbar menu (with cache disabled)
240
  4. Scanner results
241
- 5. Change Varnish IP address
242
  6. Activate Dev Mode
243
  7. Dev Mode Warning (24 hour notice)
244
-
245
- == Upgrade Notice ==
246
-
247
- = 4.5.0 =
248
-
249
- As of this release, the Varnish debugger uses remote data to collect a list of cookies, plugins, and themes known to conflict with Varnish. This will reduce the need to update the plugin for informational changes only. [Public information about this service is available on DreamObjects](https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt).
1
+ = Proxy Cache Purge =
2
  Contributors: Ipstenu, mikeschroder, techpriester, danielbachhuber
3
+ Tags: proxy, purge, cache, varnish, nginx
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
+ Stable tag: 4.7.0
7
  Requires PHP: 5.6
8
 
9
+ Automatically empty proxy cached content when your site is modified.
10
 
11
  == Description ==
12
 
13
+ <strong>This plugin <em>does not</em> install nor configure a cache proxy. It acts as an interface with such services.</strong>
14
 
15
+ One common method of caching content for websites is via the use of reverse proxy caching. Common examples of this are <a href="https://www.varnish-cache.org/">Varnish</a> and <a href="https://www.nginx.com/">Nginx</a>. These systems allow a website to update content and have the visitor's experience cached without the need for complex plugins storing the files locally and using up a user's disk space.
16
 
17
+ A reverse proxy cache is installed in front of a server and reviews requests. If the page being requested is already cached, it delivers the cached content. Otherwise it generates the page and the cache on demand.
18
 
19
+ The Proxy Cache Purge plugin sends a request to delete (aka flush) the cached data of a page or post every time it it modified. This happens when updating, publishing, commenting on, or deleting an post, and when changing themes.
20
+
21
+ = How It Works =
22
 
23
  When content on a site is updated by WordPress, the plugin reaches out to the Varnish service with the URL of the page, requesting the cache be deleted.
24
 
33
  In addition, your <em>entire</em> cache will be deleted on the following actions:
34
 
35
  * Changing themes
36
+ * Pressing the <strong>Empty Cache</strong> button on the toolbar
37
 
38
  Plugins can hook into the purge actions as well, to filter their own events to trigger a purge.
39
 
40
+ On a multisite network using subfolders, only <strong>network admins</strong> can purge the main site.
41
 
42
  = Development Mode =
43
 
58
 
59
  By default, no data is tracked. If you use the site scanner/debugging tool, your domain and IP address will access [a remote service hosted on DreamObjects](https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt). No personally identifying transaction data is recorded or stored, only overall usage. IP addresses of the website making the request may be recorded by the service, but there is no way to access them and use it to correspond with individuals or processes.
60
 
61
+ Use of this service is required for the cache checking in order to provide up to date compatibility checks on plugins and themes that may conflict with running a server based cache without needing to update the plugin every day.
62
 
63
  == Installation ==
64
 
65
+ No special instructions apply.
66
+
67
+ If you have a 3rd party proxy service (such as Sucuri or Cloudflare) you will need to add a Varnish IP address on the <em>Proxy Cache -> Settings</em> page. Alternatively you can add a define to your `wp-config.php` file: `define('VHP_VARNISH_IP','123.45.67.89');`
68
+
69
+ When using Nginx based proxies, your IP will likely be `localhost`.
70
 
71
  = Requirements =
72
 
73
  * Pretty Permalinks enabled
74
+ * A server based proxy cache service
75
 
76
  == Frequently Asked Questions ==
77
 
85
 
86
  = Why doesn't the plugin automatically delete the whole cache? =
87
 
88
+ Speed and stability. Emptying too much of a cache on every change can slow a server down. This plugin does it's best to determine what needs to be deleted and when, while providing hooks for developers to use as necessary.
89
 
90
  = Can I delete the entire cache? =
91
 
92
+ Yes. Click the 'Empty Cache' button on the "Right Now" Dashboard (see the screenshot if you can't find it). There's also an "Empty Cache" button on the admin toolbar.
93
 
94
  If you don't see a button, then your account doesn't have the appropriate permissions. Only administrators can empty the entire cache. In the case of a subfolder multisite network, only the <em>network</em> admins can empty the cache for the primary site.
95
 
103
 
104
  = I'm a developer, can I tell your cache to empty in my plugin/theme? =
105
 
106
+ Yes. [Full documentation can be found on Custom Filters in the wiki](https://github.com/Ipstenu/varnish-http-purge/wiki/Custom-Filters).
107
 
108
  = Can I turn off caching? =
109
 
110
+ Kind of. You can use development mode to have WordPress tell your proxy service not to serve cached content, but the content will still be cached by the service.
 
 
111
 
112
+ There are three ways to do this:
113
 
114
+ 1. Chose 'Pause Cache (24hrs)' from the Cache dropdown menu in your toolbar
115
+ 2. Go to Proxy Cache -> Settings and enable development mode
116
  3. Add `define( 'VHP_DEVMODE', true );` to your `wp-config.php` file
117
 
118
  The first two options will enable development mode for 24 hours. If you're working on long term development, you can should use the define.
125
 
126
  = Why do I still see cached content in development mode? =
127
 
128
+ While development mode is on, your server will continue to cache content but the plugin will tell WordPress not to use the cached content. That means files that exist outside of WordPress (like CSS or images) _may_ serve cached content. The plugin does its best to add a No Cache parameter to javascript and CSS, however if a theme or plugin _doesn't_ use proper WordPress enqueues, then their cached content will be shown.
129
 
130
  = How can I tell if everything's caching? =
131
 
149
 
150
  = Why do I get a 503 or 504 error on every post update? =
151
 
152
+ Your Varnish IP address is incorrect. Check the IP of your server and then the setting for your Varnish IP. If they're _not_ the same, that's likely why.
153
 
154
  = How do I find my Varnish IP? =
155
 
158
  If your webhost set up Varnish, you may need to ask them for the specifics if they don't have it documented. I've listed the ones I know about here, however you should still check with them if you're not sure.
159
 
160
  <ul>
161
+ <li><strong>DreamHost</strong> - If you're using DreamPress and Cloudflare, go into the Panel and click on the DNS settings for the domain. The entry for <em>resolve-to.domain</em> is your server: `resolve-to.www A 208.97.157.172` -- If you're <em>NOT</em> using Cloudflare, you don't need it; it's just your normal IP. If you're on DreamPress' Nginx hosting, the ip is `localhost`.</li>
162
  </ul>
163
 
164
  = What if I have multiple varnish IPs? =
183
 
184
  = How can I see what the plugin is sending to Varnish? =
185
 
186
+ Yes _IF_ the service has an interface. Sadly Nginx doesn't. [Detailed directions can be found on the debugging section on GitHub](https://github.com/Ipstenu/varnish-http-purge/wiki#debugging). Bear in mind, these interfaces tend to be command-line only.
187
 
188
+ = Don't you work at DreamHost? Is this Official or DreamHost only? =
189
 
190
+ * Yes, I do work for DreamHost
191
+ * No, this plugin is not DreamHost Only
192
 
193
  This plugin is installed by default for _all_ DreamPress installs on DreamHost, and I maintain it for DreamHost, but it was not originally an official DreamHost plugin which means I will continue to support all users to the best of my ability.
194
 
195
  == Changelog ==
196
 
197
+ = 4.7.0 =
198
+ * October 2018
199
+ * WP-CLI: documentation
200
+ * Bugfix: Nginx compatibility
201
+ * Bugfix: Only enqueue CSS on front0end if the admin bar is used (props @mathieuhays)
202
+ * Feature: Rebranding
203
+ * Deprecation: "Right Now" button (not needed anymore)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
 
205
  == Screenshots ==
206
 
208
  2. Toolbar menu (with cache enabled)
209
  3. Toolbar menu (with cache disabled)
210
  4. Scanner results
211
+ 5. Change Proxy IP address
212
  6. Activate Dev Mode
213
  7. Dev Mode Warning (24 hour notice)
 
 
 
 
 
 
settings.php CHANGED
@@ -22,12 +22,11 @@ if ( ! defined( 'ABSPATH' ) ) {
22
  }
23
 
24
  /**
25
- * Varnish Status Class
26
  *
27
  * @since 4.0
28
  */
29
  class VarnishStatus {
30
-
31
  /**
32
  * Construct
33
  * Fires when class is constructed, adds init hook
@@ -56,8 +55,8 @@ class VarnishStatus {
56
  * @since 4.0
57
  */
58
  public function admin_menu() {
59
- add_menu_page( __( 'Varnish HTTP Purge', 'varnish-http-purge' ), __( 'Varnish', 'varnish-http-purge' ), 'manage_options', 'varnish-page', array( &$this, 'settings_page' ), VarnishPurger::get_icon_svg( true, '#82878c' ), 75 );
60
- add_submenu_page( 'varnish-page', __( 'Varnish HTTP Purge', 'varnish-http-purge' ), __( 'Settings', 'varnish-http-purge' ), 'manage_options', 'varnish-page', array( &$this, 'settings_page' ) );
61
  add_submenu_page( 'varnish-page', __( 'Check Caching', 'varnish-http-purge' ), __( 'Check Caching', 'varnish-http-purge' ), 'manage_options', 'varnish-check-caching', array( &$this, 'check_caching_page' ) );
62
  }
63
 
@@ -99,17 +98,19 @@ class VarnishStatus {
99
 
100
  $devmode = get_site_option( 'vhp_varnish_devmode', VarnishPurger::$devmode );
101
  $active = ( isset( $devmode['active'] ) ) ? $devmode['active'] : false;
 
102
  $expire = current_time( 'timestamp' ) + DAY_IN_SECONDS;
103
-
104
  ?>
105
  <input type="hidden" name="vhp_varnish_devmode[expire]" value="<?php $expire; ?>" />
106
- <input type="checkbox" name="vhp_varnish_devmode[active]" value="true" <?php checked( $active, true ); ?> />
107
  <label for="vhp_varnish_devmode['active']">
108
  <?php
109
- if ( $active && isset( $devmode['expire'] ) ) {
110
  $timestamp = date_i18n( get_site_option( 'date_format' ), $devmode['expire'] ) . ' @ ' . date_i18n( get_site_option( 'time_format' ), $devmode['expire'] );
111
  // translators: %s is the time (in hours) until Development Mode expires.
112
- echo sprintf( esc_html__( 'Development Mode is active until %s. After that, it will automatically disable the next time someone visits your site.', 'varnish-http-purge' ), esc_html( $timestamp ) );
 
 
113
  } else {
114
  esc_attr_e( 'Activate Development Mode', 'varnish-http-purge' );
115
  }
@@ -136,7 +137,7 @@ class VarnishStatus {
136
  } else {
137
  $output['active'] = ( isset( $input['active'] ) || $input['active'] ) ? true : false;
138
  $output['expire'] = ( isset( $input['expire'] ) && is_int( $input['expire'] ) ) ? $input['expire'] : $expire;
139
- $set_message = ( $output['active'] ) ? __( 'Development Mode activated for the next 24 hours', 'varnish-http-purge' ) : __( 'Development Mode dectivated', 'varnish-http-purge' );
140
  $set_type = 'updated';
141
  }
142
 
@@ -156,13 +157,10 @@ class VarnishStatus {
156
  */
157
  public function options_settings_ip() {
158
  ?>
159
- <p><a name="#configureip"></a><?php esc_html_e( 'There are cases when a custom Varnish IP Address will need to be set, in order to tell the plugin to empty the cache in a specific location. If you\'re using a CDN like Cloudflare or a Firewall Proxy like Sucuri, you will want to set this.', 'varnish-http-purge' ); ?></p>
160
- <p><?php esc_html_e( 'Your Varnish IP is the IP address of the server where your caching service (i.e. Varnish or Nginx) is installed. It must be one of the IPs used by your cache service. If you use multiple IPs, or have customized your ACLs, you\'ll need to pick one that doesn\'t conflict with your other settings. For example, if you have Varnish listening on a public and private IP, pick the private. On the other hand, if you told Varnish to listen on 0.0.0.0 (i.e. "listen on every interface you can") you would need to check what IP you set your purge ACL to allow (commonly 127.0.0.1 aka localhost), and use that (i.e. 127.0.0.1).', 'varnish-http-purge' ); ?></p>
161
- <p><?php esc_html_e( 'If your webhost set the service up for you, as is the case with DreamPress or WP Engine, ask them for the specifics if they don\'t have it documented. I\'ve listed the ones I know about here, however you should still check with them if you\'re not sure.', 'varnish-http-purge' ); ?></p>
162
  <p><strong><?php esc_html_e( 'If you aren\'t sure what to do, contact your webhost or server admin before making any changes.', 'varnish-http-purge' ); ?></strong></p>
163
- <ul>
164
- <li><?php esc_html_e( 'DreamHost - Go into the Panel and click on the DNS settings for the domain. The entry for <em>resolve-to.domain</em> (if set) will be your cache server. If it\'s not set, then you don\'t need to worry about this at all. Example:', 'varnish-http-purge' ); ?> <code>resolve-to.www A 208.97.157.172</code></li>
165
- </ul>
166
  <?php
167
  }
168
 
@@ -185,10 +183,10 @@ class VarnishStatus {
185
  echo '<label for="vhp_varnish_ip">';
186
 
187
  if ( $disabled ) {
188
- esc_html_e( 'A Varnish IP has been defined in your wp-config file, so it is not editable here.', 'varnish-http-purge' );
189
  } else {
190
- esc_html_e( 'Example:', 'varnish-http-purge' );
191
- echo '<code>123.45.67.89</code>';
192
  }
193
 
194
  echo '</label>';
@@ -208,8 +206,8 @@ class VarnishStatus {
208
 
209
  if ( empty( $input ) ) {
210
  return; // do nothing.
211
- } elseif ( filter_var( $input, FILTER_VALIDATE_IP ) ) {
212
- $set_message = 'IP Updated.';
213
  $set_type = 'updated';
214
  $output = filter_var( $input, FILTER_VALIDATE_IP );
215
  }
@@ -226,7 +224,7 @@ class VarnishStatus {
226
  public function register_check_caching() {
227
  register_setting( 'varnish-http-purge-url', 'vhp_varnish_url', array( &$this, 'varnish_url_sanitize' ) );
228
  add_settings_section( 'varnish-url-settings-section', __( 'Check Caching Status', 'varnish-http-purge' ), array( &$this, 'options_check_caching_scan' ), 'varnish-url-settings' );
229
- add_settings_field( 'varnish_url', __( 'Check A URL On Your Site:', 'varnish-http-purge' ), array( &$this, 'check_caching_callback' ), 'varnish-url-settings', 'varnish-url-settings-section' );
230
  }
231
 
232
  /**
@@ -236,13 +234,15 @@ class VarnishStatus {
236
  */
237
  public function options_check_caching_scan() {
238
  ?>
239
- <p><?php esc_html_e( 'While it is impossible to detect all possible conflicts, this status page performs a check of the most common issues that prevents your site from caching properly. This feature is provided to help you in resolve potential conflicts on your own. When filing an issue with your web-host, we recommend you include the output in your ticket.', 'varnish-http-purge' ); ?></p>
 
240
  <p>
241
  <?php
242
  // translators: %s is a link to the readme for the detection service.
243
- printf( wp_kses_post( __( '<strong>This check uses <a href="%s">a remote service hosted on DreamObjects</a></strong>. The service used only for providing up to date compatibility checks on plugins and themes that may conflict with running a server based cache (such as Varnish or Nginx). No personally identifying information regarding persons running this check, nor the plugins and themes in use on this site will be transmitted. The bare minimum of usage information is collected, concerning only IPs and domains making requests of the service. If you do not wish to use this service, please do not use this feature.', 'varnish-http-purge' ) ), 'https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt' );
244
  ?>
245
  </p>
 
246
  <?php
247
 
248
  // If there's no post made, let's not...
@@ -278,7 +278,7 @@ class VarnishStatus {
278
  // Check for Remote IP.
279
  $remote_ip = VarnishDebug::remote_ip( $headers );
280
 
281
- // Get the Varnish IP.
282
  if ( false !== VHP_VARNISH_IP ) {
283
  $varniship = VHP_VARNISH_IP;
284
  } else {
@@ -289,7 +289,7 @@ class VarnishStatus {
289
  <h4>
290
  <?php
291
  // translators: %s is the URL someone asked to scan.
292
- printf( esc_html__( 'Results for %s', 'varnish-http-purge' ), esc_url_raw( $varnishurl ) );
293
  ?>
294
  </h4>
295
 
@@ -350,7 +350,7 @@ class VarnishStatus {
350
  }
351
 
352
  /**
353
- * Varnish URL Callback
354
  *
355
  * @since 4.0
356
  */
@@ -436,7 +436,8 @@ class VarnishStatus {
436
  <?php
437
  } else {
438
  ?>
439
- <p><?php esc_html_e( 'Editing these settings via the Dashboard is disabled on Multisite as incorrect edits can prevent your network from loading entirely. You can toggle debug mode globally using the admin toolbar option, and you should define your Varnish IP directly into your wp-config file for best results.', 'varnish-http-purge' ); ?></p>
 
440
  <?php
441
  }
442
  ?>
@@ -507,7 +508,6 @@ class VarnishStatus {
507
 
508
  return $text;
509
  }
510
-
511
  }
512
 
513
- $status = new VarnishStatus();
22
  }
23
 
24
  /**
25
+ * Status Class
26
  *
27
  * @since 4.0
28
  */
29
  class VarnishStatus {
 
30
  /**
31
  * Construct
32
  * Fires when class is constructed, adds init hook
55
  * @since 4.0
56
  */
57
  public function admin_menu() {
58
+ add_menu_page( __( 'Proxy Cache Purge', 'varnish-http-purge' ), __( 'Proxy Cache', 'varnish-http-purge' ), 'manage_options', 'varnish-page', array( &$this, 'settings_page' ), VarnishPurger::get_icon_svg( true, '#82878c' ), 75 );
59
+ add_submenu_page( 'varnish-page', __( 'Proxy Cache Purge', 'varnish-http-purge' ), __( 'Settings', 'varnish-http-purge' ), 'manage_options', 'varnish-page', array( &$this, 'settings_page' ) );
60
  add_submenu_page( 'varnish-page', __( 'Check Caching', 'varnish-http-purge' ), __( 'Check Caching', 'varnish-http-purge' ), 'manage_options', 'varnish-check-caching', array( &$this, 'check_caching_page' ) );
61
  }
62
 
98
 
99
  $devmode = get_site_option( 'vhp_varnish_devmode', VarnishPurger::$devmode );
100
  $active = ( isset( $devmode['active'] ) ) ? $devmode['active'] : false;
101
+ $active = ( VHP_DEVMODE ) ? true : $active;
102
  $expire = current_time( 'timestamp' ) + DAY_IN_SECONDS;
 
103
  ?>
104
  <input type="hidden" name="vhp_varnish_devmode[expire]" value="<?php $expire; ?>" />
105
+ <input type="checkbox" name="vhp_varnish_devmode[active]" value="true" <?php disabled( VHP_DEVMODE ); ?> <?php checked( $active, true ); ?> />
106
  <label for="vhp_varnish_devmode['active']">
107
  <?php
108
+ if ( $active && isset( $devmode['expire'] ) && ! VHP_DEVMODE ) {
109
  $timestamp = date_i18n( get_site_option( 'date_format' ), $devmode['expire'] ) . ' @ ' . date_i18n( get_site_option( 'time_format' ), $devmode['expire'] );
110
  // translators: %s is the time (in hours) until Development Mode expires.
111
+ echo sprintf( esc_html__( 'Development Mode is active until %s. It will automatically disable after that time.', 'varnish-http-purge' ), esc_html( $timestamp ) );
112
+ } elseif ( VHP_DEVMODE ) {
113
+ esc_attr_e( 'Development Mode has been activated via wp-config and cannot be deactivated here.', 'varnish-http-purge' );
114
  } else {
115
  esc_attr_e( 'Activate Development Mode', 'varnish-http-purge' );
116
  }
137
  } else {
138
  $output['active'] = ( isset( $input['active'] ) || $input['active'] ) ? true : false;
139
  $output['expire'] = ( isset( $input['expire'] ) && is_int( $input['expire'] ) ) ? $input['expire'] : $expire;
140
+ $set_message = ( $output['active'] ) ? __( 'Development Mode activated for the next 24 hours.', 'varnish-http-purge' ) : __( 'Development Mode dectivated.', 'varnish-http-purge' );
141
  $set_type = 'updated';
142
  }
143
 
157
  */
158
  public function options_settings_ip() {
159
  ?>
160
+ <p><a name="#configureip"></a><?php esc_html_e( 'There are cases when a custom IP Address is needed to for the plugin to properly communicate with the cache service. If you\'re using a CDN like Cloudflare or a Firewall Proxy like Sucuri, or your cache is Nginx based, you may need to customize this setting.', 'varnish-http-purge' ); ?></p>
161
+ <p><?php esc_html_e( 'Normally your Proxy Cache IP is the IP address of the server where your caching service (i.e. Varnish or Nginx) is installed. It must an address used by your cache service. If you use multiple IPs, or have customized your ACLs, you\'ll need to pick one that doesn\'t conflict with your other settings. For example, if you have Varnish listening on a public and private IP, pick the private. On the other hand, if you told Varnish to listen on 0.0.0.0 (i.e. "listen on every interface you can") you would need to check what IP you set your purge ACL to allow (commonly 127.0.0.1 aka localhost), and use that (i.e. 127.0.0.1 or localhost).', 'varnish-http-purge' ); ?></p>
162
+ <p><?php esc_html_e( 'If your webhost set the service up for you, as is the case with DreamPress or WP Engine, ask them for the specifics.', 'varnish-http-purge' ); ?></p>
163
  <p><strong><?php esc_html_e( 'If you aren\'t sure what to do, contact your webhost or server admin before making any changes.', 'varnish-http-purge' ); ?></strong></p>
 
 
 
164
  <?php
165
  }
166
 
183
  echo '<label for="vhp_varnish_ip">';
184
 
185
  if ( $disabled ) {
186
+ esc_html_e( 'A Proxy Cache IP has been defined in your wp-config file, so it is not editable in settings.', 'varnish-http-purge' );
187
  } else {
188
+ esc_html_e( 'Example: ', 'varnish-http-purge' );
189
+ echo '<code>123.45.67.89</code> or <code>localhost</code>';
190
  }
191
 
192
  echo '</label>';
206
 
207
  if ( empty( $input ) ) {
208
  return; // do nothing.
209
+ } elseif ( 'localhost' === $input || filter_var( $input, FILTER_VALIDATE_IP ) ) {
210
+ $set_message = 'Proxy Cache IP Updated.';
211
  $set_type = 'updated';
212
  $output = filter_var( $input, FILTER_VALIDATE_IP );
213
  }
224
  public function register_check_caching() {
225
  register_setting( 'varnish-http-purge-url', 'vhp_varnish_url', array( &$this, 'varnish_url_sanitize' ) );
226
  add_settings_section( 'varnish-url-settings-section', __( 'Check Caching Status', 'varnish-http-purge' ), array( &$this, 'options_check_caching_scan' ), 'varnish-url-settings' );
227
+ add_settings_field( 'varnish_url', __( 'Check A URL On Your Site: ', 'varnish-http-purge' ), array( &$this, 'check_caching_callback' ), 'varnish-url-settings', 'varnish-url-settings-section' );
228
  }
229
 
230
  /**
234
  */
235
  public function options_check_caching_scan() {
236
  ?>
237
+ <p><?php esc_html_e( 'This feature performs a check of the most common issues that prevents your site from caching properly. This feature is provided to help you in resolve potential conflicts on your own. When filing an issue with your web-host, we recommend you include the output in your ticket.', 'varnish-http-purge' ); ?></p>
238
+ <h4><?php esc_html_e( 'Privacy Note', 'varnish-http-purge' ); ?></h4>
239
  <p>
240
  <?php
241
  // translators: %s is a link to the readme for the detection service.
242
+ printf( wp_kses_post( __( '<strong>This check uses <a href="%s">a remote service hosted on DreamObjects</a></strong>.', 'varnish-http-purge' ) ), 'https://varnish-http-purge.objects-us-east-1.dream.io/readme.txt' );
243
  ?>
244
  </p>
245
+ <p><?php esc_html_e( 'The service used only for providing up to date compatibility checks on plugins and themes that may conflict with running a server based cache. No personally identifying information regarding persons running this check, nor the plugins and themes in use on this site will be transmitted. The bare minimum of usage information is collected, concerning only IPs and domains making requests of the service. If you do not wish to use this service, please do not use this feature.', 'varnish-http-purge' ); ?></p>
246
  <?php
247
 
248
  // If there's no post made, let's not...
278
  // Check for Remote IP.
279
  $remote_ip = VarnishDebug::remote_ip( $headers );
280
 
281
+ // Get the IP.
282
  if ( false !== VHP_VARNISH_IP ) {
283
  $varniship = VHP_VARNISH_IP;
284
  } else {
289
  <h4>
290
  <?php
291
  // translators: %s is the URL someone asked to scan.
292
+ printf( esc_html__( 'Results for %s ', 'varnish-http-purge' ), esc_url_raw( $varnishurl ) );
293
  ?>
294
  </h4>
295
 
350
  }
351
 
352
  /**
353
+ * URL Callback
354
  *
355
  * @since 4.0
356
  */
436
  <?php
437
  } else {
438
  ?>
439
+ <p><?php esc_html_e( 'Editing these settings via the Dashboard is disabled on Multisite as incorrect edits can prevent your network from loading entirely. You can toggle debug mode globally using the admin toolbar option, and you should define your Proxy IP directly into your wp-config file for best results.', 'varnish-http-purge' ); ?></p>
440
+ <p><?php esc_html_e( 'The cache check page remains available to assist you in determining if pages on your site are properly cached by your server.', 'varnish-http-purge' ); ?></p>
441
  <?php
442
  }
443
  ?>
508
 
509
  return $text;
510
  }
 
511
  }
512
 
513
+ new VarnishStatus();
style.css CHANGED
@@ -1,4 +1,4 @@
1
- /* Add Orange Carrot Dashicon */
2
  #wpadminbar #wp-admin-bar-purge-varnish-cache .ab-icon {
3
  float: left;
4
  width: 26px;
@@ -8,11 +8,12 @@
8
  background-size: 20px;
9
  }
10
 
11
- /* Add Orange Carrot to Button */
12
  span.dashicons.varnish-http-purge {
13
  vertical-align: middle;
14
  }
15
 
 
16
  @media screen and (max-width: 782px) {
17
  #wpadminbar #wp-admin-bar-purge-varnish-cache .ab-icon,
18
  #wpadminbar li#wp-admin-bar-purge-varnish-cache {
@@ -22,4 +23,4 @@ span.dashicons.varnish-http-purge {
22
  height: 46px;
23
  width: 52px;
24
  }
25
- }
1
+ /* Add Dashicon */
2
  #wpadminbar #wp-admin-bar-purge-varnish-cache .ab-icon {
3
  float: left;
4
  width: 26px;
8
  background-size: 20px;
9
  }
10
 
11
+ /* Add Style icon properly */
12
  span.dashicons.varnish-http-purge {
13
  vertical-align: middle;
14
  }
15
 
16
+ /* Allow display on small screen */
17
  @media screen and (max-width: 782px) {
18
  #wpadminbar #wp-admin-bar-purge-varnish-cache .ab-icon,
19
  #wpadminbar li#wp-admin-bar-purge-varnish-cache {
23
  height: 46px;
24
  width: 52px;
25
  }
26
+ }
varnish-http-purge.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
- * Plugin Name: Varnish HTTP Purge
4
  * Plugin URI: https://halfelf.org/plugins/varnish-http-purge/
5
  * Description: Automatically empty cached pages when content on your site is modified.
6
- * Version: 4.6.6
7
  * Author: Mika Epstein
8
  * Author URI: https://halfelf.org/
9
  * License: http://www.apache.org/licenses/LICENSE-2.0
@@ -25,7 +25,7 @@
25
  */
26
 
27
  /**
28
- * Purge Varnish Class
29
  *
30
  * @since 2.0
31
  */
@@ -35,7 +35,7 @@ class VarnishPurger {
35
  * Version Number
36
  * @var string
37
  */
38
- public static $version = '4.6.6';
39
 
40
  /**
41
  * List of URLs to be purged
@@ -101,9 +101,6 @@ class VarnishPurger {
101
  */
102
  public function admin_init() {
103
 
104
- // Add to 'right now'.
105
- add_action( 'activity_box_end', array( $this, 'varnish_rightnow' ), 100 );
106
-
107
  // Failure: Pre WP 4.7.
108
  if ( version_compare( get_bloginfo( 'version' ), '4.7', '<=' ) ) {
109
  deactivate_plugins( plugin_basename( __FILE__ ) );
@@ -244,14 +241,14 @@ class VarnishPurger {
244
  */
245
  public function devmode_is_active_notice() {
246
  if ( VHP_DEVMODE ) {
247
- $message = __( 'Varnish HTTP Purge Development Mode is active because it has been defined in wp-config.', 'varnish-http-purge' );
248
  } else {
249
  $devmode = get_site_option( 'vhp_varnish_devmode', self::$devmode );
250
  $time = human_time_diff( current_time( 'timestamp' ), $devmode['expire'] );
251
  if ( ! is_multisite() ) {
252
  // translators: %1$s is the time until dev mode expires.
253
- // translators: %2$s is a link to the Varnish settings pages.
254
- $message = sprintf( __( 'Varnish HTTP Purge Development Mode is active for the next %1$s. You can disable this at the <a href="%2$s">Varnish Settings Page</a>.', 'varnish-http-purge' ), $time, esc_url( admin_url( 'admin.php?page=varnish-page' ) ) );
255
  } else {
256
  // translators: %1$s is the time until dev mode expires.
257
  $message = sprintf( __( 'Varnish HTTP Purge Development Mode is active for the next %1$s.', 'varnish-http-purge' ), $time );
@@ -279,14 +276,14 @@ class VarnishPurger {
279
  * @since 4.5.0
280
  */
281
  public function custom_css() {
282
- if ( is_user_logged_in() ) {
283
  wp_register_style( 'varnish_http_purge', plugins_url( 'style.css', __FILE__ ), false, self::$version );
284
  wp_enqueue_style( 'varnish_http_purge' );
285
  }
286
  }
287
 
288
  /**
289
- * Varnish Purge Button in the Admin Bar
290
  *
291
  * @access public
292
  * @param mixed $admin_bar - data passed back from admin bar.
@@ -412,42 +409,6 @@ class VarnishPurger {
412
  return $svg;
413
  }
414
 
415
- /**
416
- * Varnish Right Now Information
417
- * This information is put on the Dashboard 'Right now' widget
418
- *
419
- * @since 1.0
420
- */
421
- public function varnish_rightnow() {
422
- global $blog_id;
423
- // translators: %1$s links to the plugin's page on WordPress.org.
424
- $intro = sprintf( __( '<a href="%1$s">Varnish HTTP Purge</a> automatically deletes your cached posts when published or updated. When making major site changes, such as with a new theme, plugins, or widgets, you may need to manually empty the cache.', 'varnish-http-purge' ), 'http://wordpress.org/plugins/varnish-http-purge/' );
425
- $url = wp_nonce_url( add_query_arg( 'vhp_flush_do', 'all' ), 'vhp-flush-do' );
426
- $button = __( 'Press the button below to force it to empty your entire Varnish cache.', 'varnish-http-purge' );
427
- $button .= '</p><p><span class="button"><span class="dashicons varnish-http-purge" style="background-image: url(' . self::get_icon_svg( true, '#F56E28' ) . ') !important;"></span> <a href="' . $url . '"><strong>';
428
- $button .= __( 'Empty Cache', 'varnish-http-purge' );
429
- $button .= '</strong></a></span>';
430
- $nobutton = __( 'You do not have permission to empty the Varnish cache for the whole site. Please contact your administrator.', 'varnish-http-purge' );
431
-
432
- if (
433
- // SingleSite - admins can always purge.
434
- ( ! is_multisite() && current_user_can( 'activate_plugins' ) ) ||
435
- // Multisite - Network Admin can always purge.
436
- current_user_can( 'manage_network' ) ||
437
- // Multisite - Site admins can purge UNLESS it's a subfolder install and we're on site #1.
438
- ( is_multisite() && current_user_can( 'activate_plugins' ) && ( SUBDOMAIN_INSTALL || ( ! SUBDOMAIN_INSTALL && ( BLOG_ID_CURRENT_SITE !== $blog_id ) ) ) )
439
- ) {
440
- $text = $intro . ' ' . $button;
441
- } else {
442
- $text = $intro . ' ' . $nobutton;
443
- }
444
- // @codingStandardsIgnoreStart
445
- // This is safe to echo as it's controlled and secured above.
446
- // Using wp_kses will delete the icon.
447
- echo '<p class="varnish-rightnow">' . $text . '</p>';
448
- // @codingStandardsIgnoreEnd
449
- }
450
-
451
  /**
452
  * Registered Events
453
  * These are when the purge is triggered
@@ -511,7 +472,7 @@ class VarnishPurger {
511
 
512
  if ( empty( $purge_urls ) && isset( $_GET ) ) {
513
  if ( isset( $_GET['vhp_flush_all'] ) && check_admin_referer( 'vhp-flush-all' ) ) {
514
- // Flush Varnish Cache recursize.
515
  $this->purge_url( $this->the_home_url() . '/?vhp-regex' );
516
  } elseif ( isset( $_GET['vhp_flush_do'] ) && check_admin_referer( 'vhp-flush-do' ) ) {
517
  if ( 'object' === $_GET['vhp_flush_do'] ) {
@@ -520,7 +481,7 @@ class VarnishPurger {
520
  wp_cache_flush();
521
  }
522
  } elseif ( 'all' === $_GET['vhp_flush_do'] ) {
523
- // Flush Varnish Cache recursize.
524
  $this->purge_url( $this->the_home_url() . '/?vhp-regex' );
525
  } else {
526
  // Flush the URL we're on.
@@ -903,7 +864,7 @@ class VarnishPurger {
903
  }
904
 
905
  /**
906
- * Purge Varnish via WP-CLI
907
  *
908
  * @since 3.8
909
  */
1
  <?php
2
  /**
3
+ * Plugin Name: Proxy Cache Purge
4
  * Plugin URI: https://halfelf.org/plugins/varnish-http-purge/
5
  * Description: Automatically empty cached pages when content on your site is modified.
6
+ * Version: 4.7.0
7
  * Author: Mika Epstein
8
  * Author URI: https://halfelf.org/
9
  * License: http://www.apache.org/licenses/LICENSE-2.0
25
  */
26
 
27
  /**
28
+ * Purge Class
29
  *
30
  * @since 2.0
31
  */
35
  * Version Number
36
  * @var string
37
  */
38
+ public static $version = '4.7.0';
39
 
40
  /**
41
  * List of URLs to be purged
101
  */
102
  public function admin_init() {
103
 
 
 
 
104
  // Failure: Pre WP 4.7.
105
  if ( version_compare( get_bloginfo( 'version' ), '4.7', '<=' ) ) {
106
  deactivate_plugins( plugin_basename( __FILE__ ) );
241
  */
242
  public function devmode_is_active_notice() {
243
  if ( VHP_DEVMODE ) {
244
+ $message = __( 'Proxy Cache Purge Development Mode has been activated via wp-config.', 'varnish-http-purge' );
245
  } else {
246
  $devmode = get_site_option( 'vhp_varnish_devmode', self::$devmode );
247
  $time = human_time_diff( current_time( 'timestamp' ), $devmode['expire'] );
248
  if ( ! is_multisite() ) {
249
  // translators: %1$s is the time until dev mode expires.
250
+ // translators: %2$s is a link to the settings pages.
251
+ $message = sprintf( __( 'Proxy Cache Purge Development Mode is active for the next %1$s. You can disable this at the <a href="%2$s">Proxy Settings Page</a>.', 'varnish-http-purge' ), $time, esc_url( admin_url( 'admin.php?page=varnish-page' ) ) );
252
  } else {
253
  // translators: %1$s is the time until dev mode expires.
254
  $message = sprintf( __( 'Varnish HTTP Purge Development Mode is active for the next %1$s.', 'varnish-http-purge' ), $time );
276
  * @since 4.5.0
277
  */
278
  public function custom_css() {
279
+ if ( is_user_logged_in() && is_admin_bar_showing() ) {
280
  wp_register_style( 'varnish_http_purge', plugins_url( 'style.css', __FILE__ ), false, self::$version );
281
  wp_enqueue_style( 'varnish_http_purge' );
282
  }
283
  }
284
 
285
  /**
286
+ * Purge Button in the Admin Bar
287
  *
288
  * @access public
289
  * @param mixed $admin_bar - data passed back from admin bar.
409
  return $svg;
410
  }
411
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  /**
413
  * Registered Events
414
  * These are when the purge is triggered
472
 
473
  if ( empty( $purge_urls ) && isset( $_GET ) ) {
474
  if ( isset( $_GET['vhp_flush_all'] ) && check_admin_referer( 'vhp-flush-all' ) ) {
475
+ // Flush Cache recursize.
476
  $this->purge_url( $this->the_home_url() . '/?vhp-regex' );
477
  } elseif ( isset( $_GET['vhp_flush_do'] ) && check_admin_referer( 'vhp-flush-do' ) ) {
478
  if ( 'object' === $_GET['vhp_flush_do'] ) {
481
  wp_cache_flush();
482
  }
483
  } elseif ( 'all' === $_GET['vhp_flush_do'] ) {
484
+ // Flush Cache recursize.
485
  $this->purge_url( $this->the_home_url() . '/?vhp-regex' );
486
  } else {
487
  // Flush the URL we're on.
864
  }
865
 
866
  /**
867
+ * Purge via WP-CLI
868
  *
869
  * @since 3.8
870
  */
wp-cli.php CHANGED
@@ -285,7 +285,7 @@ if ( ! class_exists( 'WP_CLI_Varnish_Command' ) ) {
285
  // Check for Remote IP.
286
  $remote_ip = VarnishDebug::remote_ip( $headers );
287
 
288
- // Get the Varnish IP.
289
  if ( false !== VHP_VARNISH_IP ) {
290
  $varniship = VHP_VARNISH_IP;
291
  } else {
285
  // Check for Remote IP.
286
  $remote_ip = VarnishDebug::remote_ip( $headers );
287
 
288
+ // Get the IP.
289
  if ( false !== VHP_VARNISH_IP ) {
290
  $varniship = VHP_VARNISH_IP;
291
  } else {