Varnish HTTP Purge - Version 4.6.2

Version Description

  • July 2018
  • Fixing some translation output.
  • Multisite fixes for settings pages.
Download this release

Release Info

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

Code changes from version 4.6.1 to 4.6.2

Files changed (3) hide show
  1. readme.txt +12 -1
  2. settings.php +11 -14
  3. varnish-http-purge.php +14 -6
readme.txt CHANGED
@@ -3,7 +3,7 @@ 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.1
7
  Requires PHP: 5.6
8
 
9
  Automatically empty Varnish Cache when content on your site is modified.
@@ -188,6 +188,17 @@ This plugin is installed by default for _all_ DreamPress installs on DreamHost,
188
 
189
  == Changelog ==
190
 
 
 
 
 
 
 
 
 
 
 
 
191
  = 4.6.0 =
192
 
193
  * July 2018
3
  Tags: varnish, purge, cache
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
+ Stable tag: 4.6.2
7
  Requires PHP: 5.6
8
 
9
  Automatically empty Varnish Cache when content on your site is modified.
188
 
189
  == Changelog ==
190
 
191
+ = 4.6.2 =
192
+
193
+ * July 2018
194
+ * Fixing some translation output.
195
+ * Multisite fixes for settings pages.
196
+
197
+ = 4.6.1 =
198
+
199
+ * July 2018
200
+ * Fix situation where purging wasn't (props @carlalexander)
201
+
202
  = 4.6.0 =
203
 
204
  * July 2018
settings.php CHANGED
@@ -66,17 +66,15 @@ class VarnishStatus {
66
  * @since 4.0.2
67
  */
68
  public function register_settings() {
69
- if ( ! is_multisite() || current_user_can( 'manage_network' ) ) {
70
- // Development Mode Settings.
71
- register_setting( 'vhp-settings-devmode', 'vhp_varnish_devmode', array( &$this, 'settings_devmode_sanitize' ) );
72
- add_settings_section( 'vhp-settings-devmode-section', __( 'Development Mode Settings', 'varnish-http-purge' ), array( &$this, 'options_settings_devmode' ), 'varnish-devmode-settings' );
73
- add_settings_field( 'varnish_devmode', __( 'Development Mode', 'varnish-http-purge' ), array( &$this, 'settings_devmode_callback' ), 'varnish-devmode-settings', 'vhp-settings-devmode-section' );
74
-
75
- // IP Settings.
76
- register_setting( 'vhp-settings-ip', 'vhp_varnish_ip', array( &$this, 'settings_ip_sanitize' ) );
77
- add_settings_section( 'vhp-settings-ip-section', __( 'Configure Custom IP', 'varnish-http-purge' ), array( &$this, 'options_settings_ip' ), 'varnish-ip-settings' );
78
- add_settings_field( 'varnish_ip', __( 'Set Custom IP', 'varnish-http-purge' ), array( &$this, 'settings_ip_callback' ), 'varnish-ip-settings', 'vhp-settings-ip-section' );
79
- }
80
  }
81
 
82
  /**
@@ -417,7 +415,7 @@ class VarnishStatus {
417
  <p><?php esc_html_e( 'Varnish HTTP Purge can empty the cache for different server based caching systems, including Varnish and nginx. For most users, there should be no configuration necessary as the plugin is intended to work silently, behind the scenes.', 'varnish-http-purge' ); ?></p>
418
 
419
  <?php
420
- if ( ! is_multisite() || current_user_can( 'manage_network' ) ) {
421
  ?>
422
  <form action="options.php" method="POST" >
423
  <?php
@@ -437,11 +435,10 @@ class VarnishStatus {
437
  <?php
438
  } else {
439
  ?>
440
- <p><?php esc_html_e( 'Your account does not have access to configure settings. Please contact your site administrator.', 'varnish-http-purge' ); ?></p>
441
  <?php
442
  }
443
  ?>
444
-
445
  </div>
446
  <?php
447
  }
66
  * @since 4.0.2
67
  */
68
  public function register_settings() {
69
+ // Development Mode Settings.
70
+ register_setting( 'vhp-settings-devmode', 'vhp_varnish_devmode', array( &$this, 'settings_devmode_sanitize' ) );
71
+ add_settings_section( 'vhp-settings-devmode-section', __( 'Development Mode Settings', 'varnish-http-purge' ), array( &$this, 'options_settings_devmode' ), 'varnish-devmode-settings' );
72
+ add_settings_field( 'varnish_devmode', __( 'Development Mode', 'varnish-http-purge' ), array( &$this, 'settings_devmode_callback' ), 'varnish-devmode-settings', 'vhp-settings-devmode-section' );
73
+
74
+ // IP Settings.
75
+ register_setting( 'vhp-settings-ip', 'vhp_varnish_ip', array( &$this, 'settings_ip_sanitize' ) );
76
+ add_settings_section( 'vhp-settings-ip-section', __( 'Configure Custom IP', 'varnish-http-purge' ), array( &$this, 'options_settings_ip' ), 'varnish-ip-settings' );
77
+ add_settings_field( 'varnish_ip', __( 'Set Custom IP', 'varnish-http-purge' ), array( &$this, 'settings_ip_callback' ), 'varnish-ip-settings', 'vhp-settings-ip-section' );
 
 
78
  }
79
 
80
  /**
415
  <p><?php esc_html_e( 'Varnish HTTP Purge can empty the cache for different server based caching systems, including Varnish and nginx. For most users, there should be no configuration necessary as the plugin is intended to work silently, behind the scenes.', 'varnish-http-purge' ); ?></p>
416
 
417
  <?php
418
+ if ( ! is_multisite() ) {
419
  ?>
420
  <form action="options.php" method="POST" >
421
  <?php
435
  <?php
436
  } else {
437
  ?>
438
+ <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>
439
  <?php
440
  }
441
  ?>
 
442
  </div>
443
  <?php
444
  }
varnish-http-purge.php CHANGED
@@ -3,7 +3,7 @@
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.1
7
  * Author: Mika Epstein
8
  * Author URI: https://halfelf.org/
9
  * License: http://www.apache.org/licenses/LICENSE-2.0
@@ -216,7 +216,7 @@ class VarnishPurger {
216
  */
217
  public function require_pretty_permalinks_notice() {
218
  // translators: The URL should link to the permalinks page.
219
- echo "<div id='message' class='error'><p>" . sprintf( esc_html__( 'Varnish HTTP Purge requires you to use custom permalinks. Please go to the <a href="%1$s">Permalinks Options Page</a> to configure them.', 'varnish-http-purge' ), esc_url( admin_url( 'options-permalink.php' ) ) ) . '</p></div>';
220
  }
221
 
222
  /**
@@ -242,9 +242,14 @@ class VarnishPurger {
242
  } else {
243
  $devmode = get_site_option( 'vhp_varnish_devmode', self::$devmode );
244
  $time = human_time_diff( current_time( 'timestamp' ), $devmode['expire'] );
245
- // translators: %1$s is the time until dev mode expires.
246
- // translators: %2$s is a link to the Varnish settings pages.
247
- $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' ) ) );
 
 
 
 
 
248
  }
249
  echo '<div class="notice notice-warning"><p>' . wp_kses_post( $message ) . '</p></div>';
250
  }
@@ -879,7 +884,10 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
879
  *
880
  * @since 4.0
881
  */
882
- require_once 'settings.php';
 
 
 
883
  require_once 'debug.php';
884
 
885
  $purger = new VarnishPurger();
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.2
7
  * Author: Mika Epstein
8
  * Author URI: https://halfelf.org/
9
  * License: http://www.apache.org/licenses/LICENSE-2.0
216
  */
217
  public function require_pretty_permalinks_notice() {
218
  // translators: The URL should link to the permalinks page.
219
+ echo wp_kses_post( '<div id="message" class="error"><p>' . sprintf( __( 'Varnish HTTP Purge requires you to use custom permalinks. Please go to the <a href="%1$s">Permalinks Options Page</a> to configure them.', 'varnish-http-purge' ), esc_url( admin_url( 'options-permalink.php' ) ) ) . '</p></div>' );
220
  }
221
 
222
  /**
242
  } else {
243
  $devmode = get_site_option( 'vhp_varnish_devmode', self::$devmode );
244
  $time = human_time_diff( current_time( 'timestamp' ), $devmode['expire'] );
245
+ if ( ! is_multisite() ) {
246
+ // translators: %1$s is the time until dev mode expires.
247
+ // translators: %2$s is a link to the Varnish settings pages.
248
+ $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' ) ) );
249
+ } else {
250
+ // translators: %1$s is the time until dev mode expires.
251
+ $message = sprintf( __( 'Varnish HTTP Purge Development Mode is active for the next %1$s.', 'varnish-http-purge' ), $time );
252
+ }
253
  }
254
  echo '<div class="notice notice-warning"><p>' . wp_kses_post( $message ) . '</p></div>';
255
  }
884
  *
885
  * @since 4.0
886
  */
887
+ // The settings PAGES aren't needed on the network admin page
888
+ if ( ! is_network_admin() ) {
889
+ require_once 'settings.php';
890
+ }
891
  require_once 'debug.php';
892
 
893
  $purger = new VarnishPurger();